Class GeometryOfVolume

java.lang.Object
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

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     
    protected int
     
    protected GeometryOfSlice[]
     
    protected boolean
     
    protected int
     
    protected int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Are all the frames in the set of frames parallel ?
    final void
    Check if the set of frames regularly sampled along the frame dimension.
    final int
    Find the slice in the our geometry that is closest to the supplied slice geometry.
    protected final void
    findMaxComponents(double[] rowArray, double[] columnArray, double[] normalArray)
     
    final String
    Get the letter representation of the orientation of the columns of this slice.
    final String
    getColumnOrientation(int frame, boolean quadruped)
    Get the letter representation of the orientation of the columns of this slice.
    final double[]
    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).
    getGeometryOfSlice(int frame)
    Get the geometry of the selected slice.
    Get the geometry of the slices.
    final int
    Get the number of slices.
    final String
    getRowOrientation(int frame)
    Get the letter representation of the orientation of the rows of this slice.
    final String
    getRowOrientation(int frame, boolean quadruped)
    Get the letter representation of the orientation of the rows of this slice.
    final boolean
    Is the geometry of each frame available?
    final boolean
    Is the set of frames regularly sampled along the frame dimension?
    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).
    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).
    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.
    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.
    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.
    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.
    final String
    Get a human-readable rendering of the geometry.

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • frames

      protected GeometryOfSlice[] frames
    • R

      protected int R
    • C

      protected int C
    • N

      protected int N
    • areParallel

      protected boolean areParallel
    • isVolume

      protected boolean isVolume
  • Constructor Details

    • GeometryOfVolume

      protected GeometryOfVolume()
    • GeometryOfVolume

      public GeometryOfVolume(GeometryOfSlice[] frames)
  • Method Details

    • 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 (or NaN if not a regularly sampled volume)
    • findMaxComponents

      protected final void findMaxComponents(double[] rowArray, double[] columnArray, double[] normalArray)
    • 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 (or NaN if not a regularly sampled 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
    • areAllSlicesParallel

      public final boolean areAllSlicesParallel()

      Are all the frames in the set of frames parallel ?

      Returns:
      true if all frames have the same orientation
    • 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
    • hasFrameInformation

      public final boolean hasFrameInformation()

      Is the geometry of each frame available?

      Returns:
      true if per-slice geometry of each frame is available
    • 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, 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).

      Parameters:
      frame - the offset along the frames from first frame, zero being no offset
      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

      public final 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).

      Parameters:
      frame - the offset along the frames from first frame, zero being no offset
      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

      public final 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.

      Parameters:
      frame - the offset along the frames from first frame, zero being no offset
      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

      public final 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.

      Parameters:
      frame - the offset along the frames from first frame, zero being no offset
      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