VolumeJ

## Class VJTrilinear

• ### Constructor Summary

Constructors
Constructor and Description
`VJTrilinear()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`protected static VJGradient` ```gradient(byte[] v, int height, int width, VJVoxelLoc vl)```
Interpolate the gradient *xyz* in a byte volume.
`protected static VJGradient` ```gradient(float[][][] v, VJVoxelLoc vl)```
Interpolate the gradient *xyz* in a float volume.
`protected static VJGradient` ```gradient(short[][][] v, int mask, VJVoxelLoc vl)```
Interpolate the gradient *xyz* in a short volume with a mask.
`protected static VJGradient` ```gradient(short[][][] v, VJVoxelLoc vl)```
Interpolate the gradient *xyz* in a short volume.
`VJGradient` ```gradient(Volume v, VJVoxelLoc vl)```
Compute an interpolated gradient from a volume.
`boolean` ```isValid(VJVoxelLoc vl, Volume v)```
Does vl fall within the bounds of a volume for interpolation?
`boolean` ```isValidGradient(VJCell c, Volume v)```
Does cell c fall within the bounds of a volume for nearest neighbor gradient interpolation? Bounds are -2...+3 of the cell location (translates to -2...+2 for the voxel location).
`boolean` ```isValidGradient(VJVoxelLoc vl, Volume v)```
Does vl fall within the bounds of a volume for trilinear gradient interpolation?
`String` `toString()`
`static boolean` ```valid(int width, int height, int ix, int iy)```
Determine whether x,y are valid in an image width*height for bilinear interpolation.
`static float` ```value(byte[] i, int width, int ix, int iy, float dx, float dy)```
Bilinear interpolation at (ix+dx, iy+dy) of 2D image organised as byte[].
`protected static float` ```value(byte[] v, int height, int width, VJVoxelLoc vl)```
Interpolate in a byte volume organized as a single array.
`protected static float` ```value(float[][][][] v, int dimension, VJVoxelLoc vl)```
Interpolate in a float 4D hypervolume in a single dimension.
`protected static float` ```value(float[][][] v, VJVoxelLoc vl)```
Interpolate in a float volume.
`static float` ```value(float[] i, int width, int ix, int iy, float dx, float dy)```
Bilinear interpolation at (ix+dx, iy+dy) of 2D image organised as float[].
`static float` ```value(int[] i, int width, int ix, int iy, float dx, float dy)```
Bilinear interpolation of brightness at (ix+dx, iy+dy) of 2D image organised as int[].
`protected static float` ```value(short[][][] v, VJVoxelLoc vl)```
Interpolate in a short volume.
`static float` ```value(short[] i, int width, int ix, int iy, float dx, float dy)```
Bilinear interpolation at (ix+dx, iy+dy) of 2D image organised as short[].
`VJValue` ```value(VJValue voxel, Volume v, VJVoxelLoc vl)```
Interpolate a volume.
`protected static float[]` ```valueHS(float[] hs, Object[] sliceArray, int width, VJVoxelLoc vl)```
Interpolate hue and saturation in an RGB int volume organized as an array of slices.
• ### Methods inherited from class VolumeJ.VJInterpolator

`valueHS`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Constructor Detail

• #### VJTrilinear

`public VJTrilinear()`
• ### Method Detail

• #### isValid

```public boolean isValid(VJVoxelLoc vl,
Volume v)```
Does vl fall within the bounds of a volume for interpolation?
Specified by:
`isValid` in class `VJInterpolator`
Parameters:
`vl` - a VJVoxelLoc for which you want to know whether it falls inside the bounds, taking account of support.
`startx` - ... endz the bounds of the volume.
`boolean` - whether or not vl falls within the bounds.
Returns:
boolean whether or not vl falls within the bounds.

```public boolean isValidGradient(VJVoxelLoc vl,
Volume v)```
Does vl fall within the bounds of a volume for trilinear gradient interpolation?
Specified by:
`isValidGradient` in class `VJInterpolator`
Parameters:
`vl` - a VJVoxelLoc for which you want to know whether it falls inside the bounds, taking account of support for the gradient kernel.
`v` - the volume.
`boolean` - whether or not vl falls within the bounds.
Returns:
boolean whether or not vl falls within the bounds.

```public boolean isValidGradient(VJCell c,
Volume v)```
Does cell c fall within the bounds of a volume for nearest neighbor gradient interpolation? Bounds are -2...+3 of the cell location (translates to -2...+2 for the voxel location). If you can use bilinear interpolation of the anterior and posterior faces of a cell, use -1...+2.
Specified by:
`isValidGradient` in class `VJInterpolator`
Parameters:
`c` - a VJCell for which you want to know whether it falls inside the bounds, taking account of support for the gradient kernel.
`v` - the volume.
`boolean` - whether or not c falls within the bounds.
• #### value

```public VJValue value(VJValue voxel,
Volume v,
VJVoxelLoc vl)```
Interpolate a volume. This method can be overloaded in subclasses for different interpolation algorithms. Interpolate the value of v at location vl. voxel must be instantiated as a (sub)class of VJValue.
Specified by:
`value` in class `VJInterpolator`
Parameters:
`voxel` - a VJValue which will contain the interpolated voxel value on exit.
`v` - a volume
`vl` - a location in the volume.
Returns:
voxel, which contains the value in v at vl.

```public VJGradient gradient(Volume v,
VJVoxelLoc vl)```
Compute an interpolated gradient from a volume. The called methods can be overloaded in subclasses for different interpolation algorithms.
Specified by:
`gradient` in class `VJInterpolator`
Parameters:
`v` - the volume.
`vl` - the VJVoxelLoc where to interpolate the gradient
Returns:
a VJGradient with the interpolated value(s).
• #### value

```protected static float value(float[][][] v,
VJVoxelLoc vl)```
Interpolate in a float volume.
Parameters:
`v` - the volume in which to interpolate
`vl` - the location where to interpolate.
Returns:
the interpolated value
• #### value

```protected static float value(short[][][] v,
VJVoxelLoc vl)```
Interpolate in a short volume.
Parameters:
`v` - the volume in which to interpolate
`vl` - the location where to interpolate.
Returns:
the interpolated value
• #### value

```protected static float value(float[][][][] v,
int dimension,
VJVoxelLoc vl)```
Interpolate in a float 4D hypervolume in a single dimension.
Parameters:
`v` - the volume in which to interpolate
`dimension` - the dimension in which to interpolate.
`vl` - the location where to interpolate.
Returns:
the interpolated value.
• #### value

```protected static float value(byte[] v,
int height,
int width,
VJVoxelLoc vl)```
Interpolate in a byte volume organized as a single array.
Parameters:
`v` - the volume array in which to interpolate
`height` - the height of the volume.
`width` - the width of the volume.
`vl` - the location where to interpolate.
Returns:
the interpolated value
• #### valueHS

```protected static float[] valueHS(float[] hs,
Object[] sliceArray,
int width,
VJVoxelLoc vl)```
Interpolate hue and saturation in an RGB int volume organized as an array of slices. Interpolation of hue and saturation are not very succesful, probably because hue is an angle, and empty voxels default to hue=0.
Parameters:
`hs` - a float[2] that will contain the interpolated hue and saturation on return.
`sliceArray` - the volume slice array in which to interpolate
`width` - the width of the volume.
`vl` - the location where to interpolate.
Returns:
the interpolated value

```protected static VJGradient gradient(float[][][] v,
VJVoxelLoc vl)```
Interpolate the gradient *xyz* in a float volume.
Parameters:
`v` - the volume in which to interpolate
`vl` - the location where to interpolate.
Returns:
the VJGradient containing the 3 dimensional vector of the gradient.

```protected static VJGradient gradient(short[][][] v,
VJVoxelLoc vl)```
Interpolate the gradient *xyz* in a short volume.
Parameters:
`v` - the volume in which to interpolate
`vl` - the location where to interpolate.
Returns:
the VJGradient containing the 3 dimensional vector of the gradient.

```protected static VJGradient gradient(byte[] v,
int height,
int width,
VJVoxelLoc vl)```
Interpolate the gradient *xyz* in a byte volume.
Parameters:
`v` - the volume in which to interpolate
`vl` - the location where to interpolate.
Returns:
the VJGradient containing the 3 dimensional vector of the gradient.

```protected static VJGradient gradient(short[][][] v,
VJVoxelLoc vl)```
Interpolate the gradient *xyz* in a short volume with a mask.
Parameters:
`v` - the volume in which to interpolate
`vl` - the location where to interpolate.
Returns:
the VJGradient containing the 3 dimensional vector of the gradient.
• #### toString

`public String toString()`
Specified by:
`toString` in class `VJInterpolator`
• #### value

```public static float value(float[] i,
int width,
int ix,
int iy,
float dx,
float dy)```
Bilinear interpolation at (ix+dx, iy+dy) of 2D image organised as float[].
Parameters:
`i` - the 2D image.
`width` - the width of the image.
`ix` - the integer x position at which to interpolate.
`iy` - the integer y position at which to interpolate.
`dx` - the x fractional position
`dy` - the y fractional position
• #### value

```public static float value(byte[] i,
int width,
int ix,
int iy,
float dx,
float dy)```
Bilinear interpolation at (ix+dx, iy+dy) of 2D image organised as byte[].
Parameters:
`i` - the 2D image.
`width` - the width of the image.
`ix` - the integer x position at which to interpolate.
`iy` - the integer y position at which to interpolate.
`dx` - the x fractional position
`dy` - the y fractional position
• #### value

```public static float value(short[] i,
int width,
int ix,
int iy,
float dx,
float dy)```
Bilinear interpolation at (ix+dx, iy+dy) of 2D image organised as short[].
Parameters:
`i` - the 2D image.
`width` - the width of the image.
`ix` - the integer x position at which to interpolate.
`iy` - the integer y position at which to interpolate.
`dx` - the x fractional position
`dy` - the y fractional position
• #### value

```public static float value(int[] i,
int width,
int ix,
int iy,
float dx,
float dy)```
Bilinear interpolation of brightness at (ix+dx, iy+dy) of 2D image organised as int[].
Parameters:
`i` - the 2D image.
`width` - the width of the image.
`ix` - the integer x position at which to interpolate.
`iy` - the integer y position at which to interpolate.
`dx` - the x fractional position
`dy` - the y fractional position
• #### valid

```public static boolean valid(int width,
int height,
int ix,
int iy)```
Determine whether x,y are valid in an image width*height for bilinear interpolation.
Parameters:
`width` - the width of the image.
`height` - the height of the image.
`ix` - the integer x-position
`iy` - the integer y-position.