Skip to content

Commit

Permalink
Merged in bugfix/RAM-1713_pf_small_sets (pull request #351)
Browse files Browse the repository at this point in the history
RAM-1713 Fix required prominence for small picket fences

Approved-by: Randy Taylor
  • Loading branch information
jrkerns committed Mar 7, 2024
2 parents 84617af + 8e7bf70 commit 661a5da
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ CT
The slice spacing distance will now use the distance between ``ImagePositionPatient`` tags of
the first two slices to avoid reliance on the ``SpacingBetweenSlices`` tag.

Picket Fence
^^^^^^^^^^^^

* Picket fences where only a relatively small subset of the leaves were being analyzed (e.g. 10 pairs) were sometimes failing.
This would produce a ``ValueError: cannot convert float NaN to integer`` error. This has been fixed.
As a workaround, often the fix was to set ``required_prominence`` to a small value or None. This is no longer necessary.
``required_prominence`` now reflects the *normalized* height (0-1.0) the pickets should be above the background. Previously,
this value was not normalized, requiring fiddling with the value to get correct and depending on the number
of leaf pairs that were being analyzed. The number of leaf pairs should no longer be a factor in the analysis.

Image Metrics
^^^^^^^^^^^^^

Expand Down
1 change: 1 addition & 0 deletions pylinac/picketfence.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@ def analyze(
else:
leaf_prof = np.mean(self.image, 1)
leaf_prof = MultiProfile(leaf_prof)
leaf_prof.normalize() # normalize so required prominence is also normalized.
peak_idxs, peak_vals = leaf_prof.find_fwxm_peaks(
min_distance=0.02,
threshold=height_threshold,
Expand Down
10 changes: 10 additions & 0 deletions tests_basic/test_picketfence.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,3 +957,13 @@ class CharlestonRA(PFTestMixin, TestCase):
class CharlestonG0(PFTestMixin, TestCase):
file_name = ["Charleston", "TB1", "July2016", "G0.dcm"]
max_error = 0.1


class CanberraShortSet(PFTestMixin, TestCase):
"""This is a small picket set (~10-20 leaves). Should be no problem"""

file_name = "canberra.dcm"
max_error = 0
abs_median_error = 0
num_pickets = 10
mean_picket_spacing = 15

0 comments on commit 661a5da

Please sign in to comment.