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.Segment

java.lang.Object
  |
  +--ncsa.horizon.util.Volume
        |
        +--ncsa.horizon.util.Segment
Subclasses:
AdjustableSegment

public class Segment
extends Volume
an immutable Volume in which all but one of the sides have unit sampled lengths. This axis is referred to as the "long" axis.

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 Slice.

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
Segment(int nax, int longaxis)
          create a Segment object
Segment(int nax)
          create a Segment object of unit size and nax dimensions; the first axis is assumed to be the long axis.
Segment(Voxel vox, int len, int longaxis)
          create a Segment object located at a given Voxel and of given length.
Segment(Voxel vox, double len, int longaxis)
          create a Segment object located at a given Voxel and of given length.
Segment(Volume vol, int longaxis)
          create a Segment object from a Volume
Segment(Segment seg)
          create a Segment from another Segment.
Segment(Volume vol)
          create a Segment object from a Volume.
 
Method Summary
java.lang.Object clone()
           
double getExactLength()
          get the exact length of the long axis of this Segment.
double getExactLongAxisOrigin()
          set the position of the Segment along the long axis
int getLength()
          get the length of the long axis of this Segment (rounded to the nearest whole position).
int getLongAxisOrigin()
          set the position of the Segment along the long axis
int getLongAxis()
          return the currently set long axis
double getLongAxisStride()
          set the sampling of the Segment along the long axis
int getRoundedLongAxisStride()
          set the sampling of the Segment along the long axis
static boolean isSegment(Volume vol)
          return true if no more than one side have unit length
int laxis()
           
Segment segmentProjection(Volume vol)
          return a Segment that is a projection of a Volume onto the line of this segment.
void setLength(double len)
          set the length of the long axis of this Segment
void setLength(int len)
          set the length of the long axis of this Segment
void setLongAxisOrigin(double pos)
          set the position of the Segment along the x axis
void setLongAxisOrigin(int pos)
          set the position of the Segment along the x axis
void setLongAxis(int i)
          set the long axis to be the given integer, indicating that this axis can be have a length larger than one.
void setLongAxisStride(double pos)
          set the sampling of the Segment along the long axis
void setLongAxisStride(int pos)
          set the sampling of the Segment along the long axis
java.lang.String toString()
           
 
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

Segment

public Segment(int nax,
               int longaxis)
        throws java.lang.ArrayIndexOutOfBoundsException
create a Segment object
Parameters:
nax - number of axes in the space in which it exists
longaxis - axis to be considered the long axis (zero-relative).
Throws:
java.lang.ArrayIndexOutOfBoundsException - thrown if nax < 0 or if longaxis is outside of range [0, nax)

Segment

public Segment(int nax)
create a Segment object of unit size and nax dimensions; the first axis is assumed to be the long axis.
Throws:
java.lang.ArrayIndexOutOfBoundsException - thrown if nax < 0

Segment

public Segment(Voxel vox,
               int len,
               int longaxis)
        throws java.lang.ArrayIndexOutOfBoundsException
create a Segment object located at a given Voxel and of given length.
Parameters:
vox - location of volume vertex closest to origin of space
len - length of Segment along its long axis
Throws:
java.lang.ArrayIndexOutOfBoundsException - thrown if longaxis is outside of range [0, nax)

Segment

public Segment(Voxel vox,
               double len,
               int longaxis)
        throws java.lang.ArrayIndexOutOfBoundsException,
               ValueOutOfBoundsException
create a Segment object located at a given Voxel and of given length.
Parameters:
vox - location of volume vertex closest to origin of space
len - length of Segment along its long axis
Throws:
java.lang.ArrayIndexOutOfBoundsException - thrown if longaxis is outside of range [0, nax)
ValueOutOfBoundsException - if len is out of bounds

Segment

public Segment(Volume vol,
               int longaxis)
        throws java.lang.ArrayIndexOutOfBoundsException
create a Segment object from a Volume
Parameters:
vol - volume to segment
longaxis - axis index of x-axis (zero-relative)
Throws:
java.lang.ArrayIndexOutOfBoundsException - thrown if longaxis

Segment

public Segment(Segment seg)
create a Segment from another Segment. This constructor is helpful for converting mutable Segments (e.g. AdjustableSegment) into an immutable one.
Parameters:
sl - the segment to copy

Segment

public Segment(Volume vol)
create a Segment object from a Volume. The long axis will be set to the volume's first axis having a non-unit sampled length (as in as returned by Volume.getSampledSize(int)). If all axes have unit-length, the first axis will be made the long axis.
Parameters:
vol - the input volume
Method Detail

laxis

protected final int laxis()

isSegment

public static boolean isSegment(Volume vol)
return true if no more than one side have unit length

setLongAxis

protected void setLongAxis(int i)
set the long axis to be the given integer, indicating that this axis can be have a length larger than one.
Parameters:
i - index of axis using the numbering convention defined when this object was created.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if i < 0 or >= the number of axes

getLongAxis

public int getLongAxis()
return the currently set long axis

getLongAxisOrigin

public int getLongAxisOrigin()
set the position of the Segment along the long axis

getExactLongAxisOrigin

public double getExactLongAxisOrigin()
set the position of the Segment along the long axis

setLongAxisOrigin

protected void setLongAxisOrigin(double pos)
set the position of the Segment along the x axis

setLongAxisOrigin

protected void setLongAxisOrigin(int pos)
set the position of the Segment along the x axis

setLength

protected void setLength(double len)
                 throws ValueOutOfBoundsException
set the length of the long axis of this Segment

setLength

protected void setLength(int len)
set the length of the long axis of this Segment

getLength

public int getLength()
get the length of the long axis of this Segment (rounded to the nearest whole position).

getExactLength

public double getExactLength()
get the exact length of the long axis of this Segment.

setLongAxisStride

protected void setLongAxisStride(double pos)
set the sampling of the Segment along the long axis

setLongAxisStride

protected void setLongAxisStride(int pos)
set the sampling of the Segment along the long axis

getRoundedLongAxisStride

public int getRoundedLongAxisStride()
set the sampling of the Segment along the long axis

getLongAxisStride

public double getLongAxisStride()
set the sampling of the Segment along the long axis

segmentProjection

public Segment segmentProjection(Volume vol)
return a Segment that is a projection of a Volume onto the line of this segment. The sampling will be that of this Segment.

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