|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | ||||||||
java.lang.Objectjava.lang.Enum<PixelDataType>
com.xinapse.multisliceimage.PixelDataType
public enum PixelDataType
An enumeration of the pixel formats (data types) that can be used in MultiSliceImage
images. These pixel formats are a super-set of the pixel formats used in sub-classes of
MultiSliceImage.
The class contains many methods for performing operations on pixels of these different
data types.
| Enum Constant Summary | |
|---|---|
BINARY
PixelDataType for 1-bit per pixel. |
|
BYTE
PixelDataType for signed byte. |
|
COLOURPACKED
PixelDataType for colour packed (UNC). |
|
COMPLEX
PixelDataType for complex (2x32-bit float in real/imaginary interlaced pairs). |
|
DOUBLE
PixelDataType for double (64-bit). |
|
DOUBLECOMPLEX
PixelDataType for double complex (2x64-bit double in real/imaginary interlaced pairs). |
|
DOUBLEDOUBLE
PixelDataType for double double (128-bit) - not implemented. |
|
DOUBLEDOUBLECOMPLEX
PixelDataType for double double complex (2x128-bit double in real/imaginary interlaced pairs) - not implemented. |
|
FLOAT
PixelDataType for float (32-bit). |
|
INT
PixelDataType for signed int (32-bit). |
|
LONG
PixelDataType for signed long (64-bit integer). |
|
RGB_BY_PLANE
PixelDataType for RGB (24-bit) - red plane followed by the green plane followed by the blue plane (non-interlaced). |
|
RGB_INTERLACED
PixelDataType for RGB (24-bit) with one red value followed by one blue value followed by one green value, etc. |
|
SHORT
PixelDataType for signed short (16-bit). |
|
UBYTE
PixelDataType for unsigned byte. |
|
UINT
PixelDataType for unsigned int (32-bit). |
|
ULONG
PixelDataType for unsigned long (64-bit integer). |
|
UNDEFINED
PixelDataType for a type that hasn't been set. |
|
USHORT
PixelDataType for signed short (16-bit). |
|
| Method Summary | |
|---|---|
java.lang.Object |
coerce(java.lang.Object primitiveValues,
PixelDataType toType,
boolean clipIfNecessary)
Coerce pixels of this PixelDataType to a new PixelDataType. |
java.lang.Object |
coerce(java.lang.Object primitiveValues,
PixelDataType toType,
ComplexMode complexMode,
boolean clipIfNecessary)
Coerce pixels of this PixelDataType to a new PixelDataType. |
java.lang.Object |
coerce(java.lang.Object primitiveValues,
PixelDataType toType,
int pixStart,
int nPixels,
ComplexMode complexMode,
boolean clipIfNecessary)
Coerce pixels of this PixelDataType to a new PixelDataType. |
java.lang.Object |
copyPixels(java.lang.Object array)
Copies the pixel samples to a new array of the correct type for this type of pixel. |
java.lang.Object |
copyPixels(java.lang.Object sourceArray,
int pixelOffset,
java.lang.Object dstArray)
Copies the pixel samples to an array of the correct type for this type of pixel. |
java.lang.Object |
copyPixels(java.lang.Object sourceArray,
java.lang.Object dstArray)
Copies the pixel samples to an array of the correct type for this type of pixel. |
java.lang.Object |
copyPixels(java.lang.Object sourceArray,
java.lang.Object dstArray,
int pixelOffset)
Copies the pixel samples to an array of the correct type for this type of pixel. |
void |
flipX(java.lang.Object pixArray,
int nCols,
int nRows)
Flips an array of pixels in-place about the x-axis (ie, flips top to bottom). |
void |
flipY(java.lang.Object pixArray,
int nCols)
Flips an array of pixels in-place about the y-axis (ie flips left-right). |
int |
getArrayElementsPerPixel()
Returns the number of array elements of a primitive type needed to store a single pixel value. |
int |
getBitsPerPixel()
Returns the number of bits used to store one pixel for this data type. |
int |
getNPixels(java.lang.Object array)
Returns the number of pixels in the supplied array of pixel samples. |
java.lang.Object |
getPixels(java.lang.Object sourceArray,
int nPixels)
Gets an array of pixel samples, large enough to hold a specified number of pixels. |
float[] |
getPixelsAsFloat(java.lang.Object array)
Returns a set of pixel samples as an array of float values. |
float[] |
getPixelsAsFloat(java.lang.Object array,
int pixStart,
int nPixels)
Returns a set of pixel samples as an array of float values. |
double |
getRangeMax()
Returns the maximum value that a pixel of this PixelDataType can take. |
double |
getRangeMin()
Returns the minimum value that a pixel of this PixelDataType can take. |
double |
getValue(java.lang.Object array,
int index)
Gets a single pixel value from an array of pixels. |
boolean |
isColourType()
Tests whether this PixelDataType specifies explicitly the red,green,blue colour components to display, rather than needing a ColourMapping to display. |
boolean |
isComplex()
Returns true if this PixelDataType is a complex (real/imaginary) data type. |
boolean |
isIntegerType()
Tests whether a sample of this PixelDataType can be represented by a single int value (Note: not integer). |
void |
scale(java.lang.Object pixels,
double scaleFactor)
Scale pixel intensities "in-place". |
void |
scale(java.lang.Object pixels,
double scaleFactor,
int pixStart,
int nPixels)
Scale pixel intensities "in-place". |
void |
setPixels(java.lang.Object sourceArray,
java.lang.Object dstArray)
Sets the values of an array of the pixel samples, copying the values from another array. |
void |
setValue(java.lang.Object array,
int index,
double value)
Sets a single pixel value in an array of pixels to the given value. |
static short |
toLuminance(byte red,
byte green,
byte blue)
Converts three (unsigned) byte values, representing the red, green and blue components of a colour to a luminance. |
java.lang.String |
toString()
Returns a String describing this PixelDataType. |
void |
transpose(java.lang.Object pixArray,
int nCols,
int nRows)
Transposes (slice-by-slice) an array of pixels in-place (ie flips top-right to bottom-left). |
static PixelDataType |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static PixelDataType[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
| Methods inherited from class java.lang.Enum |
|---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final PixelDataType UNDEFINED
public static final PixelDataType BINARY
public static final PixelDataType BYTE
public static final PixelDataType UBYTE
public static final PixelDataType SHORT
public static final PixelDataType USHORT
public static final PixelDataType INT
public static final PixelDataType UINT
public static final PixelDataType FLOAT
public static final PixelDataType DOUBLE
public static final PixelDataType COMPLEX
public static final PixelDataType COLOURPACKED
public static final PixelDataType RGB_BY_PLANE
public static final PixelDataType RGB_INTERLACED
public static final PixelDataType LONG
public static final PixelDataType ULONG
public static final PixelDataType DOUBLECOMPLEX
public static final PixelDataType DOUBLEDOUBLE
public static final PixelDataType DOUBLEDOUBLECOMPLEX
| Method Detail |
|---|
public static PixelDataType[] values()
for (PixelDataType c : PixelDataType.values()) System.out.println(c);
public static PixelDataType valueOf(java.lang.String name)
name - the name of the enum constant to be returned.
java.lang.IllegalArgumentException - if this enum type has no constant
with the specified name
java.lang.NullPointerException - if the argument is nullpublic double getRangeMin()
public double getRangeMax()
public boolean isColourType()
public boolean isIntegerType()
public java.lang.String toString()
toString in class java.lang.Enum<PixelDataType>public int getBitsPerPixel()
public int getArrayElementsPerPixel()
public boolean isComplex()
public int getNPixels(java.lang.Object array)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - if the PixelDataType is not supported,
or if the supplied array is not of the correct type for this PixelDataType.
public java.lang.Object getPixels(java.lang.Object sourceArray,
int nPixels)
throws MultiSliceImageException
sourceArray - the array of pixel samples to be re-used, if possible.nPixels - the number of pixels requested.
MultiSliceImageException - if the PixelDataType is not supported, or the
sourceArray is of the wrong data type, or is not of the correct size to hold
the requested number of pixels.
public java.lang.Object copyPixels(java.lang.Object array)
throws MultiSliceImageException
array - the array of pixel samples to be copied.
MultiSliceImageException - if the PixelDataType is not supported, or if
the supplied array is not of the correct type for this PixelDataType.
public java.lang.Object copyPixels(java.lang.Object sourceArray,
java.lang.Object dstArray)
throws MultiSliceImageException
sourceArray - the array of pixel samples to be copied.dstArray - the array into which the pixel samples will be copied. If dstArray is
null, or if dstArray is not of the correct type for this
PixelDataType, or if it is of the wrong length, then a new array will be created.
MultiSliceImageException - if the PixelDataType is not supported, or if
the supplied array to be copied is not of the correct type for this
PixelDataType.
public java.lang.Object copyPixels(java.lang.Object sourceArray,
int pixelOffset,
java.lang.Object dstArray)
throws MultiSliceImageException
sourceArray - the array of pixel samples to be copied.pixelOffset - an offset (in pixels) into the sourceArray from which pixel
values are copied. Copying will start from a point pixelOffset into the array
(of pixels).dstArray - the array into which the pixel samples will be copied. The number of pixels
copied is determined by the length of this array.
MultiSliceImageException - if the PixelDataType is not supported,
or if the supplied array to be copied is not of the correct type for this
PixelDataType.
public java.lang.Object copyPixels(java.lang.Object sourceArray,
java.lang.Object dstArray,
int pixelOffset)
throws MultiSliceImageException
sourceArray - the array of pixel samples to be copied.dstArray - the array into which the pixel samples will be copied. If dstArray is
null, or if it is of the wrong length, then a new array will be created.pixelOffset - an offset (in pixels) into the dstArray into which pixel
values are copied. Copying will start at a point pixelOffset into the array.
MultiSliceImageException - if the PixelDataType is not supported, or if
the supplied array to be copied is not of the correct type for this
PixelDataType.
public void setPixels(java.lang.Object sourceArray,
java.lang.Object dstArray)
throws MultiSliceImageException
sourceArray - an array of pixel values to be copied.dstArray - an array of pixel data primitives into which the pixel values are to be
copied.
MultiSliceImageException - if the PixelDataType is not supported.
public float[] getPixelsAsFloat(java.lang.Object array)
throws MultiSliceImageException
For pixel data types where the number of samples per pixel is greater than 1, the following coersions take place:
array - the array of pixels values to be returned as an array of float.
MultiSliceImageException - if the PixelDataType is not supported,
or if the supplied array to be copied is not of the correct type for this
PixelDataType.
public float[] getPixelsAsFloat(java.lang.Object array,
int pixStart,
int nPixels)
throws MultiSliceImageException
For pixel data types where the number of samples per pixel is greater than 1, the following coersions take place:
array - the array of pixels values to be returned as an array of float.pixStart - the index of the first pixel in the array of pixels that should be converted.nPixels - the number of pixels to convert.
MultiSliceImageException - if the PixelDataType is not supported,
or if the supplied array to be copied is not of the correct type for this
PixelDataType.
public double getValue(java.lang.Object array,
int index)
throws MultiSliceImageException
array - the array of pixels from within which the pixel value will be gotten.index - the index (offset) to the pixel value to get.
MultiSliceImageException - if the a sample of this PixelDataType is
not stored as a single value, or if the supplied array is of the wrong primitive
type for this PixelDataType.
java.lang.IndexOutOfBoundsException - if the supplied index is bad.
public void setValue(java.lang.Object array,
int index,
double value)
throws MultiSliceImageException
array - the array of pixels within which the pixel value will be set.index - the index (offset) to the pixel value to set.value - the value to set into the array.
MultiSliceImageException - if the a sample of this PixelDataType is
not stored as a single value, or if the supplied array is of the wrong type
for this PixelDataType.
java.lang.IndexOutOfBoundsException - if the supplied index is bad.
public java.lang.Object coerce(java.lang.Object primitiveValues,
PixelDataType toType,
boolean clipIfNecessary)
throws java.lang.IllegalArgumentException
When a colour (R,G,B) data type is coerced to a non-colour data type, the new data type contains the luminance values of the colours, where the luminance is (0.299*red) + (0.587*green) + (0.114*blue). When a non-colour data type is coerced to a colour data types, the colours will always be grey.
If this is a complex data type, then ComplexMode.MAGNITUDE is used in the coersion.
primitiveValues - the set of primitive values that are the pixel values to coerce.toType - the new PixelDataType of the coerced pixels.clipIfNecessary - a flag to indicate whether clipping should be performed if necessary.
If clipIfNecessary is false, then an InvalidArgumentException
will be thrown should any of the pixels to be coerced have a value outside the range that
can be stored in the toType PixelDataType.
java.lang.IllegalArgumentException - if this PixelDataType cannot be coerced to the
toType PixelDataType.
public java.lang.Object coerce(java.lang.Object primitiveValues,
PixelDataType toType,
ComplexMode complexMode,
boolean clipIfNecessary)
throws java.lang.IllegalArgumentException
When a colour (R,G,B) data type is coerced to a non-colour data type, the new data type contains the luminance values of the colours, where the luminance is (0.299*red) + (0.587*green) + (0.114*blue). When a non-colour data type is coerced to a colour data types, the colours will always be grey.
When a complex data type is coerced to a real data type, the conversion depends on the argument complexMode. When a non-complex data type is coerced to a complex data type, the imaginary channel will always be zero.
primitiveValues - the set of primitive values that are the pixel values to coerce.toType - the new PixelDataType of the coerced pixels.complexMode - the ComplexMode for conversion from complex data types
to real data types. Ignored for non-complex data types.clipIfNecessary - a flag to indicate whether clipping should be performed if necessary.
If clipIfNecessary is false, then an InvalidArgumentException
will be thrown should any of the pixels to be coerced have a value outside the range that
can be stored in the toType PixelDataType.
java.lang.IllegalArgumentException - if this PixelDataType cannot be coerced to the
toType PixelDataType.
public java.lang.Object coerce(java.lang.Object primitiveValues,
PixelDataType toType,
int pixStart,
int nPixels,
ComplexMode complexMode,
boolean clipIfNecessary)
throws java.lang.IllegalArgumentException
When a colour (R,G,B) data type is coerced to a non-colour data type, the new data type contains the luminance values of the colours, where the luminance is (0.299*red) + (0.587*green) + (0.114*blue). When a non-colour data type is coerced to a colour data types, the colours will always be grey.
When a complex data type is coerced to a real data type, the conversion depends on the argument complexMode. When a non-complex data type is coerced to a complex data type, the imaginary channel will always be zero.
primitiveValues - the set of primitive values that are the pixel values to coerce.toType - the new PixelDataType of the coerced pixels.pixStart - the index of the first pixel in the array of pixels that should be coerced.nPixels - the number of pixels to coerce.complexMode - the ComplexMode for conversion from complex data types
to real data types. Ignored for non-complex data types.clipIfNecessary - a flag to indicate whether clipping should be performed if necessary.
If clipIfNecessary is false, then an InvalidArgumentException
will be thrown should any of the pixels to be coerced have a value outside the range that
can be stored in the toType PixelDataType.
java.lang.IllegalArgumentException - if this PixelDataType cannot be coerced to the
toType PixelDataType.
public void scale(java.lang.Object pixels,
double scaleFactor)
throws java.lang.IllegalArgumentException
pixels - the set of pixel values to scale.scaleFactor - the intensity scaling factor.
java.lang.IllegalArgumentException - if the intensties cannot be rescaled.
public void scale(java.lang.Object pixels,
double scaleFactor,
int pixStart,
int nPixels)
throws java.lang.IllegalArgumentException
pixels - the pixel values to scale.scaleFactor - the intensity scaling factor.pixStart - the index of the first pixel in the array of pixels that should be rescaled.nPixels - the number of pixels to rescale.
java.lang.IllegalArgumentException - if the intensties cannot be rescaled.
public static short toLuminance(byte red,
byte green,
byte blue)
red - the red component of the colour, as an unsigned byte value, stored in a byte.green - the green component of the colour, as an unsigned byte value, stored in a
byte.blue - the blue component of the colour, as an unsigned byte value, stored in a byte.
public void flipX(java.lang.Object pixArray,
int nCols,
int nRows)
throws MultiSliceImageException
pixArray - the array of pixels to flip. This array must contain enough pixel
samples for a whole number of slices.nCols - the number of image columns.nRows - the number of image rows.
MultiSliceImageException - if pixels of the supplied type cannot be handled,
or if the array does not contain enough pixel samples for a whole number of slices.
public void flipY(java.lang.Object pixArray,
int nCols)
throws MultiSliceImageException
pixArray - the array of pixels to flip. This array must contain enough pixel
samples for a whole number of image rows.nCols - the number of image columns.
MultiSliceImageException - if pixels of the supplied type cannot be handled,
or if the array does not contain enough pixel samples for a whole number of rows.
public void transpose(java.lang.Object pixArray,
int nCols,
int nRows)
throws MultiSliceImageException
pixArray - the array of pixels to transpose. This array must contain enough pixel
samples for a whole number of image slices.nCols - the number of image columns.nRows - the number of image rows.
MultiSliceImageException - if pixels of the supplied type cannot be handled,
or if the array does not contain enough pixel samples for a whole number of slices.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | ||||||||