CNR calculation

Hi there,

i want to know how to calculate CNR on CTP515 by using the Difference algorithm, but I don’t know where to get “feature” and “background” these two variables from my code so that I can calculate CNR.

The low contrast algorithm is passed in the analyze method ( CatPhan - pylinac 3.14.0 documentation) like so:

import pylinac
from pylinac.core.contrast import Contrast

ct = pylinac.CatPhan504.from_demo_images()

Thank you!

After i entered that, the number of “Low contrast ROIs seen” changed. But i thought i would also get a CNR value, wouldn’t it?

Screenshot 2023-08-15 at 11.21.07 AM.png

CNR is ROI-specific. There is no “global” CNR. To print the CNR of each ROI:

data = ct.results_data()
for diameter, roi in data.ctp515.roi_results.items():
print(diameter, roi[‘cnr’])