ArithmeticOperationWithValue
Performs a pointwise arithmetic operation between an image and a value.
Access to parameter description
The arithmetic operator to apply between the input image $I$ and the constant value $C$ can be selected from:
See also
Access to parameter description
The arithmetic operator to apply between the input image $I$ and the constant value $C$ can be selected from:
- Addition
- Subtraction
- Multiply
- Division
- Minimum or maximum
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > arithmeticOperationWithValue( std::shared_ptr< iolink::ImageView > inputImage, double value, ArithmeticOperationWithValue::ArithmeticOperator arithmeticOperator, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype. arithmetic_operation_with_value(input_image: idt.ImageType, value: float = 0, arithmetic_operator: ArithmeticOperationWithValue.ArithmeticOperator = ArithmeticOperationWithValue.ArithmeticOperator.ADD, output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype. public static IOLink.ImageView ArithmeticOperationWithValue( IOLink.ImageView inputImage, double value = 0, ArithmeticOperationWithValue.ArithmeticOperator arithmeticOperator = ImageDev.ArithmeticOperationWithValue.ArithmeticOperator.ADD, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputImage |
The input image.
The image type can be grayscale, binary, label, and color. |
Image | Binary, Label, Grayscale or Multispectral | nullptr | |||||||||||||
value |
The value to apply.
The value is cast into the smallest type with no loss of precision. |
Float64 | Any value | 0 | |||||||||||||
arithmeticOperator |
The arithmetic operator to apply.
|
Enumeration | ADD | ||||||||||||||
outputImage |
The output image.
The output image dimensions are forced to the same values as the input. The output image type is deduced from the input. |
Image | nullptr |
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
input_image |
The input image.
The image type can be grayscale, binary, label, and color. |
image | Binary, Label, Grayscale or Multispectral | None | |||||||||||||
value |
The value to apply.
The value is cast into the smallest type with no loss of precision. |
float64 | Any value | 0 | |||||||||||||
arithmetic_operator |
The arithmetic operator to apply.
|
enumeration | ADD | ||||||||||||||
output_image |
The output image.
The output image dimensions are forced to the same values as the input. The output image type is deduced from the input. |
image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputImage |
The input image.
The image type can be grayscale, binary, label, and color. |
Image | Binary, Label, Grayscale or Multispectral | null | |||||||||||||
value |
The value to apply.
The value is cast into the smallest type with no loss of precision. |
Float64 | Any value | 0 | |||||||||||||
arithmeticOperator |
The arithmetic operator to apply.
|
Enumeration | ADD | ||||||||||||||
outputImage |
The output image.
The output image dimensions are forced to the same values as the input. The output image type is deduced from the input. |
Image | null |
Object Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); ArithmeticOperationWithValue arithmeticOperationWithValueAlgo; arithmeticOperationWithValueAlgo.setInputImage( polystyrene ); arithmeticOperationWithValueAlgo.setValue( 10 ); arithmeticOperationWithValueAlgo.setArithmeticOperator( ArithmeticOperationWithValue::ArithmeticOperator::ADD ); arithmeticOperationWithValueAlgo.execute(); std::cout << "outputImage:" << arithmeticOperationWithValueAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) arithmetic_operation_with_value_algo = imagedev.ArithmeticOperationWithValue() arithmetic_operation_with_value_algo.input_image = polystyrene arithmetic_operation_with_value_algo.value = 10 arithmetic_operation_with_value_algo.arithmetic_operator = imagedev.ArithmeticOperationWithValue.ADD arithmetic_operation_with_value_algo.execute() print("output_image:", str(arithmetic_operation_with_value_algo.output_image))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); ArithmeticOperationWithValue arithmeticOperationWithValueAlgo = new ArithmeticOperationWithValue { inputImage = polystyrene, value = 10, arithmeticOperator = ArithmeticOperationWithValue.ArithmeticOperator.ADD }; arithmeticOperationWithValueAlgo.Execute(); Console.WriteLine( "outputImage:" + arithmeticOperationWithValueAlgo.outputImage.ToString() );
Function Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = arithmeticOperationWithValue( polystyrene, 10, ArithmeticOperationWithValue::ArithmeticOperator::ADD ); std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) result = imagedev.arithmetic_operation_with_value(polystyrene, 10, imagedev.ArithmeticOperationWithValue.ADD) print("output_image:", str(result))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); IOLink.ImageView result = Processing.ArithmeticOperationWithValue( polystyrene, 10, ArithmeticOperationWithValue.ArithmeticOperator.ADD ); Console.WriteLine( "outputImage:" + result.ToString() );