Description
Hi,
I was used to set all my DICOM images to the 'LPS' orientation before processing them, using the following few lines of code:
orient = sitk.DICOMOrientImageFilter()
orient.SetDesiredCoordinateOrientation("LPS")
image = orient.Execute( image )
On one image series I get the following error:
"Exception thrown in SimpleITK DICOMOrientImageFilter_Execute: /Users/runner/work/1/sitk-build/ITK-prefix/include/ITK-5.2/itkPermuteAxesImageFilter.hxx:100 Order indices must not repeat"
When I print the orientation from coordinates, using orient.GetOrientationFromDirectionCosines (image.GetDirection()), I get INVALID.
The image direction is the following:
(0.5986634407395047, 0.22716302314740483, -0.768113953548866, 0.5627936241740271, 0.563067040943212, 0.6051601804419384, 0.5699696670095713, -0.794576911518317, 0.20924175102261847)
Would you have an idea of why would this direction be invalid?
Thanks in advance!
Activity
blowekamp commentedon Apr 13, 2021
Please add:
orient.DebugOn()to report additional output for what is occurring inside the ITK filter.wwaleww commentedon Apr 13, 2021
I added the debug, and using the following code:
I get the following output:
I hope this gives you more clues on what's the problem, and thanks again!
blowekamp commentedon Apr 22, 2021
I have looked into this issue further. The matrix is orthonormal and has a determinate of 1 so it is valid but it is rather interesting. The first column is:
[ 0.59866344, 0.56279362, 0.56996967]which is really in the middle of all three axis.The DICOMOrientImageFilter only permutes, and flips the axises. It does not do the arbitrary rotation to resample the image so it is exactly in
LPSorientation. It is designed for the simple case of just changing the order of the axises. So for this particular direction the re orientation can not achieve results that are close to the desired LPS orientation.With that said, the numeric computation of the "closest" orientation can be improved so that it is robust to cases similar to this one.
blowekamp commentedon May 28, 2021
Need to verify 2.1rc1 contains this fix.
blowekamp commentedon Aug 26, 2021
This has been fixed in v2.1.0 release.