Commit 2b4b17469ade764fa566338f52e568e8390606c3
1 parent
49584a75
Exists in
master
and in
68 other branches
FIX: Bug separate series (\other\higroma) case, separete in 17 series but real is 8
Showing
2 changed files
with
21 additions
and
12 deletions
Show diff stats
invesalius/reader/dicom.py
... | ... | @@ -669,9 +669,11 @@ class Parser(): |
669 | 669 | if ds.FindDataElement(tag): |
670 | 670 | data = str(ds.GetDataElement(tag).GetValue()) |
671 | 671 | if (data): |
672 | - | |
673 | - return data.split('\\') | |
674 | - return "" | |
672 | + try: | |
673 | + return data.split('\\') | |
674 | + except(IndexError): | |
675 | + return [] | |
676 | + return [] | |
675 | 677 | |
676 | 678 | def GetSOPClassUID(self): |
677 | 679 | """ |
... | ... | @@ -1810,7 +1812,8 @@ class Image(object): |
1810 | 1812 | self.orientation_label = parser.GetImageOrientationLabel() |
1811 | 1813 | self.file = parser.filename |
1812 | 1814 | self.time = parser.GetImageTime() |
1813 | - | |
1815 | + self.type = parser.GetImageType() | |
1816 | + | |
1814 | 1817 | if (parser.GetImageThickness()): |
1815 | 1818 | try: |
1816 | 1819 | spacing.append(parser.GetImageThickness()) |
... | ... | @@ -1827,8 +1830,4 @@ class Image(object): |
1827 | 1830 | spacing[2] = round(spacing[2],2) |
1828 | 1831 | self.spacing = spacing |
1829 | 1832 | |
1830 | - try: | |
1831 | - self.type = parser.GetImageType()[2] | |
1832 | - except(IndexError): | |
1833 | - self.type = "" | |
1834 | 1833 | ... | ... |
invesalius/reader/dicom_grouper.py
... | ... | @@ -73,12 +73,22 @@ class DicomGroup: |
73 | 73 | if not self.dicom: |
74 | 74 | self.dicom = dicom |
75 | 75 | pos = tuple(dicom.image.position) |
76 | - if pos not in self.slices_dict.keys(): | |
77 | - self.slices_dict[pos] = dicom | |
76 | + | |
77 | + #Case to test: \other\higroma | |
78 | + #condition created, if any dicom with the same | |
79 | + #position, but 3D, leaving the same series. | |
80 | + if not "DERIVED" in dicom.image.type: | |
81 | + #if any dicom with the same position | |
82 | + if pos not in self.slices_dict.keys(): | |
83 | + self.slices_dict[pos] = dicom | |
84 | + self.nslices += 1 | |
85 | + return True | |
86 | + else: | |
87 | + return False | |
88 | + else: | |
89 | + self.slices_dict[dicom.image.number] = dicom | |
78 | 90 | self.nslices += 1 |
79 | 91 | return True |
80 | - else: | |
81 | - return False | |
82 | 92 | |
83 | 93 | def GetList(self): |
84 | 94 | # Should be called when user selects this group | ... | ... |