The vtkNIFTIImageHeader class is based on the nifti_1_header struct from niftilib. I’m not sure if it’s 100% compatible with nifti1_io.h
since I’ve never used the latter.
But using vtkNIFTIImageHeader isn’t going to be of use here, because vtkNIFTIImageReader itself cannot read from memory, only from disk.
The vtkImageImport class can, indeed, be used. You can assume that the endianness of your image-in-memory is already correct, since native endianness is used almost universally for images in memory and is only switched for input/output.
For vtkImageImport, use either the SetImportVoidPointer()
or CopyInputVoidPointer()
to import your vector data. You’ll also need
SetScalarTypeToFloat()
or Double()
, depending on which you are using, and SetDataExtent()
, SetDataSpacing()
, SetNumberOfComponents(3)
.
E.g. for a 256x256x128 volume, use SetDataExtent(0, 255, 0, 255, 0, 127)
.
Also, vtkImageImport expects vector data to be packed, e.g. XYZXYZXYZ… (not XXX… YYY… ZZZ…)