From 4486c2065a7b13ed7c0527fff9a29c1573a4b10c Mon Sep 17 00:00:00 2001 From: paulojamorim Date: Fri, 3 Dec 2010 17:31:50 +0000 Subject: [PATCH] ENH: Returned dialog while generating MPR --- invesalius/data/imagedata_utils.py | 6 ++++++ invesalius/reader/dicom_reader.py | 10 ++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/invesalius/data/imagedata_utils.py b/invesalius/data/imagedata_utils.py index bd0c8d4..173b76c 100644 --- a/invesalius/data/imagedata_utils.py +++ b/invesalius/data/imagedata_utils.py @@ -461,6 +461,9 @@ def dcm2memmap(files, slice_size, orientation): From a list of dicom files it creates memmap file in the temp folder and returns it and its related filename. """ + message = _("Generating multiplanar visualization...") + update_progress= vtk_utils.ShowProgress(len(files), dialog_type = "ProgressDialog") + temp_file = tempfile.mktemp() if orientation == 'SAGITTAL': @@ -472,6 +475,7 @@ def dcm2memmap(files, slice_size, orientation): print shape matrix = numpy.memmap(temp_file, mode='w+', dtype='int16', shape=shape) dcm_reader = vtkgdcm.vtkGDCMImageReader() + cont = 0 for n, f in enumerate(files): dcm_reader.SetFileName(f) dcm_reader.Update() @@ -486,6 +490,8 @@ def dcm2memmap(files, slice_size, orientation): else: array.shape = matrix.shape[1], matrix.shape[2] matrix[n] = array + update_progress(cont,message) + cont += 1 matrix.flush() return matrix, temp_file diff --git a/invesalius/reader/dicom_reader.py b/invesalius/reader/dicom_reader.py index 9562531..a1f092b 100644 --- a/invesalius/reader/dicom_reader.py +++ b/invesalius/reader/dicom_reader.py @@ -86,27 +86,21 @@ tag_labels = {} main_dict = {} dict_file = {} -class LoadDicom:#(threading.Thread): +class LoadDicom: def __init__(self, grouper, filepath): - #threading.Thread.__init__(self) self.grouper = grouper if sys.platform == 'win32': self.filepath = filepath.encode(utils.get_system_encoding()) else: self.filepath = filepath + self.run() def run(self): grouper = self.grouper - #while 1: - - #filepath = q.get() - #if not filepath: - # break - reader = gdcm.Reader() reader.SetFileName(self.filepath) -- libgit2 0.21.2