Commit caac4beb46da3e4ebd49eeaddd8bc637b8d6bdd4
1 parent
d160d17f
Exists in
master
and in
6 other branches
ENH: #68 default DICOM encoding is 'ISO_IR 100'
Showing
1 changed file
with
8 additions
and
11 deletions
Show diff stats
invesalius/reader/dicom.py
... | ... | @@ -1139,11 +1139,8 @@ class Parser(): |
1139 | 1139 | if (data): |
1140 | 1140 | name = data.strip() |
1141 | 1141 | encoding = self.GetEncoding() |
1142 | - if encoding != None: | |
1143 | - # Returns a unicode decoded in the own dicom encoding | |
1144 | - return name.decode(encoding) | |
1145 | - else: | |
1146 | - return name.strip() | |
1142 | + # Returns a unicode decoded in the own dicom encoding | |
1143 | + return name.decode(encoding) | |
1147 | 1144 | return "" |
1148 | 1145 | |
1149 | 1146 | def GetPatientID(self): |
... | ... | @@ -1158,11 +1155,8 @@ class Parser(): |
1158 | 1155 | .GetPatientID() |
1159 | 1156 | if (data): |
1160 | 1157 | encoding = self.GetEncoding() |
1161 | - if encoding != None: | |
1162 | - # Returns a unicode decoded in the own dicom encoding | |
1163 | - return data.decode(self.GetEncoding()) | |
1164 | - else: | |
1165 | - return data | |
1158 | + # Returns a unicode decoded in the own dicom encoding | |
1159 | + return data.decode(encoding) | |
1166 | 1160 | return "" |
1167 | 1161 | |
1168 | 1162 | |
... | ... | @@ -1509,7 +1503,10 @@ class Parser(): |
1509 | 1503 | ds = self.gdcm_reader.GetFile().GetDataSet() |
1510 | 1504 | if ds.FindDataElement(tag): |
1511 | 1505 | encoding = str(ds.GetDataElement(tag).GetValue()) |
1512 | - return encoding | |
1506 | + if encoding != None: | |
1507 | + return encoding | |
1508 | + | |
1509 | + return 'ISO_IR 100' | |
1513 | 1510 | |
1514 | 1511 | |
1515 | 1512 | class DicomWriter: | ... | ... |