public abstract class LocalizerPoster
extends java.lang.Object
An abstract class that provides the basis for posting the position of specified slices and volumes on (usually orthogonal) localizer images.
This base class provides the interface, common storage and various utility methods, and specific methods of performing the localization operation are performed by concrete sub-classes, instantiated through a factory class.
Typically this would b used as follows, to get outlines in the form of a vector of shapes whose coordinates are those of the localizer image:
GeometryOfSlice localizerGeometry = new GeometryOfSliceFromAttributeList(localizerAttributeList); GeometryOfSlice postImageGeometry = new GeometryOfSliceFromAttributeList(postImageAttributeList); LocalizerPoster localizerPoster = LocalizerPosterFactory.getLocalizerPoster(false,false); localizerPoster.setLocalizerGeometry(localizerGeometry); Vector shapes = localizerPoster.getOutlineOnLocalizerForThisGeometry(postImageGeometry);
Modifier and Type | Field and Description |
---|---|
protected javax.vecmath.Vector3d |
localizerColumn |
protected javax.vecmath.Tuple3d |
localizerDimensions |
protected double[] |
localizerDimensionsArray |
protected javax.vecmath.Vector3d |
localizerNormal |
protected javax.vecmath.Vector3d |
localizerRow |
protected javax.vecmath.Point3d |
localizerTLHC |
protected javax.vecmath.Tuple3d |
localizerVoxelSpacing |
protected double[] |
localizerVoxelSpacingArray |
protected javax.vecmath.Matrix3d |
rotateIntoLocalizerSpace |
Modifier and Type | Method and Description |
---|---|
protected static boolean |
classifyCornersIntoEdgeCrossingZPlane(javax.vecmath.Point3d startCorner,
javax.vecmath.Point3d endCorner) |
protected void |
doCommonConstructorStuff() |
protected java.util.Vector |
drawLinesBetweenAnyPointsWhichIntersectPlaneWhereZIsZero(javax.vecmath.Point3d[] corners) |
protected java.util.Vector |
drawOutlineOnLocalizer(javax.vecmath.Point3d[] corners) |
protected java.util.Vector |
drawOutlineOnLocalizer(java.util.Vector corners) |
static java.awt.Rectangle |
getBoundsOfContainedRectangle(javax.vecmath.Point3d[] containedRectangle,
javax.vecmath.Point3d[] wholeRectangle,
java.awt.Rectangle boundsOfWholeRectangle) |
static javax.vecmath.Point3d[] |
getCornersOfSourceCubeInSourceSpace(javax.vecmath.Vector3d row,
javax.vecmath.Vector3d column,
javax.vecmath.Point3d originalTLHC,
javax.vecmath.Tuple3d voxelSpacing,
double sliceThickness,
javax.vecmath.Tuple3d dimensions)
Get the corners of a volume in the 3D coordinate space of that volume.
|
static javax.vecmath.Point3d[] |
getCornersOfSourceRectangleInSourceSpace(GeometryOfSlice g)
Get the corners of a slice in the 3D coordinate space of that slice.
|
static javax.vecmath.Point3d[] |
getCornersOfSourceRectangleInSourceSpace(javax.vecmath.Vector3d row,
javax.vecmath.Vector3d column,
javax.vecmath.Point3d originalTLHC,
javax.vecmath.Tuple3d voxelSpacing,
javax.vecmath.Tuple3d dimensions)
Get the corners of a slice in the 3D coordinate space of that slice.
|
static javax.vecmath.Point3d[] |
getIntersectionOfRectanglesInXYPlane(javax.vecmath.Point3d[] rect1,
javax.vecmath.Point3d[] rect2) |
protected java.util.Vector |
getIntersectionsOfCubeWithZPlane(javax.vecmath.Point3d[] corners) |
java.util.Vector |
getOutlineOnLocalizerForThisGeometry(GeometryOfSlice geometry)
Get the shape on the localizer of a zero-thickness slice specified by the geometry of a 2D rectangle.
|
abstract java.util.Vector |
getOutlineOnLocalizerForThisGeometry(javax.vecmath.Vector3d row,
javax.vecmath.Vector3d column,
javax.vecmath.Point3d tlhc,
javax.vecmath.Tuple3d voxelSpacing,
double sliceThickness,
javax.vecmath.Tuple3d dimensions)
Get the shapes on the localizer of the specified slice.
|
java.util.Vector |
getOutlineOnLocalizerForThisVolumeLocalization(SpectroscopyVolumeLocalization spectroscopyVolumeLocalization)
Get the shape on the localizer of one or more volume localization slabs.
|
protected javax.vecmath.Point3d |
intersectLineBetweenTwoPointsWithPlaneWhereZIsZero(double[] a,
double[] b) |
protected javax.vecmath.Point3d |
intersectLineBetweenTwoPointsWithPlaneWhereZIsZero(javax.vecmath.Point3d aP,
javax.vecmath.Point3d bP) |
void |
setLocalizerGeometry(GeometryOfSlice geometry)
Established the geometry of the localizer image to be posted.
|
void |
setLocalizerGeometry(javax.vecmath.Vector3d row,
javax.vecmath.Vector3d column,
javax.vecmath.Point3d tlhc,
javax.vecmath.Tuple3d voxelSpacing,
javax.vecmath.Tuple3d dimensions)
Established the geometry of the localizer image to be posted.
|
protected javax.vecmath.Point3d |
transformPointFromSourceSpaceIntoLocalizerSpace(javax.vecmath.Point3d point)
Transform a point into the "viewport" defined by the localizer that we are an instance of.
|
static javax.vecmath.Point3d |
transformPointFromSourceSpaceIntoSpecifiedSpace(javax.vecmath.Point3d point,
javax.vecmath.Point3d tlhc,
javax.vecmath.Vector3d row,
javax.vecmath.Vector3d column)
Transform a point into the "viewport" defined by an origin and row and column vectors
in the same 3D space, by shifting the points to the origin (TLHC) and rotating.
|
protected java.awt.geom.Point2D.Double |
transformPointInLocalizerPlaneIntoImageSpace(javax.vecmath.Point3d point)
Project a point in localizer 3D space onto the plane of the localizer by ignoring
the Z component, and return the X and Y coordinates as image-TLHC relative
column and row offsets.
|
static javax.vecmath.Point3d[] |
transformPointsFromSourceSpaceIntoSpecifiedSpace(javax.vecmath.Point3d[] points,
javax.vecmath.Point3d tlhc,
javax.vecmath.Vector3d row,
javax.vecmath.Vector3d column)
Transform a set of points into the "viewport" defined by an origin and row and column vectors
in the same 3D space, by shifting the points to the origin (TLHC) and rotating.
|
static void |
validateDirectionCosines(javax.vecmath.Vector3d row,
javax.vecmath.Vector3d column)
Check that the row and column vectors are unit vectors and are orthogonal.
|
static void |
validateDirectionCosines(javax.vecmath.Vector3d row,
javax.vecmath.Vector3d column,
javax.vecmath.Vector3d normal)
Check that the row and column and slice direction vectors are unit vectors and are orthogonal.
|
protected javax.vecmath.Vector3d localizerColumn
protected javax.vecmath.Tuple3d localizerDimensions
protected double[] localizerDimensionsArray
protected javax.vecmath.Vector3d localizerNormal
protected javax.vecmath.Vector3d localizerRow
protected javax.vecmath.Point3d localizerTLHC
protected javax.vecmath.Tuple3d localizerVoxelSpacing
protected double[] localizerVoxelSpacingArray
protected javax.vecmath.Matrix3d rotateIntoLocalizerSpace
protected static boolean classifyCornersIntoEdgeCrossingZPlane(javax.vecmath.Point3d startCorner, javax.vecmath.Point3d endCorner)
protected void doCommonConstructorStuff()
protected java.util.Vector drawLinesBetweenAnyPointsWhichIntersectPlaneWhereZIsZero(javax.vecmath.Point3d[] corners)
protected java.util.Vector drawOutlineOnLocalizer(javax.vecmath.Point3d[] corners)
protected java.util.Vector drawOutlineOnLocalizer(java.util.Vector corners)
public static java.awt.Rectangle getBoundsOfContainedRectangle(javax.vecmath.Point3d[] containedRectangle, javax.vecmath.Point3d[] wholeRectangle, java.awt.Rectangle boundsOfWholeRectangle)
public static javax.vecmath.Point3d[] getCornersOfSourceCubeInSourceSpace(javax.vecmath.Vector3d row, javax.vecmath.Vector3d column, javax.vecmath.Point3d originalTLHC, javax.vecmath.Tuple3d voxelSpacing, double sliceThickness, javax.vecmath.Tuple3d dimensions)
Get the corners of a volume in the 3D coordinate space of that volume.
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+originalTLHC
- 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 the slice intervalsliceThickness
- the slice thicknessdimensions
- the row and column dimensions and number of frames for the third dimensionpublic static javax.vecmath.Point3d[] getCornersOfSourceRectangleInSourceSpace(GeometryOfSlice g)
Get the corners of a slice in the 3D coordinate space of that slice.
g
- the geometry of a slicepublic static javax.vecmath.Point3d[] getCornersOfSourceRectangleInSourceSpace(javax.vecmath.Vector3d row, javax.vecmath.Vector3d column, javax.vecmath.Point3d originalTLHC, javax.vecmath.Tuple3d voxelSpacing, javax.vecmath.Tuple3d dimensions)
Get the corners of a slice in the 3D coordinate space of that slice.
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+originalTLHC
- 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 the slice intervaldimensions
- the row and column dimensions and 1 for the third dimensionpublic static javax.vecmath.Point3d[] getIntersectionOfRectanglesInXYPlane(javax.vecmath.Point3d[] rect1, javax.vecmath.Point3d[] rect2)
protected java.util.Vector getIntersectionsOfCubeWithZPlane(javax.vecmath.Point3d[] corners)
public final java.util.Vector getOutlineOnLocalizerForThisGeometry(GeometryOfSlice geometry)
Get the shape on the localizer of a zero-thickness slice specified by the geometry of a 2D rectangle.
geometry
- java.awt.Shape
to be drawn in the localizer row and column coordinatespublic abstract java.util.Vector getOutlineOnLocalizerForThisGeometry(javax.vecmath.Vector3d row, javax.vecmath.Vector3d column, javax.vecmath.Point3d tlhc, javax.vecmath.Tuple3d voxelSpacing, double sliceThickness, javax.vecmath.Tuple3d dimensions)
Get the shapes on the localizer of the specified slice.
row
- the unit vector (direction cosine) of the row direction in the DICOM coordinate systemcolumn
- the unit vector (direction cosine) of the row direction in the DICOM coordinate systemtlhc
- the position in the DICOM coordinate system of the center of the top left hand corner pixel of the slicevoxelSpacing
- the row and column and slice interval in mmsliceThickness
- the slice thickness in mmdimensions
- the number of rows and columns and slicesjava.awt.Shape
to be drawn in the localizer row and column coordinatespublic final java.util.Vector getOutlineOnLocalizerForThisVolumeLocalization(SpectroscopyVolumeLocalization spectroscopyVolumeLocalization)
Get the shape on the localizer of one or more volume localization slabs.
spectroscopyVolumeLocalization
- java.awt.Shape
to be drawn in the localizer row and column coordinatesprotected javax.vecmath.Point3d intersectLineBetweenTwoPointsWithPlaneWhereZIsZero(double[] a, double[] b)
protected javax.vecmath.Point3d intersectLineBetweenTwoPointsWithPlaneWhereZIsZero(javax.vecmath.Point3d aP, javax.vecmath.Point3d bP)
public void setLocalizerGeometry(GeometryOfSlice geometry)
Established the geometry of the localizer image to be posted.
geometry
- public void setLocalizerGeometry(javax.vecmath.Vector3d row, javax.vecmath.Vector3d column, javax.vecmath.Point3d tlhc, javax.vecmath.Tuple3d voxelSpacing, javax.vecmath.Tuple3d dimensions)
Established the geometry of the localizer image to be posted.
row
- the unit vector (direction cosine) of the row direction in the DICOM coordinate systemcolumn
- the unit vector (direction cosine) of the row direction in the DICOM coordinate systemtlhc
- the position in the DICOM coordinate system of the center of the top left hand corner of the imagevoxelSpacing
- the row and column pixel spacing in mmdimensions
- the number of rows and columnsprotected javax.vecmath.Point3d transformPointFromSourceSpaceIntoLocalizerSpace(javax.vecmath.Point3d point)
Transform a point into the "viewport" defined by the localizer that we are an instance of.
point
- a 3D point to be transformedpublic static javax.vecmath.Point3d transformPointFromSourceSpaceIntoSpecifiedSpace(javax.vecmath.Point3d point, javax.vecmath.Point3d tlhc, javax.vecmath.Vector3d row, javax.vecmath.Vector3d column)
Transform a point into the "viewport" defined by an origin and row and column vectors in the same 3D space, by shifting the points to the origin (TLHC) and rotating.
point
- a 3D point to be transformedtlhc
- the position of the top left hand corner of the slice as a point (X, Y and Z) LPH+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+protected java.awt.geom.Point2D.Double transformPointInLocalizerPlaneIntoImageSpace(javax.vecmath.Point3d point)
Project a point in localizer 3D space onto the plane of the localizer by ignoring the Z component, and return the X and Y coordinates as image-TLHC relative column and row offsets.
Will return sub-pixel values ranging from 0.5 to 0.5 less than the maximum dimensions of the image, which allows points at the very edges of the rendered image to be drawn (e.g. a column of 0.5 will draw at the extreme left and a column of 255.5 will draw at the extreme right of a 256 pixel wide image (whereas 256.0 will not, though 0.0 will).
point
- the point in 3D localizer space, the Z coordinate of which is ignoredpublic static javax.vecmath.Point3d[] transformPointsFromSourceSpaceIntoSpecifiedSpace(javax.vecmath.Point3d[] points, javax.vecmath.Point3d tlhc, javax.vecmath.Vector3d row, javax.vecmath.Vector3d column)
Transform a set of points into the "viewport" defined by an origin and row and column vectors in the same 3D space, by shifting the points to the origin (TLHC) and rotating.
points
- an array of 3D points to be transformedtlhc
- the position of the top left hand corner of the slice as a point (X, Y and Z) LPH+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+public static void validateDirectionCosines(javax.vecmath.Vector3d row, javax.vecmath.Vector3d column) throws java.lang.IllegalArgumentException
Check that the row and column vectors are unit vectors and are orthogonal.
row
- the row direction cosinescolumn
- the column direction cosinesjava.lang.IllegalArgumentException
- thrown if notpublic static void validateDirectionCosines(javax.vecmath.Vector3d row, javax.vecmath.Vector3d column, javax.vecmath.Vector3d normal) throws java.lang.IllegalArgumentException
Check that the row and column and slice direction vectors are unit vectors and are orthogonal.
row
- the row direction cosinescolumn
- the column direction cosinesnormal
- the normal to the row and column plane (the slice direction)java.lang.IllegalArgumentException
- thrown if not