Skip to content

DOC: Dicom doc. improvement #910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
.pydevproject
*.py.orig
.DS_Store
.idea/

# Not sure what the next one is for
*.kpf
Expand Down
14 changes: 9 additions & 5 deletions doc/source/dicom/dicom_orientation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ Where:

For later convenience we also define values useful for 3D volumes:

* $s$ : slice index to the slice plane. The first slice index is zero.
* $\Delta{s}$ - spacing in mm between slices.
* $s$ : Slice index to the slice plane. The first slice index is zero.
* $\Delta{s}$ - Spacing in mm between slices.

.. _dicom-3d-affines:

Expand Down Expand Up @@ -307,13 +307,13 @@ first voxel in the last (slice index = $N-1$) slice to mm space. So:

.. math::

\left(\begin{smallmatrix}T^N\\1\end{smallmatrix}\right) = A \left(\begin{smallmatrix}0\\0\\-1 + N\\1\end{smallmatrix}\right)
\left(\begin{smallmatrix}T^N\\1\end{smallmatrix}\right) = A \left(\begin{smallmatrix}0\\0\\N - 1\\1\end{smallmatrix}\right)

From this it follows that:

.. math::

\begin{Bmatrix}k_{{1}} : \frac{T^{1}_{{1}} - T^{N}_{{1}}}{1 - N}, & k_{{2}} : \frac{T^{1}_{{2}} - T^{N}_{{2}}}{1 - N}, & k_{{3}} : \frac{T^{1}_{{3}} - T^{N}_{{3}}}{1 - N}\end{Bmatrix}
\begin{Bmatrix}k_{{1}} : \frac{T^{N}_{{1}} - T^{1}_{{1}}}{N - 1}, & k_{{2}} : \frac{T^{N}_{{2}} - T^{1}_{{2}}}{N - 1}, & k_{{3}} : \frac{T^{N}_{{3}} - T^{1}_{{3}}}{N - 1}\end{Bmatrix}

and therefore:

Expand All @@ -324,13 +324,17 @@ and therefore:

.. math::

A_{multi} = \left(\begin{smallmatrix}F_{{11}} \Delta{r} & F_{{12}} \Delta{c} & \frac{T^{1}_{{1}} - T^{N}_{{1}}}{1 - N} & T^{1}_{{1}}\\F_{{21}} \Delta{r} & F_{{22}} \Delta{c} & \frac{T^{1}_{{2}} - T^{N}_{{2}}}{1 - N} & T^{1}_{{2}}\\F_{{31}} \Delta{r} & F_{{32}} \Delta{c} & \frac{T^{1}_{{3}} - T^{N}_{{3}}}{1 - N} & T^{1}_{{3}}\\0 & 0 & 0 & 1\end{smallmatrix}\right)
A_{multi} = \left(\begin{smallmatrix}F_{{11}} \Delta{r} & F_{{12}} \Delta{c} & \frac{T^{N}_{{1}} - T^{1}_{{1}}}{N - 1} & T^{1}_{{1}}\\F_{{21}} \Delta{r} & F_{{22}} \Delta{c} & \frac{T^{N}_{{2}} - T^{1}_{{2}}}{N - 1} & T^{1}_{{2}}\\F_{{31}} \Delta{r} & F_{{32}} \Delta{c} & \frac{T^{N}_{{3}} - T^{1}_{{3}}}{N - 1} & T^{1}_{{3}}\\0 & 0 & 0 & 1\end{smallmatrix}\right)

A_{single} = \left(\begin{smallmatrix}F_{{11}} \Delta{r} & F_{{12}} \Delta{c} & \Delta{s} n_{{1}} & T^{1}_{{1}}\\F_{{21}} \Delta{r} & F_{{22}} \Delta{c} & \Delta{s} n_{{2}} & T^{1}_{{2}}\\F_{{31}} \Delta{r} & F_{{32}} \Delta{c} & \Delta{s} n_{{3}} & T^{1}_{{3}}\\0 & 0 & 0 & 1\end{smallmatrix}\right)

See :download:`derivations/spm_dicom_orient.py` for the derivations and
some explanations.

For a single slice $N=1$ the affine matrix is $A_{single}$. In this
case, the slice spacing $\Delta{s}$ may be obtained by the Spacing
Between Slices (0018,0088) attribute in units of mm, if it exists.

.. _dicom-z-from-slice:

Working out the Z coordinates for a set of slices
Expand Down
2 changes: 1 addition & 1 deletion doc/source/dicom/spm_dicom.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Then, for each currently identified volume:
#. ImageOrientationPatient (to tolerance of sum squared difference 1e-4)
#. PixelSpacing (to tolerance of sum squared difference 1e-4)
#. ICE dims as defined above
#. ImageType (iff imagetype exists in both)zv
#. ImageType (iff imagetype exists in both)
#. SequenceName (iff sequencename exists in both)
#. SeriesInstanceUID (iff exists in both)
#. EchoNumbers (iff exists in both)
Expand Down