Commit 291b78c316e9a756607b35b874d844c061136ebc

Authored by Paulo Henrique Junqueira Amorim
1 parent 7d25dcfb

ENH: Date time formated. If tag is seconds

invesalius/reader/dicom.py
@@ -1416,7 +1416,10 @@ class Parser(): @@ -1416,7 +1416,10 @@ class Parser():
1416 return "" 1416 return ""
1417 1417
1418 def __format_time(self,value): 1418 def __format_time(self,value):
1419 - if (len(value.split(".")) > 1): 1419 +
  1420 + if (len(value.split(".")) == 1):
  1421 + data = time.gmtime(float(value))
  1422 + elif (len(value.split(".")) > 1):
1420 data = time.strptime(value, "%H.%M.%S") 1423 data = time.strptime(value, "%H.%M.%S")
1421 elif(len(value.split(":")) > 1): 1424 elif(len(value.split(":")) > 1):
1422 data = time.strptime(value, "%H:%M:%S") 1425 data = time.strptime(value, "%H:%M:%S")
@@ -1674,6 +1677,7 @@ if __name__ == "__main__": @@ -1674,6 +1677,7 @@ if __name__ == "__main__":
1674 1677
1675 for i in xrange(1,total+1): 1678 for i in xrange(1,total+1):
1676 filename = "..//data//"+str(i)+".dcm" 1679 filename = "..//data//"+str(i)+".dcm"
  1680 +
1677 parser = Parser() 1681 parser = Parser()
1678 if parser.SetFileName(filename): 1682 if parser.SetFileName(filename):
1679 print "p:", parser.GetPatientName() 1683 print "p:", parser.GetPatientName()
invesalius/reader/dicom_grouper.py
@@ -287,7 +287,7 @@ class DicomGroups: @@ -287,7 +287,7 @@ class DicomGroups:
287 287
288 key = tmp1.keys()[m] 288 key = tmp1.keys()[m]
289 information = tmp1[key] 289 information = tmp1[key]
290 - new_key = (information.patient.name, None, x, information.image.orientation_label) 290 + new_key = (information.patient.name, None, x, information.image.orientation_label, information.acquisition.time)
291 291
292 292
293 list = [information] 293 list = [information]