Pylinac 2.3.2: Cannot detect WL test BB in the EPID images

Hi, I analyzed my WL test with pylinac 2.3.2 and get these error results. I am using the same WL test pattern and setup and the same Varian EPID a1200 settings as before. The results were successfully analyzed with version 2.2.6.
Attached with a sample of exposed image at 4x4 cm field size using BrainLab WL pointer.

The weighted-pixel value location of the BB.
“”"
# get initial starting conditions
hmin, hmax = np.percentile(self.array, [5, 99.9])
spread = hmax - hmin
max_thresh = hmax
lower_thresh = hmax - spread / 1.5
# search for the BB by iteratively lowering the low-pass threshold value until the BB is found.
found = False
while not found:
try:
binary_arr = np.logical_and((max_thresh > self), (self >= lower_thresh))
labeled_arr, num_roi = ndimage.measurements.label(binary_arr)
roi_sizes, bin_edges = np.histogram(labeled_arr, bins=num_roi + 1)
bw_bb_img = np.where(labeled_arr == np.argsort(roi_sizes)[-3], 1, 0) # we pick the 3rd largest one because the largest is the background, 2nd is rad field, 3rd is the BB
bw_bb_img = ndimage.binary_fill_holes(bw_bb_img).astype(int) # fill holes for low energy beams like 2.5MV
bb_regionprops = measure.regionprops(bw_bb_img)[0]

if not is_round(bb_regionprops):
raise ValueError
if not is_modest_size(bw_bb_img, self.rad_field_bounding_box):
raise ValueError
if not is_symmetric(bw_bb_img):
raise ValueError
except (IndexError, ValueError):
max_thresh -= 0.05 * spread
if max_thresh < hmin:
raise ValueError(“Unable to locate the BB. Make sure the field edges do not obscure the BB and that there is no artifacts in the images.”)
else:
found = True

# determine the center of mass of the BB
inv_img = image.load(self.array)
# we invert so BB intensity increases w/ attenuation
inv_img.check_inversion_by_histogram(percentiles=(99.99, 50, 0.01))
bb_rprops = measure.regionprops(bw_bb_img, intensity_image=inv_img)[0]
return Point(bb_rprops.weighted_centroid[1], bb_rprops.weighted_centroid[0])

Hi Jasper,
I can’t seem to reproduce the error. See attached files. Can you confirm you’re on 2.3.2?

print(pylinac.__version__)

Jasper.png

Jasper.pdf (528 KB)

Hi James,

Yes, I installed pylinac 2.3.2 via pip. I run the WL demo and get the error in locating the BB too.

install pylinac 2.3.2.png

Run demo.png

Looks like the code looks at the third ROI to see the BB. Maybe the holder stem is being detected as the 3rd ROI and the marker is the 4th.

Hi Jasper,

you could check if all pylinac dependencies are still correct. When I run pipdeptree (install with pip install pipdeptree) I get the following dependency tree. Maybe you reverted to an older lib version trough conda or something else.

pipdeptree -p pylinac

pylinac==2.3.2
- argue [required: Any, installed: 0.3.1]
- matplotlib [required: >=1.4, installed: 3.2.1]
- cycler [required: >=0.10, installed: 0.10.0]
- six [required: Any, installed: 1.14.0]
- kiwisolver [required: >=1.0.1, installed: 1.2.0]
- numpy [required: >=1.11, installed: 1.18.1]
- pyparsing [required: >=2.0.1,!=2.1.6,!=2.1.2,!=2.0.4, installed: 2.4.7]
- python-dateutil [required: >=2.1, installed: 2.8.1]
- six [required: >=1.5, installed: 1.14.0]
- numpy [required: >=1.14, installed: 1.18.1]
- Pillow [required: >=4.0, installed: 7.1.2]
- pydicom [required: >=1.0, installed: 1.4.2]
- pyyaml [required: >=3.10, installed: 5.3.1]
- reportlab [required: >=3.3, installed: 3.5.42]
- pillow [required: >=4.0.0, installed: 7.1.2]
- scikit-image [required: >=0.13, installed: 0.15.0]
- imageio [required: >=2.0.1, installed: 2.8.0]
- numpy [required: Any, installed: 1.18.1]
- pillow [required: Any, installed: 7.1.2]
- networkx [required: >=2.0, installed: 2.4]
- decorator [required: >=4.3.0, installed: 4.4.2]
- pillow [required: >=4.3.0, installed: 7.1.2]
- PyWavelets [required: >=0.4.0, installed: 1.1.1]
- numpy [required: >=1.13.3, installed: 1.18.1]
- scikit-learn [required: >=0.18, installed: 0.22.2.post1]
- joblib [required: >=0.11, installed: 0.14.1]
- numpy [required: >=1.11.0, installed: 1.18.1]
- scipy [required: >=0.17.0, installed: 1.4.1]
- numpy [required: >=1.13.3, installed: 1.18.1]
- scipy [required: >=1.0, installed: 1.4.1]
- numpy [required: >=1.13.3, installed: 1.18.1]
- tqdm [required: >=3.8, installed: 4.46.0]
- yagmail [required: Any, installed: 0.11.224]