Commit 4486c2065a7b13ed7c0527fff9a29c1573a4b10c

Authored by Paulo Henrique Junqueira Amorim
1 parent 8d148544

ENH: Returned dialog while generating MPR

invesalius/data/imagedata_utils.py
... ... @@ -461,6 +461,9 @@ def dcm2memmap(files, slice_size, orientation):
461 461 From a list of dicom files it creates memmap file in the temp folder and
462 462 returns it and its related filename.
463 463 """
  464 + message = _("Generating multiplanar visualization...")
  465 + update_progress= vtk_utils.ShowProgress(len(files), dialog_type = "ProgressDialog")
  466 +
464 467 temp_file = tempfile.mktemp()
465 468  
466 469 if orientation == 'SAGITTAL':
... ... @@ -472,6 +475,7 @@ def dcm2memmap(files, slice_size, orientation):
472 475 print shape
473 476 matrix = numpy.memmap(temp_file, mode='w+', dtype='int16', shape=shape)
474 477 dcm_reader = vtkgdcm.vtkGDCMImageReader()
  478 + cont = 0
475 479 for n, f in enumerate(files):
476 480 dcm_reader.SetFileName(f)
477 481 dcm_reader.Update()
... ... @@ -486,6 +490,8 @@ def dcm2memmap(files, slice_size, orientation):
486 490 else:
487 491 array.shape = matrix.shape[1], matrix.shape[2]
488 492 matrix[n] = array
  493 + update_progress(cont,message)
  494 + cont += 1
489 495  
490 496 matrix.flush()
491 497 return matrix, temp_file
... ...
invesalius/reader/dicom_reader.py
... ... @@ -86,27 +86,21 @@ tag_labels = {}
86 86 main_dict = {}
87 87 dict_file = {}
88 88  
89   -class LoadDicom:#(threading.Thread):
  89 +class LoadDicom:
90 90  
91 91 def __init__(self, grouper, filepath):
92   - #threading.Thread.__init__(self)
93 92 self.grouper = grouper
94 93 if sys.platform == 'win32':
95 94 self.filepath = filepath.encode(utils.get_system_encoding())
96 95 else:
97 96 self.filepath = filepath
  97 +
98 98 self.run()
99 99  
100 100 def run(self):
101 101  
102 102 grouper = self.grouper
103 103  
104   - #while 1:
105   -
106   - #filepath = q.get()
107   - #if not filepath:
108   - # break
109   -
110 104 reader = gdcm.Reader()
111 105 reader.SetFileName(self.filepath)
112 106  
... ...