[Insight-users] factories for FFTW filters

Jakub Bican jakub.bican at matfyz.cz
Wed Oct 25 12:18:13 EDT 2006


Hello,

i would like to implement a factory mechanism for FFT filters. The point 
is that if the user selects "USE_FFTW" once during configuration, then 
the factory mechanism will provide him FFTW-based classes instead of 
standard VNL implementation. And user can also create his own dll with 
some fft implementation and attach it dynamically to his project.

I studied the tutorial 
(http://www.na-mic.org/Wiki/images/2/24/Insight-DesignPatterns.ppt) 
including examples.

I would like to ask someone if i understand well what i have to do:

step A) create factories FFTWFFTFactory and VNLFFTFactory (derived from 
following class), that will override creation of 
RealToComplexConjugateImageFilter and ComplexConjugateToRealImageFilter 
types so that an instance from appropriate implementation is created.

step B) create class FFTFactoryBase (derived from ObjectFactoryBase) 
that will be implemented similary to TransformFactoryBase and that will 
register one of the above factories, depending on if the FFTW is used or not
(this is difference to TransformFactoryBase, which registers all known 
factories, while the new class will register only one depending on 
configuration)


And i have some questions:

1) what is the correct way of registering FFTFactoryBase automatically, 
so that it registers appropriate factory "at the beginning"?
I don't want to register it explicitly at the beginning of every program 
that will use FFT - i just want to call 
RealToComplexConjugateImageFilter::New() and get FFTW implementation if 
i attached FFTW library to ITK or VNL implementation otherwise.

2) what happens if someone loads dll into ITK_AUTOLOAD_PATH with a new 
FFT implementation and corresponding factory? What will be overriden by 
what?

Thanks in advance for guidance and answers,

    Jakub





More information about the Insight-users mailing list