Commit 2b4b17469ade764fa566338f52e568e8390606c3

Authored by Paulo Henrique Junqueira Amorim
1 parent 49584a75

FIX: Bug separate series (\other\higroma) case, separete in 17 series but real is 8

invesalius/reader/dicom.py
@@ -669,9 +669,11 @@ class Parser(): @@ -669,9 +669,11 @@ class Parser():
669 if ds.FindDataElement(tag): 669 if ds.FindDataElement(tag):
670 data = str(ds.GetDataElement(tag).GetValue()) 670 data = str(ds.GetDataElement(tag).GetValue())
671 if (data): 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 def GetSOPClassUID(self): 678 def GetSOPClassUID(self):
677 """ 679 """
@@ -1810,7 +1812,8 @@ class Image(object): @@ -1810,7 +1812,8 @@ class Image(object):
1810 self.orientation_label = parser.GetImageOrientationLabel() 1812 self.orientation_label = parser.GetImageOrientationLabel()
1811 self.file = parser.filename 1813 self.file = parser.filename
1812 self.time = parser.GetImageTime() 1814 self.time = parser.GetImageTime()
1813 - 1815 + self.type = parser.GetImageType()
  1816 +
1814 if (parser.GetImageThickness()): 1817 if (parser.GetImageThickness()):
1815 try: 1818 try:
1816 spacing.append(parser.GetImageThickness()) 1819 spacing.append(parser.GetImageThickness())
@@ -1827,8 +1830,4 @@ class Image(object): @@ -1827,8 +1830,4 @@ class Image(object):
1827 spacing[2] = round(spacing[2],2) 1830 spacing[2] = round(spacing[2],2)
1828 self.spacing = spacing 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,12 +73,22 @@ class DicomGroup:
73 if not self.dicom: 73 if not self.dicom:
74 self.dicom = dicom 74 self.dicom = dicom
75 pos = tuple(dicom.image.position) 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 self.nslices += 1 90 self.nslices += 1
79 return True 91 return True
80 - else:  
81 - return False  
82 92
83 def GetList(self): 93 def GetList(self):
84 # Should be called when user selects this group 94 # Should be called when user selects this group