[med-svn] [invesalius] 01/01: d/p/20: Fix import of dicom serie with one unique slice, Closes: #779655

Thiago Franco Moraes tfmoraes-guest at moszumanska.debian.org
Fri Sep 15 13:48:54 UTC 2017


This is an automated email from the git hooks/post-receive script.

tfmoraes-guest pushed a commit to branch master
in repository invesalius.

commit 3903e7f8c298943bb0cf3dc62f5417ce4f1c4933
Author: Thiago Franco de Moraes <totonixsame at gmail.com>
Date:   Fri Sep 15 10:47:34 2017 -0300

    d/p/20: Fix import of dicom serie with one unique slice, Closes: #779655
---
 debian/patches/20_fix_one_slice_import.patch | 84 ++++++++++++++++++++++++++++
 debian/patches/series                        |  2 +-
 2 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/debian/patches/20_fix_one_slice_import.patch b/debian/patches/20_fix_one_slice_import.patch
new file mode 100644
index 0000000..08b231e
--- /dev/null
+++ b/debian/patches/20_fix_one_slice_import.patch
@@ -0,0 +1,84 @@
+Description: Fix import of dicom serie with one unique slice.
+Author: Thiago Franco de Moraes <tfmoraes at cti.gov.br>
+Debian-Bug: https://bugs.debian.org/779655
+
+--- a/invesalius/control.py
++++ b/invesalius/control.py
+@@ -408,6 +408,10 @@ class Controller():
+ 
+     def OnLoadImportPanel(self, evt):
+         patient_series = evt.data
++        if self.progress_dialog:
++            self.progress_dialog.Close()
++            self.progress_dialog = None
++
+         ok = self.LoadImportPanel(patient_series)
+         if ok:
+             Publisher.sendMessage('Show import panel')
+--- a/invesalius/data/imagedata_utils.py
++++ b/invesalius/data/imagedata_utils.py
+@@ -523,7 +523,8 @@ def dcm2memmap(files, slice_size, orientation, resolution_percentage):
+     returns it and its related filename.
+     """
+     message = _("Generating multiplanar visualization...")
+-    update_progress= vtk_utils.ShowProgress(len(files) - 1, dialog_type = "ProgressDialog")
++    if len(files) > 1:
++        update_progress= vtk_utils.ShowProgress(len(files) - 1, dialog_type = "ProgressDialog")
+ 
+     temp_file = tempfile.mktemp()
+ 
+@@ -584,7 +585,8 @@ def dcm2memmap(files, slice_size, orientation, resolution_percentage):
+         else:
+             array.shape = matrix.shape[1], matrix.shape[2]
+             matrix[n] = array
+-        update_progress(cont,message)
++        if len(files) > 1:
++            update_progress(cont,message)
+         cont += 1
+ 
+     matrix.flush()
+--- a/invesalius/data/slice_.py
++++ b/invesalius/data/slice_.py
+@@ -633,7 +633,7 @@ class Slice(object):
+                 if np.any(self.q_orientation[1::]):
+                     transforms.apply_view_matrix_transform(self.matrix, self.spacing, M, slice_number, orientation, self.interp_method, self.matrix.min(), tmp_array)
+                 if self._type_projection == const.PROJECTION_NORMAL:
+-                    n_image = tmp_array.squeeze()
++                    n_image = tmp_array[0]
+                 else:
+                     if inverted:
+                         tmp_array = tmp_array[::-1]
+@@ -681,7 +681,7 @@ class Slice(object):
+                     transforms.apply_view_matrix_transform(self.matrix, self.spacing, M, slice_number, orientation, self.interp_method, self.matrix.min(), tmp_array)
+ 
+                 if self._type_projection == const.PROJECTION_NORMAL:
+-                    n_image = tmp_array.squeeze()
++                    n_image = tmp_array[:, 0, :]
+                 else:
+                     #if slice_number == 0:
+                         #slice_number = 1
+@@ -731,7 +731,7 @@ class Slice(object):
+                     transforms.apply_view_matrix_transform(self.matrix, self.spacing, M, slice_number, orientation, self.interp_method, self.matrix.min(), tmp_array)
+ 
+                 if self._type_projection == const.PROJECTION_NORMAL:
+-                    n_image = tmp_array.squeeze()
++                    n_image = tmp_array[:, :, 0]
+                 else:
+                     if inverted:
+                         tmp_array = tmp_array[:, :, ::-1]
+--- a/invesalius/gui/import_panel.py
++++ b/invesalius/gui/import_panel.py
+@@ -186,11 +186,8 @@ class InnerPanel(wx.Panel):
+                 slice_amont = group.nslices
+ 
+         nslices_result = slice_amont / (interval + 1)
+-        if (nslices_result > 1):
+-            Publisher.sendMessage('Open DICOM group', (group, interval, 
+-                                    [self.first_image_selection, self.last_image_selection]))
+-        else:
+-            dlg.MissingFilesForReconstruction()
++        Publisher.sendMessage('Open DICOM group', (group, interval, 
++                                [self.first_image_selection, self.last_image_selection]))
+ 
+ class TextPanel(wx.Panel):
+     def __init__(self, parent):
diff --git a/debian/patches/series b/debian/patches/series
index 9ea65a7..d36421d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,3 @@
 10_sample_path.patch
 10_import_cython_modules.patch
-20_fix_division_by_zero.patch
+20_fix_one_slice_import.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/invesalius.git



More information about the debian-med-commit mailing list