From 2b4b17469ade764fa566338f52e568e8390606c3 Mon Sep 17 00:00:00 2001 From: paulojamorim Date: Thu, 15 Oct 2009 18:34:10 +0000 Subject: [PATCH] FIX: Bug separate series (\other\higroma) case, separete in 17 series but real is 8 --- invesalius/reader/dicom.py | 15 +++++++-------- invesalius/reader/dicom_grouper.py | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/invesalius/reader/dicom.py b/invesalius/reader/dicom.py index 1c60e39..33de505 100644 --- a/invesalius/reader/dicom.py +++ b/invesalius/reader/dicom.py @@ -669,9 +669,11 @@ class Parser(): if ds.FindDataElement(tag): data = str(ds.GetDataElement(tag).GetValue()) if (data): - - return data.split('\\') - return "" + try: + return data.split('\\') + except(IndexError): + return [] + return [] def GetSOPClassUID(self): """ @@ -1810,7 +1812,8 @@ class Image(object): self.orientation_label = parser.GetImageOrientationLabel() self.file = parser.filename self.time = parser.GetImageTime() - + self.type = parser.GetImageType() + if (parser.GetImageThickness()): try: spacing.append(parser.GetImageThickness()) @@ -1827,8 +1830,4 @@ class Image(object): spacing[2] = round(spacing[2],2) self.spacing = spacing - try: - self.type = parser.GetImageType()[2] - except(IndexError): - self.type = "" diff --git a/invesalius/reader/dicom_grouper.py b/invesalius/reader/dicom_grouper.py index ead509c..df68851 100644 --- a/invesalius/reader/dicom_grouper.py +++ b/invesalius/reader/dicom_grouper.py @@ -73,12 +73,22 @@ class DicomGroup: if not self.dicom: self.dicom = dicom pos = tuple(dicom.image.position) - if pos not in self.slices_dict.keys(): - self.slices_dict[pos] = dicom + + #Case to test: \other\higroma + #condition created, if any dicom with the same + #position, but 3D, leaving the same series. + if not "DERIVED" in dicom.image.type: + #if any dicom with the same position + if pos not in self.slices_dict.keys(): + self.slices_dict[pos] = dicom + self.nslices += 1 + return True + else: + return False + else: + self.slices_dict[dicom.image.number] = dicom self.nslices += 1 return True - else: - return False def GetList(self): # Should be called when user selects this group -- libgit2 0.21.2