Skip to content

Commit 335d859

Browse files
Merge pull request #910 from jond01/master
MRG: Dicom doc. improvement Some improvements for the Dicom documentation, as suggested in this PR: - (-1 + N) in the affine formulas -> (N - 1) for better readability - Further explanation about slice spacing (\Delta{s}) - Small typo
2 parents bfde527 + 5dcdccd commit 335d859

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
.pydevproject
1818
*.py.orig
1919
.DS_Store
20+
.idea/
2021

2122
# Not sure what the next one is for
2223
*.kpf

doc/source/dicom/dicom_orientation.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ Where:
242242

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

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

248248
.. _dicom-3d-affines:
249249

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

308308
.. math::
309309
310-
\left(\begin{smallmatrix}T^N\\1\end{smallmatrix}\right) = A \left(\begin{smallmatrix}0\\0\\-1 + N\\1\end{smallmatrix}\right)
310+
\left(\begin{smallmatrix}T^N\\1\end{smallmatrix}\right) = A \left(\begin{smallmatrix}0\\0\\N - 1\\1\end{smallmatrix}\right)
311311
312312
From this it follows that:
313313

314314
.. math::
315315
316-
\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}
316+
\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}
317317
318318
and therefore:
319319

@@ -324,13 +324,17 @@ and therefore:
324324

325325
.. math::
326326
327-
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)
327+
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)
328328
329329
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)
330330
331331
See :download:`derivations/spm_dicom_orient.py` for the derivations and
332332
some explanations.
333333

334+
For a single slice $N=1$ the affine matrix is $A_{single}$. In this
335+
case, the slice spacing $\Delta{s}$ may be obtained by the Spacing
336+
Between Slices (0018,0088) attribute in units of mm, if it exists.
337+
334338
.. _dicom-z-from-slice:
335339

336340
Working out the Z coordinates for a set of slices

doc/source/dicom/spm_dicom.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Then, for each currently identified volume:
156156
#. ImageOrientationPatient (to tolerance of sum squared difference 1e-4)
157157
#. PixelSpacing (to tolerance of sum squared difference 1e-4)
158158
#. ICE dims as defined above
159-
#. ImageType (iff imagetype exists in both)zv
159+
#. ImageType (iff imagetype exists in both)
160160
#. SequenceName (iff sequencename exists in both)
161161
#. SeriesInstanceUID (iff exists in both)
162162
#. EchoNumbers (iff exists in both)

0 commit comments

Comments
 (0)