Main Page | Features | Central Services | csv-Files | Types | Transfer | Access | API-C | API-VB/ActiveX | API-Java | Examples | Downloads
Classes | Public Member Functions | Static Public Attributes | Static Package Functions
de.desy.tine.types.IMAGE Class Reference

TINE type CF_IMAGE java class implementation. More...

Inheritance diagram for de.desy.tine.types.IMAGE:
de.desy.tine.types.TCompoundDataObject

List of all members.

Classes

class  FrameHeader
 Subclass of second (and last) part of header (subclass used for logical grouping of class member variables which map almost 1:1 to header structures physically transferred in binary form. More...
class  SourceHeader
 Subclass of first part of header (subclass used for logical grouping of class member variables which map almost 1:1 to header structures transferred in binary form. More...

Public Member Functions

 IMAGE ()
 Constructs an empty image frame buffer with an initial capacity of DEFAULT_DATA_SIZE.
 IMAGE (int initialCapacity)
 Constructs an empty image frame buffer with the specified initial capacity.
byte[] getImageFrameBuffer ()
 Returns a reference to the appended image bits buffer.
void setImageFrameBuffer (byte[] buffer)
 Sets the internal image bits buffer reference to the passed byte buffer argument.
byte[] trimFrameBuffer ()
 Trims the capacity of the image data buffer that contains actual/delivered data.
void ensureFrameBufferCapacity (int length)
 needed for arrays of IMAGE (or within structs)
void setHeaderBytes (DataInputStream dis) throws IOException
 mdavid note: currently unused, can be removed later
void setImageBytes (DataInputStream dis) throws IOException
 mdavid: unused, can be removed later
void setImageBytes (DataInputStream dis, int off, int len) throws IOException
 mdavid: unused, can be removed (?)
void readHeaders (byte[] src) throws IOException
 Reads headers structure from byte array.
void readHeaders (DataInputStream input) throws IOException
void writeHeaders (DataOutputStream output) throws IOException
void fillFrameBuffer (byte[] src, int srcPos, int destPos, int length)
 Copies an array from the specified source array, beginning at the specified position, to the specified position of the image data array.
void fillFrameBuffer (byte src, int destPos)
 Copies a byte into the designated position of the image buffer.
int getImageFrameSize ()
 Returns gross length of the appended image bits buffer in bytes.
int getHeaderSize ()
 Returns the header size by questioning TFormat.
byte[] toByteArray ()
 Convert IMAGE object into a byte array.
byte[] toAdjustableHeaderByteArray ()
 for arrays, inclusion in structs, things are serialized differently : need separate routines for adjustable header and adjustable frame parts
void toStruct ()
 Initializes header structure.
byte[] getByteArray ()
 Returns headers byte array.
void setByteArray (byte[] byteArray)
 Initializes object from byte array.
void read (byte[] src) throws IOException
 Reads the IMAGE from the supplied byte array.
void read (DataInputStream input) throws IOException
 Reads the IMAGE from the supplied DataInputStream
void write (DataOutputStream output) throws IOException
 Appends a complete image containing a trimmed image data with source/frame headers to the output.
byte[] getHeaderBytes ()
 Convert image headers (SourceHeader/FrameHeader) into a byte array.
short getFormat ()
 Used by TDataType, TTaggedStruct and other routines.
String getTag ()
 Used by TDataType, TTaggedStruct and other routines.
int getSizeInBytes ()
 Used by TDataType, TTaggedStruct and other routines.
double getDoubleValue ()
int getIntegerValue ()
SourceHeader getSourceHeader ()
 Returns reference to subclass SourceHeader.
void setSourceHeader (SourceHeader sourceHeader)
 Sets the image source header.
FrameHeader getFrameHeader ()
 Returns reference to subclass FrameHeader.
void setFrameHeader (FrameHeader frameHeader)
 Sets the image frame header.
String getCsvString ()
 Used by TDataType.toCsvString() to get a valid parse-able string to of the objects data contents to supply to csv files.

Static Public Attributes

static final int HEADER_SIZE = TFormat.getFormatHeaderSize(TFormat.CF_IMAGE)
 Total size in bytes of frame/source headers.
static final int DEFAULT_DATA_SIZE = 0x600000
 Default capacity of an image data buffer.
static final int DEFAULT_BASE_TAG = 0x33565356
 Magic id for VSv3 'VSV3'.
static final long DEFAULT_CAMERA_PORT_ID = 0x0
 No camera port is set.
static final long IMAGE_INITIAL_VERSION = 0x1
 Initial IMAGE version.
static final long IMAGE_VERSION = 0x1
 Current IMAGE version.
static final long IMAGE_MAX_VERSION = 0x1
 Maximum IMAGE version.
static final String DEFAULT_CAMERA_PORT_NAME = "unknown"
 Default camera port name.

Static Package Functions

static long UnsignedInt (int ival)
 mdavid: annotated as 'deprecated'

Detailed Description

TINE type CF_IMAGE java class implementation.

Documentation mainly done by Stefan Weisse. Initial class design and implementation by Philip Duval, based on negotiations and agreement (between DESY Zeuthen-based controls group (now ERS), MST (now MCS 1) and MVP (now MCS 4)) on a defined control system type for video image data transport. Refactoring and optimizations by David Melkymyan.

Author:
Philip Duval (pd)
Stefan Weisse (sw)
David Melkumyan (mdavid)
Version:
1.1 Aug 10, 2009
last documented Jan 28, 2009

Constructor & Destructor Documentation

de.desy.tine.types.IMAGE.IMAGE ( )

Constructs an empty image frame buffer with an initial capacity of DEFAULT_DATA_SIZE.

Author:
mdavid
de.desy.tine.types.IMAGE.IMAGE ( int  initialCapacity)

Constructs an empty image frame buffer with the specified initial capacity.

Author:
mdavid
Parameters:
initialCapacity
  • the initial capacity of the data buffer
Exceptions:
IllegalArgumentExceptionif the specified initial capacity is negative

Member Function Documentation

void de.desy.tine.types.IMAGE.ensureFrameBufferCapacity ( int  length)

needed for arrays of IMAGE (or within structs)

Returns:
void de.desy.tine.types.IMAGE.fillFrameBuffer ( byte  src,
int  destPos 
)

Copies a byte into the designated position of the image buffer.

Used in IMAGE array transfers

void de.desy.tine.types.IMAGE.fillFrameBuffer ( byte[]  src,
int  srcPos,
int  destPos,
int  length 
)

Copies an array from the specified source array, beginning at the specified position, to the specified position of the image data array.

Note: unused - can be removed

Author:
mdavid
Parameters:
srcthe source array.
srcPosstarting position in the source array.
destPosstarting position in the destination data.
lengththe number of array elements to be copied.
Exceptions:
IllegalArgumentExceptionif imageData is null and destPos != 0.
IndexOutOfBoundsExceptionif copying would cause access of data outside array bounds.
NullPointerExceptionif either src or imageData is null.
byte [] de.desy.tine.types.IMAGE.getByteArray ( )

Returns headers byte array.


Note: unused (not yet true: TTaggedStruct doesn't yet treat IMAGE explicitly)!

yet deprecated mdavid: use toByteArray() instead

Implements de.desy.tine.types.TCompoundDataObject.

double de.desy.tine.types.IMAGE.getDoubleValue ( )
short de.desy.tine.types.IMAGE.getFormat ( )

Used by TDataType, TTaggedStruct and other routines.

Returns:
the format code of this compound data type

Implements de.desy.tine.types.TCompoundDataObject.

FrameHeader de.desy.tine.types.IMAGE.getFrameHeader ( )

Returns reference to subclass FrameHeader.

Returns:
reference to subclass FrameHeader
byte [] de.desy.tine.types.IMAGE.getHeaderBytes ( )

Convert image headers (SourceHeader/FrameHeader) into a byte array.

Author:
mdavid
Returns:
the byte array representing the headers.
int de.desy.tine.types.IMAGE.getHeaderSize ( )

Returns the header size by questioning TFormat.

Returns:
size of the header in bytes, if serialized
See also:
TFormat
TFormat.getFormatHeaderSize(short)
byte [] de.desy.tine.types.IMAGE.getImageFrameBuffer ( )

Returns a reference to the appended image bits buffer.

One should note that this buffer might only be filled to a certain extend, because buffer can be bigger than contained data is.
To obtain buffer that contains only actual/delivered data (based on FrameHeader#appendedFrameSize) use trimFrameBuffer() instead.

Returns:
reference to attached frame buffer (byte array)
int de.desy.tine.types.IMAGE.getImageFrameSize ( )

Returns gross length of the appended image bits buffer in bytes.

Value might be significantly bigger than appended frame size, because buffer must be bigger or equal to appended frame size.

Returns:
size of the attached buffer in bytes
int de.desy.tine.types.IMAGE.getIntegerValue ( )
int de.desy.tine.types.IMAGE.getSizeInBytes ( )

Used by TDataType, TTaggedStruct and other routines.

Returns:
the size in bytes of the of this compound data type

Implements de.desy.tine.types.TCompoundDataObject.

SourceHeader de.desy.tine.types.IMAGE.getSourceHeader ( )

Returns reference to subclass SourceHeader.

Returns:
reference to subclass SourceHeader
String de.desy.tine.types.IMAGE.getTag ( )

Used by TDataType, TTaggedStruct and other routines.

Returns:
the data tag of this compound data type

Implements de.desy.tine.types.TCompoundDataObject.

void de.desy.tine.types.IMAGE.read ( byte[]  src) throws IOException

Reads the IMAGE from the supplied byte array.

Author:
mdavid
Parameters:
src
  • input byte array
Exceptions:
IOExceptionif I/O error occurs
void de.desy.tine.types.IMAGE.read ( DataInputStream  input) throws IOException

Reads the IMAGE from the supplied DataInputStream

Author:
mdavid
Parameters:
input
  • an DataInputStream to read from.
Exceptions:
NullPointerExceptionif input is null.
IOExceptionif an error occurs during reading.
void de.desy.tine.types.IMAGE.readHeaders ( byte[]  src) throws IOException

Reads headers structure from byte array.

Author:
mdavid
Parameters:
src
  • source byte array
Exceptions:
IOException
void de.desy.tine.types.IMAGE.readHeaders ( DataInputStream  input) throws IOException
Author:
mdavid 21.12.09 duval: made this public for handling adjustable arrays inside structs
void de.desy.tine.types.IMAGE.setByteArray ( byte[]  byteArray)

Initializes object from byte array.

yet deprecated mdavid: use read(byte[]) instead

Implements de.desy.tine.types.TCompoundDataObject.

void de.desy.tine.types.IMAGE.setFrameHeader ( FrameHeader  frameHeader)

Sets the image frame header.

Author:
mdavid
Parameters:
frameHeader
  • frame header
void de.desy.tine.types.IMAGE.setHeaderBytes ( DataInputStream  dis) throws IOException

mdavid note: currently unused, can be removed later

Parameters:
dis
  • data input stream
Exceptions:
IOException
Deprecated:
mdavid: use readHeaders(byte[]) instead
void de.desy.tine.types.IMAGE.setImageBytes ( DataInputStream  dis) throws IOException

mdavid: unused, can be removed later

Deprecated:
mdavid: use read(DataInputStream) instead
Parameters:
dis
Exceptions:
IOException
void de.desy.tine.types.IMAGE.setImageBytes ( DataInputStream  dis,
int  off,
int  len 
) throws IOException

mdavid: unused, can be removed (?)

Deprecated:
mdavid: use read(DataInputStream) instead
Parameters:
dis
off
len
Exceptions:
IOException
void de.desy.tine.types.IMAGE.setImageFrameBuffer ( byte[]  buffer)

Sets the internal image bits buffer reference to the passed byte buffer argument.


Note (mdavid): do not use this method for constructing empty buffer, use constructor IMAGE(int) instead.

Deprecated:
temporary annotated as deprecated (see Note)
Parameters:
buffer
  • reference to image bits buffer
void de.desy.tine.types.IMAGE.setSourceHeader ( SourceHeader  sourceHeader)

Sets the image source header.

Author:
mdavid
Parameters:
sourceHeader
  • source header
byte [] de.desy.tine.types.IMAGE.toAdjustableHeaderByteArray ( )

for arrays, inclusion in structs, things are serialized differently : need separate routines for adjustable header and adjustable frame parts

Author:
duval
Returns:
the byte array representing the header + 8 bytes frame location info
byte [] de.desy.tine.types.IMAGE.toByteArray ( )

Convert IMAGE object into a byte array.

Author:
mdavid
Returns:
the byte array representing this object.

Implements de.desy.tine.types.TCompoundDataObject.

void de.desy.tine.types.IMAGE.toStruct ( )

Initializes header structure.

yet deprecated mdavid: use readHeaders(byte[]) instead

Implements de.desy.tine.types.TCompoundDataObject.

byte [] de.desy.tine.types.IMAGE.trimFrameBuffer ( )

Trims the capacity of the image data buffer that contains actual/delivered data.

An application can use this operation to minimize the storage of an image data.

Author:
mdavid
Returns:
trimmed image data buffer
See also:
FrameHeader.appendedFrameSize
Exceptions:
IllegalStateExceptionif appendedFrameSize is undefined
IndexOutOfBoundsExceptionif appendedFrameSize is greater than image data size
static long de.desy.tine.types.IMAGE.UnsignedInt ( int  ival) [static, package]

mdavid: annotated as 'deprecated'

reason(s):

  • duplicated (see "de.desy.tine.dataUtils.TDataType.UnsignedInt")
  • not-optimized
  • Note: doesn't follow the Java naming convention

Deprecated:
use UnsignedUtils#toUnsignedInt(int) instead (~6 times faster!)
Since:
08.2009

void de.desy.tine.types.IMAGE.write ( DataOutputStream  output) throws IOException

Appends a complete image containing a trimmed image data with source/frame headers to the output.

Author:
mdavid
Parameters:
output
  • an DataOutputStream to write to.
Exceptions:
IOExceptionif an error occurs during writing.
See also:
trimFrameBuffer()
void de.desy.tine.types.IMAGE.writeHeaders ( DataOutputStream  output) throws IOException
Author:
mdavid 21.12.09 duval: made this public for handling adjustable arrays inside structs

The documentation for this class was generated from the following file: