From 291b78c316e9a756607b35b874d844c061136ebc Mon Sep 17 00:00:00 2001 From: paulojamorim Date: Tue, 6 Oct 2009 19:35:19 +0000 Subject: [PATCH] ENH: Date time formated. If tag is seconds --- invesalius/reader/dicom.py | 6 +++++- invesalius/reader/dicom_grouper.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/invesalius/reader/dicom.py b/invesalius/reader/dicom.py index 17452ad..8f61ce4 100644 --- a/invesalius/reader/dicom.py +++ b/invesalius/reader/dicom.py @@ -1416,7 +1416,10 @@ class Parser(): return "" def __format_time(self,value): - if (len(value.split(".")) > 1): + + if (len(value.split(".")) == 1): + data = time.gmtime(float(value)) + elif (len(value.split(".")) > 1): data = time.strptime(value, "%H.%M.%S") elif(len(value.split(":")) > 1): data = time.strptime(value, "%H:%M:%S") @@ -1674,6 +1677,7 @@ if __name__ == "__main__": for i in xrange(1,total+1): filename = "..//data//"+str(i)+".dcm" + parser = Parser() if parser.SetFileName(filename): print "p:", parser.GetPatientName() diff --git a/invesalius/reader/dicom_grouper.py b/invesalius/reader/dicom_grouper.py index 6801d65..8c7d5a4 100644 --- a/invesalius/reader/dicom_grouper.py +++ b/invesalius/reader/dicom_grouper.py @@ -287,7 +287,7 @@ class DicomGroups: key = tmp1.keys()[m] information = tmp1[key] - new_key = (information.patient.name, None, x, information.image.orientation_label) + new_key = (information.patient.name, None, x, information.image.orientation_label, information.acquisition.time) list = [information] -- libgit2 0.21.2