[Insight-developers] ImageIOFactory missing method

Luis Ibanez luis.ibanez at kitware.com
Mon Apr 4 09:13:25 EDT 2011


Hi Bill,

On Friday we had a very productive three-hour tcon with
Julien Malik from the OTB team, and identified the need
for a more flexible mechanism for registering factories.

In particular, for controlling the order in which the factories
get registered.


If Slicer was calling the method "RegisterBuiltInLibraries()"
chances are that it was attempting to re-register a collection
of libraries in a particular order (after unregistering all factories).


If that is the case, then the following patch that we came
up with Julien  M. may be useful to Slicer as well:

     http://review.source.kitware.com/#change,1308

It will be interesting to take a look at the code where Slicer
was calling  "RegisterBuiltInLibraries()" and see if it fits
this scenario.


The commit message is:

----------------------------------------------------------------------------
ENH: Allow position when registering factories.

The RegisterFactory() method traditionally add the new factory at the
end of the factory list. There are however, cases in which it is
desirable for an application to be able to chose the position in which
the new factory should be inserted. In this patch, arguments are added
to the RegisterFactory() method, to indicate what postion to use.

The new options are:

INSERT_AT_FRONT
INSERT_AT_BACK
INSERT_AT_POSITION

When INSERT_AT_POSITION is selected, a third argumen must be provided
with the actual integer number of the intended position. The position
numbe must be in the range [0, numberOfRegisteredFactories-1].

Usage should be any of the following:

itk::ObjectFactoryBase::RegisterFactory( newFactory1 ); // inserts at back
itk::ObjectFactoryBase::RegisterFactory( newFactory2, INSERT_AT_FRONT );
itk::ObjectFactoryBase::RegisterFactory( newFactory3, INSERT_AT_BACK );
itk::ObjectFactoryBase::RegisterFactory( newFactory4, INSERT_AT_POSITION, 5 );

If the position value is out of range, an exception will be thrown.


-----------------------------------
On Mon, Apr 4, 2011 at 8:51 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> I just #if'`ed the call in Slicer based on the ITK version.
>
> On Mon, Apr 4, 2011 at 8:44 AM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>>
>> Hi Bill,
>>
>> I'll add the .xml file for the migration guide.
>>
>> The method in question is no longer used.
>> (e.g. it doesn't do anything...)
>>
>> When you configure Slicer now, a directory is created
>> in the Slicer binary tree that provides the code for
>> registering the IO factories corresponding to the IO
>> modules enabled during ITK configuration.
>>
>>
>>     Luis
>>
>>
>> ------------------------------------------
>> On Sun, Apr 3, 2011 at 2:49 PM, Bill Lorensen <bill.lorensen at gmail.com>
>> wrote:
>> > I missed that. Why was the method removed? It breaks backward
>> > compatibility
>> > and an application developer has no idea why it was removed and how to
>> > duplicate its functionality.
>> >
>> > Bill
>> >
>> > 2011/4/3 Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr>
>> >>
>> >> Hi Bill,
>> >>
>> >> This was in
>> >>
>> >>  http://review.source.kitware.com/#change,1280
>> >>
>> >> and
>> >>
>> >>  http://review.source.kitware.com/#change,1300
>> >>
>> >> Regards,
>> >>
>> >> Gaëtan
>> >>
>> >> Le 3 avr. 11 à 20:04, Bill Lorensen a écrit :
>> >>
>> >>> Sometime recently, the method:
>> >>> ImageIOFactory::RegisterBuiltInFactories
>> >>> disappeared.
>> >>>
>> >>> Can someone point me to the gerrit topic that did this? I tried to
>> >>> find
>> >>> the change in the history but cannot locate with the tools that I
>> >>> know.
>> >>>
>> >>> This method is used in Slicer.
>> >>>
>> >>> Bill
>> >>>
>> >>> _______________________________________________
>> >>> Powered by www.kitware.com
>> >>>
>> >>> Visit other Kitware open-source projects at
>> >>> http://www.kitware.com/opensource/opensource.html
>> >>>
>> >>> Kitware offers ITK Training Courses, for more information visit:
>> >>> http://kitware.com/products/protraining.html
>> >>>
>> >>> Please keep messages on-topic and check the ITK FAQ at:
>> >>> http://www.itk.org/Wiki/ITK_FAQ
>> >>>
>> >>> Follow this link to subscribe/unsubscribe:
>> >>> http://www.itk.org/mailman/listinfo/insight-developers
>> >>
>> >> --
>> >> 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  http://www.itk.org
>> >> http://www.mandriva.org  http://www.bepo.fr
>> >>
>> >
>> >
>> > _______________________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Kitware offers ITK Training Courses, for more information visit:
>> > http://kitware.com/products/protraining.html
>> >
>> > Please keep messages on-topic and check the ITK FAQ at:
>> > http://www.itk.org/Wiki/ITK_FAQ
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.itk.org/mailman/listinfo/insight-developers
>> >
>> >
>
>


More information about the Insight-developers mailing list