Skip to content

Commit

Permalink
reorder axis interpretation to pull from DICOM before trying filenames.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrkerns committed Feb 12, 2021
1 parent 409bf7c commit 5f749b8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pylinac/core/image.py
Expand Up @@ -797,7 +797,16 @@ def _get_axis_value(self, axis_str: str, axis_dcm_attr: str) -> float:
float
"""
axis_found = False
if self._use_filenames:

# try to interpret from DICOM data
if not axis_found:
try:
axis = float(getattr(self.metadata, axis_dcm_attr))
axis_found = True
except AttributeError:
axis = 0

if self._use_filenames and not axis_found:
filename = osp.basename(self.path)
# see if the keyword is in the filename
keyword_in_filename = axis_str.lower() in filename.lower()
Expand Down

0 comments on commit 5f749b8

Please sign in to comment.