Commit 9e599160abed4e9dbfcd0aae6ebecf9850a1f76b

Authored by Paulo Henrique Junqueira Amorim
1 parent 586739ec

ENH: Removed list of list from dicom_grouper

Showing 1 changed file with 11 additions and 10 deletions   Show diff stats
invesalius/reader/dicom_grouper.py
... ... @@ -136,9 +136,9 @@ class DicomGroups:
136 136 information.acquisition.serie_number, information.image.orientation_label)
137 137  
138 138 if (key in groups_dcm.keys()):
139   - groups_dcm[key][0].append(information)
  139 + groups_dcm[key].append(information)
140 140 else:
141   - groups_dcm[key] = [[information]]
  141 + groups_dcm[key] = [information]
142 142  
143 143 self.groups_dcm = groups_dcm
144 144  
... ... @@ -191,19 +191,19 @@ class DicomGroups:
191 191 #only adds value. Otherwise this key create in the
192 192 #dictionary and add value
193 193 if (key in groups_dcm.keys()):
194   - groups_dcm[key][0].append(information)
  194 + groups_dcm[key].append(information)
195 195 else:
196   - groups_dcm[key] = [[information]]
  196 + groups_dcm[key] = [information]
197 197 else:
198 198 cont_series = cont_series + 1
199   - groups_dcm[key] = [[information]]
  199 + groups_dcm[key] = [information]
200 200  
201 201 else:
202 202  
203 203 if (cont_series in groups_dcm.keys()):
204 204 groups_dcm[key].append(information)
205 205 else:
206   - groups_dcm[key] = [[information]]
  206 + groups_dcm[key] = [information]
207 207  
208 208 cont_series = cont_series + 1
209 209  
... ... @@ -229,12 +229,12 @@ class DicomGroups:
229 229 key = groups_dcm.keys()[n]
230 230  
231 231 #Number of slices in the series
232   - size_list = len(groups_dcm[key][0])
  232 + size_list = len(groups_dcm[key])
233 233  
234 234 for y in xrange(size_list):
235 235  
236 236 #Slices walks in the series
237   - information = groups_dcm[key][0][y]
  237 + information = groups_dcm[key][y]
238 238  
239 239 #Generate new key to dictionary
240 240 image_pos = information.image.position
... ... @@ -298,11 +298,12 @@ class DicomGroups:
298 298 #the number of previously existing number is
299 299 #greater or equal then the group keeps up,
300 300 #but maintains the same group of positions.
301   - #if len(self.groups_dcm.keys()) > len(groups_dcm_.keys()):
302   - self.groups_dcm = groups_dcm_
  301 + if len(self.groups_dcm.keys()) > len(groups_dcm_.keys()):
  302 + self.groups_dcm = groups_dcm_
303 303  
304 304 for j in xrange(len(self.groups_dcm.keys())):
305 305 key = self.groups_dcm.keys()[j]
  306 + #print self.groups_dcm[key]
306 307 self.groups_dcm[key].sort(key=lambda x: x.image.number)
307 308  
308 309  
... ...