Commit eed60cd7ce84a8290352189481ac54751404294f

Authored by Paulo Henrique Junqueira Amorim
1 parent 22d6f6d5

FIX: Fixed bug in the spliter2 function from dicom_grouper

Showing 1 changed file with 10 additions and 4 deletions   Show diff stats
invesalius/reader/dicom_grouper.py
@@ -167,13 +167,17 @@ class DicomGroups: @@ -167,13 +167,17 @@ class DicomGroups:
167 #last slice. 167 #last slice.
168 if ((x < len(self.filelist) and (x != len(self.filelist) - 1))): 168 if ((x < len(self.filelist) and (x != len(self.filelist) - 1))):
169 #position of next slice 169 #position of next slice
170 - image_position_prox = self.__GetInformations(x + 1)[3] 170 + information = self.__GetInformations(x + 1)
  171 + image_position_prox = information.image.position
  172 + print image_position_prox
171 else: 173 else:
172 #slice up the position. 174 #slice up the position.
173 - image_position_prox = self.__GetInformations(x - 1)[3]  
174 - 175 + information = self.__GetInformations(x - 1)
  176 + image_position_prox = information.image.position
175 #According to the orientation of the image subtraction 177 #According to the orientation of the image subtraction
176 #will be between a specific position in the vector of positions. 178 #will be between a specific position in the vector of positions.
  179 + image_orientation_label = information.image.orientation_label
  180 + image_position = information.image.position
177 if(image_orientation_label == "SAGITTAL"): 181 if(image_orientation_label == "SAGITTAL"):
178 dif_image_position = image_position_prox[0] - image_position[0] 182 dif_image_position = image_position_prox[0] - image_position[0]
179 183
@@ -185,6 +189,7 @@ class DicomGroups: @@ -185,6 +189,7 @@ class DicomGroups:
185 #If the difference in the positions is less than the 189 #If the difference in the positions is less than the
186 #spacing z-axis (thickness) multiplied by two. 190 #spacing z-axis (thickness) multiplied by two.
187 #Otherwise this key create and add value 191 #Otherwise this key create and add value
  192 + spacing = information.image.spacing
188 if ((dif_image_position) <= spacing[2] * 2): 193 if ((dif_image_position) <= spacing[2] * 2):
189 #If there is already such a key in the dictionary, 194 #If there is already such a key in the dictionary,
190 #only adds value. Otherwise this key create in the 195 #only adds value. Otherwise this key create in the
@@ -289,7 +294,8 @@ class DicomGroups: @@ -289,7 +294,8 @@ class DicomGroups:
289 #new_key = (x,information.patient.name, information.image.orientation_label, 294 #new_key = (x,information.patient.name, information.image.orientation_label,
290 # information.acquisition.serie_number) 295 # information.acquisition.serie_number)
291 296
292 - new_key = (information.patient.name, None, x, information.image.orientation_label) 297 + new_key = (information.patient.name, None, x,
  298 + information.image.orientation_label)
293 299
294 if (new_key in groups_dcm_.keys()): 300 if (new_key in groups_dcm_.keys()):
295 groups_dcm_[new_key].append(information) 301 groups_dcm_[new_key].append(information)