@@ -724,7 +724,7 @@ def strptime(datetime_string: str, fmts: list[str]) -> datetime.datetime:
724
724
fmts: list[str]
725
725
List of format strings
726
726
"""
727
- datetime_str = datetime_string . strip ()
727
+ datetime_str = datetime_string
728
728
for fmt in fmts :
729
729
try :
730
730
return datetime .datetime .strptime (datetime_str , fmt )
@@ -769,20 +769,20 @@ def strptime_dcm_da_tm(
769
769
Dicom tag with TM value representation
770
770
"""
771
771
# https://dicom.nema.org/medical/dicom/current/output/chtml/part05/sect_6.2.html
772
- date_str = dcm_data [da_tag ].value . strip ()
772
+ date_str = dcm_data [da_tag ].value
773
773
fmts = [
774
774
"%Y%m%d" ,
775
775
]
776
776
date = strptime (date_str , fmts )
777
777
778
- time_str = dcm_data [tm_tag ].value . strip ()
778
+ time_str = dcm_data [tm_tag ].value
779
779
fmts = ["%H" , "%H%M" , "%H%M%S" , "%H%M%S.%f" ]
780
780
time = strptime (time_str , fmts )
781
781
782
782
datetime_obj = datetime .datetime .combine (date .date (), time .time ())
783
783
784
784
if utc_offset_dcm := dcm_data .get ((0x0008 , 0x0201 )):
785
- utc_offset = utc_offset_dcm .value . strip ()
785
+ utc_offset = utc_offset_dcm .value
786
786
datetime_obj = (
787
787
datetime_utc_offset (datetime_obj , utc_offset )
788
788
if utc_offset
@@ -804,7 +804,7 @@ def strptime_dcm_dt(dcm_data: dcm.Dataset, dt_tag: TagType) -> datetime.datetime
804
804
Dicom tag with DT value representation
805
805
"""
806
806
# https://dicom.nema.org/medical/dicom/current/output/chtml/part05/sect_6.2.html
807
- datetime_str = dcm_data [dt_tag ].value . strip ()
807
+ datetime_str = dcm_data [dt_tag ].value
808
808
fmts = [
809
809
"%Y%z" ,
810
810
"%Y%m%z" ,
@@ -824,7 +824,7 @@ def strptime_dcm_dt(dcm_data: dcm.Dataset, dt_tag: TagType) -> datetime.datetime
824
824
datetime_obj = strptime (datetime_str , fmts )
825
825
826
826
if utc_offset_dcm := dcm_data .get ((0x0008 , 0x0201 )):
827
- if utc_offset := utc_offset_dcm .value . strip () :
827
+ if utc_offset := utc_offset_dcm .value :
828
828
datetime_obj2 = datetime_utc_offset (datetime_obj , utc_offset )
829
829
if datetime_obj .tzinfo and datetime_obj2 != datetime_obj :
830
830
lgr .warning (
0 commit comments