I got a .dcm serie of images with gantry tilt. I loaded them with ITK5.1 and ITK4.10, but both of them give a skewed image. Using Dicom2Nifti doesn’t have this problem. Photo as example:
This is the code I use:
auto volumeReader = itk::ImageSeriesReader<InputShortImageType>::New();
volumeReader->SetForceOrthogonalDirection(false); // Doesn't solve gantry tilt problem
auto movinggdcmIO = itk::GDCMImageIO::New();
auto volumeInputNamesGenerator = itk::GDCMSeriesFileNames::New();
Is there anything I am overlooking?
Also, you are viewing the image using ITK-SNAP, which ignores non-orthogonal basis vectors. Try visualizing the images using 3D Slicer, which has better support for it.
Hey @dzenanz, thanks for the swift reply!
Interesting enough, it indeed does work when exporting to .nrrd and visualised with 3d-Slicer
:o However, all other ways are skewed. (.nii with 3d-slicer is skewed, .nrrd with ITK-Snap is skewed, .nrrd with an older VTK)
It look like the meta date of the .dcm files is passed trough to the .nrrd. Maybe, is there a way to resample the image to an orthogonal axis system?
Of course! By the looks of it, that’s what Dicom2Nifti does. @bpaniagua is the tool from craniosynostosis project publicly available? If not, translating dicom2nifti resample into ITK is not trivial, but should not be hard.
If you want to have image with correct geometry and orthogonal axes then you need to resample the image.
You can do this in 3D Slicer by enabling regularization (application settings / DICOM / DICOMScalarVolumePlugin / Acquisition geometry regularization -> apply regularization transform) and resampling the volume by Crop volume module (or other resampling modules).
I would not recommend porting dicom2nifti’s simplistic approach to ITK, as it can only deal with tilted-gantry acquisition, but fails for other non-regularities, such as non-uniform slice spacing. 3D Slicer’s implementation builds a grid transform from all transformed slice corner points, which is simpler, more elegant, and it correctly handles all kinds of non-regularities.