From 299bbcf1b1602a3ec874280d922f61efd9dcdabf Mon Sep 17 00:00:00 2001 From: jond01 <36337649+jond01@users.noreply.github.com> Date: Fri, 15 May 2020 12:18:00 +0300 Subject: [PATCH 1/5] Update spm_dicom.rst --- doc/source/dicom/spm_dicom.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From f0c0cd8c83901b0e72c9d458de06c7320e692491 Mon Sep 17 00:00:00 2001 From: jond01 <36337649+jond01@users.noreply.github.com> Date: Fri, 15 May 2020 12:24:40 +0300 Subject: [PATCH 2/5] DOC: dicom orientation (-1 + N) -> (N - 1) Better readability --- doc/source/dicom/dicom_orientation.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/dicom/dicom_orientation.rst b/doc/source/dicom/dicom_orientation.rst index 03710450ef..631025c5f0 100644 --- a/doc/source/dicom/dicom_orientation.rst +++ b/doc/source/dicom/dicom_orientation.rst @@ -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,7 +324,7 @@ 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) From 0f86986983ceb7665a84c57c542d16f99f2de966 Mon Sep 17 00:00:00 2001 From: Jonathan Daniel Date: Fri, 15 May 2020 13:08:30 +0300 Subject: [PATCH 3/5] MNT: Added .idea/ to .gitignore (PyCharm) --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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 From 70b0697cc7867d6bfc7302d9a4b11f3d4b1a9838 Mon Sep 17 00:00:00 2001 From: Jonathan Daniel Date: Fri, 15 May 2020 13:08:53 +0300 Subject: [PATCH 4/5] DOC: Added explanation for Spacing Between Slices See: http://dicom.nema.org/MEDICAL/dicom/2015b/output/chtml/part03/sect_C.7.6.16.2.html#table_C.7.6.16-2 --- doc/source/dicom/dicom_orientation.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/source/dicom/dicom_orientation.rst b/doc/source/dicom/dicom_orientation.rst index 631025c5f0..ce90c24ef2 100644 --- a/doc/source/dicom/dicom_orientation.rst +++ b/doc/source/dicom/dicom_orientation.rst @@ -243,7 +243,11 @@ 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. +* $\Delta{s}$ - Spacing in mm between slices, given by the Spacing + Between Slices (0018,0088) attribute in units of mm (if exists). + Can also be calculated from the Image Orientation (Patient) of + multiple slices together with Image Orientation (Patient), as + explained in :ref:`dicom-affine-defs`. .. _dicom-3d-affines: From 5dcdccd080e69e345baea28b09fb4b8618015720 Mon Sep 17 00:00:00 2001 From: Jonathan Daniel Date: Mon, 18 May 2020 20:44:03 +0300 Subject: [PATCH 5/5] DOC: Moved Spacing Between Slices to a note Related to N=1, A_{single} --- doc/source/dicom/dicom_orientation.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/source/dicom/dicom_orientation.rst b/doc/source/dicom/dicom_orientation.rst index ce90c24ef2..f4d66ae979 100644 --- a/doc/source/dicom/dicom_orientation.rst +++ b/doc/source/dicom/dicom_orientation.rst @@ -242,12 +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, given by the Spacing - Between Slices (0018,0088) attribute in units of mm (if exists). - Can also be calculated from the Image Orientation (Patient) of - multiple slices together with Image Orientation (Patient), as - explained in :ref:`dicom-affine-defs`. +* $s$ : Slice index to the slice plane. The first slice index is zero. +* $\Delta{s}$ - Spacing in mm between slices. .. _dicom-3d-affines: @@ -335,6 +331,10 @@ and therefore: 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