Class ConvertToPhysicalDistance<T extends FeatureInputWithResolution>
Object
org.anchoranalysis.bean.AnchorBean<B>
org.anchoranalysis.bean.initializable.InitializableBean<Feature<T>,FeatureInitialization>
org.anchoranalysis.feature.bean.Feature<T>
org.anchoranalysis.feature.bean.operator.FeatureUnary<T,T>
org.anchoranalysis.feature.bean.operator.FeatureUnaryGeneric<T>
org.anchoranalysis.image.feature.bean.physical.WithResolutionBase<T>
org.anchoranalysis.image.feature.bean.physical.FeatureConvertUnits<T>
org.anchoranalysis.image.feature.bean.physical.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
Constructors Constructor Description ConvertToPhysicalDistance()ConvertToPhysicalDistance(Feature<T> feature, SpatialUnits.UnitSuffix unitType, org.anchoranalysis.spatial.orientation.DirectionVector directionVector)Creates a new instance with specified feature, unit type, and direction vector. -
Method Summary
Modifier and Type Method Description protected voidbeforeCalc(FeatureInitialization initialization)Initializes the direction vector before calculation.protected doubleconvertToPhysical(double value, UnitConverter unitConverter)Converts the input value to physical distance along the specified direction.DirectionVectorBeangetDirection()Direction of the distance being converted, defaults to a unit vector along the X-axis.voidsetDirection(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, setUnitTypeMethods inherited from class org.anchoranalysis.image.feature.bean.physical.WithResolutionBase
calculate, isAcceptMissingResolution, setAcceptMissingResolutionMethods inherited from class org.anchoranalysis.feature.bean.operator.FeatureUnary
getItem, inputType, setItemMethods inherited from class org.anchoranalysis.feature.bean.Feature
assignTo, calculateCheckInitialized, castAs, createListChildFeatures, describeBean, describeParameters, descriptionLong, duplicateChangeName, getCustomName, getFriendlyName, onInitialization, setCustomName, toStringMethods inherited from class org.anchoranalysis.bean.initializable.InitializableBean
getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitializedMethods 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, org.anchoranalysis.spatial.orientation.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:
beforeCalcin 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 FeatureCalculationExceptionConverts the input value to physical distance along the specified direction.- Specified by:
convertToPhysicalin 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.
-