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 167 #last slice.
168 168 if ((x < len(self.filelist) and (x != len(self.filelist) - 1))):
169 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 173 else:
172 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 177 #According to the orientation of the image subtraction
176 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 181 if(image_orientation_label == "SAGITTAL"):
178 182 dif_image_position = image_position_prox[0] - image_position[0]
179 183  
... ... @@ -185,6 +189,7 @@ class DicomGroups:
185 189 #If the difference in the positions is less than the
186 190 #spacing z-axis (thickness) multiplied by two.
187 191 #Otherwise this key create and add value
  192 + spacing = information.image.spacing
188 193 if ((dif_image_position) <= spacing[2] * 2):
189 194 #If there is already such a key in the dictionary,
190 195 #only adds value. Otherwise this key create in the
... ... @@ -289,7 +294,8 @@ class DicomGroups:
289 294 #new_key = (x,information.patient.name, information.image.orientation_label,
290 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 300 if (new_key in groups_dcm_.keys()):
295 301 groups_dcm_[new_key].append(information)
... ...