Class GeometryOfSlice
- Direct Known Subclasses:
GeometryOfSliceFromAttributeList
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected javax.vecmath.Vector3d
protected double[]
protected javax.vecmath.Tuple3d
protected javax.vecmath.Vector3d
protected double[]
protected int
protected javax.vecmath.Vector3d
protected double[]
protected double
protected javax.vecmath.Point3d
protected double[]
protected javax.vecmath.Tuple3d
protected double[]
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct 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. -
Method Summary
Modifier and TypeMethodDescriptionstatic final boolean
areSlicesParallel
(GeometryOfSlice slice1, GeometryOfSlice slice2) Determine if two slices are parallel.protected final void
final javax.vecmath.Vector3d
Get the column direction.final double[]
Get the column direction.final String
Get the letter representation of the orientation of the columns of this slice.final String
getColumnOrientation
(boolean quadruped) Get the letter representation of the orientation of the columns of this slice.final javax.vecmath.Tuple3d
Get the dimensions of the voxel.final double
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).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).final javax.vecmath.Vector3d
Get the normal direction.final double[]
Get the normal direction.static final String
getOrientation
(double[] orientation) Get the letter representation of the orientation of a vector.static final String
getOrientation
(double[] orientation, boolean quadruped) Get the letter representation of the orientation of a vector.final javax.vecmath.Vector3d
getRow()
Get the row direction.final double[]
Get the row direction.final String
Get the letter representation of the orientation of the rows of this slice.final String
getRowOrientation
(boolean quadruped) Get the letter representation of the orientation of the rows of this slice.final double
Get the spacing between centers of the voxel in three dimension.final javax.vecmath.Point3d
getTLHC()
Get the position of the top left hand corner.final double[]
Get the position of the top left hand corner.final javax.vecmath.Tuple3d
Get the spacing between centers of the voxel in three dimension.final double[]
Get the spacing between centers of the voxel in three dimension.final boolean
isPointInSlicePlane
(double[] location) Is an arbitrary point in the DICOM 3D coordinate space within the plane of the image.final boolean
isPointInSlicePlane
(javax.vecmath.Point3d point) Is an arbitrary point in the DICOM 3D coordinate space within the plane of the image.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).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).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.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.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.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.protected final void
final String
toString()
Get a human-readable rendering of the geometry.
-
Field Details
-
rowArray
protected double[] rowArray -
row
protected javax.vecmath.Vector3d row -
columnArray
protected double[] columnArray -
column
protected javax.vecmath.Vector3d column -
tlhc
protected javax.vecmath.Point3d tlhc -
tlhcArray
protected double[] tlhcArray -
voxelSpacing
protected javax.vecmath.Tuple3d voxelSpacing -
voxelSpacingArray
protected double[] voxelSpacingArray -
sliceThickness
protected double sliceThickness -
dimensions
protected javax.vecmath.Tuple3d dimensions -
normal
protected javax.vecmath.Vector3d normal -
normalArray
protected double[] normalArray -
R
protected int R -
C
protected int C
-
-
Constructor Details
-
GeometryOfSlice
public GeometryOfSlice()Construct an empty geometry.
-
GeometryOfSlice
public 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.
- Parameters:
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 dimension
-
GeometryOfSlice
public GeometryOfSlice(double[] rowArray, double[] columnArray, double[] tlhcArray, double[] voxelSpacingArray, double sliceThickness, double[] dimensions) Construct the geometry.
- Parameters:
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 dimension
-
-
Method Details
-
makeNormal
protected final void makeNormal() -
getRow
public final javax.vecmath.Vector3d getRow()Get the row direction.
- Returns:
- the direction of the row as X, Y and Z components (direction cosines, unit vector) LPH+
-
getRowArray
public final double[] getRowArray()Get the row direction.
- Returns:
- the direction of the row as X, Y and Z components (direction cosines, unit vector) LPH+
-
getColumn
public final javax.vecmath.Vector3d getColumn()Get the column direction.
- Returns:
- the direction of the column as X, Y and Z components (direction cosines, unit vector) LPH+
-
getColumnArray
public final double[] getColumnArray()Get the column direction.
- Returns:
- the direction of the column as X, Y and Z components (direction cosines, unit vector) LPH+
-
getNormal
public final javax.vecmath.Vector3d getNormal()Get the normal direction.
- Returns:
- the direction of the normal to the plane of the slices, as X, Y and Z components (direction cosines, unit vector) LPH+
-
getNormalArray
public final double[] getNormalArray()Get the normal direction.
- Returns:
- the direction of the normal to the plane of the slices, as X, Y and Z components (direction cosines, unit vector) LPH+
-
getTLHC
public final javax.vecmath.Point3d getTLHC()Get the position of the top left hand corner.
- Returns:
- the position of the top left hand corner of the slice as a point (X, Y and Z) LPH+
-
getTLHCArray
public final double[] getTLHCArray()Get the position of the top left hand corner.
- Returns:
- the position of the top left hand corner of the slice as a point (X, Y and Z) LPH+
-
getVoxelSpacing
public final javax.vecmath.Tuple3d getVoxelSpacing()Get the spacing between centers of the voxel in three dimension.
- Returns:
- the row and column spacing and, if a volume, the slice interval (spacing between the centers of parallel slices) in mm
-
getVoxelSpacingArray
public final double[] getVoxelSpacingArray()Get the spacing between centers of the voxel in three dimension.
- Returns:
- the row and column spacing and, if a volume, the slice interval (spacing between the centers of parallel slices) in mm
-
getSliceThickness
public final double getSliceThickness()Get the spacing between centers of the voxel in three dimension.
- Returns:
- the slice thickness in mm
-
getDimensions
public final javax.vecmath.Tuple3d getDimensions()Get the dimensions of the voxel.
- Returns:
- the row and column dimensions and 1 for the third dimension
-
lookupImageCoordinate
public 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.
- Parameters:
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 offset- Returns:
- the x, y and z location in 3D space
-
lookupImageCoordinate
public 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.
- Parameters:
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 offset
-
lookupImageCoordinate
public 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.
- Parameters:
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 offset- Returns:
- the x, y and z location in 3D space
-
lookupImageCoordinate
public 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.
- Parameters:
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 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 image coordinates (column and row offset).
- Parameters:
location
- the x, y and z location in 3D space- Returns:
- the column and row offsets from the top left hand corner of the image
-
findMaxComponents
protected final void findMaxComponents() -
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 image coordinates (column and row offset).
- Parameters:
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 space
-
getDistanceAlongNormalFromOrigin
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).
- Parameters:
point
- the point- Returns:
- the distance of the point from the origin along the normal axis
-
getDistanceAlongNormalFromOrigin
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).
- Returns:
- the distance of the TLHC from the origin along the normal axis
-
isPointInSlicePlane
public 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.
- Parameters:
point
- the point- Returns:
- true if within the plane of the image
-
isPointInSlicePlane
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.
- Parameters:
location
- the point- Returns:
- true if within the plane of the image
-
areSlicesParallel
Determine if two slices are parallel.
- Parameters:
slice1
- the geometry of one sliceslice2
- the geometry of the other slice- Returns:
- true if slices are parallel
-
toString
Get a human-readable rendering of the geometry.
-
getOrientation
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).
- Parameters:
orientation
- the orientationquadruped
- true if subject is a quadruped rather than a biped- Returns:
- a string rendering of the orientation, more than one letter if oblique to the orthogonal axes, or empty string (not null) if fails
-
getOrientation
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.
- Parameters:
orientation
- the orientation- Returns:
- a string rendering of the orientation, more than one letter if oblique to the orthogonal axes, or empty string (not null) if fails
-
getRowOrientation
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).
- Parameters:
quadruped
- true if subject is a quadruped rather than a biped- Returns:
- a string rendering of the row orientation, more than one letter if oblique to the orthogonal axes, or empty string (not null) if fails
-
getColumnOrientation
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).
- Parameters:
quadruped
- true if subject is a quadruped rather than a biped- Returns:
- a string rendering of the column orientation, more than one letter if oblique to the orthogonal axes, or empty string (not null) if fails
-
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.
- Returns:
- a string rendering of the row orientation, more than one letter if oblique to the orthogonal axes, or empty string (not null) if fails
-
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.
- Returns:
- a string rendering of the column orientation, more than one letter if oblique to the orthogonal axes, or empty string (not null) if fails
-