# Loadable module ITK filters I/O

**URL:** https://discourse.slicer.org/t/loadable-module-itk-filters-i-o/5589
**Category:** Support
**Tags:** itk
**Created:** [January 31, 2019, 3:22am UTC](https://discourse.slicer.org/t/loadable-module-itk-filters-i-o/5589 "2019-01-31T03:22:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Amn3s14](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@Amn3s14](https://discourse.slicer.org/u/Amn3s14)
#### Post date: [January 31, 2019, 3:22am UTC](https://discourse.slicer.org/t/loadable-module-itk-filters-i-o/5589/1 "2019-01-31T03:22:40Z")

</div>

Hello, I am new to Slicer and ITK. I am trying to perform one of the SimpleFilters in my c++ module, but am having trouble getting the right input/output for ITK.

```
const int dim = 3;

typedef unsigned char PType;
typedef itk::Image< PType, dim > IType;

typedef itk::ImageFileReader< IType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(d->InputVolumeNode->GetID());

typedef itk::MeanProjectionImageFilter< IType, IType > FilterType;
FilterType::Pointer filter = FilterType::New();
filter->SetInput(reader->GetOutput());

itk::SimpleFilterWatcher watcher(filter, "filter");

typedef itk::ImageFileWriter< IType > WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetInput(filter->GetOutput());
writer->SetFileName(d->OutputVolumeNode->GetID());
writer->Update();

```

Both InputVolumeNode and OutputVolumeNode are vtkMRMLScalarVolumeNodes. I am assuming I need to convert to MRMLIDImageIO or similar but am having trouble with the code to do so. Any help would be greatly appreciated.

Operating system: Windows 10  
Slicer version: 4.10.0

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [February 2, 2019, 2:58am UTC](https://discourse.slicer.org/t/loadable-module-itk-filters-i-o/5589/2 "2019-02-02T02:58:51Z")

</div>

You need to add this line to `CMakeLists.txt` file of your module:

```
set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt 

```

See source code of all CLI modules as examples: [https://github.com/Slicer/Slicer/tree/master/Modules/CLI](https://github.com/Slicer/Slicer/tree/master/Modules/CLI)
