From 0aca2ead23a31813c3eb5d4f861a305f13a43ec4 Mon Sep 17 00:00:00 2001 From: paulojamorim Date: Thu, 2 Dec 2010 13:07:50 +0000 Subject: [PATCH] FIX: Returned DICOM importation from GUI --- invesalius/gui/dicom_preview_panel.py | 15 ++++++++++++--- invesalius/reader/dicom.py | 5 +++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/invesalius/gui/dicom_preview_panel.py b/invesalius/gui/dicom_preview_panel.py index 9956934..d7f4f32 100755 --- a/invesalius/gui/dicom_preview_panel.py +++ b/invesalius/gui/dicom_preview_panel.py @@ -33,7 +33,7 @@ import constants as const from reader import dicom_reader import data.vtk_utils as vtku import utils - +import vtkgdcm NROWS = 3 NCOLS = 6 NUM_PREVIEWS = NCOLS*NROWS @@ -105,11 +105,15 @@ class DicomInfo(object): @property def preview(self): + rdicom = vtkgdcm.vtkGDCMImageReader() if self._preview: return self._preview else: + rdicom.SetFileName(self.dicom.image.file) + rdicom.Update() + colorer = vtk.vtkImageMapToWindowLevelColors() - colorer.SetInput(self.dicom.image.imagedata) + colorer.SetInput(rdicom.GetOutput()) colorer.SetWindow(float(self.dicom.image.window)) colorer.SetLevel(float(self.dicom.image.level)) colorer.SetOutputFormatToRGB() @@ -770,12 +774,17 @@ class SingleImagePreview(wx.Panel): value = STR_ACQ % (dicom.acquisition.date, dicom.acquisition.time) self.text_acquisition.SetValue(value) + + + rdicom = vtkgdcm.vtkGDCMImageReader() + rdicom.SetFileName(dicom.image.file) + rdicom.Update() # ADJUST CONTRAST window_level = dicom.image.level window_width = dicom.image.window colorer = vtk.vtkImageMapToWindowLevelColors() - colorer.SetInput(dicom.image.imagedata) + colorer.SetInput(rdicom.GetOutput()) colorer.SetWindow(float(window_width)) colorer.SetLevel(float(window_level)) diff --git a/invesalius/reader/dicom.py b/invesalius/reader/dicom.py index 4406ae8..b2796cf 100644 --- a/invesalius/reader/dicom.py +++ b/invesalius/reader/dicom.py @@ -91,6 +91,7 @@ class Parser(): def __init__(self): self.filename = "" self.encoding = "" + self.filepath = "" #def SetFileName(self, filename): """ @@ -140,7 +141,7 @@ class Parser(): def SetDataImage(self, data_image, filename): self.data_image = data_image - self.filename = filename + self.filename = self.filepath = filename def __format_time(self,value): sp1 = value.split(".") @@ -1240,7 +1241,7 @@ class Parser(): DICOM standard tag (0x0010, 0x1010) was used. """ try: - data = self.data_image['0010']['0010'] + data = self.data_image['0010']['1010'] except(KeyError): return "" -- libgit2 0.21.2