Loadable module ITK filters I/O

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

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