Class VolumeInterpolator
PixelDataType.BINARY
PixelDataType.BYTE
PixelDataType.UBYTE
PixelDataType.SHORT
PixelDataType.USHORT
PixelDataType.INT
PixelDataType.UINT
PixelDataType.LONG
PixelDataType.FLOAT
PixelDataType.DOUBLE
PixelDataType.COMPLEX
PixelDataType.DOUBLECOMPLEX
ColourVolumeInterpolator
.
The VolumeInterpolator
always interpolates to produce a set of floating point
interpolated values at an arbitrary set of locations, regardless of the
PixelDataType
of the pixel samples to be interpolated. For complex data types,
the floating point values are in interleaved (real/imaginary) pairs and the length of the
returned array of values is twice the number of locations to be interpolated.
Supported interpolation types are:
InterpolationType.NEAREST_NEIGHBOUR
. Nearest neighbour interpolation.InterpolationType.LINEAR
. Tri-linear interpolation.InterpolationType.SINC
. Blackman-Harris windowed sinc interpolation.
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 a value that depends on the
BoundaryCondition
. For BoundaryCondition.FIXED
, the interpolated
intensities are equal to the "fixedValue" outside the field of view. This fixed
value defaults to zero, but can be set to any other (real) floating-point value. 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 VolumeInterpolator
, and any pixel samples outside the
central portion have an intensity equal to the "fixedValue".
-
Field Summary
Modifier and TypeFieldDescriptionprotected PixelDataType
The PixelDataType of the pixel values to be interpolated.protected static final int
The maximum number of interpolations that is performed in a singkle method call before the procedure is multi-threaded.protected int
The number of columns in the block of pixels.protected int
The number of rows in the block of pixels.protected int
The number of slices in the block of pixels.protected final Object
The array of pixel values to be interpolated.protected float
Horizontal pixel size in the block of pixels to be interpolated.protected float
Vertical pixel size in the block of pixels to be interpolated.protected float
Pixel depth in the block of pixels to be interpolated.protected Boolean
A Flag to indicate that thisVolumeInterpolator
should stop the current interpolation, (if an interpolation is in progress) and throw aCancellationException
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Signal to thisVolumeInterpolator
to stop the current interpolation (if an interpolation is in progress) as soon as possible, and throw aCancellationException
.static InterpolationType[]
Returns the types of interpolation that are implemented by the VolumeInterpolator class.static VolumeInterpolator
getInstance
(VolumeInterpolator interpolator, InterpolationType newType) Returns a newVolumeInterpolator
, constructed from an existing one.static VolumeInterpolator
getInstance
(Object pix, PixelDataType dataType, int nCols, int nRows, int nSlices, float pixelXSize, float pixelYSize, float pixelZSize, BoundaryCondition boundaryCondition, Float fixedValue, InterpolationType type) Returns a newVolumeInterpolator
for a block of pixel samples.float[]
interpolate
(float[] xyzArray, float[] intensityArray) Interpolate the intensity samples at a set of supplied coordinates.static void
Run the self-test for VolumeInterpolator.
-
Field Details
-
MAX_INTERPOLATIONS_BEFORE_MULTITHREADING
protected static final int MAX_INTERPOLATIONS_BEFORE_MULTITHREADINGThe maximum number of interpolations that is performed in a singkle method call before the procedure is multi-threaded.- See Also:
-
pix
The array of pixel values to be interpolated. -
dataType
The PixelDataType of the pixel values to be interpolated. -
nCols
protected int nColsThe number of columns in the block of pixels. -
nRows
protected int nRowsThe number of rows in the block of pixels. -
nSlices
protected int nSlicesThe number of slices in the block of pixels. -
pixelXSize
protected float pixelXSizeHorizontal pixel size in the block of pixels to be interpolated. -
pixelYSize
protected float pixelYSizeVertical pixel size in the block of pixels to be interpolated. -
pixelZSize
protected float pixelZSizePixel depth in the block of pixels to be interpolated. -
stopMe
A Flag to indicate that thisVolumeInterpolator
should stop the current interpolation, (if an interpolation is in progress) and throw aCancellationException
.
-
-
Method Details
-
cancel
public void cancel()Signal to thisVolumeInterpolator
to stop the current interpolation (if an interpolation is in progress) as soon as possible, and throw aCancellationException
. -
interpolate
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.intensityArray
- the array into which the interpolated pixel intensities will be placed. If intensityArray isnull
, 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:
IndexOutOfBoundsException
- if the intensityArray is of the wrong length for the number of pixel (x,y,z) coordinates supplied.CancellationException
- if the interpolation halts prematurely because it has been cancelled.
-
getInstance
public static VolumeInterpolator getInstance(Object pix, PixelDataType dataType, int nCols, int nRows, int nSlices, float pixelXSize, float pixelYSize, float pixelZSize, BoundaryCondition boundaryCondition, Float fixedValue, InterpolationType type) throws InstantiationException Returns a newVolumeInterpolator
for a block of pixel samples.- Parameters:
pix
- the set of intensities 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.boundaryCondition
- theBoundaryCondition
to apply for interpolated points that are outside the block of pixels.fixedValue
- if non-null, the fixed value interpolated values outside the pixel array if the boundary condition isBoundaryCondition.FIXED
.type
- the InterpolationType to be used for interpolation. One of:- Returns:
- a
VolumeInterpolator
. - Throws:
InstantiationException
- if aVolumeInterpolator
cannot be created.
-
getInstance
public static VolumeInterpolator getInstance(VolumeInterpolator interpolator, InterpolationType newType) throws InstantiationException Returns a newVolumeInterpolator
, constructed from an existing one. This method can be used to change theInterpolationType
of an existingVolumeInterpolator
.- Parameters:
interpolator
- the existingVolumeInterpolator
.newType
- the newInterpolationType
to be used for interpolation. One of:- Returns:
- a
VolumeInterpolator
using the new type of interpolation. - Throws:
InstantiationException
- if aVolumeInterpolator
cannot be created.
-
main
Run the self-test for VolumeInterpolator.- Parameters:
args
- ignored.
-
getImplementedInterpolationTypes
Returns the types of interpolation that are implemented by the VolumeInterpolator class.- Returns:
- an array of
InterpolationType
s that can be used for volume interpolation.
-