public abstract class DataBlk extends Object
The data is always stored in one array, of the type matching the data type (i.e. for 'int' it's an 'int[]'). The data should be stored in the array in standard scan-line order. That is the samples go from the top-left corner of the code-block to the lower-right corner by line and then column.
The member variable 'offset' gives the index in the array of the first data element (i.e. the top-left coefficient (ulx,uly)). The member variable 'scanw' gives the width of the scan that is used to store the data, that can be different from the width of the block. Element '(x,y)' of the code-block (i.e. '(ulx,uly)' is the top-left coefficient), will appear at position 'offset+(y-uly)*scanw+(x-ulx)' in the array of data.
A block of data can have the progressive attribute set. Data is progressive when it is obtained by successive refinement and the values in this block are approximations of the "final" values. When the final values are returned the progressive attribute must be turned off.
The classes DataBlkInt and DataBlkFloat provide implementations for int and float types respectively.
DataBlkInt
,
DataBlkFloat
Modifier and Type | Field and Description |
---|---|
int |
h
The height of the block, in pixels.
|
int |
offset
The offset in the array of the top-left coefficient
|
boolean |
progressive
The progressive attribute (false by default)
|
int |
scanw
The width of the scanlines used to store the data in the array
|
static int |
TYPE_BYTE
The identifier for the byte data type, as signed 8
bits.
|
static int |
TYPE_FLOAT
The identifier for the float data type
|
static int |
TYPE_INT
The identifier for the int data type, as signed 32
bits.
|
static int |
TYPE_SHORT
The identifier for the short data type, as signed 16
bits.
|
int |
ulx
The horizontal coordinate (in pixels) of the upper-left corner
of the block of data.
|
int |
uly
The vertical coordinate of the upper-left corner of the block
of data.
|
int |
w
The width of the block, in pixels.
|
Constructor and Description |
---|
DataBlk() |
Modifier and Type | Method and Description |
---|---|
abstract Object |
getData()
Returns the array containing the data, or null if there is no
data.
|
abstract int |
getDataType()
Returns the data type of the DataBlk object, as
defined in this class.
|
static int |
getSize(int type)
Returns the size in bits, given the data type.
|
abstract void |
setData(Object arr)
Sets the data array to the specified one.
|
String |
toString()
Returns a string of informations about the DataBlk
|
public static final int TYPE_BYTE
public static final int TYPE_SHORT
public static final int TYPE_INT
public static final int TYPE_FLOAT
public int ulx
public int uly
public int w
public int h
public int offset
public int scanw
public boolean progressive
public static int getSize(int type)
type
- The data type.public abstract int getDataType()
public abstract Object getData()
Each implementing class should provide a type specific equivalent method (e.g., getDataInt() in DataBlkInt) which returns an array of the correct type explicetely and not through an Object.
getDataType()
public abstract void setData(Object arr)
The size of the array is not necessarily checked for consistency with w and h or any other fields.
Each implementing class should provide a type specific equivalent method (e.g., setDataInt() in DataBlkInt) which takes an array of the correct type explicetely and not through an Object.
arr
- The new data array to usegetDataType()
Copyright © 2017 Open Microscopy Environment