ApplyMorphologicalLut3d
Applies a predefined morphological lookup table (LUT) on a three-dimensional binary image.
Access to parameter description
For an introduction:
Before launching this algorithm, a MorphologicalLut3d object has to be built and set as the morphologicalLut parameter. The kernels defining the searched configurations can be inserted in this object with its addKernel method.
See also
Access to parameter description
For an introduction:
- section Mathematical Morphology
- section Morphological LUT
Before launching this algorithm, a MorphologicalLut3d object has to be built and set as the morphologicalLut parameter. The kernels defining the searched configurations can be inserted in this object with its addKernel method.
See also
Function Syntax
This function returns a ApplyMorphologicalLut3dOutput structure containing the outputBinaryImage and outputMeasurement output parameters.
// Output structure. struct ApplyMorphologicalLut3dOutput { std::shared_ptr< iolink::ImageView > outputBinaryImage; ApplyMorphologicalLutMsr::Ptr outputMeasurement; }; // Function prototype. ApplyMorphologicalLut3dOutput applyMorphologicalLut3d( std::shared_ptr< iolink::ImageView > inputBinaryImage, imagedev::MorphologicalLut3d::Ptr morphologicalLut, ApplyMorphologicalLut3d::MatchingFlag matchingFlag, ApplyMorphologicalLut3d::UnmatchingFlag unmatchingFlag, ApplyMorphologicalLut3d::BorderCondition borderCondition, std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL, ApplyMorphologicalLutMsr::Ptr outputMeasurement = NULL );
This function returns a tuple containing the output_binary_image and output_measurement output parameters.
// Function prototype. apply_morphological_lut_3d( input_binary_image, morphological_lut, matching_flag = ApplyMorphologicalLut3d.MatchingFlag.M_SET_ONE, unmatching_flag = ApplyMorphologicalLut3d.UnmatchingFlag.U_SET_ZERO, border_condition = ApplyMorphologicalLut3d.BorderCondition.MIRROR, output_binary_image = None, output_measurement = None )
This function returns a ApplyMorphologicalLut3dOutput structure containing the outputBinaryImage and outputMeasurement output parameters.
/// Output structure of the ApplyMorphologicalLut3d function. public struct ApplyMorphologicalLut3dOutput { public IOLink.ImageView outputBinaryImage; public ApplyMorphologicalLutMsr outputMeasurement; }; // Function prototype. public static ApplyMorphologicalLut3dOutput ApplyMorphologicalLut3d( IOLink.ImageView inputBinaryImage, Data.MorphologicalLut3d morphologicalLut, ApplyMorphologicalLut3d.MatchingFlag matchingFlag = ImageDev.ApplyMorphologicalLut3d.MatchingFlag.M_SET_ONE, ApplyMorphologicalLut3d.UnmatchingFlag unmatchingFlag = ImageDev.ApplyMorphologicalLut3d.UnmatchingFlag.U_SET_ZERO, ApplyMorphologicalLut3d.BorderCondition borderCondition = ImageDev.ApplyMorphologicalLut3d.BorderCondition.MIRROR, IOLink.ImageView outputBinaryImage = null, ApplyMorphologicalLutMsr outputMeasurement = null );
Class Syntax
Parameters
Class Name | ApplyMorphologicalLut3d |
---|
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputBinaryImage |
The binary input image. | Image | Binary | nullptr | |||||||||
morphologicalLut |
The input morphological LUT array defining the configurations to detect. | MorphologicalLut3d | MorphologicalLut3d::New( MorphologicalKernel3d::New( MorphologicalKernel3d::ONE ) ) | ||||||||||
matchingFlag |
The value to set when a predefined configuration is encountered.
|
Enumeration | M_SET_ONE | ||||||||||
unmatchingFlag |
The value to set when a predefined configuration is not encountered.
|
Enumeration | U_SET_ZERO | ||||||||||
borderCondition |
The border condition used to extrapolate outside pixels.
|
Enumeration | MIRROR | ||||||||||
outputBinaryImage |
The binary output image. Its size and type are forced to the same values as the input. | Image | nullptr | ||||||||||
outputMeasurement |
The output object containing the number of modified voxels by the selected LUT. | ApplyMorphologicalLutMsr | nullptr |
Object Examples
auto foam_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep.vip" ); ApplyMorphologicalLut3d applyMorphologicalLut3dAlgo; applyMorphologicalLut3dAlgo.setInputBinaryImage( foam_sep ); applyMorphologicalLut3dAlgo.setMorphologicalLut( MorphologicalLut3d::New( MorphologicalKernel3d::New( MorphologicalKernel3d::ONE ) ) ); applyMorphologicalLut3dAlgo.setMatchingFlag( ApplyMorphologicalLut3d::MatchingFlag::M_SET_ONE ); applyMorphologicalLut3dAlgo.setUnmatchingFlag( ApplyMorphologicalLut3d::UnmatchingFlag::U_SET_ZERO ); applyMorphologicalLut3dAlgo.setBorderCondition( ApplyMorphologicalLut3d::BorderCondition::ZERO ); applyMorphologicalLut3dAlgo.execute(); std::cout << "outputBinaryImage:" << applyMorphologicalLut3dAlgo.outputBinaryImage()->toString(); std::cout << "modifiedPixelCount: " << applyMorphologicalLut3dAlgo.outputMeasurement()->modifiedPixelCount( 0 ) ;
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip")) apply_morphological_lut_3d_algo = imagedev.ApplyMorphologicalLut3d() apply_morphological_lut_3d_algo.input_binary_image = foam_sep apply_morphological_lut_3d_algo.morphological_lut = imagedev.MorphologicalLut3d(imagedev.MorphologicalKernel3d(imagedev.MorphologicalKernel3d.Value.ONE)) apply_morphological_lut_3d_algo.matching_flag = imagedev.ApplyMorphologicalLut3d.M_SET_ONE apply_morphological_lut_3d_algo.unmatching_flag = imagedev.ApplyMorphologicalLut3d.U_SET_ZERO apply_morphological_lut_3d_algo.border_condition = imagedev.ApplyMorphologicalLut3d.ZERO apply_morphological_lut_3d_algo.execute() print( "output_binary_image:", str( apply_morphological_lut_3d_algo.output_binary_image ) ); print( print("modifiedPixelCount: ", apply_morphological_lut_3d_algo.output_measurement.modified_pixel_count( 0 ) ) );
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" ); ApplyMorphologicalLut3d applyMorphologicalLut3dAlgo = new ApplyMorphologicalLut3d { inputBinaryImage = foam_sep, morphologicalLut = new Data.MorphologicalLut3d(new Data.MorphologicalKernel3d(Data.MorphologicalKernel3d.Value.ONE)), matchingFlag = ApplyMorphologicalLut3d.MatchingFlag.M_SET_ONE, unmatchingFlag = ApplyMorphologicalLut3d.UnmatchingFlag.U_SET_ZERO, borderCondition = ApplyMorphologicalLut3d.BorderCondition.ZERO }; applyMorphologicalLut3dAlgo.Execute(); Console.WriteLine( "outputBinaryImage:" + applyMorphologicalLut3dAlgo.outputBinaryImage.ToString() ); Console.WriteLine( "modifiedPixelCount: " + applyMorphologicalLut3dAlgo.outputMeasurement.modifiedPixelCount( 0 ) );
Function Examples
auto foam_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep.vip" ); auto result = applyMorphologicalLut3d( foam_sep, MorphologicalLut3d::New( MorphologicalKernel3d::New( MorphologicalKernel3d::ONE ) ), ApplyMorphologicalLut3d::MatchingFlag::M_SET_ONE, ApplyMorphologicalLut3d::UnmatchingFlag::U_SET_ZERO, ApplyMorphologicalLut3d::BorderCondition::ZERO ); std::cout << "outputBinaryImage:" << result.outputBinaryImage->toString(); std::cout << "modifiedPixelCount: " << result.outputMeasurement->modifiedPixelCount( 0 ) ;
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip")) result_output_binary_image, result_output_measurement = imagedev.apply_morphological_lut_3d( foam_sep, imagedev.MorphologicalLut3d(imagedev.MorphologicalKernel3d(imagedev.MorphologicalKernel3d.Value.ONE)), imagedev.ApplyMorphologicalLut3d.M_SET_ONE, imagedev.ApplyMorphologicalLut3d.U_SET_ZERO, imagedev.ApplyMorphologicalLut3d.ZERO ) print( "output_binary_image:", str( result_output_binary_image ) ); print( "modifiedPixelCount: ", result_output_measurement.modified_pixel_count( 0 ) );
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" ); Processing.ApplyMorphologicalLut3dOutput result = Processing.ApplyMorphologicalLut3d( foam_sep, new Data.MorphologicalLut3d(new Data.MorphologicalKernel3d(Data.MorphologicalKernel3d.Value.ONE)), ApplyMorphologicalLut3d.MatchingFlag.M_SET_ONE, ApplyMorphologicalLut3d.UnmatchingFlag.U_SET_ZERO, ApplyMorphologicalLut3d.BorderCondition.ZERO ); Console.WriteLine( "outputBinaryImage:" + result.outputBinaryImage.ToString() ); Console.WriteLine( "modifiedPixelCount: " + result.outputMeasurement.modifiedPixelCount( 0 ) );