Commit f4bb8776261436490c9d86a319a745d9122690d8
1 parent
ef4591da
Exists in
master
and in
6 other branches
FIX: Date formatting 0392
Showing
1 changed file
with
6 additions
and
6 deletions
Show diff stats
invesalius/reader/dicom.py
@@ -102,7 +102,7 @@ class Parser(): | @@ -102,7 +102,7 @@ class Parser(): | ||
102 | # TODO: internationalize data | 102 | # TODO: internationalize data |
103 | date = self.vtkgdcm_reader.GetMedicalImageProperties()\ | 103 | date = self.vtkgdcm_reader.GetMedicalImageProperties()\ |
104 | .GetAcquisitionDate() | 104 | .GetAcquisitionDate() |
105 | - if (date): | 105 | + if (date) and (date != ''): |
106 | return self.__format_date(date) | 106 | return self.__format_date(date) |
107 | return "" | 107 | return "" |
108 | 108 | ||
@@ -145,7 +145,7 @@ class Parser(): | @@ -145,7 +145,7 @@ class Parser(): | ||
145 | """ | 145 | """ |
146 | time = self.vtkgdcm_reader.GetMedicalImageProperties()\ | 146 | time = self.vtkgdcm_reader.GetMedicalImageProperties()\ |
147 | .GetAcquisitionTime() | 147 | .GetAcquisitionTime() |
148 | - if (time): | 148 | + if (time) and (time != 'None'): |
149 | return self.__format_time(time) | 149 | return self.__format_time(time) |
150 | return "" | 150 | return "" |
151 | 151 | ||
@@ -1048,7 +1048,7 @@ class Parser(): | @@ -1048,7 +1048,7 @@ class Parser(): | ||
1048 | # TODO: internationalize data | 1048 | # TODO: internationalize data |
1049 | date = self.vtkgdcm_reader.GetMedicalImageProperties()\ | 1049 | date = self.vtkgdcm_reader.GetMedicalImageProperties()\ |
1050 | .GetPatientBirthDate() | 1050 | .GetPatientBirthDate() |
1051 | - if (date): | 1051 | + if (date) and (date!='None'): |
1052 | self.__format_date(date) | 1052 | self.__format_date(date) |
1053 | return "" | 1053 | return "" |
1054 | 1054 | ||
@@ -1410,9 +1410,9 @@ class Parser(): | @@ -1410,9 +1410,9 @@ class Parser(): | ||
1410 | tag = gdcm.Tag(0x0008, 0x0033) | 1410 | tag = gdcm.Tag(0x0008, 0x0033) |
1411 | ds = self.gdcm_reader.GetFile().GetDataSet() | 1411 | ds = self.gdcm_reader.GetFile().GetDataSet() |
1412 | if ds.FindDataElement(tag): | 1412 | if ds.FindDataElement(tag): |
1413 | - data = str(ds.GetDataElement(tag).GetValue()) | ||
1414 | - if (data): | ||
1415 | - return self.__format_time(data) | 1413 | + date = str(ds.GetDataElement(tag).GetValue()) |
1414 | + if (date) and (date != 'None'): | ||
1415 | + return self.__format_time(date) | ||
1416 | return "" | 1416 | return "" |
1417 | 1417 | ||
1418 | def __format_time(self,value): | 1418 | def __format_time(self,value): |