Class ncsa.horizon.util.Voxel
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.horizon.util.Voxel

java.lang.Object
   |
   +----ncsa.horizon.util.Voxel

public class Voxel
extends Object
implements Cloneable
a generalized description of a point in n-space whose dimensions n are specified in the constructor call.

The axes of the space are referred to through an index which, by default, begins with zero; however, the index that refers to the first axis can be set when the Voxel object is created using the appropriate constructor.

See also Volume, Slice, and Segment.


Variable Index

 o firstAxisIndex
 o pos

Constructor Index

 o Voxel(int)
create a Voxel in a space of nax dimensions and initialize it to the origin (i.e.
 o Voxel(int, double[])
create a Voxel in a space of nax dimensions and initialize it with a position.
 o Voxel(int, int)
create a Voxel in a space of nax dimensions and initialize it to the origin (i.e.
 o Voxel(Voxel, int)
Create a Voxel that is a copy of another Voxel but with the specified index for the first axis

Method Index

 o axisPos(int)
get the projection of the Voxel's position along the i-th axis.
 o clone()
create a deep copy of this Voxel
 o equals(Voxel)
return true if another Voxel is (in principle) at the same location as this Voxel.
 o getFirstAxisIndex()
return the index of the first axis (as defined during this object's construction).
 o getNaxes()
return the number of dimensions in the space containing this Voxel
 o getValues()
return an array of doubles representing the position along each axis.
 o getValues(int)
return an array of doubles representing the position along each axis
 o main(String[])
run this class as an application to test it
 o setAxisPos(int, double)
set the projection of the Voxel's position along the i-th axis Axes are numbered beginning with 0.
 o setValues(double[])
set the position along all axes with the values given in the input array.
 o setValues(double[], int)
set the position along all axes with the values given in the input array.
 o toString()
converts position to (x, y, ...) formatted string
 o translate(double[], int)
move this Voxel to a relative position
 o translate(Voxel)
move this Voxel to a relative position

Variables

 o pos
  protected double pos[]
 o firstAxisIndex
  protected int firstAxisIndex

Constructors

 o Voxel
  public Voxel(int nax,
               int firstAxisIndex) throws ArrayIndexOutOfBoundsException
create a Voxel in a space of nax dimensions and initialize it to the origin (i.e. position = [0, 0, 0, ...]).
Parameters:
nax - number of axes or dimensions in the space
firstAxisIndex - index of the first axis (can be <, =, or > 0)
Throws: ArrayIndexOutOfBoundsException
thrown if nax < 0
 o Voxel
  public Voxel(int nax) throws ArrayIndexOutOfBoundsException
create a Voxel in a space of nax dimensions and initialize it to the origin (i.e. position = [0, 0, 0, ...]). The index of the first axis will be zero.
Parameters:
nax - number of axes or dimensions in the space
Throws: ArrayIndexOutOfBoundsException
thrown if nax < 0
 o Voxel
  public Voxel(int nax,
               double in[]) throws ArrayIndexOutOfBoundsException
create a Voxel in a space of nax dimensions and initialize it with a position. The index of the first axis will be zero.
Parameters:
nax - number of axes or dimensions in the space
in - an array containing the position. The first nax elements will be used. If the array size is smaller than nax, the remaining components will be 0.
Throws: ArrayIndexOutOfBoundsException
thrown if nax < 0
 o Voxel
  public Voxel(Voxel vox,
               int firstAxisIndex)
Create a Voxel that is a copy of another Voxel but with the specified index for the first axis
Parameters:
vox - the input voxel
firstAxisIndex - the index that should be used for the first axis in the new Voxel

Methods

 o getNaxes
  public int getNaxes()
return the number of dimensions in the space containing this Voxel
 o getFirstAxisIndex
  public int getFirstAxisIndex()
return the index of the first axis (as defined during this object's construction).
 o axisPos
  public double axisPos(int i) throws ArrayIndexOutOfBoundsException
get the projection of the Voxel's position along the i-th axis. Axes are numbered using the convention defined when the Voxel was constructed.
 o setAxisPos
  public void setAxisPos(int i,
                         double value) throws ArrayIndexOutOfBoundsException
set the projection of the Voxel's position along the i-th axis Axes are numbered beginning with 0.
 o getValues
  public double[] getValues(int firstaxis) throws ArrayIndexOutOfBoundsException
return an array of doubles representing the position along each axis
Parameters:
firstaxis - index at which first value should appear
Throws: ArrayIndexOutOfBoundsException
if firstaxis < 0
 o getValues
  public double[] getValues()
return an array of doubles representing the position along each axis. The first value will appear at the first axis index used when this object was constructed, unless that index is < 0, in which case the first value will appear at index 0.
 o setValues
  public void setValues(double newpos[],
                        int firstaxis) throws ArrayIndexOutOfBoundsException
set the position along all axes with the values given in the input array.
Parameters:
newpos - array of doubles containing position values
firstaxis - index at which first value appears in newpos
Throws: ArrayIndexOutOfBoundsException
if firstaxis < 0
 o setValues
  public void setValues(double newpos[])
set the position along all axes with the values given in the input array. The first value will be assumed to be at the first index axis defined when this object was constructed, unless that index is < 0, in which case, the first value will be assumed to be at 0.
Parameters:
newpos - array of doubles containing position values
 o toString
  public String toString()
converts position to (x, y, ...) formatted string
Overrides:
toString in class Object
 o clone
  public Object clone()
create a deep copy of this Voxel
Overrides:
clone in class Object
 o translate
  public void translate(Voxel vox)
move this Voxel to a relative position
Parameters:
vox - the relative position to add to this voxel's position; only dimensions that overlap this space will be added.
 o translate
  public void translate(double newpos[],
                        int firstaxis) throws ArrayIndexOutOfBoundsException
move this Voxel to a relative position
Parameters:
newpos - the relative position to add to this voxel's position; only dimensions that overlap this space will be added.
firstaxis - index at which first value appears in newpos
 o equals
  public boolean equals(Voxel vox)
return true if another Voxel is (in principle) at the same location as this Voxel. For equality to be true, locations along extra axes (for either Voxel) must be zero.
 o main
  public static void main(String args[])
run this class as an application to test it
Parameters:
args - components of a vector

All Packages  Class Hierarchy  This Package  Previous  Next  Index