Skip to content

Commit

Permalink
RF: replace string size comparison with a more generic "bool" of a st…
Browse files Browse the repository at this point in the history
…ring check
  • Loading branch information
yarikoptic committed May 1, 2024
1 parent 0821456 commit b3cfd73
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions heudiconv/dicoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,16 +528,16 @@ def get_datetime_from_dcm(dcm_data: dcm.FileDataset) -> Optional[datetime.dateti
"""
acq_date = dcm_data.get("AcquisitionDate", "").strip()
acq_time = dcm_data.get("AcquisitionTime", "").strip()
if len(acq_date) > 0 and len(acq_time) > 0:
if acq_date and acq_time:
return strptime_micr(acq_date + acq_time, "%Y%m%d%H%M%S[.%f]")

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

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

Expand Down

0 comments on commit b3cfd73

Please sign in to comment.