Recently I tried to analyze the QC3 Phantom image with the StandardImagingQC3 module but got a ValueError(“Unable to find the QC-3 phantom in the image.”).
We are seeing the same thing here. Images that worked with 2.2.7 are not working on a new install with 2.3.1. Same error,
File “C:\DICOMAnalyzer\PythonScripts\ImageQA.py”, line 3288, in ProcessDirectory
qc3.analyze(low_contrast_threshold=0.01, high_contrast_threshold=0.5)
File “C:\Program Files\Python\lib\site-packages\pylinac\planar_imaging.py”, line 159, in analyze
self.high_contrast_rois = self._sample_high_contrast_rois()
File “C:\Program Files\Python\lib\site-packages\pylinac\planar_imaging.py”, line 202, in _sample_high_contrast_rois
self.phantom_radius * stng[‘roi radius’],
File “C:\Program Files\Python\lib\site-packages\pylinac\planar_imaging.py”, line 421, in phantom_radius
return self._size_override if self._size_override is not None else self._phantom_radius_calc()
File “C:\Program Files\Python\lib\site-packages\pylinac\planar_imaging.py”, line 609, in _phantom_radius_calc
return self.phantom_ski_region.major_axis_length / 14
File “C:\Program Files\Python\lib\site-packages\pylinac\planar_imaging.py”, line 593, in phantom_ski_region
raise ValueError(“Unable to find the QC-3 phantom in the image.”)
ValueError: Unable to find the QC-3 phantom in the image.
So this ended up being an error that happens for images at 140cm vs iso. The mag factor correction was faulty but still worked for most images. Fixed and pushing out 2.3.2.
Interestingly, I still get the “Unable to find the QC-3 phantom in the image.” when taking images at 100cm SID, but not at 140cm SID. Do you have any idea why it wouldn’t be working at 100cm SID. The same image will process on 2.2.7, but not 2.3.2.
As I previously mentioned in this issue, I have some EPID dicom RT image that planar imaging module can’t detect phantom outline (error: ValueError: Unable to find the QC-3 phantom in the image). I was thinking about manually drawing the phantom outline in an image (As PipsPro do) and return ROI in NumPy array when automatic detection failed. However, I share these images with you to check the problem.
I’m not sure if you are seeing the same thing that I have been. For me, if I take the image at 140cm SID, it detects it fine, but at 100cm SID, I get the error you reported. What I found is that I have to increase the tolerance from 0.07 to 0.08 (rtol) on line 588 of the planar_imaging.py file in the class definition of the SI QC3 class:
changing that made it so it will find the phantom. Not an official fix, but what worked for me.
Clinically we are using 2.2.7. I am trying to validate 2.3.2 against our routine images and this is one of the issues that came up. Images that would analyze in 2.2.7 gave the error you reported above in 2.3.2. In debugging I looked at the results of the np.isclose function and that is how I came up with 0.08 being able to find the phantom. Whether it gives the correct value or not, I couldn’t say. I took the same phantom and setup and just increased the SID to 140 and the algorithm worked fine and found the phantom. That is about as far as I got with this and will be picking it up. We could just switch to doing the test at 140, but already have a workflow in place for 100cm…
I also downgraded the Pylinac version to 2.2.7 and work properly. However, I want to try manually draw a phantom outline in interactive mode when automatic phantom detection has failed. Have you ever do something like this for pylinac?
Just a question. Where do you put the phantom? If you put it on the imager at 160 cm, you can add another distance to the code. So you can add this:
`
is_at_160cm = np.isclose(region.bbox_area, phantom_size_pix/(1.6**2), rtol=0.07)
if (is_at_iso or is_at_140cm or is_at_160cm) and centered:
blobs.append(phantom_idx)
Thank you. Usually, I put the phantom in SID=140 cm for Siemens and Varian Machine. But for the Elekta machine, we should put it at SID=160 cm. However, It’s a good idea to add SID=160 to the code.