[Insight-users] Pluggable Factories
Luis Ibanez
luis.ibanez at kitware.com
Mon Mar 20 08:59:16 EST 2006
Hi Bart,
Thanks for pointing this out.
We should clarify the text in the Software Guide.
Here is what happens:
1) Every new file format requires you to implement
two classes. If the fileformat is called WWWW,
then the classes will be called:
itkWWWImageIO
itkWWWImageIOFactory
2) They will derive respectively:
itkWWWImageIO from itkImageIOBase
itkWWWImageIOFactory from itkObjectFactoryBase**
**All factories in ITK derive from this base factory
3) The class itkImageIOFactory, is the front end to
all the IO factories. You can see it as a sort of
"Dispatcher" pattern. All the actuall IO factories
get registered with the ImageIOFactory in the file
Insight/Code/IO/itkImageIOFactory.cxx
4) When you ask the ImageFileReader or the ImageFileWriter
to read/write (respectively) a file. They will ask the
ImageIOFactory to find an actual IO factory for that file
format.
A more appropriate name for the ImageIOFactory could
have been:
"ImageIOFactoryFinder"
or "ImageIOFactoryCollection"
or "ImageIOFactoryRegistry"
or "ImageIOFactoryDispatcher"
Since this class does not really create ImageIO objects
but ImageIOFactory objects.
Please let us know if you have further questions,
Thanks
Luis
=================
deboeck wrote:
> Hi,
>
>
>
> The ITK book mentions on page 211 that “each time a new file format is
> added (i.e. a new ImageIO subclass is created), a factory must be
> implemented as a derived class of the ImageIOFactory class”.
>
> The PNGImageIO and PNGImageIOFactory types in ITK, however, are
> derived from ImageIOBase and ObjectFactoryBase respectively. How does
> this relate ?
>
>
>
> Thanks,
>
> Bart
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
More information about the Insight-users
mailing list