Class ConstantScaleFactor
Scale X and Y dimension by a constant floating-point number.
e.g. Applying 0.5 to an image of size (width=50, height=10) would produce a scaled image with (width=25, height=5).
The constant floating-point number is equal across both dimensions.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionConstantScaleFactor(double value) Creates a newConstantScaleFactorinstance. -
Method Summary
Modifier and TypeMethodDescriptioncalculate(Optional<Dimensions> dimensionsToBeScaled, Optional<ImageSizeSuggestion> suggestedSize) Calculates a scaling-factor for a source image/entity of particular dimensions.doublegetValue()The constant floating-point value to scale each dimension by.voidsetValue(double value) The constant floating-point value to scale each dimension by.Methods inherited from class org.anchoranalysis.bean.initializable.InitializableBean
getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitialized, onInitializationMethods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
ConstantScaleFactor
public ConstantScaleFactor() -
ConstantScaleFactor
public ConstantScaleFactor(double value) Creates a newConstantScaleFactorinstance.- Parameters:
value- The constant floating-point value to scale each dimension by.
-
-
Method Details
-
calculate
public ScaleFactor calculate(Optional<Dimensions> dimensionsToBeScaled, Optional<ImageSizeSuggestion> suggestedSize) throws OperationFailedException Description copied from class:ScaleCalculatorCalculates a scaling-factor for a source image/entity of particular dimensions.- Specified by:
calculatein classScaleCalculator- Parameters:
dimensionsToBeScaled- dimensions of the source image/entity that will be scaled, if they are known.suggestedSize- a string suggesting dimensions to resize to or a scaling-factor.- Returns:
- the scaling-factor to use.
- Throws:
OperationFailedException- if a scale-factor cannot be successfully calculated.
-
getValue
public double getValue()The constant floating-point value to scale each dimension by. -
setValue
public void setValue(double value) The constant floating-point value to scale each dimension by.
-