Commit 9e599160abed4e9dbfcd0aae6ebecf9850a1f76b
1 parent
586739ec
Exists in
master
and in
68 other branches
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,9 +136,9 @@ class DicomGroups: | ||
136 | information.acquisition.serie_number, information.image.orientation_label) | 136 | information.acquisition.serie_number, information.image.orientation_label) |
137 | 137 | ||
138 | if (key in groups_dcm.keys()): | 138 | if (key in groups_dcm.keys()): |
139 | - groups_dcm[key][0].append(information) | 139 | + groups_dcm[key].append(information) |
140 | else: | 140 | else: |
141 | - groups_dcm[key] = [[information]] | 141 | + groups_dcm[key] = [information] |
142 | 142 | ||
143 | self.groups_dcm = groups_dcm | 143 | self.groups_dcm = groups_dcm |
144 | 144 | ||
@@ -191,19 +191,19 @@ class DicomGroups: | @@ -191,19 +191,19 @@ class DicomGroups: | ||
191 | #only adds value. Otherwise this key create in the | 191 | #only adds value. Otherwise this key create in the |
192 | #dictionary and add value | 192 | #dictionary and add value |
193 | if (key in groups_dcm.keys()): | 193 | if (key in groups_dcm.keys()): |
194 | - groups_dcm[key][0].append(information) | 194 | + groups_dcm[key].append(information) |
195 | else: | 195 | else: |
196 | - groups_dcm[key] = [[information]] | 196 | + groups_dcm[key] = [information] |
197 | else: | 197 | else: |
198 | cont_series = cont_series + 1 | 198 | cont_series = cont_series + 1 |
199 | - groups_dcm[key] = [[information]] | 199 | + groups_dcm[key] = [information] |
200 | 200 | ||
201 | else: | 201 | else: |
202 | 202 | ||
203 | if (cont_series in groups_dcm.keys()): | 203 | if (cont_series in groups_dcm.keys()): |
204 | groups_dcm[key].append(information) | 204 | groups_dcm[key].append(information) |
205 | else: | 205 | else: |
206 | - groups_dcm[key] = [[information]] | 206 | + groups_dcm[key] = [information] |
207 | 207 | ||
208 | cont_series = cont_series + 1 | 208 | cont_series = cont_series + 1 |
209 | 209 | ||
@@ -229,12 +229,12 @@ class DicomGroups: | @@ -229,12 +229,12 @@ class DicomGroups: | ||
229 | key = groups_dcm.keys()[n] | 229 | key = groups_dcm.keys()[n] |
230 | 230 | ||
231 | #Number of slices in the series | 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 | for y in xrange(size_list): | 234 | for y in xrange(size_list): |
235 | 235 | ||
236 | #Slices walks in the series | 236 | #Slices walks in the series |
237 | - information = groups_dcm[key][0][y] | 237 | + information = groups_dcm[key][y] |
238 | 238 | ||
239 | #Generate new key to dictionary | 239 | #Generate new key to dictionary |
240 | image_pos = information.image.position | 240 | image_pos = information.image.position |
@@ -298,11 +298,12 @@ class DicomGroups: | @@ -298,11 +298,12 @@ class DicomGroups: | ||
298 | #the number of previously existing number is | 298 | #the number of previously existing number is |
299 | #greater or equal then the group keeps up, | 299 | #greater or equal then the group keeps up, |
300 | #but maintains the same group of positions. | 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 | for j in xrange(len(self.groups_dcm.keys())): | 304 | for j in xrange(len(self.groups_dcm.keys())): |
305 | key = self.groups_dcm.keys()[j] | 305 | key = self.groups_dcm.keys()[j] |
306 | + #print self.groups_dcm[key] | ||
306 | self.groups_dcm[key].sort(key=lambda x: x.image.number) | 307 | self.groups_dcm[key].sort(key=lambda x: x.image.number) |
307 | 308 | ||
308 | 309 |