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

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

public class AdjustableSlice
extends Slice
implements MoveableVolume, SafeAsMetadata
a reshapable Slice.

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

See Also:
Slice, 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
AdjustableSlice(int nax, int xaxis, int yaxis)
          create a Slice object in which all the lengths of all sides have a length of one.
AdjustableSlice(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.
AdjustableSlice(Voxel vox, java.awt.Dimension dim, int xaxis, int yaxis)
          create a Slice object located at a given Voxel and of given dimensions
AdjustableSlice(Volume vol, int xaxis, int yaxis)
          create a Slice object from a Volume
AdjustableSlice(Volume vol)
          create a Slice object from a Volume.
 
Method Summary
int[] getArea()
          return a two element array giving the area enclosed by this slice
int[] getAreaOrigin()
          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[] getExactAreaOrigin()
          return a two element array giving the x and y positions of 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()
          set the position of the Slice along the y axis
java.util.Observable getMonitor()
          return an Observable monitor for listening for changes to this Slice.
int getRoundedXaxisStride()
          set the sampling of the Slice along the x axis
int getRoundedYaxisStride()
          set the sampling of the Slice along the y axis
int getXaxisLength()
          set the length of the Slice along the x axis
int getXaxisOrigin()
          set the position of the Slice along the 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()
          set the position of the Slice along the y axis
double getYaxisStride()
          set the sampling of the Slice along the y axis
boolean isMutable()
          return true if the position of this Voxel can change.
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
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 setXaxisLength(double pos)
          set the position of the Slice along the x axis
void setXaxisLength(int pos)
          set the position 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 setXaxisStride(double pos)
          set the position of the Slice along the x axis
void setXaxisStride(int pos)
          set the position of the Slice along the x 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 setYaxisLength(double pos)
          set the position of the Slice along the y axis
void setYaxisLength(int pos)
          set the position 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 setYaxisStride(double pos)
          set the position of the Slice along the y axis
void setYaxisStride(int pos)
          set the position of the Slice along the y axis
 
Methods inherited from class ncsa.horizon.util.Slice
clone, getAreaDimension, getAreaOrigin, getArea, getExactAreaOrigin, getExactArea, getExactXaxisLength, getExactXaxisOrigin, getExactYaxisLength, getExactYaxisOrigin, getRoundedXaxisStride, getRoundedYaxisStride, getSampledAreaDimension, getXaxisLength, getXaxisOrigin, getXaxis, getXaxisStride, getYaxisLength, getYaxisOrigin, getYaxis, getYaxisStride, isSlice, setXaxisLength, setXaxisLength, setXaxisOrigin, setXaxisOrigin, setXaxis, setXaxisStride, setXaxisStride, setYaxisLength, setYaxisLength, setYaxisOrigin, setYaxisOrigin, setYaxis, setYaxisStride, setYaxisStride, sliceProjection, toString, voxelProjection, xaxis, 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

AdjustableSlice

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

AdjustableSlice

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

AdjustableSlice

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

AdjustableSlice

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

AdjustableSlice

public AdjustableSlice(Volume vol)
create a Slice object from a Volume. The x and y axes will be set to the volume's first two axes having non-unit sampled length (as in as returned by Volume.getSampledSize(int) axes in the volume. If only one axis is non-unit in length, the y axis will be the one after it; if no non-unit axes are found, the first two axes will be made the x and y axes.
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 Slice. Clients interested in such changes can add themselves to the Observable returned by this method. They will be notified when any of the Slice parameters position change, passing this Slice as an argument to the Observers' update() method.
Overrides:
getMonitor in class Volume

setXaxis

public 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
Overrides:
setXaxis in class Slice

setYaxis

public 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
Overrides:
setYaxis in class Slice

setXaxisOrigin

public void setXaxisOrigin(double pos)
set the position of the Slice along the x axis
Overrides:
setXaxisOrigin in class Slice

setYaxisOrigin

public void setYaxisOrigin(double pos)
set the position of the Slice along the y axis
Overrides:
setYaxisOrigin in class Slice

setXaxisOrigin

public void setXaxisOrigin(int pos)
set the position of the Slice along the x axis
Overrides:
setXaxisOrigin in class Slice

setYaxisOrigin

public void setYaxisOrigin(int pos)
set the position of the Slice along the y axis
Overrides:
setYaxisOrigin in class Slice

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

setXaxisLength

public void setXaxisLength(double pos)
set the position of the Slice along the x axis
Overrides:
setXaxisLength in class Slice

setYaxisLength

public void setYaxisLength(double pos)
set the position of the Slice along the y axis
Overrides:
setYaxisLength in class Slice

setXaxisLength

public void setXaxisLength(int pos)
set the position of the Slice along the x axis
Overrides:
setXaxisLength in class Slice

setYaxisLength

public void setYaxisLength(int pos)
set the position of the Slice along the y axis
Overrides:
setYaxisLength in class Slice

setXaxisStride

public void setXaxisStride(double pos)
set the position of the Slice along the x axis
Overrides:
setXaxisStride in class Slice

setYaxisStride

public void setYaxisStride(double pos)
set the position of the Slice along the y axis
Overrides:
setYaxisStride in class Slice

setXaxisStride

public void setXaxisStride(int pos)
set the position of the Slice along the x axis
Overrides:
setXaxisStride in class Slice

setYaxisStride

public void setYaxisStride(int pos)
set the position of the Slice along the y axis
Overrides:
setYaxisStride in class Slice

getExactArea

public final double[] getExactArea()
return a two element array giving the area enclosed by this slice
Overrides:
getExactArea in class Slice

getArea

public final int[] getArea()
return a two element array giving the area enclosed by this slice
Overrides:
getArea in class Slice

getAreaOrigin

public final int[] getAreaOrigin()
return a two element array giving the x and y positions of this slice
Overrides:
getAreaOrigin in class Slice

getExactAreaOrigin

public final double[] getExactAreaOrigin()
return a two element array giving the x and y positions of this slice
Overrides:
getExactAreaOrigin in class Slice

getXaxisOrigin

public final int getXaxisOrigin()
set the position of the Slice along the x axis
Overrides:
getXaxisOrigin in class Slice

getExactXaxisOrigin

public final double getExactXaxisOrigin()
set the position of the Slice along the x axis
Overrides:
getExactXaxisOrigin in class Slice

getYaxisOrigin

public final int getYaxisOrigin()
set the position of the Slice along the y axis
Overrides:
getYaxisOrigin in class Slice

getExactYaxisOrigin

public final double getExactYaxisOrigin()
set the position of the Slice along the y axis
Overrides:
getExactYaxisOrigin in class Slice

getXaxisLength

public final int getXaxisLength()
set the length of the Slice along the x axis
Overrides:
getXaxisLength in class Slice

getExactXaxisLength

public final double getExactXaxisLength()
set the length of the Slice along the x axis
Overrides:
getExactXaxisLength in class Slice

getYaxisLength

public final int getYaxisLength()
set the length of the Slice along the y axis
Overrides:
getYaxisLength in class Slice

getExactYaxisLength

public final double getExactYaxisLength()
set the length of the Slice along the y axis
Overrides:
getExactYaxisLength in class Slice

getRoundedXaxisStride

public final int getRoundedXaxisStride()
set the sampling of the Slice along the x axis
Overrides:
getRoundedXaxisStride in class Slice

getXaxisStride

public final double getXaxisStride()
set the sampling of the Slice along the x axis
Overrides:
getXaxisStride in class Slice

getRoundedYaxisStride

public final int getRoundedYaxisStride()
set the sampling of the Slice along the y axis
Overrides:
getRoundedYaxisStride in class Slice

getYaxisStride

public final double getYaxisStride()
set the sampling of the Slice along the y axis
Overrides:
getYaxisStride in class Slice

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