SnnFilter3d
Performs an edge-preserving smoothing of a three-dimensional image with the Symmetric Nearest Neighbor filter.
Access to parameter description
For an introduction to image filters: Images Filtering.
This algorithm implements the Symmetric Nearest Neighbor filter (SNN), which is an average filter weighted by the structural symmetry of a rectangular neighborhood window. It computes a local mean around a central voxel $x$, considering for each neighbor voxel $y$, having a gray level $I(y)$, the value given by:
$$ I'(y)=\left\{\begin{array}{ll} I(y) & ~\mbox{if $|I(x)-I(y)| < |I(x)-I(y_s)|$} \\ I(y_s) & ~\mbox{if $|I(x)-I(y)| > |I(x)-I(y_s)|$} \\ I(x) & ~\mbox{otherwise} \end{array}\right. $$ Where $y_s$ is the neighbor voxel symmetric to $y$ with respect to $x$.
The output value of the voxel $x$ is then given by: $$ O(x)=\mu[I'(y)] $$ Where $\mu$ is the mean value of the local window.
See also
Access to parameter description
For an introduction to image filters: Images Filtering.
This algorithm implements the Symmetric Nearest Neighbor filter (SNN), which is an average filter weighted by the structural symmetry of a rectangular neighborhood window. It computes a local mean around a central voxel $x$, considering for each neighbor voxel $y$, having a gray level $I(y)$, the value given by:
$$ I'(y)=\left\{\begin{array}{ll} I(y) & ~\mbox{if $|I(x)-I(y)| < |I(x)-I(y_s)|$} \\ I(y_s) & ~\mbox{if $|I(x)-I(y)| > |I(x)-I(y_s)|$} \\ I(x) & ~\mbox{otherwise} \end{array}\right. $$ Where $y_s$ is the neighbor voxel symmetric to $y$ with respect to $x$.
The output value of the voxel $x$ is then given by: $$ O(x)=\mu[I'(y)] $$ Where $\mu$ is the mean value of the local window.
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > snnFilter3d( std::shared_ptr< iolink::ImageView > inputImage, int32_t kernelSizeX, int32_t kernelSizeY, int32_t kernelSizeZ, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype. snn_filter_3d(input_image: idt.ImageType, kernel_size_x: int = 3, kernel_size_y: int = 3, kernel_size_z: int = 3, output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype. public static IOLink.ImageView SnnFilter3d( 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 | [3, 100] | 3 | |
kernelSizeY |
The vertical kernel size in voxels (odd value). | Int32 | [3, 100] | 3 | |
kernelSizeZ |
The depth kernel size in voxels (odd value). | Int32 | [3, 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 | [3, 100] | 3 | |
kernel_size_y |
The vertical kernel size in voxels (odd value). | int32 | [3, 100] | 3 | |
kernel_size_z |
The depth kernel size in voxels (odd value). | int32 | [3, 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 | [3, 100] | 3 | |
kernelSizeY |
The vertical kernel size in voxels (odd value). | Int32 | [3, 100] | 3 | |
kernelSizeZ |
The depth kernel size in voxels (odd value). | Int32 | [3, 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" ); SnnFilter3d snnFilter3dAlgo; snnFilter3dAlgo.setInputImage( foam ); snnFilter3dAlgo.setKernelSizeX( 3 ); snnFilter3dAlgo.setKernelSizeY( 3 ); snnFilter3dAlgo.setKernelSizeZ( 3 ); snnFilter3dAlgo.execute(); std::cout << "outputImage:" << snnFilter3dAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) snn_filter_3d_algo = imagedev.SnnFilter3d() snn_filter_3d_algo.input_image = foam snn_filter_3d_algo.kernel_size_x = 3 snn_filter_3d_algo.kernel_size_y = 3 snn_filter_3d_algo.kernel_size_z = 3 snn_filter_3d_algo.execute() print("output_image:", str(snn_filter_3d_algo.output_image))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); SnnFilter3d snnFilter3dAlgo = new SnnFilter3d { inputImage = foam, kernelSizeX = 3, kernelSizeY = 3, kernelSizeZ = 3 }; snnFilter3dAlgo.Execute(); Console.WriteLine( "outputImage:" + snnFilter3dAlgo.outputImage.ToString() );
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = snnFilter3d( foam, 3, 3, 3 ); std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) result = imagedev.snn_filter_3d(foam, 3, 3, 3) print("output_image:", str(result))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); IOLink.ImageView result = Processing.SnnFilter3d( foam, 3, 3, 3 ); Console.WriteLine( "outputImage:" + result.ToString() );