I found it such slow that using built-in 3D filtering method directly. For example, I want to implement mean filtering in a 3D image data, which size is 1024 * 1024 * 1024, and I use itkMeanImageFilter method, but it seams too slow, how can I do for speed it up?
How big is your kernel? Mean filter should be relatively fast for smaller kernels (3x3x3, aka radius 1). Median filter is much slower. Number one thing to check: are you running in release mode? Debug is 1-2 orders of magnitude slower.
thanks. kernal size is 333, and is in release mode. I found that the CPU usage in the task manager is about 10%. How can we put more computing resources into this process?
If youāre only getting 10% CPU utilization, then the process is probably thrashing. How much memory do you have?
CPU is AMD ryzen 2600, and memory is 16g
Does 1024x1024x100 image gets processed 10x faster? If the speedup is greater, your original image processing speed is limited by available memory.
What happens if you limit number of threads to say 4? You can use filter->SetNumberOfThreads(4);
What is your pixel type? Doubles would probably cause memory problems, but anything smaller ought to fit in 16 gig. Iād guess the filter needs two copies of the image in memory, the input and output images.
The MeanImageFilter
does not have a ākernel sizeā parameter. It has a Radius
parameter, which if set to 3 would mean the āsizeā of the kernel is [7,7,7] which is 343 pixel. That is some what of a large 3d convolution.
I think there is a more efficient implementaion in the BoxMeanImageFilter
.
pixel type is charļ¼and memory has been used 9/16g