diff --git a/.gitignore b/.gitignore index e876975c27..1ba201f711 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ .pydevproject *.py.orig .DS_Store +.idea/ # Not sure what the next one is for *.kpf diff --git a/doc/source/dicom/dicom_orientation.rst b/doc/source/dicom/dicom_orientation.rst index 03710450ef..f4d66ae979 100644 --- a/doc/source/dicom/dicom_orientation.rst +++ b/doc/source/dicom/dicom_orientation.rst @@ -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: @@ -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: @@ -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 diff --git a/doc/source/dicom/spm_dicom.rst b/doc/source/dicom/spm_dicom.rst index f1c4477543..8c89e0ecda 100644 --- a/doc/source/dicom/spm_dicom.rst +++ b/doc/source/dicom/spm_dicom.rst @@ -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)