Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class ncsa.horizon.util.Slice

java.lang.Object
  |
  +--ncsa.horizon.util.Volume
        |
        +--ncsa.horizon.util.Slice
Subclasses:
AdjustableSlice

public class Slice
extends Volume
an immutable Volume in which all but two of the sides have unit sampled lengths. One side is considered the "x" axis; the other, the "y" axis. Any axis can be made the x or y axis without restriction except that an axis cannot be both the x-axis and the y-axis simultaneously.

The "sampled" length is the value returned by Volume.getSampledSize(int). In other words, it is the number of points that are sampled along that access, taking in to account the stride along the axis (see Volume for details). Unit sampled length means that only one data point is sampled along that axis.

See also Voxel, Volume, and Segment.

See Also:
Serialized Form

Inner classes inherited from class ncsa.horizon.util.Volume
Volume.IndexOrder
 
Fields inherited from class ncsa.horizon.util.Volume
CAN_EXTRAPOLATE, CAN_INTERPOLATE, flags, loc, naxes, NONE, order, sample, size
 
Constructor Summary
Slice(int nax, int xaxis, int yaxis)
          create a Slice object in which all the lengths of all sides have a length of one.
Slice(int nax)
          create a Slice object of unit size and nax dimensions; the first two axes are assumed to be the ones defining the slice plane.
Slice(Voxel vox, java.awt.Dimension dim, int xaxis, int yaxis)
          create a Slice object located at a given Voxel and of given dimensions
Slice(Volume vol, int xaxis, int yaxis)
          create a Slice object from a Volume
Slice(Slice sl)
          create a Slice from another Slice.
Slice(Volume vol)
          create a Slice object from a Volume.
 
Method Summary
java.lang.Object clone()
           
java.awt.Dimension getAreaDimension()
          return the integer size of the area enclosed within the slice plane as a Dimension object
int[] getAreaOrigin()
          return a two element array giving the x and y positions of this slice
int[] getArea()
          return a two element array giving the integer size of the area enclosed within the slice plane
double[] getExactAreaOrigin()
          return a two element array giving the x and y positions of this slice
double[] getExactArea()
          return a two element array giving the area enclosed by this slice
double getExactXaxisLength()
          set the length of the Slice along the x axis
double getExactXaxisOrigin()
          set the position of the Slice along the x axis
double getExactYaxisLength()
          set the length of the Slice along the y axis
double getExactYaxisOrigin()
          get the position of the Slice along the y axis
int getRoundedXaxisStride()
          set the sampling of the Slice along the x axis
int getRoundedYaxisStride()
          set the sampling of the Slice along the y axis
java.awt.Dimension getSampledAreaDimension()
          return the sampled size of the area enclosed within the slice plane as a Dimension object.
int getXaxisLength()
          set the length of the Slice along the x axis
int getXaxisOrigin()
          set the position of the Slice along the x axis
int getXaxis()
          return the currently set x axis.
double getXaxisStride()
          set the sampling of the Slice along the x axis
int getYaxisLength()
          set the length of the Slice along the y axis
int getYaxisOrigin()
          get the position of the Slice along the y axis
int getYaxis()
          return the currently set ordinate (y) axis.
double getYaxisStride()
          set the sampling of the Slice along the y axis
static boolean isSlice(Volume vol)
          return true if the sampling and size of given volume is set such that no more than two sides allow more than one data point to be sampled.
void setXaxisLength(double pos)
          set the length of the Slice along the x axis
void setXaxisLength(int pos)
          set the length of the Slice along the x axis
void setXaxisOrigin(double pos)
          set the position of the Slice along the x axis
void setXaxisOrigin(int pos)
          set the position of the Slice along the x axis
void setXaxis(int i)
          set the x axis to be the given integer, indicating that this axis can be have a length larger than one.
void setXaxisStride(double pos)
          set the sampling of the Slice along the x axis
void setXaxisStride(int pos)
          set the sampling of the Slice along the x axis
void setYaxisLength(double pos)
          set the length of the Slice along the y axis
void setYaxisLength(int pos)
          set the length of the Slice along the y axis
void setYaxisOrigin(double pos)
          set the position of the Slice along the y axis
