Commit 994c846ff487d324ddb7f026c33358414a0bc288

Authored by Paulo Henrique Junqueira Amorim
1 parent cf6af70c

ENH: Redesign previous implementation, (Crash open CORONAL slices)

invesalius/reader/dicom_grouper.py
@@ -121,7 +121,6 @@ class ivDicomGroups: @@ -121,7 +121,6 @@ class ivDicomGroups:
121 spacing = parser.GetPixelSpacing() 121 spacing = parser.GetPixelSpacing()
122 id_study = parser.GetStudyID() 122 id_study = parser.GetStudyID()
123 tilt = parser.GetAcquisitionGantryTilt() 123 tilt = parser.GetAcquisitionGantryTilt()
124 - localization = parser.GetImageLocation()  
125 124
126 if (parser.GetImageThickness()): 125 if (parser.GetImageThickness()):
127 spacing.append(parser.GetImageThickness()) 126 spacing.append(parser.GetImageThickness())
@@ -136,7 +135,7 @@ class ivDicomGroups: @@ -136,7 +135,7 @@ class ivDicomGroups:
136 image_position, patient_position, 135 image_position, patient_position,
137 image_type,patient_name, 136 image_type,patient_name,
138 image_orientation_label, file, 137 image_orientation_label, file,
139 - series_description, id_study, tilt, localization]) 138 + series_description, id_study, tilt])
140 self.filelist = filelist 139 self.filelist = filelist
141 140
142 def __GetInformations(self, ind): 141 def __GetInformations(self, ind):
@@ -161,14 +160,12 @@ class ivDicomGroups: @@ -161,14 +160,12 @@ class ivDicomGroups:
161 series_description = filelist[ind][9] 160 series_description = filelist[ind][9]
162 id_study = filelist[ind][10] 161 id_study = filelist[ind][10]
163 tilt = filelist[ind][11] 162 tilt = filelist[ind][11]
164 - localization = filelist[ind][12]  
165 163
166 list = [image_number, serie_number, spacing, 164 list = [image_number, serie_number, spacing,
167 image_position, patient_position, 165 image_position, patient_position,
168 image_type,patient_name, 166 image_type,patient_name,
169 image_orientation_label, file, 167 image_orientation_label, file,
170 - series_description, id_study, tilt,  
171 - localization] 168 + series_description, id_study, tilt]
172 169
173 return list 170 return list
174 171
@@ -314,7 +311,6 @@ class ivDicomGroups: @@ -314,7 +311,6 @@ class ivDicomGroups:
314 series_description = groups_dcm[key][0][y][9] 311 series_description = groups_dcm[key][0][y][9]
315 id_study = groups_dcm[key][0][y][10] 312 id_study = groups_dcm[key][0][y][10]
316 tilt = groups_dcm[key][0][y][11] 313 tilt = groups_dcm[key][0][y][11]
317 - localization = groups_dcm[key][0][y][12]  
318 314
319 #Generate new key to dictionary 315 #Generate new key to dictionary
320 key_ = (image_pos[0], image_pos[1], image_pos[2]) 316 key_ = (image_pos[0], image_pos[1], image_pos[2])
@@ -324,7 +320,7 @@ class ivDicomGroups: @@ -324,7 +320,7 @@ class ivDicomGroups:
324 image_position, patient_position, 320 image_position, patient_position,
325 image_type,patient_name, 321 image_type,patient_name,
326 image_orientation_label, file, 322 image_orientation_label, file,
327 - series_description, id_study, tilt, localization] 323 + series_description, id_study, tilt]
328 324
329 #If list Null, create dictionary 325 #If list Null, create dictionary
330 #and add list with information 326 #and add list with information
@@ -383,7 +379,6 @@ class ivDicomGroups: @@ -383,7 +379,6 @@ class ivDicomGroups:
383 series_description = tmp1[key][9] 379 series_description = tmp1[key][9]
384 id_study = tmp1[key][10] 380 id_study = tmp1[key][10]
385 tilt = tmp1[key][11] 381 tilt = tmp1[key][11]
386 - localization = tmp1[key][12]  
387 382
388 new_key = (patient_name, None, x, image_orientation_label) 383 new_key = (patient_name, None, x, image_orientation_label)
389 384
@@ -392,8 +387,7 @@ class ivDicomGroups: @@ -392,8 +387,7 @@ class ivDicomGroups:
392 image_position, patient_position, 387 image_position, patient_position,
393 image_type,patient_name, 388 image_type,patient_name,
394 image_orientation_label, file, 389 image_orientation_label, file,
395 - series_description, id_study, tilt,  
396 - localization] 390 + series_description, id_study, tilt]
397 391
398 392
399 if (new_key in groups_dcm_.keys()): 393 if (new_key in groups_dcm_.keys()):
invesalius/reader/dicom_reader.py
@@ -71,12 +71,11 @@ def LoadImages(dir_): @@ -71,12 +71,11 @@ def LoadImages(dir_):
71 tilt = groups[key][0][x][11] 71 tilt = groups[key][0][x][11]
72 spacing = groups[key][1][14] 72 spacing = groups[key][1][14]
73 spacing_z = groups[key][1][30] 73 spacing_z = groups[key][1][30]
74 - localization = groups[key][0][x][12]  
75 - 74 + orientation = groups[key][0][x][7]
  75 +
76 files = file_list 76 files = file_list
77 - #Coronal or Sagital with  
78 - #localization None Crash. necessary verify  
79 - if (localization): 77 + #Coronal Crash. necessary verify
  78 + if (orientation <> "CORONAL"):
80 #Organize reversed image 79 #Organize reversed image
81 sorter = gdcm.IPPSorter() 80 sorter = gdcm.IPPSorter()
82 sorter.SetComputeZSpacing(True) 81 sorter.SetComputeZSpacing(True)