Package ome.util
Class PixelData
- java.lang.Object
-
- ome.util.PixelData
-
public class PixelData extends java.lang.ObjectRepresents a block of pixel data.- Since:
- 3.0
- See Also:
- "ome.io.nio.PixelBuffer"
-
-
Field Summary
Fields Modifier and Type Field Description static intBITIdentifies the type used to store pixel values.static intBYTEIdentifies the type used to store pixel values.protected intbytesPerPixelThe number of bytes per pixel.static java.lang.StringCONFIG_KEYprotected java.nio.ByteBufferdataThe pixels data backing buffer.static intDOUBLEIdentifies the type used to store pixel values.static intFLOATIdentifies the type used to store pixel values.static intINTIdentifies the type used to store pixel values.protected booleanisFloatIf the data is floating point.protected booleanisSignedIf the data is signed.protected intjavaTypeThe pixels type as it would be represented in Java.static intLONGIdentifies the type used to store pixel values.protected doublemaximumThe maximum pixel value for the pixels type of the pixel data.protected doubleminimumThe minimum pixel value for the pixels type of the pixel data.protected java.lang.StringpixelsTypeType of the pixel data.static intSHORTIdentifies the type used to store pixel values.
-
Constructor Summary
Constructors Constructor Description PixelData(java.lang.String pixelsType, java.nio.ByteBuffer data)Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intbytesPerPixel()Returns the number of byte per pixel for the pixel data.voiddispose()Attempt to free up any native memory resources associated with the data buffer.static intgetBitDepth(java.lang.String type)Retrieves the bit width of a particularPixelsType.java.nio.ByteBuffergetData()Returns the backing buffer for the pixel data.doublegetMaximum()Returns the minimum pixel value this pixel data supports.doublegetMinimum()Returns the minimum pixel value this pixel data supports.java.nio.ByteOrdergetOrder()Returns the byte order of the backing buffer.doublegetPixelValue(int offset)Returns the pixel intensity value of the pixel at a given offset within the backing buffer.doublegetPixelValueDirect(int offset)Returns the pixel intensity value of the pixel at a given offset within the backing buffer.booleanin(java.lang.String[] strings)Returns whether or not the pixel data type is is one of the elements in an array.booleanisFloat()Returns whether or not the data is floating point.booleanisSigned()Returns whether or not the data is signed.intjavaType()Returns the Java type that has the same byte width of the pixel data.voidsetOrder(java.nio.ByteOrder order)Set the byte order of the backing buffer.voidsetPixelValue(int offset, double value)Sets the pixel intensity value of the pixel at a given offset within the backing buffer.voidsetPixelValueDirect(int offset, double value)Sets the pixel intensity value of the pixel at a given offset within the backing buffer.intsize()Returns the pixel count of this block of pixel data.
-
-
-
Field Detail
-
CONFIG_KEY
public static final java.lang.String CONFIG_KEY
- See Also:
- Constant Field Values
-
BYTE
public static final int BYTE
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
SHORT
public static final int SHORT
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
INT
public static final int INT
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
LONG
public static final int LONG
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
FLOAT
public static final int FLOAT
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
DOUBLE
public static final int DOUBLE
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
BIT
public static final int BIT
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
pixelsType
protected java.lang.String pixelsType
Type of the pixel data.
-
data
protected java.nio.ByteBuffer data
The pixels data backing buffer.
-
isSigned
protected boolean isSigned
If the data is signed.
-
isFloat
protected boolean isFloat
If the data is floating point.
-
javaType
protected int javaType
The pixels type as it would be represented in Java.
-
bytesPerPixel
protected int bytesPerPixel
The number of bytes per pixel.
-
minimum
protected double minimum
The minimum pixel value for the pixels type of the pixel data.
-
maximum
protected double maximum
The maximum pixel value for the pixels type of the pixel data.
-
-
Method Detail
-
in
public boolean in(java.lang.String[] strings)
Returns whether or not the pixel data type is is one of the elements in an array.- Parameters:
strings- The strings for which you want to check against.- Returns:
- See above.
-
bytesPerPixel
public int bytesPerPixel()
Returns the number of byte per pixel for the pixel data.- Returns:
- See above.
-
isSigned
public boolean isSigned()
Returns whether or not the data is signed.- Returns:
- See above.
-
isFloat
public boolean isFloat()
Returns whether or not the data is floating point.- Returns:
- See above.
-
javaType
public int javaType()
Returns the Java type that has the same byte width of the pixel data.- Returns:
- See above.
-
getMinimum
public double getMinimum()
Returns the minimum pixel value this pixel data supports.- Returns:
- See above.
-
getMaximum
public double getMaximum()
Returns the minimum pixel value this pixel data supports.- Returns:
- See above.
-
setPixelValue
public void setPixelValue(int offset, double value)Sets the pixel intensity value of the pixel at a given offset within the backing buffer. This method takes into account bytes per pixel.- Parameters:
offset- The relative offset (taking into account the number of bytes per pixel) within the backing buffer.value- Pixel value to set.
-
setPixelValueDirect
public void setPixelValueDirect(int offset, double value)Sets the pixel intensity value of the pixel at a given offset within the backing buffer. This method does not take into account bytes per pixel.- Parameters:
offset- The absolute offset within the backing buffer.value- Pixel value to set.
-
getPixelValue
public double getPixelValue(int offset)
Returns the pixel intensity value of the pixel at a given offset within the backing buffer. This method takes into account bytes per pixel.- Parameters:
offset- The relative offset (taking into account the number of bytes per pixel) within the backing buffer.- Returns:
- The intensity value.
-
getPixelValueDirect
public double getPixelValueDirect(int offset)
Returns the pixel intensity value of the pixel at a given offset within the backing buffer. This method does not take into account bytes per pixel.- Parameters:
offset- The absolute offset within the backing buffer.- Returns:
- The intensity value.
-
getData
public java.nio.ByteBuffer getData()
Returns the backing buffer for the pixel data.- Returns:
- See above.
-
getOrder
public java.nio.ByteOrder getOrder()
Returns the byte order of the backing buffer.- Returns:
- See above.
-
setOrder
public void setOrder(java.nio.ByteOrder order)
Set the byte order of the backing buffer.- Parameters:
order- The byte order.
-
size
public int size()
Returns the pixel count of this block of pixel data.- Returns:
- See above.
-
getBitDepth
public static int getBitDepth(java.lang.String type)
Retrieves the bit width of a particularPixelsType.- Parameters:
type- a pixel type.- Returns:
- width of a single pixel value in bits.
-
dispose
public void dispose()
Attempt to free up any native memory resources associated with the data buffer. This is a temporary workaround hoped to ameliorate trac ticket #11250. ThisPixelDatainstance 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.
-
-