void setYaxisOrigin(int pos)
          set the position of the Slice along the y axis
void setYaxis(int i)
          set the ordinate (y-) axis to be the given integer, indicating that this axis can be have a length larger than one.
void setYaxisStride(double pos)
          set the sampling of the Slice along the y axis
void setYaxisStride(int pos)
          set the sampling of the Slice along the y axis
Slice sliceProjection(Volume vol)
          return a Slice that is a projection of a Volume onto the plane of this slice.
java.lang.String toString()
           
Voxel voxelProjection(Voxel vox)
          return a Voxel that is a projection of a given Voxel onto the plane of this slice.
int xaxis()
           
int yaxis()
           
 
Methods inherited from class ncsa.horizon.util.Volume
axisPos, clone, doubleToInt, equals, getAxisOrder, getExactOrigin, getExactOrigin, getExactSize, getExactSize, getFlags, getLength, getLocation, getLocation, getMonitor, getNaxes, getOrigin, getOrigin, getRoundedStride, getRoundedStride, getSampledCount, getSampledSize, getSampledSize, getSampling, getSampling, getSize, getSize, getStep, getStride, getStride, getTrueLength, getTrueSize, getTrueSize, getVoxel, hashCode, includes, includes, includes, includes, intersection, intersects, intToDouble, isEmpty, isInNaturalAxisOrder, isMutable, isSamplingFully, isSamplingPositively, isSamplingWholly, makeLengthsPositive, projection, reorder, reorder, reorder, roundDoubleToInt, samples, sampleWholly, toString, union, union
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Constructor Detail

Slice

public Slice(int nax,
             int xaxis,
             int yaxis)
      throws java.lang.ArrayIndexOutOfBoundsException
create a Slice object in which all the lengths of all sides have a length of one.
Parameters:
nax - number of axes in the space in which it exists
xaxis - axis to be considered the x axis (zero-relative).
yaxis - axis to be considered the y axis (zero-relative).
Throws:
java.lang.ArrayIndexOutOfBoundsException - thrown if nax < 0 or if xaxis or yaxis is outside of range [0, nax)

Slice

public Slice(int nax)
create a Slice object of unit size and nax dimensions; the first two axes are assumed to be the ones defining the slice plane. The index of the first axis will be zero.
Throws:
java.lang.ArrayIndexOutOfBoundsException - thrown if nax < 0

Slice

public Slice(Voxel vox,
             java.awt.Dimension dim,
             int xaxis,
             int yaxis)
      throws java.lang.ArrayIndexOutOfBoundsException
create a Slice object located at a given Voxel and of given dimensions
Parameters:
vox - location of slice vertex closest to origin of space
dim - dimension of slice in x and y directions
xaxis - axis index of x-axis (zero-relative).
yaxis - axis index of y-axis (zero-relative).
Throws:
java.lang.ArrayIndexOutOfBoundsException - thrown if xaxis or yaxis is outside of range [0, nax)

Slice

public Slice(Volume vol,
             int xaxis,
             int yaxis)
      throws java.lang.ArrayIndexOutOfBoundsException
create a Slice object from a Volume
Parameters:
vol - volume to slice
xaxis - axis index of x-axis (zero-relative).
yaxis - axis index of y-axis (zero-relative).
Throws:
java.lang.ArrayIndexOutOfBoundsException - thrown if xaxis or yaxis is outside of range [0, nax)

Slice

public Slice(Slice sl)
create a Slice from another Slice. This constructor is helpful for converting mutable Slices (e.g. AdjustableSlice) into an immutable one.
Parameters:
sl - the slice to copy

Slice

public Slice(Volume vol)
create a Slice object from a Volume. The x and y axes will be set to the volume's first two axes in its reordered sequence.
Parameters:
vol - the input volume
Method Detail

xaxis

protected final int xaxis()

yaxis

protected final int yaxis()

isSlice

public static boolean isSlice(Volume vol)
return true if the sampling and size of given volume is set such that no more than two sides allow more than one data point to be sampled. This means that the array returned by vol.getSampledSize() will only contain two values greater than one.

setXaxis

