IO in python module

I have started to work on the wrapping of IO in RTK:


There is something which is not clear to me. When working with C++, I can register IO factories so that this is quite transparent for the user, the adequate ImageIO is automatically detected:

In an example that I found, it seems that one has to specify manually the IO using the SetImageIO method of the image reader. Is there a way to avoid this and to register factories in a module? My PR attempted to do this with the rtk::HisImageIO but that does not work so farā€¦

Specifying FACTORY_NAMES like this should do it:

Thanks. Thatā€™s what I tried for one factory in my PR but that did not seem to work, I havenā€™t found whatā€™s wrong yet. Is it supposed to work even if a separate wheel package is created for the module? If yes, why is this not used in ITKIOScanco example?

FACTORY_NAMES might only work at compile time? @matt.mccormick can probably explain better.

I confirm that it works if I compile all the wrappings. I guess it comes down to this generated file


which cannot contain the factories added by a module. I see no obvious solution for thisā€¦

1 Like

Yes, the itk::ImageIOFactoryRegisterManager is configured at ITK build time, so externally built remote modules will not be in the list of registered factories.

I will work on a patch to register remote module IO factories at runtime.

1 Like