[Insight-users] [Fwd: factories for FFTW filters - update]

Jakub Bican jakub.bican at matfyz.cz
Thu Oct 26 05:51:13 EDT 2006


Hi,

things seem more clear now: I have to make just one class 
(FFTFactory:ObjectFactoryBase) that calls RegisterOverride() in its 
constructor to override creation of RealToComplexConjugateImageFilter 
and ComplexConjugateToRealImageFilter by available implementation from 
VNL or FFTW.

But the questions remains the same:
1) how to register this factory as "implicit default factory" - without 
need to register it manually in every filter or every program that uses FFT

2) what happens if there will be new FFT implementation in dynamic 
library, that will override in the same way - which factory will have 
priority? (if the dynamic one overrides the default one, then it is ok - 
that is the intention, but does it really happen?)


Regards,

        Jakub




-------- Původní zpráva --------

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