com.pixelmed.geometry

## Class GeometryOfVolume

- java.lang.Object
- - com.pixelmed.geometry.GeometryOfVolume

- Direct Known Subclasses:
    GeometryOfVolumeFromAttributeList

      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.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `areParallel`
    `protected int` | `C`
    `protected GeometryOfSlice[]` | `frames`
    `protected boolean` | `isVolume`
    `protected int` | `N`
    `protected int` | `R`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `GeometryOfVolume()`
    `` | `GeometryOfVolume(GeometryOfSlice[] frames)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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` | `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### 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 Detail

    - #### GeometryOfVolume

          protected GeometryOfVolume()

    - #### GeometryOfVolume

          public GeometryOfVolume(GeometryOfSlice[] frames)

  - ### Method Detail

    - #### 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

    - #### 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 java.lang.String toString()

      Get a human-readable rendering of the geometry.

      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        the string rendering of the geometry

    - #### getRowOrientation

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

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

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

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

      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