public class GeometryOfVolume
extends java.lang.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.
Modifier and Type | Field and Description |
---|---|
protected boolean |
areParallel |
protected int |
C |
protected GeometryOfSlice[] |
frames |
protected boolean |
isVolume |
protected int |
N |
protected int |
R |
Modifier | Constructor and Description |
---|---|
protected |
GeometryOfVolume() |
|
GeometryOfVolume(GeometryOfSlice[] frames) |
Modifier and Type | Method and Description |
---|---|
boolean |
areAllSlicesParallel()
Are all the frames in the set of frames parallel ?
|
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.
|
protected void |
findMaxComponents(double[] rowArray,
double[] columnArray,
double[] normalArray) |
java.lang.String |
getColumnOrientation(int frame)
Get the letter representation of the orientation of the columns of this slice.
|
java.lang.String |
getColumnOrientation(int frame,
boolean quadruped)
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.
|
java.lang.String |
getRowOrientation(int frame)
Get the letter representation of the orientation of the rows of this slice.
|
java.lang.String |
getRowOrientation(int frame,
boolean quadruped)
Get the letter representation of the orientation of the rows of this slice.
|
boolean |
hasFrameInformation()
Is the geometry of each frame available?
|
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.
|
java.lang.String |
toString()
Get a human-readable rendering of the geometry.
|
protected boolean areParallel
protected int C
protected GeometryOfSlice[] frames
protected boolean isVolume
protected int N
protected int R
protected GeometryOfVolume()
public GeometryOfVolume(GeometryOfSlice[] frames)
public final boolean areAllSlicesParallel()
Are all the frames in the set of frames parallel ?
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.
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.
otherSlice
- the geometry of the slice to matchprotected final void findMaxComponents(double[] rowArray, double[] columnArray, double[] normalArray)
public final java.lang.String getColumnOrientation(int frame)
Get the letter representation of the orientation of the columns of this slice.
Assumes a biped rather than a quadruped, so returns L or R, A or P, H or F.
frame
- the offset along the frames from first frame, zero being no offsetpublic final java.lang.String getColumnOrientation(int frame, boolean quadruped)
Get the letter representation of the orientation of the columns of this slice.
For bipeds, L or R, A or P, H or F.
For quadrupeds, Le or Rt, V or D, Cr or Cd (with lower case; use toUpperCase() to produce valid CodeString for PatientOrientation).
frame
- the offset along the frames from first frame, zero being no offsetquadruped
- true if subject is a quadruped rather than a bipedpublic 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).
public final GeometryOfSlice getGeometryOfSlice(int frame)
Get the geometry of the selected slice.
frame
- the offset along the frames from first frame, zero being no offsetpublic final GeometryOfSlice[] getGeometryOfSlices()
Get the geometry of the slices.
public final int getNumberOfSlices()
Get the number of slices.
public final java.lang.String getRowOrientation(int frame)
Get the letter representation of the orientation of the rows of this slice.
Assumes a biped rather than a quadruped, so returns L or R, A or P, H or F.
frame
- the offset along the frames from first frame, zero being no offsetpublic final java.lang.String getRowOrientation(int frame, boolean quadruped)
Get the letter representation of the orientation of the rows of this slice.
For bipeds, L or R, A or P, H or F.
For quadrupeds, Le or Rt, V or D, Cr or Cd (with lower case; use toUpperCase() to produce valid CodeString for PatientOrientation).
frame
- the offset along the frames from first frame, zero being no offsetquadruped
- true if subject is a quadruped rather than a bipedpublic final boolean hasFrameInformation()
Is the geometry of each frame available?
public final boolean isVolumeSampledRegularlyAlongFrameDimension()
Is the set of frames regularly sampled along the frame dimension?
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).
location
- the x, y and z location in 3D spacepublic 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).
offsets
- an array in which to return the column and row and frame offsets from the top left hand corner of the volume (or NaN if not a regularly sampled volume)location
- the x, y and z location in 3D spacepublic 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.
location
- an array in which to return the x, y and z location in 3D spacecolumn
- the offset along the column from the top left hand corner, zero being no offsetrow
- the offset along the row from the top left hand corner, zero being no offsetframe
- the offset along the frames from first frame, zero being no offsetpublic 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.
location
- an array in which to return the x, y and z location in 3D spacecolumn
- the offset along the column from the top left hand corner, zero being no offsetrow
- the offset along the row from the top left hand corner, zero being no offsetframe
- the offset along the frames from first frame, zero being no offsetpublic 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.
column
- the offset along the column from the top left hand corner, zero being no offsetrow
- the offset along the row from the top left hand corner, zero being no offsetframe
- the offset along the frames from first frame, zero being no offsetpublic 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.
column
- the offset along the column from the top left hand corner, zero being no offsetrow
- the offset along the row from the top left hand corner, zero being no offsetframe
- the offset along the frames from first frame, zero being no offsetpublic final java.lang.String toString()
Get a human-readable rendering of the geometry.
toString
in class java.lang.Object