public class PixelData
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
BIT
Identifies the type used to store pixel values.
|
static int |
BYTE
Identifies the type used to store pixel values.
|
protected int |
bytesPerPixel
The number of bytes per pixel.
|
static java.lang.String |
CONFIG_KEY |
protected java.nio.ByteBuffer |
data
The pixels data backing buffer.
|
static int |
DOUBLE
Identifies the type used to store pixel values.
|
static int |
FLOAT
Identifies the type used to store pixel values.
|
static int |
INT
Identifies the type used to store pixel values.
|
protected boolean |
isFloat
If the data is floating point.
|
protected boolean |
isSigned
If the data is signed.
|
protected int |
javaType
The pixels type as it would be represented in Java.
|
static int |
LONG
Identifies the type used to store pixel values.
|
protected double |
maximum
The maximum pixel value for the pixels type of the pixel data.
|
protected double |
minimum
The minimum pixel value for the pixels type of the pixel data.
|
protected java.lang.String |
pixelsType
Type of the pixel data.
|
static int |
SHORT
Identifies the type used to store pixel values.
|
Constructor and Description |
---|
PixelData(java.lang.String pixelsType,
java.nio.ByteBuffer data)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
bytesPerPixel()
Returns the number of byte per pixel for the pixel data.
|
void |
dispose()
Attempt to free up any native memory resources associated with the data buffer.
|
static int |
getBitDepth(java.lang.String type)
Retrieves the bit width of a particular
PixelsType . |
java.nio.ByteBuffer |
getData()
Returns the backing buffer for the pixel data.
|
double |
getMaximum()
Returns the minimum pixel value this pixel data supports.
|
double |
getMinimum()
Returns the minimum pixel value this pixel data supports.
|
java.nio.ByteOrder |
getOrder()
Returns the byte order of the backing buffer.
|
double |
getPixelValue(int offset)
Returns the pixel intensity value of the pixel at a given offset within
the backing buffer.
|
double |
getPixelValueDirect(int offset)
Returns the pixel intensity value of the pixel at a given offset within
the backing buffer.
|
boolean |
in(java.lang.String[] strings)
Returns whether or not the pixel data type is is one of the elements in
an array.
|
boolean |
isFloat()
Returns whether or not the data is floating point.
|
boolean |
isSigned()
Returns whether or not the data is signed.
|
int |
javaType()
Returns the Java type that has the same byte width of the pixel data.
|
void |
setOrder(java.nio.ByteOrder order)
Set the byte order of the backing buffer.
|
void |
setPixelValue(int offset,
double value)
Sets the pixel intensity value of the pixel at a given offset within
the backing buffer.
|
void |
setPixelValueDirect(int offset,
double value)
Sets the pixel intensity value of the pixel at a given offset within
the backing buffer.
|
int |
size()
Returns the pixel count of this block of pixel data.
|
public static final java.lang.String CONFIG_KEY
public static final int BYTE
public static final int SHORT
public static final int INT
public static final int LONG
public static final int FLOAT
public static final int DOUBLE
public static final int BIT
protected java.lang.String pixelsType
protected java.nio.ByteBuffer data
protected boolean isSigned
protected boolean isFloat
protected int javaType
protected int bytesPerPixel
protected double minimum
protected double maximum
public PixelData(java.lang.String pixelsType, java.nio.ByteBuffer data)
pixelsType
- The OME pixels type.data
- The raw pixel data.public boolean in(java.lang.String[] strings)
strings
- The strings for which you want to check against.public int bytesPerPixel()
public boolean isSigned()
public boolean isFloat()
public int javaType()
public double getMinimum()
public double getMaximum()
public void setPixelValue(int offset, double value)
offset
- The relative offset (taking into account the number of
bytes per pixel) within the backing buffer.value
- Pixel value to set.public void setPixelValueDirect(int offset, double value)
offset
- The absolute offset within the backing buffer.value
- Pixel value to set.public double getPixelValue(int offset)
offset
- The relative offset (taking into account the number of
bytes per pixel) within the backing buffer.public double getPixelValueDirect(int offset)
offset
- The absolute offset within the backing buffer.public java.nio.ByteBuffer getData()
public java.nio.ByteOrder getOrder()
public void setOrder(java.nio.ByteOrder order)
order
- The byte order.public int size()
public static int getBitDepth(java.lang.String type)
PixelsType
.type
- a pixel type.public void dispose()
PixelData
instance must not be accessed by any thread after this method is called.
If not called, the resources should eventually be freed anyway by garbage collection and finalization.