@@ -242,8 +242,8 @@ Where:
242242
243243For 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- * $\D elta{s}$ - spacing in mm between slices.
245+ * $s$ : Slice index to the slice plane. The first slice index is zero.
246+ * $\D elta{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
332332some explanations.
333333
334+ For a single slice $N=1$ the affine matrix is $A_{single}$. In this
335+ case, the slice spacing $\D elta{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
336340Working out the Z coordinates for a set of slices
0 commit comments