CudaGaussianFilter3d
Applies a three-dimensional Gaussian filter using either a separable finite kernel.
Access to parameter description
This command is experimental, his signature may be modified between now and his final version.
This algorithm performs a 3D smoothing filter whose impulse response is a Gaussian function. $$ f(x,y,z) = e^{ \frac{-x ^ 2 }{2\sigma_x ^ 2 } }e^{ \frac{-y ^ 2 }{2\sigma_y ^ 2 }} e^{ \frac{-z ^ 2 }{2\sigma_z ^ 2 } } $$ Where:
The separable mode is based on a Finite Impulse Response (FIR) algorithm applied in separable way (a three-dimensional convolution separated in three one-dimensional filters). Using this mode, the computation time is proportional to the kernel size, which is determined by using the standard deviation and the kernel size factor.
See also
Access to parameter description
This command is experimental, his signature may be modified between now and his final version.
This algorithm performs a 3D smoothing filter whose impulse response is a Gaussian function. $$ f(x,y,z) = e^{ \frac{-x ^ 2 }{2\sigma_x ^ 2 } }e^{ \frac{-y ^ 2 }{2\sigma_y ^ 2 }} e^{ \frac{-z ^ 2 }{2\sigma_z ^ 2 } } $$ Where:
- $x$, $y$ and $z$ represent the offsets from the pixel to process,
- $\sigma_x$, $\sigma_y$ and $\sigma_z$ is the standard deviation along each axis.
The separable mode is based on a Finite Impulse Response (FIR) algorithm applied in separable way (a three-dimensional convolution separated in three one-dimensional filters). Using this mode, the computation time is proportional to the kernel size, which is determined by using the standard deviation and the kernel size factor.
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > cudaGaussianFilter3d( std::shared_ptr< iolink::ImageView > inputImage, CudaGaussianFilter3d::FilterMode filterMode, const iolink::Vector3d& standardDeviation, double kernelSizeFactor, CudaGaussianFilter3d::OutputType outputType, bool lowMemory, CudaGaussianFilter3d::TilingMode tilingMode, const iolink::Vector3u32& tileSize, CudaContext::Ptr cudaContext, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype. cuda_gaussian_filter_3d(input_image: idt.ImageType, filter_mode: CudaGaussianFilter3d.FilterMode = CudaGaussianFilter3d.FilterMode.SEPARABLE, standard_deviation: Union[Iterable[int], Iterable[float]] = [1, 1, 1], kernel_size_factor: float = 2, output_type: CudaGaussianFilter3d.OutputType = CudaGaussianFilter3d.OutputType.SAME_AS_INPUT, low_memory: bool = False, tiling_mode: CudaGaussianFilter3d.TilingMode = CudaGaussianFilter3d.TilingMode.NONE, tile_size: Iterable[int] = [128, 128, 128], cuda_context: Union[CudaContext, None] = None, output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype. public static IOLink.ImageView CudaGaussianFilter3d( IOLink.ImageView inputImage, CudaGaussianFilter3d.FilterMode filterMode = ImageDev.CudaGaussianFilter3d.FilterMode.SEPARABLE, double[] standardDeviation = null, double kernelSizeFactor = 2, CudaGaussianFilter3d.OutputType outputType = ImageDev.CudaGaussianFilter3d.OutputType.SAME_AS_INPUT, bool lowMemory = false, CudaGaussianFilter3d.TilingMode tilingMode = ImageDev.CudaGaussianFilter3d.TilingMode.NONE, uint[] tileSize = null, Data.CudaContext cudaContext = null, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
![]() |
inputImage |
The input image. The type of image can be integer or float. |
Image | Binary, Label, Grayscale or Multispectral | nullptr | ||||
![]() |
filterMode |
The algorithm implementation used to compute the gaussian filter.
|
Enumeration | SEPARABLE | |||||
![]() |
standardDeviation |
The standard deviation value for each direction (X, Y, Z) in voxel units. Each value must be greater or equal to 0.0. | Vector3d | >=0 | {1.f, 1.f, 1.f} | ||||
![]() |
kernelSizeFactor |
This parameter is used to compute the size of the kernel applied in the SEPARABLE mode. The kernel size value is twice the kernelSizeFactor multiplied by the standard deviation associated with the axis. If the resulting kernel size is even, it is incremented by one in order to ensure an odd kernel size. | Float64 | >0 | 2 | ||||
![]() |
outputType |
The output data type. It can either be the same as the input type, or forced to be float. In the case of floating input images, this parameter has no effect.
|
Enumeration | SAME_AS_INPUT | |||||
![]() |
lowMemory |
This parameter defines if the SEPARABLE algorithm must limit its memory usage. If equal to false, a temporary 32-bit float image is used to store the result before casting it to the output type. The result is thus less precise and faster to compute when this parameter is set to true. | Bool | false | |||||
![]() |
tilingMode |
The way to manage the GPU memory.
|
Enumeration | NONE | |||||
![]() |
tileSize |
The tile width and height in pixels. This parameter is used only in USER_DEFINED tiling mode. | Vector3u32 | Any value | {128, 128, 128} | ||||
![]() |
cudaContext |
CUDA context information. | CudaContext | nullptr | |||||
![]() |
outputImage |
The output image. Dimensions, calibration, and interpretation of the output image are forced to the same values as the input. | Image | nullptr |
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
![]() |
input_image |
The input image. The type of image can be integer or float. |
image | Binary, Label, Grayscale or Multispectral | None | ||||
![]() |
filter_mode |
The algorithm implementation used to compute the gaussian filter.
|
enumeration | SEPARABLE | |||||
![]() |
standard_deviation |
The standard deviation value for each direction (X, Y, Z) in voxel units. Each value must be greater or equal to 0.0. | vector3d | >=0 | [1, 1, 1] | ||||
![]() |
kernel_size_factor |
This parameter is used to compute the size of the kernel applied in the SEPARABLE mode. The kernel size value is twice the kernelSizeFactor multiplied by the standard deviation associated with the axis. If the resulting kernel size is even, it is incremented by one in order to ensure an odd kernel size. | float64 | >0 | 2 | ||||
![]() |
output_type |
The output data type. It can either be the same as the input type, or forced to be float. In the case of floating input images, this parameter has no effect.
|
enumeration | SAME_AS_INPUT | |||||
![]() |
low_memory |
This parameter defines if the SEPARABLE algorithm must limit its memory usage. If equal to false, a temporary 32-bit float image is used to store the result before casting it to the output type. The result is thus less precise and faster to compute when this parameter is set to true. | bool | False | |||||
![]() |
tiling_mode |
The way to manage the GPU memory.
|
enumeration | NONE | |||||
![]() |
tile_size |
The tile width and height in pixels. This parameter is used only in USER_DEFINED tiling mode. | vector3u32 | Any value | [128, 128, 128] | ||||
![]() |
cuda_context |
CUDA context information. | cuda_context | None | |||||
![]() |
output_image |
The output image. Dimensions, calibration, and interpretation of the output image are forced to the same values as the input. | image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
![]() |
inputImage |
The input image. The type of image can be integer or float. |
Image | Binary, Label, Grayscale or Multispectral | null | ||||
![]() |
filterMode |
The algorithm implementation used to compute the gaussian filter.
|
Enumeration | SEPARABLE | |||||
![]() |
standardDeviation |
The standard deviation value for each direction (X, Y, Z) in voxel units. Each value must be greater or equal to 0.0. | Vector3d | >=0 | {1f, 1f, 1f} | ||||
![]() |
kernelSizeFactor |
This parameter is used to compute the size of the kernel applied in the SEPARABLE mode. The kernel size value is twice the kernelSizeFactor multiplied by the standard deviation associated with the axis. If the resulting kernel size is even, it is incremented by one in order to ensure an odd kernel size. | Float64 | >0 | 2 | ||||
![]() |
outputType |
The output data type. It can either be the same as the input type, or forced to be float. In the case of floating input images, this parameter has no effect.
|
Enumeration | SAME_AS_INPUT | |||||
![]() |
lowMemory |
This parameter defines if the SEPARABLE algorithm must limit its memory usage. If equal to false, a temporary 32-bit float image is used to store the result before casting it to the output type. The result is thus less precise and faster to compute when this parameter is set to true. | Bool | false | |||||
![]() |
tilingMode |
The way to manage the GPU memory.
|
Enumeration | NONE | |||||
![]() |
tileSize |
The tile width and height in pixels. This parameter is used only in USER_DEFINED tiling mode. | Vector3u32 | Any value | {128, 128, 128} | ||||
![]() |
cudaContext |
CUDA context information. | CudaContext | null | |||||
![]() |
outputImage |
The output image. Dimensions, calibration, and interpretation of the output image are forced to the same values as the input. | Image | null |
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); CudaGaussianFilter3d cudaGaussianFilter3dAlgo; cudaGaussianFilter3dAlgo.setInputImage( foam ); cudaGaussianFilter3dAlgo.setFilterMode( CudaGaussianFilter3d::FilterMode::SEPARABLE ); cudaGaussianFilter3dAlgo.setStandardDeviation( {1.0, 1.0, 1.0} ); cudaGaussianFilter3dAlgo.setKernelSizeFactor( 2.0 ); cudaGaussianFilter3dAlgo.setOutputType( CudaGaussianFilter3d::OutputType::SAME_AS_INPUT ); cudaGaussianFilter3dAlgo.setLowMemory( false ); cudaGaussianFilter3dAlgo.setTilingMode( CudaGaussianFilter3d::TilingMode::NONE ); cudaGaussianFilter3dAlgo.setTileSize( {128, 128, 128} ); cudaGaussianFilter3dAlgo.setCudaContext( nullptr ); cudaGaussianFilter3dAlgo.setOutputImage( iolink::ImageViewFactory::allocate( iolink::VectorXu64( { 1, 1 } ), iolink::DataTypeId::UINT8 ) ); cudaGaussianFilter3dAlgo.execute(); std::cout << "outputImage:" << cudaGaussianFilter3dAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) cuda_gaussian_filter_3d_algo = imagedev.CudaGaussianFilter3d() cuda_gaussian_filter_3d_algo.input_image = foam cuda_gaussian_filter_3d_algo.filter_mode = imagedev.CudaGaussianFilter3d.SEPARABLE cuda_gaussian_filter_3d_algo.standard_deviation = [1.0, 1.0, 1.0] cuda_gaussian_filter_3d_algo.kernel_size_factor = 2.0 cuda_gaussian_filter_3d_algo.output_type = imagedev.CudaGaussianFilter3d.SAME_AS_INPUT cuda_gaussian_filter_3d_algo.low_memory = False cuda_gaussian_filter_3d_algo.tiling_mode = imagedev.CudaGaussianFilter3d.NONE cuda_gaussian_filter_3d_algo.tile_size = [128, 128, 128] cuda_gaussian_filter_3d_algo.cuda_context = None cuda_gaussian_filter_3d_algo.execute() print("output_image:", str(cuda_gaussian_filter_3d_algo.output_image))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); CudaGaussianFilter3d cudaGaussianFilter3dAlgo = new CudaGaussianFilter3d { inputImage = foam, filterMode = CudaGaussianFilter3d.FilterMode.SEPARABLE, standardDeviation = new double[]{1.0, 1.0, 1.0}, kernelSizeFactor = 2.0, outputType = CudaGaussianFilter3d.OutputType.SAME_AS_INPUT, lowMemory = false, tilingMode = CudaGaussianFilter3d.TilingMode.NONE, tileSize = new uint[]{128, 128, 128}, cudaContext = null }; cudaGaussianFilter3dAlgo.Execute(); Console.WriteLine( "outputImage:" + cudaGaussianFilter3dAlgo.outputImage.ToString() );
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = cudaGaussianFilter3d( foam, CudaGaussianFilter3d::FilterMode::SEPARABLE, {1.0, 1.0, 1.0}, 2.0, CudaGaussianFilter3d::OutputType::SAME_AS_INPUT, false, CudaGaussianFilter3d::TilingMode::NONE, {128, 128, 128}, nullptr , iolink::ImageViewFactory::allocate( iolink::VectorXu64( { 1, 1 } ), iolink::DataTypeId::UINT8 )); std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) result = imagedev.cuda_gaussian_filter_3d(foam, imagedev.CudaGaussianFilter3d.SEPARABLE, [1.0, 1.0, 1.0], 2.0, imagedev.CudaGaussianFilter3d.SAME_AS_INPUT, False, imagedev.CudaGaussianFilter3d.NONE, [128, 128, 128], None) print("output_image:", str(result))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); IOLink.ImageView result = Processing.CudaGaussianFilter3d( foam, CudaGaussianFilter3d.FilterMode.SEPARABLE, new double[]{1.0, 1.0, 1.0}, 2.0, CudaGaussianFilter3d.OutputType.SAME_AS_INPUT, false, CudaGaussianFilter3d.TilingMode.NONE, new uint[]{128, 128, 128}, null ); Console.WriteLine( "outputImage:" + result.ToString() );
© 2025 Thermo Fisher Scientific Inc. All rights reserved.