Skip to content

Commit b3cfd73

Browse files
committed
RF: replace string size comparison with a more generic "bool" of a string check
1 parent 0821456 commit b3cfd73

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

heudiconv/dicoms.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,16 +528,16 @@ def get_datetime_from_dcm(dcm_data: dcm.FileDataset) -> Optional[datetime.dateti
528528
"""
529529
acq_date = dcm_data.get("AcquisitionDate", "").strip()
530530
acq_time = dcm_data.get("AcquisitionTime", "").strip()
531-
if len(acq_date) > 0 and len(acq_time) > 0:
531+
if acq_date and acq_time:
532532
return strptime_micr(acq_date + acq_time, "%Y%m%d%H%M%S[.%f]")
533533

534534
acq_dt = dcm_data.get("AcquisitionDateTime", "").strip()
535-
if len(acq_dt) > 0:
535+
if acq_dt:
536536
return strptime_micr(acq_dt, "%Y%m%d%H%M%S[.%f]")
537537

538538
series_date = dcm_data.get("SeriesDate", "").strip()
539539
series_time = dcm_data.get("SeriesTime", "").strip()
540-
if len(series_date) > 0 and len(series_time) > 0:
540+
if series_date and series_time:
541541
return strptime_micr(series_date + series_time, "%Y%m%d%H%M%S[.%f]")
542542
return None
543543

0 commit comments

Comments
 (0)