jrkerns / pylinac

An image analysis library for medical physics
MIT License
145 stars 94 forks source link

find_origin_slice - Check for 2 peaks when looking for key CBCT slice #482

Closed t-milan closed 4 months ago

t-milan commented 4 months ago

We noticed the CBCT module for our CatPhan604 was failing to find the proper keyslice of the CBCT - the find_origin_slice method looks for the middle slice within a range, but that range is too large. As you can see in the image below, there are extra slices which don't contain all the HU modules, which we want to ignore. My solution is to add an extra check that the proper slices should have 2 peaks in the Circular Profile. Once we added this, the proper key slice was found. Hope that makes sense. Unfortunately I haven't been able to test this for other CatPhan models. CBCT_Peak_Examples

jrkerns commented 4 months ago

There's a PR and discussion about this here: https://github.com/jrkerns/pylinac/pull/426.

What version are you using? In v3.19 the 604 origin slice algorithm was adjusted: https://pylinac.readthedocs.io/en/latest/changelog.html#ct

t-milan commented 4 months ago

Thanks for that - You're right, I tested the latest version but didn't see the fix because I was using my own custom CatPhan604 class overriding CatPhanBase, which therefore didn't have the refine_origin_slice method. The fix from #426 seems to work fine for me so you can ignore my solution.

jrkerns commented 4 months ago

Your solution is a lot more clever than mine! Good work.