Commit 0aca2ead23a31813c3eb5d4f861a305f13a43ec4
1 parent
0759123d
Exists in
master
and in
67 other branches
FIX: Returned DICOM importation from GUI
Showing
2 changed files
with
15 additions
and
5 deletions
Show diff stats
invesalius/gui/dicom_preview_panel.py
... | ... | @@ -33,7 +33,7 @@ import constants as const |
33 | 33 | from reader import dicom_reader |
34 | 34 | import data.vtk_utils as vtku |
35 | 35 | import utils |
36 | - | |
36 | +import vtkgdcm | |
37 | 37 | NROWS = 3 |
38 | 38 | NCOLS = 6 |
39 | 39 | NUM_PREVIEWS = NCOLS*NROWS |
... | ... | @@ -105,11 +105,15 @@ class DicomInfo(object): |
105 | 105 | |
106 | 106 | @property |
107 | 107 | def preview(self): |
108 | + rdicom = vtkgdcm.vtkGDCMImageReader() | |
108 | 109 | if self._preview: |
109 | 110 | return self._preview |
110 | 111 | else: |
112 | + rdicom.SetFileName(self.dicom.image.file) | |
113 | + rdicom.Update() | |
114 | + | |
111 | 115 | colorer = vtk.vtkImageMapToWindowLevelColors() |
112 | - colorer.SetInput(self.dicom.image.imagedata) | |
116 | + colorer.SetInput(rdicom.GetOutput()) | |
113 | 117 | colorer.SetWindow(float(self.dicom.image.window)) |
114 | 118 | colorer.SetLevel(float(self.dicom.image.level)) |
115 | 119 | colorer.SetOutputFormatToRGB() |
... | ... | @@ -770,12 +774,17 @@ class SingleImagePreview(wx.Panel): |
770 | 774 | value = STR_ACQ % (dicom.acquisition.date, |
771 | 775 | dicom.acquisition.time) |
772 | 776 | self.text_acquisition.SetValue(value) |
777 | + | |
778 | + | |
779 | + rdicom = vtkgdcm.vtkGDCMImageReader() | |
780 | + rdicom.SetFileName(dicom.image.file) | |
781 | + rdicom.Update() | |
773 | 782 | |
774 | 783 | # ADJUST CONTRAST |
775 | 784 | window_level = dicom.image.level |
776 | 785 | window_width = dicom.image.window |
777 | 786 | colorer = vtk.vtkImageMapToWindowLevelColors() |
778 | - colorer.SetInput(dicom.image.imagedata) | |
787 | + colorer.SetInput(rdicom.GetOutput()) | |
779 | 788 | colorer.SetWindow(float(window_width)) |
780 | 789 | colorer.SetLevel(float(window_level)) |
781 | 790 | ... | ... |
invesalius/reader/dicom.py
... | ... | @@ -91,6 +91,7 @@ class Parser(): |
91 | 91 | def __init__(self): |
92 | 92 | self.filename = "" |
93 | 93 | self.encoding = "" |
94 | + self.filepath = "" | |
94 | 95 | |
95 | 96 | #def SetFileName(self, filename): |
96 | 97 | """ |
... | ... | @@ -140,7 +141,7 @@ class Parser(): |
140 | 141 | |
141 | 142 | def SetDataImage(self, data_image, filename): |
142 | 143 | self.data_image = data_image |
143 | - self.filename = filename | |
144 | + self.filename = self.filepath = filename | |
144 | 145 | |
145 | 146 | def __format_time(self,value): |
146 | 147 | sp1 = value.split(".") |
... | ... | @@ -1240,7 +1241,7 @@ class Parser(): |
1240 | 1241 | DICOM standard tag (0x0010, 0x1010) was used. |
1241 | 1242 | """ |
1242 | 1243 | try: |
1243 | - data = self.data_image['0010']['0010'] | |
1244 | + data = self.data_image['0010']['1010'] | |
1244 | 1245 | except(KeyError): |
1245 | 1246 | return "" |
1246 | 1247 | ... | ... |