MajorityFilter3d
Replaces voxels of a three-dimensional image by the most represented value inside their neighborhood.
Access to parameter description
For an introduction to image filters: see Images Filtering.
This algorithm replaces pixels by the value that is most frequent within the filter kernel. If several values occur the same number of times, the module favors the original voxel value.
This algorithm can be especially useful for post-processing a label image, and thus correcting misclassifications of a segmentation process.
See also
Access to parameter description
For an introduction to image filters: see Images Filtering.
This algorithm replaces pixels by the value that is most frequent within the filter kernel. If several values occur the same number of times, the module favors the original voxel value.
This algorithm can be especially useful for post-processing a label image, and thus correcting misclassifications of a segmentation process.
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > majorityFilter3d( std::shared_ptr< iolink::ImageView > inputImage, int32_t kernelSizeX, int32_t kernelSizeY, int32_t kernelSizeZ, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype. majority_filter_3d( input_image, kernel_size_x = 3, kernel_size_y = 3, kernel_size_z = 3, output_image = None )
This function returns outputImage.
// Function prototype. public static IOLink.ImageView MajorityFilter3d( IOLink.ImageView inputImage, Int32 kernelSizeX = 3, Int32 kernelSizeY = 3, Int32 kernelSizeZ = 3, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
![]() |
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | nullptr |
![]() |
kernelSizeX |
The horizontal kernel size in voxels (odd value). | Int32 | [1, 100] | 3 |
![]() |
kernelSizeY |
The vertical kernel size in voxels (odd value). | Int32 | [1, 100] | 3 |
![]() |
kernelSizeZ |
The depth kernel size in voxels (odd value). | Int32 | [1, 100] | 3 |
![]() |
outputImage |
The output image. Its dimensions, type, and calibration are forced to the same values as the input. | Image | nullptr |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
![]() |
input_image |
The input image. | image | Binary, Label, Grayscale or Multispectral | None |
![]() |
kernel_size_x |
The horizontal kernel size in voxels (odd value). | int32 | [1, 100] | 3 |
![]() |
kernel_size_y |
The vertical kernel size in voxels (odd value). | int32 | [1, 100] | 3 |
![]() |
kernel_size_z |
The depth kernel size in voxels (odd value). | int32 | [1, 100] | 3 |
![]() |
output_image |
The output image. Its dimensions, type, and calibration are forced to the same values as the input. | image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
![]() |
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | null |
![]() |
kernelSizeX |
The horizontal kernel size in voxels (odd value). | Int32 | [1, 100] | 3 |
![]() |
kernelSizeY |
The vertical kernel size in voxels (odd value). | Int32 | [1, 100] | 3 |
![]() |
kernelSizeZ |
The depth kernel size in voxels (odd value). | Int32 | [1, 100] | 3 |
![]() |
outputImage |
The output image. Its dimensions, type, and calibration are forced to the same values as the input. | Image | null |
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); MajorityFilter3d majorityFilter3dAlgo; majorityFilter3dAlgo.setInputImage( foam ); majorityFilter3dAlgo.setKernelSizeX( 3 ); majorityFilter3dAlgo.setKernelSizeY( 3 ); majorityFilter3dAlgo.setKernelSizeZ( 3 ); majorityFilter3dAlgo.execute(); std::cout << "outputImage:" << majorityFilter3dAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) majority_filter_3d_algo = imagedev.MajorityFilter3d() majority_filter_3d_algo.input_image = foam majority_filter_3d_algo.kernel_size_x = 3 majority_filter_3d_algo.kernel_size_y = 3 majority_filter_3d_algo.kernel_size_z = 3 majority_filter_3d_algo.execute() print( "output_image:", str( majority_filter_3d_algo.output_image ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); MajorityFilter3d majorityFilter3dAlgo = new MajorityFilter3d { inputImage = foam, kernelSizeX = 3, kernelSizeY = 3, kernelSizeZ = 3 }; majorityFilter3dAlgo.Execute(); Console.WriteLine( "outputImage:" + majorityFilter3dAlgo.outputImage.ToString() );
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = majorityFilter3d( foam, 3, 3, 3 ); std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) result = imagedev.majority_filter_3d( foam, 3, 3, 3 ) print( "output_image:", str( result ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); IOLink.ImageView result = Processing.MajorityFilter3d( foam, 3, 3, 3 ); Console.WriteLine( "outputImage:" + result.ToString() );