Class UnitConverter

Object
UnitConverter

public class UnitConverter extends Object
Converts from voxelized units to different physical measurements of area / volume / distance.
Author:
Owen Feehan
  • Constructor Details

    • UnitConverter

      public UnitConverter(Resolution resolution)
      Creates a new UnitConverter instance.
      Parameters:
      resolution - The image-resolution used to resolve physical measurements in different directions.
  • Method Details

    • toPhysicalArea

      public double toPhysicalArea(double value)
      Converts an area from square voxels to square meters.
      Parameters:
      value - the area in square voxels
      Returns:
      the area converted into square meters.
    • toPhysicalArea

      public double toPhysicalArea(double value, String unitType)
      Converts an area from square voxels to physical units.
      Parameters:
      value - the area in square voxels
      unitType - unit-type to convert to ala SpatialUnits.
      Returns:
      the area converted into physical units (of type unitType).
    • toPhysicalVolume

      public double toPhysicalVolume(double value)
      Converts a volume from cubic voxels to cubic meters.
      Parameters:
      value - the volume in cubic voxels
      Returns:
      the volume converted into cubic meters.
    • toPhysicalVolume

      public double toPhysicalVolume(double value, String unitType)
      Converts a volume from cubic voxels to physical units.
      Parameters:
      value - the volume in cubic voxels
      unitType - unit-type to convert to ala SpatialUnits.
      Returns:
      the volume converted into physical units (of type unitType).
    • toPhysicalDistance

      public double toPhysicalDistance(double value, DirectionVector direction)
      Converts a distance from voxels to meters.
      Parameters:
      value - the distance in voxels
      direction - the direction in which the distance is measured
      Returns:
      the distance converted into meters.
    • toPhysicalDistance

      public double toPhysicalDistance(double value, DirectionVector direction, String unitType)
      Converts a distance from voxels to physical units.
      Parameters:
      value - the distance in voxels
      direction - the direction in which the distance is measured
      unitType - unit-type to convert to ala SpatialUnits.
      Returns:
      the distance converted into physical units (of type unitType).
    • fromPhysicalVolume

      public double fromPhysicalVolume(double value)
      Converts from physical-volume to voxels.

      The physical unit-type is assumed to be cubic-meters.

      Parameters:
      value - the value in physical units
      Returns:
      the area converted into voxels.
    • fromPhysicalVolume

      public double fromPhysicalVolume(double value, String unitType)
      Converts from physical-volume to voxels.
      Parameters:
      value - the value in physical units
      unitType - unit-type of value ala SpatialUnits
      Returns:
      the area converted into voxels.
    • fromPhysicalArea

      public double fromPhysicalArea(double value)
      Converts from physical-area to pixels.

      The physical unit-type is assumed to be square-meters.

      Parameters:
      value - the value in physical units
      Returns:
      the area converted into pixels.
    • fromPhysicalArea

      public double fromPhysicalArea(double value, String unitType)
      Converts from physical-area to pixels.
      Parameters:
      value - the value in physical units
      unitType - physical-unit type ala SpatialUnits
      Returns:
      the area converted into pixels.
    • fromPhysicalDistance

      public double fromPhysicalDistance(double value, DirectionVector direction)
      Converts from physical-distance to voxels.

      The physical unit-type is assumed to be meters.

      Parameters:
      value - the value in physical units
      direction - the direction in which the distance is measured
      Returns:
      the distance converted into voxels.
    • fromPhysicalDistance

      public double fromPhysicalDistance(double value)
      Converts from physical-distance to voxels.

      The physical unit-type is assumed to be meters, and the direction of the distance is assumed to be along the X axis.

      Parameters:
      value - the value in physical units
      Returns:
      the distance converted into voxels.