Hi!
Briefly: is there a way to force ITK to write NRRD version 5 files?
The longer story goes like this. I’m writing nrrd/nhrd files with
using DWIImageType = itk::VectorImage<short, 3>;
DWIImageType::Pointer dwi = DWIImageType::New();
// ... dwi is processed here ..
using WriterType = itk::ImageFileWriter<DWIImageType>;
WriterType::Pointer writer = WriterType::New();
writer->SetInput(dwi);
writer->SetFileName("dwi.nhdr");
writer->Update();
This works fine and the output will be NRRD version 4 (“NRRD0004”). Now, I would need version 5 because v4 does not support NRRD field “measurement frame”. If I add that field into the image e.g. like this
itk::EncapsulateMetaData<std::string>(imgMetaDictionary,
"measurement frame", "(1,0,0) (0,1,0) (0,0,1)");
dwi->SetMetaDataDictionary(imgMetaDictionary);
the output header will look like this
NRRD0004
measurement frame:= (1,0,0) (0,1,0) (0,0,1)
However, in v5 it would look like this
NRRD0005
measurement frame: (1,0,0) (0,1,0) (0,0,1)
The difference is minimal, but for some readers this actually causes problems and the measurement frame field in v4 is not read.
So far my smallest effort solution here has been to simply write v4 and then edit the ascii header (.nhdr) with few lines of code, but it would be nice to be able to actually write v5 in the first place.
We have ITK 5.0.1 (C++) in use and can’t change the version. We also want to avoid installing additonal external libraries just for this simple task.