We have a lot of dicom images with negative spacing when we convert them to ITK mhd format (always a mystery for me) And it could lead to a lot of bug in another tools (crop, stitch, ...).
So I suggest to add an option in gt_image_convert to be able to remove this negative spacing using gt_affine_transform automatically with:
And by extension to remove the non-identity directions too.
We can call this option:
@click.option('-r', '--resample', flag=True, help='Remove negative spacing and non-identity direction')
Moreover, with python ITK v5.1rc2, it is not correctly handled because with an image with a spacing in the .mhd: 4 4 -4. When I open it with python ITK
It's not a bug, but it could be a feature:
We have a lot of dicom images with negative spacing when we convert them to ITK mhd format (always a mystery for me) And it could lead to a lot of bug in another tools (crop, stitch, ...). So I suggest to add an option in gt_image_convert to be able to remove this negative spacing using gt_affine_transform automatically with:
And by extension to remove the non-identity directions too. We can call this option:
Moreover, with python ITK v5.1rc2, it is not correctly handled because with an image with a spacing in the .mhd: 4 4 -4. When I open it with python ITK
the output is:
It is a feature of ITK: https://github.com/InsightSoftwareConsortium/ITK/commit/7501479a970694b0dd4a8c4bbf7cbcc033fe059c https://github.com/InsightSoftwareConsortium/ITK/commit/7501479a970694b0dd4a8c4bbf7cbcc033fe059c
What do you think?