Hi all,
I’d like to read an NRRD volume that looks like this:
type: int
dimension: 4
space: right-anterior-superior
sizes: 26 102 102 61
kinds: list domain domain domain
I have this code that is supposed to do the reading:
constexpr unsigned int ImageDimension = 3;
using ImageType = itk::Image<PixelType, ImageDimension>;
using ReaderType = itk::ImageFileReader<ImageType>;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(self->GetFileName());
reader->Update();
ImageType::ConstPointer image = reader->GetOutput();
PixelType
is itk::Vector<int>
for example. As you see from the NRRD we expect reading in 26 components in each voxel (contains the frames of a sequence), but the default vector type only reads 3 components.
Can you think of a way to allow reading in a variable size vector for each voxel? May it be 3, or 26, or more? One problem is that I cannot pass variables as template arguments due to the limitations, which really make developing this feature hard.
By the way this snippet comes from a new vtkITKImageSequenceReader
class in Slicer, in this branch.
I also improved the ITK NRRD reader to support more complex cases (both component axis and list axis), in this branch. (However, this is not strictly needed for the actual question, but will be part of the whole improvement)
Thanks a lot!