[Insight-users] [Fwd: factories for FFTW filters - update]
Gaetan Lehmann
gaetan.lehmann at jouy.inra.fr
Thu Oct 26 06:08:06 EDT 2006
Hi Jakub,
That's only my point of view, but don't you think that the factory is
quite complicated for that case ?
IMHO opinion, a customized New() method in
RealToComplexConjugateImageFilter would do the job without problem.
Something like:
static Pointer New()
{
#if defined(USE_FFTWF)
return FFTWRealToComplexConjugateImageFilter<PixelType,
ImageDimension>::New().GetPointer();
#else
return VnlFFTRealToComplexConjugateImageFilter<PixelType,
ImageDimension>::New().GetPointer();
#endif
}
Regards,
Gaetan
On Thu, 26 Oct 2006 11:51:13 +0200, Jakub Bican <jakub.bican at matfyz.cz>
wrote:
>
> 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
>
>
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
http://voxel.jouy.inra.fr
More information about the Insight-users
mailing list