protected void setXaxis(int i)
set the x axis to be the given integer, indicating that this axis can be have a length larger than one.
Parameters:
i - index of axis (zero-relative)
Throws:
java.lang.ArrayIndexOutOfBoundsException - if i < 0 or >= the number of axes

setYaxis

protected void setYaxis(int i)
set the ordinate (y-) axis to be the given integer, indicating that this axis can be have a length larger than one.
Parameters:
i - index of axis (zero-relative)
Throws:
java.lang.ArrayIndexOutOfBoundsException - if i < 0 or >= the number of axes

getXaxis

public int getXaxis()
return the currently set x axis.

getYaxis

public int getYaxis()
return the currently set ordinate (y) axis.

getExactArea

public double[] getExactArea()
return a two element array giving the area enclosed by this slice

getArea

public int[] getArea()
return a two element array giving the integer size of the area enclosed within the slice plane

getAreaDimension

public java.awt.Dimension getAreaDimension()
return the integer size of the area enclosed within the slice plane as a Dimension object

getSampledAreaDimension

public java.awt.Dimension getSampledAreaDimension()
return the sampled size of the area enclosed within the slice plane as a Dimension object. This returns the width and height in terms of the number of data points sampled, taking into account the sampling.

getAreaOrigin

public int[] getAreaOrigin()
return a two element array giving the x and y positions of this slice

getExactAreaOrigin

public double[] getExactAreaOrigin()
return a two element array giving the x and y positions of this slice

setXaxisOrigin

protected void setXaxisOrigin(double pos)
set the position of the Slice along the x axis

setXaxisOrigin

protected void setXaxisOrigin(int pos)
set the position of the Slice along the x axis

getXaxisOrigin

public int getXaxisOrigin()
set the position of the Slice along the x axis

getExactXaxisOrigin

public double getExactXaxisOrigin()
set the position of the Slice along the x axis

setYaxisOrigin

protected void setYaxisOrigin(double pos)
set the position of the Slice along the y axis

setYaxisOrigin

protected void setYaxisOrigin(int pos)
set the position of the Slice along the y axis

getYaxisOrigin

public int getYaxisOrigin()
get the position of the Slice along the y axis

getExactYaxisOrigin

public double getExactYaxisOrigin()
get the position of the Slice along the y axis

setXaxisLength

protected void setXaxisLength(double pos)
set the length of the Slice along the x axis

setXaxisLength

protected void setXaxisLength(int pos)
set the length of the Slice along the x axis

getXaxisLength

public int getXaxisLength()
set the length of the Slice along the x axis

getExactXaxisLength

public double getExactXaxisLength()
set the length of the Slice along the x axis

setYaxisLength

protected void setYaxisLength(double pos)
set the length of the Slice along the y axis

setYaxisLength

protected void setYaxisLength(int pos)
set the length of the Slice along the y axis

getYaxisLength

public int getYaxisLength()
set the length of the Slice along the y axis

getExactYaxisLength

public double getExactYaxisLength()
set the length of the Slice along the y axis

setXaxisStride

protected void setXaxisStride(double pos)
set the sampling of the Slice along the x axis

setXaxisStride

protected void setXaxisStride(int pos)
set the sampling of the Slice along the x axis

getRoundedXaxisStride

public int getRoundedXaxisStride()
set the sampling of the Slice along the x axis

getXaxisStride

public double getXaxisStride()
set the sampling of the Slice along the x axis

setYaxisStride

protected void setYaxisStride(double pos)
set the sampling of the Slice along the y axis

setYaxisStride

protected void setYaxisStride(int pos)
set the sampling of the Slice along the y axis

getRoundedYaxisStride

public int getRoundedYaxisStride()
set the sampling of the Slice along the y axis

getYaxisStride

public double getYaxisStride()
set the sampling of the Slice along the y axis

sliceProjection

public Slice sliceProjection(Volume vol)
return a Slice that is a projection of a Volume onto the plane of this slice. The sampling and will be that of the input Volume.

voxelProjection

public Voxel voxelProjection(Voxel vox)
return a Voxel that is a projection of a given Voxel onto the plane of this slice. The indexing convention will be that of the input Voxel

clone

public java.lang.Object clone()
Overrides:
clone in class Volume

toString

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

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD