Class FeatureConvertUnits<T extends FeatureInputWithResolution>

Type Parameters:
T - the type of feature input, which must include resolution information
Direct Known Subclasses:
ConvertFromPhysicalVolume, ConvertToPhysicalAreaXY, ConvertToPhysicalDistance, ConvertToPhysicalVolume

public abstract class FeatureConvertUnits<T extends FeatureInputWithResolution> extends WithResolutionBase<T>
An abstract base class for features that convert units between physical and voxel space.

This class provides a framework for converting feature values between different unit systems, typically between voxel-based measurements and physical measurements (e.g., micrometers).

  • Constructor Details

    • FeatureConvertUnits

      protected FeatureConvertUnits(Feature<T> feature, SpatialUnits.UnitSuffix unitType)
      Constructs a FeatureConvertUnits with a specified feature and unit type.
      Parameters:
      feature - the feature to be converted
      unitType - the type of unit to convert to
    • FeatureConvertUnits

      public FeatureConvertUnits()
  • Method Details

    • calculateWithResolution

      protected double calculateWithResolution(double value, Resolution resolution) throws FeatureCalculationException
      Calculates the feature value with resolution information.
      Specified by:
      calculateWithResolution in class WithResolutionBase<T extends FeatureInputWithResolution>
      Parameters:
      value - the input value to be converted
      resolution - the resolution information for the conversion
      Returns:
      the converted value
      Throws:
      FeatureCalculationException - if an error occurs during the calculation
    • convertToPhysical

      protected abstract double convertToPhysical(double value, UnitConverter unitConverter) throws FeatureCalculationException
      Converts the input value to physical units.
      Parameters:
      value - the input value to be converted
      unitConverter - the unit converter to use for the conversion
      Returns:
      the converted value in physical units
      Throws:
      FeatureCalculationException - if an error occurs during the conversion
    • getUnitType

      public String getUnitType()
      The type of unit to convert to, represented as a string (e.g., "um" for micrometers).
    • setUnitType

      public void setUnitType(String unitType)
      The type of unit to convert to, represented as a string (e.g., "um" for micrometers).