com.xinapse.multisliceimage
Class ColourVolumeInterpolator

java.lang.Object
  extended by com.xinapse.multisliceimage.ColourVolumeInterpolator

public class ColourVolumeInterpolator
extends java.lang.Object

An interpolator for a 3- (or fewer) dimensional array of pixels in a Colour image. Supported pixel data types are:

The ColourVolumeInterpolator interpolates to produce a set of interpolated colour values at an arbitrary set of locations.

Supported interpolation types are:

The origin (x=0, y=0, z=0) is assumed to be at the centre of the block of pixels, such that x values within the block go from x=-FoVx/2 to x=+FoVx/2 where FoVx is the field of view in the x-direction (with similar specification for y and z). The array of pixels to be interpolated is inset within the block such that there is half a pixel distance between the edges of the field of view and the first and last samples (i.e., FoVx = pixelXSize * number of columns, etc.).

Supplied coordinates outside the field of view will yield the "missing colour value" pixel colour. This missing colour value defaults to black, but can be set to any other java.awt.Color. The result of any interpolation is the same as would result when iterpolating within an infinite array of pixel samples, where the central portion of samples is that supplied to form the ColourVolumeInterpolator, and any pixel samples outside the central portion have a colour equal to the "missing colour value".


Constructor Summary
ColourVolumeInterpolator(byte[] pix, PixelDataType dataType, int nCols, int nRows, int nSlices, float pixelXSize, float pixelYSize, float pixelZSize, java.awt.Color missingColourValue, InterpolationType interpolationType)
          Creates a new ColourVolumeInterpolator for a block of colour (R,G,B) pixel samples.
ColourVolumeInterpolator(ColourVolumeInterpolator interpolator, InterpolationType newType)
          Returns a new ColourVolumeInterpolator, constructed from an existing one.
 
Method Summary
 void cancel()
          Signal to this ColourVolumeInterpolator to stop the current interpolation (if an interpolation is in progress) as soon as possible.
 byte[] interpolate(float[] xyzArray, byte[] colourArray)
          Interpolate the intensity samples at a set of supplied coordinates.
static void main(java.lang.String[] argv)
          Run the test suite for ColourVolumeInterpolator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColourVolumeInterpolator

public ColourVolumeInterpolator(byte[] pix,
                                PixelDataType dataType,
                                int nCols,
                                int nRows,
                                int nSlices,
                                float pixelXSize,
                                float pixelYSize,
                                float pixelZSize,
                                java.awt.Color missingColourValue,
                                InterpolationType interpolationType)
                         throws java.lang.InstantiationException
Creates a new ColourVolumeInterpolator for a block of colour (R,G,B) pixel samples.

Parameters:
pix - the block of colour pixels to be interpolated.
dataType - the PixelDataType of the block of pixels.
nCols - the number of columns in the block of pixels.
nRows - the number of rows in the block of pixels.
nSlices - the number of slices in the block of pixels.
pixelXSize - the pixel width.
pixelYSize - the pixel height.
pixelZSize - the pixel depth.
missingColourValue - the pixel value that that will be set for interpolated points that are outside the block of pixels. If null, the default value of java.awt.Color.black will be set.
interpolationType - the InterpolationType to be used for interpolation. One of:
  • InterpolationType.NEAREST_NEIGHBOUR.
  • InterpolationType.LINEAR.
  • InterpolationType.SINC.
Throws:
java.lang.InstantiationException - if the interpolationType is not supported.

ColourVolumeInterpolator

public ColourVolumeInterpolator(ColourVolumeInterpolator interpolator,
                                InterpolationType newType)
                         throws java.lang.InstantiationException
Returns a new ColourVolumeInterpolator, constructed from an existing one. This method can be used to change the IterpolationType of an existing ColourVolumeInterpolator.

Parameters:
interpolator - the existing ColourVolumeInterpolator.
newType - the new IterpolationType to be used for interpolation. One of:
  • InterpolationType.NEAREST_NEIGHBOUR.
  • InterpolationType.LINEAR.
  • InterpolationType.SINC.
Throws:
java.lang.InstantiationException - if the interpolationType is not supported.
Method Detail

cancel

public void cancel()
Signal to this ColourVolumeInterpolator to stop the current interpolation (if an interpolation is in progress) as soon as possible.


interpolate

public byte[] interpolate(float[] xyzArray,
                          byte[] colourArray)
                   throws MultiSliceImageException,
                          com.xinapse.util.CancelledException
Interpolate the intensity samples at a set of supplied coordinates.

Parameters:
xyzArray - the x,y,z coordinates of each of the new sample locations. The x, y and z coordinates are supplied in interlaced order: x0, y0, z0, x1, y1, z1, .... xN-1, yN-1, zN-1.
colourArray - the array into which the interpolated pixel colours will be placed. If intensityArray is null, a new array will be allocated.
Returns:
the array of pixel intensities - either the newly-allocated one, or the one supplied. Pixel intensities are always returned as an array of float values, regardless of the data type of pixels to be interpolated.
Throws:
MultiSliceImageException - if the intensityArray is of the wrong length for the number of pixel (x,y,z) coordinates supplied, or if the data type isn't supported.
com.xinapse.util.CancelledException - if the interpolation halts prematurely because it has been cancelled.

main

public static void main(java.lang.String[] argv)
Run the test suite for ColourVolumeInterpolator.

Parameters:
argv - is ignored.


Copyright 2006-2008 Xinapse Systems Limited. All Rights Reserved.