BIJ API

VolumeJ
Class VJNearestNeighbor

java.lang.Object
  |
  +--VolumeJ.VJInterpolator
        |
        +--VolumeJ.VJNearestNeighbor

public class VJNearestNeighbor
extends VJInterpolator

This class is the standard interpolator and implements nearest neighbor interpolation and interpolation of gradients. Copyright (c) 1999-2002, Michael Abramoff. All rights reserved.


Constructor Summary
VJNearestNeighbor()
           
 
Method Summary
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 (central difference).
protected static VJGradient gradient(short[][][] v, VJVoxelLoc vl)
          Interpolate the gradient *xyz* in a short volume (central difference).
 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 volume for a nearest neighbor interpolation?
 boolean isValidGradient(VJCell c, Volume v)
          Does cell c fall within the bounds of a volume for nearest neighbor gradient interpolation?
 boolean isValidGradient(VJVoxelLoc vl, Volume v)
          Does vl fall within the bounds of volume for nearest neighbor gradient interpolation?
 java.lang.String toString()
           
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, int i)
          Interpolate an entry in a float vector volume.
protected static float value(float[][][] v, VJVoxelLoc vl)
          Interpolate in a float volume.
protected static int value(short[][][] v, VJVoxelLoc vl)
          Interpolate in a short volume.
 VJValue value(VJValue voxel, Volume v, VJVoxelLoc vl)
          Interpolate a volume.
protected static float[] valueHS(float[] hs, java.lang.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

VJNearestNeighbor

public VJNearestNeighbor()
Method Detail

isValid

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

isValidGradient

public boolean isValidGradient(VJVoxelLoc vl,
                               Volume v)
Does vl fall within the bounds of volume for nearest neighbor gradient interpolation?
Overrides:
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 to be interpolated.
Returns:
boolean whether or not vl falls within the bounds.

isValidGradient

public boolean isValidGradient(VJCell c,
                               Volume v)
Does cell c fall within the bounds of a volume for nearest neighbor gradient interpolation?
Overrides:
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 to be interpolated.
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.
Overrides:
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.

gradient

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.
Overrides:
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,
                             int i)
Interpolate an entry in a float vector volume.
Parameters:
v - the vector volume in which to interpolate
vl - the location where to interpolate.
i - the entry in the vector to interpolate.
Returns:
the interpolated value

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 int 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(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,
                                 java.lang.Object[] sliceArray,
                                 int width,
                                 VJVoxelLoc vl)
Interpolate hue and saturation in an RGB int[][] volume organized as an array of slices.
Parameters:
hs - a float[2] that will contain the hue and saturation [0-1] on return.
v - the volume array in which to interpolate
width - the width of the volume.
vl - the location where to interpolate.
Returns:
hs, the interpolated hue and saturation at vl.

gradient

protected static VJGradient gradient(short[][][] v,
                                     VJVoxelLoc vl)
Interpolate the gradient *xyz* in a short volume (central difference).
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.

gradient

protected static VJGradient gradient(float[][][] v,
                                     VJVoxelLoc vl)
Interpolate the gradient *xyz* in a float volume (central difference).
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.

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.

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.

toString

public java.lang.String toString()
Overrides:
toString in class VJInterpolator

BIJ API

Submit a bug or feature

Copyright (c) 1997-2003 Michael Abramoff
Licensing available. All Rights Reserved.