com.pixelmed.geometry
Class GeometryOfVolume

java.lang.Object
  extended by com.pixelmed.geometry.GeometryOfVolume
Direct Known Subclasses:
GeometryOfVolumeFromAttributeList

public class GeometryOfVolume
extends Object

A class to describe the spatial geometry of an entire volume of contiguous cross-sectional image slices.

The 3D coordinate space used is the DICOM coordinate space, which is LPH+, that is, the x-axis is increasing to the left hand side of the patient, the y-axis is increasing to the posterior side of the patient, and the z-axis is increasing toward the head of the patient.


Field Summary
protected  GeometryOfSlice[] frames
           
protected  boolean isVolume
           
 
Constructor Summary
protected GeometryOfVolume()
           
  GeometryOfVolume(GeometryOfSlice[] frames)
           
 
Method Summary
 void checkAndSetVolumeSampledRegularlyAlongFrameDimension()
          Check if the set of frames regularly sampled along the frame dimension.
 int findClosestSliceInSamePlane(GeometryOfSlice otherSlice)
          Find the slice in the our geometry that is closest to the supplied slice geometry.
 String getColumnOrientation(int frame)
          Get the letter representation of the orientation of the columns of this slice.
 double[] getDistanceAlongNormalFromOrigin()
          Given the present geometry, determine the distances along the normal to the plane of the slices of the TLHC of each slice from the origin of the coordinate space (0,0,0).
 GeometryOfSlice getGeometryOfSlice(int frame)
          Get the geometry of the selected slice.
 GeometryOfSlice[] getGeometryOfSlices()
          Get the geometry of the slices.
 int getNumberOfSlices()
          Get the number of slices.
 String getRowOrientation(int frame)
          Get the letter representation of the orientation of the rows of this slice.
 boolean isVolumeSampledRegularlyAlongFrameDimension()
          Is the set of frames regularly sampled along the frame dimension ?
 double[] lookupImageCoordinate(double[] location)
          Given the present geometry, look up the location of a point specified in x,y and z coordinates of the point in the DICOM 3D coordinate space, and return the volume coordinates (column and row and frame offset).
 void lookupImageCoordinate(double[] offsets, double[] location)
          Given the present geometry, look up the location of a point specified in x,y and z coordinates of the point in the DICOM 3D coordinate space, and return the volume coordinates (column and row and frame offset).
 void lookupImageCoordinate(double[] location, double column, double row, int frame)
          Given the present geometry, look up the location of a point specified in image coordinates (column and row and frame offset) and return the x,y and z coordinates of the point in the DICOM 3D coordinate space.
 void lookupImageCoordinate(double[] location, int column, int row, int frame)
          Given the present geometry, look up the location of a point specified in image coordinates (column and row and frame offset) and return the x,y and z coordinates of the point in the DICOM 3D coordinate space.
 double[] lookupImageCoordinate(double column, double row, int frame)
          Given the present geometry, look up the location of a point specified in image coordinates (column and row and frame offset) and return the x,y and z coordinates of the point in the DICOM 3D coordinate space.
 double[] lookupImageCoordinate(int column, int row, int frame)
          Given the present geometry, look up the location of a point specified in image coordinates (column and row and frame offset) and return the x,y and z coordinates of the point in the DICOM 3D coordinate space.
 String toString()
          Get a human-readable rendering of the geometry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

frames

protected GeometryOfSlice[] frames

isVolume

protected boolean isVolume
Constructor Detail

GeometryOfVolume

protected GeometryOfVolume()

GeometryOfVolume

public GeometryOfVolume(GeometryOfSlice[] frames)
Method Detail

getNumberOfSlices

public final int getNumberOfSlices()

Get the number of slices.

Returns:
the number of slices

getGeometryOfSlices

public final GeometryOfSlice[] getGeometryOfSlices()

Get the geometry of the slices.

Returns:
an array of the geometry of the slices

getGeometryOfSlice

public final GeometryOfSlice getGeometryOfSlice(int frame)

Get the geometry of the selected slice.

Parameters:
frame - the offset along the frames from first frame, zero being no offset
Returns:
the geometry of the selected slice

lookupImageCoordinate

public final double[] lookupImageCoordinate(int column,
                                            int row,
                                            int frame)

Given the present geometry, look up the location of a point specified in image coordinates (column and row and frame offset) and return the x,y and z coordinates of the point in the DICOM 3D coordinate space.

Parameters:
column - the offset along the column from the top left hand corner, zero being no offset
row - the offset along the row from the top left hand corner, zero being no offset
frame - the offset along the frames from first frame, zero being no offset
Returns:
the x, y and z location in 3D space

