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

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

public class AdjustableSegment
extends Segment
implements MoveableVolume, SafeAsMetadata
a reshapable Segment.

This class provides methods for changing a segment's position, size, and sampling. Only the number of axes in the space in which this Segment lives is immutable, being set at construction.

See Also:
Segment, Volume, 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
AdjustableSegment(int nax, int laxis)
          create a Segment object in which all the lengths of all sides have a length of one.
AdjustableSegment(int nax)
          create a Segment object of unit size and nax dimensions; the first two axes are assumed to be the ones defining the segment plane.
AdjustableSegment(Voxel vox, int len, int longaxis)
          create a Segment object located at a given Voxel and of given length.
AdjustableSegment(Voxel vox, double len, int longaxis)
          create a Segment object located at a given Voxel and of given length.
AdjustableSegment(Volume vol, int longaxis)
          create a Segment object from a Volume
AdjustableSegment(Volume vol)
          create a Segment object from a Volume.
 
Method Summary
double getExactLength()
          set the length of the Segment along the long axis
double getExactLongAxisOrigin()
          set the position of the Segment along the long axis
int getLength()
          set the length of the Segment along the long axis
int getLongAxisOrigin()
          set the position of the Segment along the long axis
double getLongAxisStride()
          set the sampling of the Segment along the long axis
java.util.Observable getMonitor()
          return an Observable monitor for listening for changes to this Segment.
int getRoundedLongAxisStride()
          set the sampling of the Segment along the long axis
boolean isMutable()
          return true if the position of this Voxel can change.
void setLength(double pos)
          set the position of the Segment along the long axis
void setLength(int pos)
          set the position of the Segment along the long 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 setLongAxisOrigin(double pos)
          set the position of the Segment along the long axis
void setLongAxisOrigin(int pos)
          set the position of the Segment along the long axis
void setLongAxisStride(double pos)
          set the position of the Segment along the long axis
void setLongAxisStride(int pos)
          set the position of the Segment along the long axis
void setOrigin(int[] pos)
          set the origin of this Volume to a position given by an array of integers.
void setOrigin(int idx, int pos)
          set one component of the origin of this Volume to a given position along a given axis
void setOrigin(double[] pos)
          set the origin of this Volume to a fractional position given by an array of integers.
void setOrigin(int idx, double pos)
          set one component of the origin of this Volume to a given position along a given axis
void setOrigin(Voxel vox)
          set the origin of this volume to the position of a given Voxel
 
Methods inherited from class ncsa.horizon.util.Segment
clone, getExactLength, getExactLongAxisOrigin, getLength, getLongAxisOrigin, getLongAxis, getLongAxisStride, getRoundedLongAxisStride, isSegment, laxis, segmentProjection, setLength, setLength, setLongAxisOrigin, setLongAxisOrigin, setLongAxis, setLongAxisStride, setLongAxisStride, 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

AdjustableSegment

public AdjustableSegment(int nax,
                         int laxis)
                  throws java.lang.ArrayIndexOutOfBoundsException
create a Segment 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
laxis - axis to be considered the long axis (zero-relative).
Throws:
java.lang.ArrayIndexOutOfBoundsException - thrown if nax < 0 or if xaxis or yaxis is outside of range [0, nax)

AdjustableSegment

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

AdjustableSegment

public AdjustableSegment(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)

AdjustableSegment

public AdjustableSegment(Voxel vox,
                         double 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)

AdjustableSegment

public AdjustableSegment(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

AdjustableSegment

public AdjustableSegment(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

isMutable

public boolean isMutable()
return true if the position of this Voxel can change. This implementation always returns true.
Overrides:
isMutable in class Volume

getMonitor

public java.util.Observable getMonitor()
return an Observable monitor for listening for changes to this Segment. Clients interested in such changes can add themselves to the Observable returned by this method. They will be notified when any of the Segment parameters position change, passing this Segment as an argument to the Observers' update() method.
Overrides:
getMonitor in class Volume

setLongAxis

public 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
Overrides:
setLongAxis in class Segment

setLongAxisOrigin

public void setLongAxisOrigin(double pos)
set the position of the Segment along the long axis
Overrides:
setLongAxisOrigin in class Segment

setLongAxisOrigin

public void setLongAxisOrigin(int pos)
set the position of the Segment along the long axis
Overrides:
setLongAxisOrigin in class Segment

setOrigin

public void setOrigin(int[] pos)
set the origin of this Volume to a position given by an array of integers.
Specified by:
setOrigin in interface MoveableVolume

setOrigin

public void setOrigin(int idx,
                      int pos)
set one component of the origin of this Volume to a given position along a given axis
Specified by:
setOrigin in interface MoveableVolume

setOrigin

public void setOrigin(double[] pos)
              throws PositionOutOfBoundsException
set the origin of this Volume to a fractional position given by an array of integers.
Specified by:
setOrigin in interface MoveableVolume
Throws:
PositionOutOfRangeException - if the position is out of range

setOrigin

public void setOrigin(int idx,
                      double pos)
              throws PositionOutOfBoundsException
set one component of the origin of this Volume to a given position along a given axis
Specified by:
setOrigin in interface MoveableVolume
Throws:
PositionOutOfRangeException - if the position is out of range

setOrigin

public void setOrigin(Voxel vox)
set the origin of this volume to the position of a given Voxel
Specified by:
setOrigin in interface MoveableVolume

setLength

public void setLength(double pos)
set the position of the Segment along the long axis
Overrides:
setLength in class Segment

setLength

public void setLength(int pos)
set the position of the Segment along the long axis
Overrides:
setLength in class Segment

setLongAxisStride

public void setLongAxisStride(double pos)
set the position of the Segment along the long axis
Overrides:
setLongAxisStride in class Segment

setLongAxisStride

public void setLongAxisStride(int pos)
set the position of the Segment along the long axis
Overrides:
setLongAxisStride in class Segment

getLongAxisOrigin

public final int getLongAxisOrigin()
set the position of the Segment along the long axis
Overrides:
getLongAxisOrigin in class Segment

getExactLongAxisOrigin

public final double getExactLongAxisOrigin()
set the position of the Segment along the long axis
Overrides:
getExactLongAxisOrigin in class Segment

getLength

public final int getLength()
set the length of the Segment along the long axis
Overrides:
getLength in class Segment

getExactLength

public final double getExactLength()
set the length of the Segment along the long axis
Overrides:
getExactLength in class Segment

getRoundedLongAxisStride

public final int getRoundedLongAxisStride()
set the sampling of the Segment along the long axis
Overrides:
getRoundedLongAxisStride in class Segment

getLongAxisStride

public final double getLongAxisStride()
set the sampling of the Segment along the long axis
Overrides:
getLongAxisStride in class Segment

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