public class GeometryOfSlice
extends java.lang.Object
A class to describe the spatial geometry of a single cross-sectional image slice.
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 int |
C |
protected javax.vecmath.Vector3d |
column |
protected double[] |
columnArray |
protected javax.vecmath.Tuple3d |
dimensions |
protected javax.vecmath.Vector3d |
normal |
protected double[] |
normalArray |
protected int |
R |
protected javax.vecmath.Vector3d |
row |
protected double[] |
rowArray |
protected double |
sliceThickness |
protected javax.vecmath.Point3d |
tlhc |
protected double[] |
tlhcArray |
protected javax.vecmath.Tuple3d |
voxelSpacing |
protected double[] |
voxelSpacingArray |
Constructor and Description |
---|
GeometryOfSlice()
Construct an empty geometry.
|
GeometryOfSlice(double[] rowArray,
double[] columnArray,
double[] tlhcArray,
double[] voxelSpacingArray,
double sliceThickness,
double[] dimensions)
Construct the geometry.
|
GeometryOfSlice(javax.vecmath.Vector3d row,
javax.vecmath.Vector3d column,
javax.vecmath.Point3d tlhc,
javax.vecmath.Tuple3d voxelSpacing,
double sliceThickness,
javax.vecmath.Tuple3d dimensions)
Construct the geometry.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
areSlicesParallel(GeometryOfSlice slice1,
GeometryOfSlice slice2)
Determine if two slices are parallel.
|
protected void |
findMaxComponents() |
javax.vecmath.Vector3d |
getColumn()
Get the column direction.
|
double[] |
getColumnArray()
Get the column direction.
|
java.lang.String |
getColumnOrientation()
Get the letter representation of the orientation of the columns of this slice.
|
java.lang.String |
getColumnOrientation(boolean quadruped)
Get the letter representation of the orientation of the columns of this slice.
|
javax.vecmath.Tuple3d |
getDimensions()
Get the dimensions of the voxel.
|
double |
getDistanceAlongNormalFromOrigin()
Given the present geometry, determine the distance along the normal
to the plane of the slice of the TLHC of the image from the origin of
the coordinate space (0,0,0).
|
double |
getDistanceAlongNormalFromOrigin(javax.vecmath.Point3d point)
Given the present geometry, determine the distance along the normal
to the plane of the slice of an arbitrary point (not necessarily in the plane of the image)
from the origin of
the coordinate space (0,0,0).
|
javax.vecmath.Vector3d |
getNormal()
Get the normal direction.
|
double[] |
getNormalArray()
Get the normal direction.
|
static java.lang.String |
getOrientation(double[] orientation)
Get the letter representation of the orientation of a vector.
|
static java.lang.String |
getOrientation(double[] orientation,
boolean quadruped)
Get the letter representation of the orientation of a vector.
|
javax.vecmath.Vector3d |
getRow()
Get the row direction.
|
double[] |
getRowArray()
Get the row direction.
|
java.lang.String |
getRowOrientation()
Get the letter representation of the orientation of the rows of this slice.
|
java.lang.String |
getRowOrientation(boolean quadruped)
Get the letter representation of the orientation of the rows of this slice.
|
double |
getSliceThickness()
Get the spacing between centers of the voxel in three dimension.
|
javax.vecmath.Point3d |
getTLHC()
Get the position of the top left hand corner.
|
double[] |
getTLHCArray()
Get the position of the top left hand corner.
|
javax.vecmath.Tuple3d |
getVoxelSpacing()
Get the spacing between centers of the voxel in three dimension.
|
double[] |
getVoxelSpacingArray()
Get the spacing between centers of the voxel in three dimension.
|
boolean |
isPointInSlicePlane(double[] location)
Is an arbitrary point in the DICOM 3D coordinate space within the plane of the image.
|
boolean |
isPointInSlicePlane(javax.vecmath.Point3d point)
Is an arbitrary point in the DICOM 3D coordinate space within the plane of the image.
|
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 image coordinates (column and row 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 image coordinates (column and row offset).
|
void |
lookupImageCoordinate(double[] location,
double column,
double row)
Given the present geometry, look up the location of a point specified
in image coordinates (column and row 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)
Given the present geometry, look up the location of a point specified
in image coordinates (column and row offset) and return the x,y and z
coordinates of the point in the DICOM 3D coordinate space.
|
double[] |
lookupImageCoordinate(double column,
double row)
Given the present geometry, look up the location of a point specified
in image coordinates (column and row offset) and return the x,y and z
coordinates of the point in the DICOM 3D coordinate space.
|
double[] |
lookupImageCoordinate(int column,
int row)
Given the present geometry, look up the location of a point specified
in image coordinates (column and row offset) and return the x,y and z
coordinates of the point in the DICOM 3D coordinate space.
|
protected void |
makeNormal() |
java.lang.String |
toString()
Get a human-readable rendering of the geometry.
|
protected int C
protected javax.vecmath.Vector3d column
protected double[] columnArray
protected javax.vecmath.Tuple3d dimensions
protected javax.vecmath.Vector3d normal
protected double[] normalArray
protected int R
protected javax.vecmath.Vector3d row
protected double[] rowArray
protected double sliceThickness
protected javax.vecmath.Point3d tlhc
protected double[] tlhcArray
protected javax.vecmath.Tuple3d voxelSpacing
protected double[] voxelSpacingArray
public GeometryOfSlice()
Construct an empty geometry.
public GeometryOfSlice(double[] rowArray, double[] columnArray, double[] tlhcArray, double[] voxelSpacingArray, double sliceThickness, double[] dimensions)
Construct the geometry.
rowArray
- the direction of the row as X, Y and Z components (direction cosines, unit vector) LPH+columnArray
- the direction of the column as X, Y and Z components (direction cosines, unit vector) LPH+tlhcArray
- the position of the top left hand corner of the slice as a point (X, Y and Z) LPH+voxelSpacingArray
- the row and column spacing and, if a volume, the slice interval (spacing between the centers of parallel slices) in mmsliceThickness
- the slice thickness in mmdimensions
- the row and column dimensions and 1 for the third dimensionpublic GeometryOfSlice(javax.vecmath.Vector3d row, javax.vecmath.Vector3d column, javax.vecmath.Point3d tlhc, javax.vecmath.Tuple3d voxelSpacing, double sliceThickness, javax.vecmath.Tuple3d dimensions)
Construct the geometry.
row
- the direction of the row as X, Y and Z components (direction cosines, unit vector) LPH+column
- the direction of the column as X, Y and Z components (direction cosines, unit vector) LPH+tlhc
- the position of the top left hand corner of the slice as a point (X, Y and Z) LPH+voxelSpacing
- the row and column spacing and, if a volume, the slice interval (spacing between the centers of parallel slices) in mmsliceThickness
- the slice thickness in mmdimensions
- the row and column dimensions and 1 for the third dimensionpublic static final boolean areSlicesParallel(GeometryOfSlice slice1, GeometryOfSlice slice2)
Determine if two slices are parallel.
slice1
- the geometry of one sliceslice2
- the geometry of the other sliceprotected final void findMaxComponents()
public final javax.vecmath.Vector3d getColumn()
Get the column direction.
public final double[] getColumnArray()
Get the column direction.
public final java.lang.String getColumnOrientation()
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.
public final java.lang.String getColumnOrientation(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).
quadruped
- true if subject is a quadruped rather than a bipedpublic final javax.vecmath.Tuple3d getDimensions()
Get the dimensions of the voxel.
public final double getDistanceAlongNormalFromOrigin()
Given the present geometry, determine the distance along the normal to the plane of the slice of the TLHC of the image from the origin of the coordinate space (0,0,0).
public final double getDistanceAlongNormalFromOrigin(javax.vecmath.Point3d point)
Given the present geometry, determine the distance along the normal to the plane of the slice of an arbitrary point (not necessarily in the plane of the image) from the origin of the coordinate space (0,0,0).
point
- the pointpublic final javax.vecmath.Vector3d getNormal()
Get the normal direction.
public final double[] getNormalArray()
Get the normal direction.
public static final java.lang.String getOrientation(double[] orientation)
Get the letter representation of the orientation of a vector.
Assumes a biped rather than a quadruped, so returns L or R, A or P, H or F.
orientation
- the orientationpublic static final java.lang.String getOrientation(double[] orientation, boolean quadruped)
Get the letter representation of the orientation of a vector.
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).
orientation
- the orientationquadruped
- true if subject is a quadruped rather than a bipedpublic final javax.vecmath.Vector3d getRow()
Get the row direction.
public final double[] getRowArray()
Get the row direction.
public final java.lang.String getRowOrientation()
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.
public final java.lang.String getRowOrientation(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).
quadruped
- true if subject is a quadruped rather than a bipedpublic final double getSliceThickness()
Get the spacing between centers of the voxel in three dimension.
public final javax.vecmath.Point3d getTLHC()
Get the position of the top left hand corner.
public final double[] getTLHCArray()
Get the position of the top left hand corner.
public final javax.vecmath.Tuple3d getVoxelSpacing()
Get the spacing between centers of the voxel in three dimension.
public final double[] getVoxelSpacingArray()
Get the spacing between centers of the voxel in three dimension.
public final boolean isPointInSlicePlane(double[] location)
Is an arbitrary point in the DICOM 3D coordinate space within the plane of the image.
Slice thickness is not considered, only floating point rounding precision tolerance is permitted.
location
- the pointpublic final boolean isPointInSlicePlane(javax.vecmath.Point3d point)
Is an arbitrary point in the DICOM 3D coordinate space within the plane of the image.
Slice thickness is not considered, only floating point rounding precision tolerance is permitted.
point
- the pointpublic 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 image coordinates (column and row 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 image coordinates (column and row offset).
offsets
- an array in which to return the column and row offsets from the top left hand corner of the imagelocation
- the x, y and z location in 3D spacepublic final void lookupImageCoordinate(double[] location, double column, double row)
Given the present geometry, look up the location of a point specified in image coordinates (column and row 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 offsetpublic final void lookupImageCoordinate(double[] location, int column, int row)
Given the present geometry, look up the location of a point specified in image coordinates (column and row 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 offsetpublic final double[] lookupImageCoordinate(double column, double row)
Given the present geometry, look up the location of a point specified in image coordinates (column and row 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 offsetpublic final double[] lookupImageCoordinate(int column, int row)
Given the present geometry, look up the location of a point specified in image coordinates (column and row 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 offsetprotected final void makeNormal()
public final java.lang.String toString()
Get a human-readable rendering of the geometry.
toString
in class java.lang.Object