lookupImageCoordinate

public final void lookupImageCoordinate(double[] location,
                                        int column,
                                        int row,
                                        int frame)

Given the present geometry, look up the location of a point specified in image coordinates (column and row and frame offset) and return the x,y and z coordinates of the point in the DICOM 3D coordinate space.

Parameters:
location - an array in which to return the x, y and z location in 3D space
column - the offset along the column from the top left hand corner, zero being no offset
row - the offset along the row from the top left hand corner, zero being no offset
frame - the offset along the frames from first frame, zero being no offset

lookupImageCoordinate

public final double[] lookupImageCoordinate(double column,
                                            double row,
                                            int frame)

Given the present geometry, look up the location of a point specified in image coordinates (column and row and frame offset) and return the x,y and z coordinates of the point in the DICOM 3D coordinate space.

Parameters:
column - the offset along the column from the top left hand corner, zero being no offset
row - the offset along the row from the top left hand corner, zero being no offset
frame - the offset along the frames from first frame, zero being no offset
Returns:
the x, y and z location in 3D space

lookupImageCoordinate

public final void lookupImageCoordinate(double[] location,
                                        double column,
                                        double row,
                                        int frame)

Given the present geometry, look up the location of a point specified in image coordinates (column and row and frame offset) and return the x,y and z coordinates of the point in the DICOM 3D coordinate space.

Parameters:
location - an array in which to return the x, y and z location in 3D space
column - the offset along the column from the top left hand corner, zero being no offset
row - the offset along the row from the top left hand corner, zero being no offset
frame - the offset along the frames from first frame, zero being no offset

lookupImageCoordinate

public final double[] lookupImageCoordinate(double[] location)

Given the present geometry, look up the location of a point specified in x,y and z coordinates of the point in the DICOM 3D coordinate space, and return the volume coordinates (column and row and frame offset).

Parameters:
location - the x, y and z location in 3D space
Returns:
the column and row and frame offsets from the top left hand corner of the volume

lookupImageCoordinate

public final void lookupImageCoordinate(double[] offsets,
                                        double[] location)

Given the present geometry, look up the location of a point specified in x,y and z coordinates of the point in the DICOM 3D coordinate space, and return the volume coordinates (column and row and frame offset).

Parameters:
offsets - an array in which to return the column and row and frame offsets from the top left hand corner of the volume
location - the x, y and z location in 3D space

findClosestSliceInSamePlane

public final int findClosestSliceInSamePlane(GeometryOfSlice otherSlice)

Find the slice in the our geometry that is closest to the supplied slice geometry.

Specifically, the shortest distance along the normal to the plane of the common orientation is chosen.

Parameters:
otherSlice - the geometry of the slice to match
Returns:
the index of the closest frame in this volume (numbered from 0), or -1 if something goes wrong

getDistanceAlongNormalFromOrigin

public final double[] getDistanceAlongNormalFromOrigin()

Given the present geometry, determine the distances along the normal to the plane of the slices of the TLHC of each slice from the origin of the coordinate space (0,0,0).

Returns:
an array of the distances of the TLHCs from the origin along the normal axis

isVolumeSampledRegularlyAlongFrameDimension

public final boolean isVolumeSampledRegularlyAlongFrameDimension()

Is the set of frames regularly sampled along the frame dimension ?

Returns:
true if same spacing between centers of frames and position monotonically increasing

checkAndSetVolumeSampledRegularlyAlongFrameDimension

public final void checkAndSetVolumeSampledRegularlyAlongFrameDimension()

Check if the set of frames regularly sampled along the frame dimension.

Method is public only to make it accessible from constructors in other packages.


toString

public final String toString()

Get a human-readable rendering of the geometry.

Overrides:
toString in class Object
Returns:
the string rendering of the geometry

getRowOrientation

public final String getRowOrientation(int frame)

Get the letter representation of the orientation of the rows of this slice.

Parameters:
frame - the offset along the frames from first frame, zero being no offset
Returns:
a string rendering of the row orientation, L or R, A or P, H or F, more than one letter if oblique to the orthogonal axes, or empty string (not null) if fails

getColumnOrientation

public final String getColumnOrientation(int frame)

Get the letter representation of the orientation of the columns of this slice.

Parameters:
frame - the offset along the frames from first frame, zero being no offset
Returns:
a string rendering of the column orientation, L or R, A or P, H or F, more than one letter if oblique to the orthogonal axes, or empty string (not null) if fails