Class FeatureConvertUnits<T extends FeatureInputWithResolution>
Object
AnchorBean<Feature<T>>
InitializableBean<Feature<T>,FeatureInitialization>
Feature<T>
FeatureUnary<T,T>
FeatureUnaryGeneric<T>
WithResolutionBase<T>
FeatureConvertUnits<T>
- 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 Summary
ConstructorsModifierConstructorDescriptionprotected
FeatureConvertUnits
(Feature<T> feature, SpatialUnits.UnitSuffix unitType) Constructs a FeatureConvertUnits with a specified feature and unit type. -
Method Summary
Modifier and TypeMethodDescriptionprotected double
calculateWithResolution
(double value, Resolution resolution) Calculates the feature value with resolution information.protected abstract double
convertToPhysical
(double value, UnitConverter unitConverter) Converts the input value to physical units.The type of unit to convert to, represented as a string (e.g., "um" for micrometers).void
setUnitType
(String unitType) The type of unit to convert to, represented as a string (e.g., "um" for micrometers).Methods inherited from class org.anchoranalysis.image.feature.bean.physical.WithResolutionBase
calculate, isAcceptMissingResolution, setAcceptMissingResolution
Methods inherited from class org.anchoranalysis.feature.bean.operator.FeatureUnary
getItem, inputType, setItem
Methods inherited from class org.anchoranalysis.feature.bean.Feature
assignTo, beforeCalc, calculateCheckInitialized, castAs, createListChildFeatures, describeBean, describeParameters, descriptionLong, duplicateChangeName, getCustomName, getFriendlyName, onInitialization, setCustomName, toString
Methods inherited from class org.anchoranalysis.bean.initializable.InitializableBean
getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitialized
Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise
-
Constructor Details
-
FeatureConvertUnits
Constructs a FeatureConvertUnits with a specified feature and unit type.- Parameters:
feature
- the feature to be convertedunitType
- 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 classWithResolutionBase<T extends FeatureInputWithResolution>
- Parameters:
value
- the input value to be convertedresolution
- 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 convertedunitConverter
- 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
The type of unit to convert to, represented as a string (e.g., "um" for micrometers). -
setUnitType
The type of unit to convert to, represented as a string (e.g., "um" for micrometers).
-