Replies: 1 comment 1 reply
-
There is a full discussion with detailed math at https://nipy.org/nibabel/dicom/dicom_orientation.html. This also came up on stackoverflow years ago, I did a very rough first pass of simple 2d there. I also contributed to dicompyler-core, some updates related to dose calculation to include decubitus orientations. The meshgrid is in there. I suppose those could be extended to arbitrary angle orientations. If someone wanted to repackage the above for pydicom (or from some other source), I think we could add it. Some of the tests in dicompyler-core could perhaps be ported over too. If general angles wanted, then there would need to be tests added for those. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
It is often necessary to calculate the position of the pixels/voxels in a DICOM file in 3D space.
To do that one has to consider the image position, orientation (row and column vector), pixel spacing, slice distance for multi-slice DICOMs, maybe half-pixel shift, etc. The calculation itself is not difficult, but easy to get wrong.
pydicom could provide a function or property for a Dataset object which returns a NumPy mgrid or meshgrid with the calculated pixel/voxel coordinates.
Beta Was this translation helpful? Give feedback.
All reactions