# Factory Registration Managers

**URL:** <https://discourse.itk.org/t/factory-registration-managers/573>\
**Category:** Engineering\
**Created:** [January 5, 2018, 6:04pm UTC](https://discourse.itk.org/t/factory-registration-managers/573 "2018-01-05T18:04:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim-evain](https://discourse.itk.org/user_avatar/discourse.itk.org/tim-evain/32/220_2.png) [@tim-evain](https://discourse.itk.org/u/tim-evain)\
**Post date:** [January 5, 2018, 6:04pm UTC](https://discourse.itk.org/t/factory-registration-managers/573/1 "2018-01-05T18:04:15Z")

</div>

Hello everyone,

Since I always use CMake to get ITK into my own projects, I get the itk(Transform/Image)IOFactoryRegisterManager.h files that are generated during the process.  
I’m now on a project without CMake, and I realize that I don’t really understand what are these files for, and if we need to generate something equivalent if we want to use ITK without CMake’s help.

Can any of you enlighten me about this ?

By the way, as this is my first post of 2018, I wish a happy new year to all of you ! 🙂

---

<div class="post-metadata">

**Author:** ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)\
**Post date:** [January 5, 2018, 6:15pm UTC](https://discourse.itk.org/t/factory-registration-managers/573/2 "2018-01-05T18:15:36Z")

</div>

Hello Tim!

Happy 2018! 🙂

The best source of documentation is current found in [comments of the `UseITK.cmake` file](https://github.com/InsightSoftwareConsortium/ITK/blob/7e9481d1ff8bd3076aa9a534dae2b82a912b6f74/CMake/UseITK.cmake#L33-L156). 🎩 h/t @jcfr

In summary, these files, when included in an executable or library, will register the available `itk::ImageIOBase` classes to the object factory, so `itk::ImageFileReader` and `itk::ImageFileWriter` can find and use them.

This, of course, depends on the available ImageIO modules that ITK has available (depends on ITK’s build options and any external modules). The infrastructure was improved even further [in ITK 4.13.0](https://discourse.itk.org/t/itk-4-13-has-been-released/549), which makes the use of CMake even more appealing. 🎩 h/t @fbudin

HTH,  
Matt

---

<div class="post-metadata">

**Author:** ![tim-evain](https://discourse.itk.org/user_avatar/discourse.itk.org/tim-evain/32/220_2.png) [@tim-evain](https://discourse.itk.org/u/tim-evain)\
**Post date:** [January 6, 2018, 6:11pm UTC](https://discourse.itk.org/t/factory-registration-managers/573/3 "2018-01-06T18:11:53Z")

</div>

Thanks for the precisions Matt!

> [@matt.mccormick](#):
>
> […] itk::ImageFileReader and itk::ImageFileWriter can find and use them.

So if I’m not mistaken, the consequence of not having it is that we have to explicitely set the desired IOBase in Writers/Readers?  
What are the reasons that prevent generating these files beforehand when one build ITK?

Tim

---

<div class="post-metadata">

**Author:** ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)\
**Post date:** [January 9, 2018, 3:23pm UTC](https://discourse.itk.org/t/factory-registration-managers/573/4 "2018-01-09T15:23:07Z")

</div>

> [@tim-evain](#):
>
> So if I’m not mistaken, the consequence of not having it is that we have to explicitely set the desired IOBase in Writers/Readers?

To not be restricted to a given image format, the ImageIO’s have to be registered to the factory manually, by calling

```auto
itk::MetaImageIOFactory::RegisterOneFactory();
itk::PNGImageIOFactory::RegisterOneFactory();
[...]

```

More details and an explanation can be found in the [Register IO Factories](https://itk.org/ITKExamples/src/IO/ImageBase/RegisterIOFactories/Documentation.html) example.

> [@tim-evain](#):
>
> What are the reasons that prevent generating these files beforehand when one build ITK?

The image IO’s can be extended after the ITK build, e.g. with the [ITKIOOpenSlide](https://github.com/InsightSoftwareConsortium/ITKIOOpenSlide) module.

---

<div class="post-metadata">

**Author:** ![tim-evain](https://discourse.itk.org/user_avatar/discourse.itk.org/tim-evain/32/220_2.png) [@tim-evain](https://discourse.itk.org/u/tim-evain)\
**Post date:** [January 9, 2018, 3:37pm UTC](https://discourse.itk.org/t/factory-registration-managers/573/5 "2018-01-09T15:37:42Z")

</div>

Thanks for the explanation Matt, it’s clearer for me now 🙂.
