Class ConvertToPhysicalDistance<T extends FeatureInputWithResolution>
Object
AnchorBean<Feature<T>>
InitializableBean<Feature<T>,FeatureInitialization>
Feature<T>
FeatureUnary<T,T>
FeatureUnaryGeneric<T>
WithResolutionBase<T>
FeatureConvertUnits<T>
ConvertToPhysicalDistance<T>
- Type Parameters:
T
- the type of feature input, which must include resolution information
public class ConvertToPhysicalDistance<T extends FeatureInputWithResolution>
extends FeatureConvertUnits<T>
Converts a distance feature to physical units along a specified direction.
This feature converter takes a distance measurement and converts it to physical units
considering the direction specified by the direction
property.
-
Constructor Summary
ConstructorsConstructorDescriptionConvertToPhysicalDistance
(Feature<T> feature, SpatialUnits.UnitSuffix unitType, DirectionVector directionVector) Creates a new instance with specified feature, unit type, and direction vector. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
beforeCalc
(FeatureInitialization initialization) Initializes the direction vector before calculation.protected double
convertToPhysical
(double value, UnitConverter unitConverter) Converts the input value to physical distance along the specified direction.Direction of the distance being converted, defaults to a unit vector along the X-axis.void
setDirection
(DirectionVectorBean direction) Direction of the distance being converted, defaults to a unit vector along the X-axis.Methods inherited from class org.anchoranalysis.image.feature.bean.physical.FeatureConvertUnits
calculateWithResolution, getUnitType, setUnitType
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, 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
-
ConvertToPhysicalDistance
public ConvertToPhysicalDistance(Feature<T> feature, SpatialUnits.UnitSuffix unitType, DirectionVector directionVector) Creates a new instance with specified feature, unit type, and direction vector.- Parameters:
feature
- the feature to convertunitType
- the type of physical unit to convert todirectionVector
- the direction vector for the distance
-
ConvertToPhysicalDistance
public ConvertToPhysicalDistance()
-
-
Method Details
-
beforeCalc
Initializes the direction vector before calculation.- Overrides:
beforeCalc
in classFeature<T extends FeatureInputWithResolution>
- Parameters:
initialization
- the feature initialization context- Throws:
InitializeException
- if the direction vector cannot be created
-
convertToPhysical
protected double convertToPhysical(double value, UnitConverter unitConverter) throws FeatureCalculationException Converts the input value to physical distance along the specified direction.- Specified by:
convertToPhysical
in classFeatureConvertUnits<T extends FeatureInputWithResolution>
- Parameters:
value
- the input distance valueunitConverter
- the unit converter to use for the conversion- Returns:
- the converted physical distance
- Throws:
FeatureCalculationException
- if the conversion fails
-
getDirection
Direction of the distance being converted, defaults to a unit vector along the X-axis. -
setDirection
Direction of the distance being converted, defaults to a unit vector along the X-axis.
-