ENH: Add FFTDiscreteGaussianImageFilter#3121
ENH: Add FFTDiscreteGaussianImageFilter#3121tbirdso merged 5 commits intoInsightSoftwareConsortium:masterfrom
FFTDiscreteGaussianImageFilter#3121Conversation
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.h
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.hxx
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/test/itkFFTDiscreteGaussianImageFilterTest.cxx
Show resolved
Hide resolved
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.h
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.h
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.hxx
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/test/itkFFTDiscreteGaussianImageFilterTest.cxx
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/test/itkFFTDiscreteGaussianImageFilterTest.cxx
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/test/itkFFTDiscreteGaussianImageFilterTest.cxx
Outdated
Show resolved
Hide resolved
3e3ac68 to
4498057
Compare
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.hxx
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.hxx
Show resolved
Hide resolved
Modules/Filtering/Smoothing/test/itkFFTDiscreteGaussianImageFilterTest.cxx
Outdated
Show resolved
Hide resolved
10e6c4a to
1f27fe4
Compare
|
Pasting review notes from @jhlegarreta here (great points):
Will finish addressing these and then mark as ready |
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.hxx
Outdated
Show resolved
Hide resolved
fa953f0 to
2e55b3d
Compare
FFTDiscreteGaussianImageFilterFFTDiscreteGaussianImageFilter
|
@thewtex @dzenanz Ping for re-review Note that I've consolidated and exposed functionality from
|
Modules/Filtering/Smoothing/include/itkDiscreteGaussianImageFilter.h
Outdated
Show resolved
Hide resolved
|
For looking forward, I've gone ahead and added a factory override mechanism so that developers can opt in to having classes like If more discussion is required around the factory mechanism I'm fine with splitting it off in a separate PR. |
7587368 to
d3454b0
Compare
Modules/Filtering/Smoothing/test/itkFFTDiscreteGaussianImageFilterFactoryTest.cxx
Show resolved
Hide resolved
Modules/Filtering/Smoothing/include/itkDiscreteGaussianImageFilter.h
Outdated
Show resolved
Hide resolved
dzenanz
left a comment
There was a problem hiding this comment.
Mostly looks good, some minor suggestions.
Modules/Filtering/Smoothing/include/itkDiscreteGaussianImageFilter.hxx
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/include/itkDiscreteGaussianImageFilter.hxx
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.hxx
Outdated
Show resolved
Hide resolved
d3454b0 to
cb9abc0
Compare
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.hxx
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/test/itkDiscreteGaussianImageFilterTest2.cxx
Show resolved
Hide resolved
|
@thewtex 's suggestion
was well-founded, because on more testing I am getting different images for
It looks like the main issue here is that each filter relies on a different kernel source with what appears to be fundamentally different mechanisms for Gaussian kernel generation, leading to different kernel values from the same parameters.
@thewtex @dzenanz could you take a look and weigh in on this? Two potential options that I see for moving forward:
|
👍 If it is not too much trouble and there is a performance benefit, we could keep |
|
Thanks @thewtex . Do you know if we multiply operators to get a kernel anywhere else in ITK? I'm having trouble finding examples of how to do this efficiently. EDIT: It looks like |
|
@tbirdso nothing comes to mind offhand, but I agree -- taking a look to re-use any existing functionality makes sense, but we can also use a manual implementation. |
cb9abc0 to
a5f0d3c
Compare
|
@dzenanz @thewtex Ping for re-review. New changes:
|
81d41bd to
41bb68b
Compare
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.h
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.hxx
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/test/itkDiscreteGaussianImageFilterTest2.cxx
Outdated
Show resolved
Hide resolved
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.h
Outdated
Show resolved
Hide resolved
4a0b5cb to
2786d9a
Compare
thewtex
left a comment
There was a problem hiding this comment.
Beautiful!
One minor issue noted inline.
Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.h
Outdated
Show resolved
Hide resolved
`itk::DiscreteGaussianImageFilter` exposes parameters for generating a Gaussian kernel to error and size specifications, but previously did not make information on the kernel that was actually generated available to other classes. These changes expose protected methods to allow subclasses to create kernels to the same specifications and also publicly exposes information on the kernel sigma when image spacing is being accounted for.
Implements `FFTDiscreteGaussianImageFilter` as a subclass of `DiscreteGaussianImageFilter` performing convolution of an ND single-channel input image with a Gaussian kernel of fixed width in the Fourier domain. Includes wrappings, test and baseline image.
Adds a factory class for manual override of `DiscreteGaussianImageFilter` with `FFTDiscreteGaussianImageFilter` through object factory instantiation. This provides an optional method for speeding up image blurring over very large images or using a very large kernel via GPU-accelerated FFTs inside other classes relying on `DiscreteGaussianImageFilter` for internal blurring (see `itkMultiResolutionPyramidImageFilter.h`).
2786d9a to
d1e7c9b
Compare
dzenanz
left a comment
There was a problem hiding this comment.
Looks good, just a few nitpicks.



Changes:
FFTDiscreteGaussianImageFilteras a subclass ofDiscreteGaussianImageFilterto perform convolution of an ND single-channel input image with a Gaussian kernel of fixed width in the Fourier domainFFTDiscreteGaussianImageFilterEnumsto select among kernel generation methods, whereCOMBINED_OPERATORScomposes through vector multiplication the exact same ND kernel as used inDiscreteGaussianImageFilterin image format, whileIMAGE_SOURCErelies on the (potentially faster) method of directly generating the kernel image throughitk::GaussianImageSourceDiscreteGaussianImageFilterclass so thatFFTDiscreteGaussianImageFiltercan use the same process for generating a kernel to specificationsFFTDiscreteGaussianImageFilterFactoryfor manually overridingDiscreteGaussianImageFilterfor FFT acceleration benefitsFFTDiscreteGaussianImageFilteroutput toDiscreteGaussianImageFilteroutput with the same parametersInput:

Test output screenshot:
PR Checklist
Refer to the ITK Software Guide for
further development details if necessary.