Enum Class PixelDataType

java.lang.Object
java.lang.Enum<PixelDataType>
com.xinapse.image.PixelDataType
All Implemented Interfaces:
Serializable, Comparable<PixelDataType>, Constable

public enum PixelDataType extends Enum<PixelDataType>
An enumeration of the pixel formats (data types) that can be used in images. These pixel formats are a super-set of the pixel formats used in implementors of ReadableImage.
The class contains many methods for performing operations on pixels of these different data types.
  • Enum Constant Details

  • Method Details

    • values

      public static PixelDataType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PixelDataType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getRangeMin

      public double getRangeMin()
      Returns the minimum value that a pixel of this PixelDataType can take. In the case of PixelDataType that have more than one primitive data element per pixel, (e.g., RGB_BY_PLANE, COMPLEX etc.) this method returns the minimum value for one of the data elements.
      Returns:
      the minimum value that a pixel can take.
    • getRangeMax

      public double getRangeMax()
      Returns the maximum value that a pixel of this PixelDataType can take. In the case of PixelDataType that have more than one primitive data element per pixel, (e.g., RGB_BY_PLANE, COMPLEX etc.) this method returns the maximum value for one of the primitive data elements.
      Returns:
      the maximum value that a pixel can take.
    • isColourType

      public boolean isColourType()
      Tests whether this PixelDataType specifies explicitly the red,green,blue colour components to display, rather than needing a ColourMapping to display.
      Returns:
      true if this PixelDataType specifies the red,green,blue colour components; false otherwise.
    • isFloatingPointType

      public boolean isFloatingPointType()
      Tests whether this PixelDataType is a floating-point (single or double precision) data type.
      Returns:
      true if this PixelDataType is a floating-point data type.
    • isIntegerType

      public boolean isIntegerType()
      Tests whether a sample of this PixelDataType can be represented by a single int value (Note: not integer). UINT, LONG and ULONG cannot, in general, be represented by an int.
      Returns:
      true if this PixelDataType can be represented by a single integer value; false otherwise.
    • toString

      public String toString()
      Returns a String describing this PixelDataType.
      Overrides:
      toString in class Enum<PixelDataType>
      Returns:
      a String describing this PixelDataType.
    • getBitsPerPixel

      public int getBitsPerPixel()
      Returns the number of bits used to store one pixel for this data type.
      Returns:
      the number of bits used to store one pixel of this data type.
    • getArrayElementsPerPixel

      public int getArrayElementsPerPixel()
      Returns the number of array elements of a primitive type needed to store a single pixel value. For BINARY, it returns 1.
      Returns:
      the number of array elements of a primitive type needed to store a single pixel value of this data type.
    • getPrimitiveClass

      public Class getPrimitiveClass() throws IllegalArgumentException
      Returns the Class of primitive used to store pixel values of this PixelDataType.
      Returns:
      the Class of primitive used to store pixel values.
      Throws:
      IllegalArgumentException
    • isComplex

      public boolean isComplex()
      Returns true if this PixelDataType is a complex (real/imaginary) data type.
      Returns:
      true if this is a complex data type; false otherwise.
    • isNarrowerThan

      public boolean isNarrowerThan(PixelDataType type) throws IllegalArgumentException
      Tests whether this PixelDataType is not capable of storing all values that can be stored by the supplied type without clipping.
      Parameters:
      type - the PixelDataType against which this is to be tested.
      Returns:
      true if this PixelDataType is not capable of storing all values that can be stored by the type without clipping; false otherwise.
      Throws:
      IllegalArgumentException
    • getNPixels

      public int getNPixels(Object pixelArray) throws IllegalArgumentException
      Returns the number of pixels in the supplied array of pixel samples. The number of pixels is the number of primitive array elements divided by the number of samples per pixel.
      Parameters:
      pixelArray - the array of pixel samples.
      Returns:
      the number of pixels in the supplied array of pixel samples.
      Throws:
      IllegalArgumentException - if the PixelDataType is not supported, if the supplied array is not of the correct type for this PixelDataType, or if the supplied array is not the right size to hold a whole number of pixels.
    • getPixels

      public Object getPixels(Object sourceArray, int nPixels) throws IllegalArgumentException
      Gets an array of pixel samples, large enough to hold a specified number of pixels. If the source array is null, a new array is created. If the source array is longer than required, it is copied so that the array returned has the required length. Otherwise the sourceArray is returned.
      Parameters:
      sourceArray - the array of pixel samples to be re-used, if possible.
      nPixels - the number of pixels requested.
      Returns:
      either sourceArray (if it is reusable) or a new array of the correct type for this PixelDataType, just long enough to hold the requested number of pixels.
      Throws:
      IllegalArgumentException - if the sourceArray is of the wrong data type or is too short.
    • copyPixels

      public Object copyPixels(Object pixelArray) throws IllegalArgumentException
      Copies the pixel samples to a new array of the correct type for this type of pixel.
      Parameters:
      pixelArray - the array of pixel samples to be copied.
      Returns:
      a copy of the array of supplied pixel samples.
      Throws:
      IllegalArgumentException - if the supplied array is not of the correct type for this PixelDataType.
    • copyPixels

      public Object copyPixels(Object sourceArray, Object dstArray) throws IllegalArgumentException
      Copies the pixel samples to an array of the correct type for this type of pixel.
      Parameters:
      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.
      Returns:
      a copy of the array of supplied pixel samples. 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 returned; otherwise dstArray is returned.
      Throws:
      IllegalArgumentException - if the supplied array to be copied is not of the correct type for this PixelDataType.
    • copyPixels

      public Object copyPixels(Object sourceArray, int pixelOffset, Object dstArray) throws IllegalArgumentException
      Copies the pixel samples to an array of the correct type for this type of pixel. The number of pixels copied is determined by the size of dstArray.
      Parameters:
      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.
      Returns:
      dstArray containing a copy of the array of supplied pixel samples.
      Throws:
      IllegalArgumentException - if the supplied array to be copied is not of the correct type for this PixelDataType.
    • copyPixels

      public Object copyPixels(Object sourceArray, Object dstArray, int pixelOffset) throws IllegalArgumentException
      Copies the pixel samples to an array of the correct type for this type of pixel.
      Parameters:
      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.
      Returns:
      a copy of the array of supplied pixel samples. If dstArray is null, then a new array will be returned; otherwise dstArray is returned.
      Throws:
      IllegalArgumentException - if the supplied array to be copied is not of the correct type for this PixelDataType.
    • setPixels

      public void setPixels(Object sourceArray, Object dstArray) throws IllegalArgumentException
      Sets the values of an array of pixel samples, copying the values from another array. The source and destination array must both be of the same type, and of the same length. The type must be the correct type for this PixelDataType.
      Parameters:
      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.
      Throws:
      IllegalArgumentException - if the souce or destination arrays are of incompatible types, or of incompatible lengths.
    • getPixelsAsFloat

      public float[] getPixelsAsFloat(Object pixelArray) throws IllegalArgumentException
      Returns a set of pixel samples as an array of float values. The length of the array returned is the number of pixels.

      For pixel data types where the number of samples per pixel is greater than 1, the following coersions take place:

      • Colour data types (RGB_BY_PLANE, RGB_INTERLACED (3 samples per pixel), and COLOURPACKED (4 samples per pixel)) images: the colours are converted to luminance values.
      • Complex (COMPLEX and DOUBLECOMPLEX (2 samples per pixel)): the magnitudes of the complex values are returned.
      Parameters:
      pixelArray - the array of pixels values to be returned as an array of float.
      Returns:
      a copy of the array of supplied pixel samples, with each pixel sample converted to a float.
      Throws:
      IllegalArgumentException - if the supplied array to be copied is not of the correct type for this PixelDataType.
    • getPixelsAsFloat

      public float[] getPixelsAsFloat(Object pixelArray, int pixStart, int nPixels) throws InvalidImageException
      Returns a set of pixel samples as an array of float values. The length of the array returned is the number of pixels.

      For pixel data types where the number of samples per pixel is greater than 1, the following coersions take place:

      • Colour data types (RGB_BY_PLANE, RGB_INTERLACED (3 samples per pixel), and COLOURPACKED (4 samples per pixel)) images: the colours are converted to luminance values.
      • Complex (COMPLEX and DOUBLECOMPLEX (2 samples per pixel)): the magnitudes of the complex values are returned.
      Parameters:
      pixelArray - 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.
      Returns:
      a copy of the array of supplied pixel samples, with each pixel sample converted to a float.
      Throws:
      InvalidImageException - if the PixelDataType is not supported, or if the supplied array to be copied is not of the correct type for this PixelDataType.
    • getDoubleValue

      public double getDoubleValue(Object pixelArray, int index) throws IllegalArgumentException
      Gets a single pixel value from an array of pixels. For colour images, the value returned is luninance. This method does not work for complex pixel types - it will throw an IllegalArgumentException.
      Parameters:
      pixelArray - the array of pixels from within which the pixel value will be gotten.
      index - the index (offset) to the pixel value to get.
      Returns:
      the pixel intensity value at the given index.
      Throws:
      IllegalArgumentException - if this PixelDataType is complex, or if the supplied array is of the wrong primitive type for this PixelDataType.
      IndexOutOfBoundsException - if the supplied index is bad.
    • getDoubleValue

      public double getDoubleValue(Object pixelValue, ComplexMode complexMode) throws IllegalArgumentException
      Converts a single pixel value to a double value. For colour images, the value returned is the luminance of the colour. For complex pixel types, the value returned depends on the complexMode argument.
      Parameters:
      pixelValue - the single pixe value that will be converted to a double.
      complexMode - the CompexMode that determines the value returned for complex pixel types.
      Returns:
      the pixel value at the given index.
      Throws:
      IllegalArgumentException - if the supplied array is of the wrong primitive type for this PixelDataType.
    • setValue

      public void setValue(Object pixelArray, int index, double value) throws IllegalArgumentException
      Sets a single pixel value in an array of pixels to the given value. For colour pixel types, each of the colour channels is set to the supplied value, so that the resulting colour will be monochrome. For complex pixel types, the real component will be set to the value, and the imaginary channel will be set to zero.
      Parameters:
      pixelArray - 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.
      Throws:
      IllegalArgumentException - if 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.
      IndexOutOfBoundsException - if the supplied index is bad.
    • getColorValue

      public Color getColorValue(Object pixelArray, int index) throws IllegalArgumentException
      Gets a single colour pixel value from an array of pixels. This method only works with colour pixel types.
      Parameters:
      pixelArray - the array of pixels from within which the pixel Color value will be gotten.
      index - the index (offset, in pixels) to the pixel value to get.
      Returns:
      the pixel Color value at the given index.
      Throws:
      IllegalArgumentException - if a sample of this PixelDataType is not of a colour type or if the supplied array is of the wrong primitive type.
      IndexOutOfBoundsException - if the supplied index is bad.
    • setColorValue

      public void setColorValue(Object pixelArray, Color color, int index) throws IllegalArgumentException
      Sets a single colour pixel value into an array of pixels. This method only works with colour pixel types.
      Parameters:
      pixelArray - the array of pixels to which the pixel Color value will be put.
      color - the Color value to put.
      index - the index (offset, in pixels) to the pixel value to put.
      Throws:
      IllegalArgumentException - if a sample of this PixelDataType is not of a colour type or if the supplied array is of the wrong primitive type.
      IndexOutOfBoundsException - if the supplied index is bad.
    • getComplexValue

      public Complex getComplexValue(Object pixelArray, int index) throws IllegalArgumentException
      Gets a single Complex pixel value from an array of pixels. This method only works with Complex pixel types.
      Parameters:
      pixelArray - the array of pixels from within which the pixel Complex value will be gotten.
      index - the index (offset, in pixels) to the pixel value to get.
      Returns:
      the pixel Complex value at the given index.
      Throws:
      IllegalArgumentException - if a sample of this PixelDataType is not of a Complex type or if the supplied array is of the wrong primitive type.
      IndexOutOfBoundsException - if the supplied index is bad.
    • setComplexValue

      public void setComplexValue(Object pixelArray, Complex cmplx, int index) throws IllegalArgumentException
      Sets a single complex pixel value into an array of pixels. This method only works with complex pixel types.
      Parameters:
      pixelArray - the array of pixels to which the pixel complex value will be put.
      cmplx - the complex value to put.
      index - the index (offset, in pixels) to the pixel value to put.
      Throws:
      IllegalArgumentException - if a sample of this PixelDataType is not of a complex type or if the supplied array is of the wrong primitive type.
      IndexOutOfBoundsException - if the supplied index is bad.
    • getMinMax

      public double[] getMinMax(Object pixelArray) throws IllegalArgumentException
      Returns the minimum and maximum intensity values that are present in an array of pixel values. For complex PixelDataTypes, the minimum and maximum magnitudes are returned.
      Parameters:
      pixelArray - the array of pixel values.
      Returns:
      the minimum and maximum intensity values in an array of length 2.
      Throws:
      IllegalArgumentException - if the pixelArray is of wrong primitive type for this PixelDataType.
    • getMinMax

      public double[] getMinMax(Object pixelArray, ComplexMode complexMode) throws IllegalArgumentException
      Returns the minimum and maximum intensity values that are present in an array of pixel values.
      Parameters:
      pixelArray - the array of pixel values.
      complexMode - the ComplexMode for complex data types.
      Returns:
      the minimum and maximum intensity values in an array of length 2.
      Throws:
      IllegalArgumentException - if the pixelArray is of wrong primitive type for this PixelDataType.
    • getMinMax

      public double[] getMinMax(Object pixelArray, int fromIndex, int count, ComplexMode complexMode) throws IllegalArgumentException
      Returns the minimum and maximum intensity values that are present in subset of an array of pixel values.
      Parameters:
      pixelArray - the array of pixel values.
      fromIndex - the pixel index at which to start the search for the minimum and maximum intensity values.
      count - the number of pixels to search for the minimum and maximum intensity values.
      complexMode - the ComplexMode for complex data types.
      Returns:
      the minimum and maximum intensity values in an array of length 2.
      Throws:
      IllegalArgumentException - if the pixelArray is of wrong primitive type for this PixelDataType.
    • coerce

      public Object coerce(Object primitiveValues, PixelDataType toType, boolean clipIfNecessary) throws IllegalArgumentException
      Coerce pixels of this PixelDataType to a new PixelDataType.

      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.

      Parameters:
      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.
      Returns:
      a new array of primitive values that are the coerced pixel values.
      Throws:
      IllegalArgumentException - if this PixelDataType cannot be coerced to the toType PixelDataType.
    • coerce

      public Object coerce(Object primitiveValues, PixelDataType toType, ComplexMode complexMode, boolean clipIfNecessary) throws IllegalArgumentException
      Coerce pixels of this PixelDataType to a new PixelDataType.

      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.

      Parameters:
      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.
      Returns:
      a new array of primitive values that are the coerced pixel values.
      Throws:
      IllegalArgumentException - if this PixelDataType cannot be coerced to the toType PixelDataType.
    • coerce

      public Object coerce(Object primitiveValues, PixelDataType toType, int pixStart, int nPixels, ComplexMode complexMode, boolean clipIfNecessary) throws IllegalArgumentException
      Coerce pixels of this PixelDataType to a new PixelDataType.

      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.

      Parameters:
      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.
      Returns:
      a new array of primitive values that are the coerced pixel values.
      Throws:
      IllegalArgumentException - if this PixelDataType cannot be coerced to the toType PixelDataType.
    • coerceOneValue

      public Object coerceOneValue(Object value, PixelDataType toType) throws IllegalArgumentException
      Coerces a single pixel value to the given PixelDataType.
      Parameters:
      value - the single pixel value.
      toType - the PixelDataType to which it will be coerced.
      Returns:
      the coerced pixel value.
      Throws:
      IllegalArgumentException - if the pixel value cannot be coerced to the specified PixelDataType.
    • coerceOneValue

      public Object coerceOneValue(Object value, PixelDataType toType, ComplexMode complexMode) throws IllegalArgumentException
      Coerce a single pixel of this PixelDataType to a new PixelDataType.

      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 colour, 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 colour 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.

      Parameters:
      value - the pixel value to coerce.
      toType - the new PixelDataType of the coerced pixel.
      complexMode - the ComplexMode used when coercing Complex data types to real-valued data types.
      Returns:
      a new array of primitive values that are the coerced pixel values.
      Throws:
      IllegalArgumentException - if this PixelDataType cannot be coerced to the toType PixelDataType.
    • scale

      public void scale(Object pixelArray, double scaleFactor) throws IllegalArgumentException
      Scale pixel intensities "in-place". If the rescaled pixel intensities do not fit into the data range for this PixelDataType, they will be clipped.
      Parameters:
      pixelArray - the set of pixel values to scale.
      scaleFactor - the intensity scaling factor.
      Throws:
      IllegalArgumentException - if the intensties cannot be rescaled.
    • scale

      public void scale(Object pixelArray, double scaleFactor, int pixStart, int nPixels) throws IllegalArgumentException
      Scale pixel intensities "in-place". If the rescaled pixel intensities do not fit into the data range for this PixelDataType, they will be clipped.
      Parameters:
      pixelArray - 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.
      Throws:
      IllegalArgumentException - if the intensties cannot be rescaled.
    • shift

      public void shift(Object pixels, double shift) throws IllegalArgumentException
      Add a constant factor to pixel intensities "in-place". If the shifted pixel intensities do not fit into the data range for this PixelDataType, they will be clipped.
      Parameters:
      pixels - the set of pixel values to which to add a constant factor.
      shift - the constant factor to add.
      Throws:
      IllegalArgumentException - if the shift cannot be applied.
    • shift

      public void shift(Object pixelArray, double shift, int pixStart, int nPixels) throws IllegalArgumentException
      Add a constant factor to pixel intensities "in-place". If the shifted pixel intensities do not fit into the data range for this PixelDataType, they will be clipped.
      Parameters:
      pixelArray - the set of pixel values to which to add a constant factor.
      shift - the constant factor to add.
      pixStart - the index of the first pixel in the array of pixels that should be shifted.
      nPixels - the number of pixels to shift intensity.
      Throws:
      IllegalArgumentException - if the shift cannot be applied.
    • toLuminance

      public 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.
      Parameters:
      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.
      Returns:
      the luminance value, which is (0.299*red) + (0.587*green) + (0.114*blue), rounded to a short value.
    • getLuminance

      public static short getLuminance(Color color)
      Returns the luminance value of a Color.
      Parameters:
      color - the colour for which to return the luminance.
      Returns:
      the luminance value, which is (0.299*red) + (0.587*green) + (0.114*blue), rounded to a short value.
    • getPixelValue

      public Object getPixelValue(Object pixelArray, int col, int row, int nCols, int nRows, int offset)
      Gets the pixel value at a particular (column, row) of an array of pixels of this PixelDataType.
      Parameters:
      pixelArray - the array of pixel samples.
      col - the column number of the pixel.
      row - the row number of the pixel.
      nCols - the number of columns in the array.
      nRows - the number of rows in the array.
      offset - an offset (in pixels) into the pixel value array for the starting pixel of the slice.
      Returns:
      the pixel value at the column/row. The class of pixel that is returned is:
    • setPixelValue

      public void setPixelValue(Object pixelArray, int col, int row, int nCols, int nRows, int offset, Object value)
      Sets the pixel value at a particular (column, row) of an array of pixels of this PixelDataType.
      Parameters:
      pixelArray - the array of pixel values.
      col - the column number of the pixel.
      row - the row number of the pixel.
      nCols - the number of columns in the array.
      nRows - the number of rows in the array.
      offset - an offset (in pixels) into the pixel value array for the starting pixel of the slice.
      value - the pixel value to set. The class of pixel that must be supplied is:
    • interpolate

      public Object interpolate(Object pixelValue1, double pixelValue2, double alpha) throws IllegalArgumentException
      Interpolates between two pixel intensity values.
      Parameters:
      pixelValue1 - the first pixel value.
      pixelValue2 - the second pixel value.
      alpha - the alpha interpolation parameter.
      Returns:
      the interpolated pixel intensity value.
      Throws:
      IllegalArgumentException - if 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.
      IndexOutOfBoundsException - if the supplied index is bad.
    • flipX

      public void flipX(Object pixArray, int nCols, int nRows) throws InvalidImageException
      Flips an array of pixels in-place about the x-axis (ie, flips top to bottom). The array of pixels is over-written by the flipped pixels.
      Parameters:
      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.
      Throws:
      InvalidImageException - 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.
    • flipY

      public void flipY(Object pixArray, int nCols) throws InvalidImageException
      Flips an array of pixels in-place about the y-axis (ie flips left-right). The array of pixels is over-written by the flipped pixels.
      Parameters:
      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.
      Throws:
      InvalidImageException - 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.
    • transpose

      public void transpose(Object pixArray, int nCols, int nRows) throws InvalidImageException
      Transposes (slice-by-slice) an array of pixels in-place (ie flips top-right to bottom-left).
      N.B. if the number of rows is not equal to the number of columns, then there is an implict interchange of the number of rows and columns in the transposed array.
      Parameters:
      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.
      Throws:
      InvalidImageException - 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.
    • rotate

      public void rotate(Object pixArray, RotationAngle rotationAngle, int nCols, int nRows) throws InvalidImageException
      Rotates (slice-by-slice) an array of pixels in-place, by multiples of 90 degrees.
      N.B. if the number of rows is not equal to the number of columns, then there may be an implict interchange of the number of rows and columns in the rotated array (for 90 degree rotations).
      Parameters:
      pixArray - the array of pixels to rotate. This array must contain enough pixel samples for a whole number of image slices.
      rotationAngle - the rotation angle.
      nCols - the number of image columns.
      nRows - the number of image rows.
      Throws:
      InvalidImageException - 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.
    • main

      public static void main(String[] args)
      Runs the self-test of this class.
      Parameters:
      args - ignored.