Nifti: ImageFileReader + ImageFileWriter changes orientation matrix

Hi,

I’m reading a Nifti File and writing it back without applying any other filter:

using ReaderType = itk::ImageFileReader;
ReaderType::Pointer in=ReaderType::New();
in->SetFileName( ifname );
in->Update();

using WriterType = itk::ImageFileWriter< ImageType >;
WriterType::Pointer writer = WriterType::New();
writer->SetFileName( ofname );
writer->SetInput( in->GetOutput() );
writer->Update();

This modifies [qs]form_code from ALIGNED_ANAT to SCANNER_ANAT and the matrix
from:
srow_x = -0.428775 0.0278672 -0.0339817 90.6655
srow_y = 0.0272898 0.425193 0.712428 -117.436
srow_z = -0.00623679 -0.0553715 5.45356 -28.6827

to:
srow_x = -0.428775 0.0278674 -0.034018 90.6655
srow_y = 0.0272896 0.425193 0.712429 -117.436
srow_z = -0.00623959 -0.0553715 5.45356 -28.6827

What is the reason for this modification?

Regards,
Christina

Loss of precision. See these:

6 posts were split to a new topic: File format for general-purpose medical image computing

The difference to the problem described by RaC in the first answer is that I’m reading a Nifti file which should already be limited in precision, so it’s not a precision but a orthogonalization problem. My input Nifti was created with Matlab which seems to be more relaxed wrt orthogonality.

And yes: I’m working in the neuroimaging field.