Class UnitConverter
Object
UnitConverter
Converts from voxelized units to different physical measurements of area / volume / distance.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
fromPhysicalArea
(double value) Converts from physical-area to pixels.double
fromPhysicalArea
(double value, String unitType) Converts from physical-area to pixels.double
fromPhysicalDistance
(double value) Converts from physical-distance to voxels.double
fromPhysicalDistance
(double value, DirectionVector direction) Converts from physical-distance to voxels.double
fromPhysicalVolume
(double value) Converts from physical-volume to voxels.double
fromPhysicalVolume
(double value, String unitType) Converts from physical-volume to voxels.double
toPhysicalArea
(double value) Converts an area from square voxels to square meters.double
toPhysicalArea
(double value, String unitType) Converts an area from square voxels to physical units.double
toPhysicalDistance
(double value, DirectionVector direction) Converts a distance from voxels to meters.double
toPhysicalDistance
(double value, DirectionVector direction, String unitType) Converts a distance from voxels to physical units.double
toPhysicalVolume
(double value) Converts a volume from cubic voxels to cubic meters.double
toPhysicalVolume
(double value, String unitType) Converts a volume from cubic voxels to physical units.
-
Constructor Details
-
UnitConverter
Creates a newUnitConverter
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
Converts an area from square voxels to physical units.- Parameters:
value
- the area in square voxelsunitType
- unit-type to convert to alaSpatialUnits
.- 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
Converts a volume from cubic voxels to physical units.- Parameters:
value
- the volume in cubic voxelsunitType
- unit-type to convert to alaSpatialUnits
.- Returns:
- the volume converted into physical units (of type
unitType
).
-
toPhysicalDistance
Converts a distance from voxels to meters.- Parameters:
value
- the distance in voxelsdirection
- the direction in which the distance is measured- Returns:
- the distance converted into meters.
-
toPhysicalDistance
Converts a distance from voxels to physical units.- Parameters:
value
- the distance in voxelsdirection
- the direction in which the distance is measuredunitType
- unit-type to convert to alaSpatialUnits
.- 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
Converts from physical-volume to voxels.- Parameters:
value
- the value in physical unitsunitType
- unit-type of value alaSpatialUnits
- 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
Converts from physical-area to pixels.- Parameters:
value
- the value in physical unitsunitType
- physical-unit type alaSpatialUnits
- Returns:
- the area converted into pixels.
-
fromPhysicalDistance
Converts from physical-distance to voxels.The physical unit-type is assumed to be meters.
- Parameters:
value
- the value in physical unitsdirection
- 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.
-