Skip to content

Instantly share code, notes, and snippets.

@jrkerns
Created August 31, 2023 16:14
Show Gist options
  • Save jrkerns/fe093072fd2a843e98854f94d3f9de05 to your computer and use it in GitHub Desktop.
Save jrkerns/fe093072fd2a843e98854f94d3f9de05 to your computer and use it in GitHub Desktop.
from functools import cached_property
from pylinac import CatPhan504
from pylinac.ct import CTP528CP504
from pylinac.core.profile import CollapsedCircleProfile
class MyCTP528CP504(CTP528CP504):
@cached_property
def circle_profile(self) -> CollapsedCircleProfile:
"""Calculate the median profile of the Line Pair region.
Returns
-------
:class:`pylinac.core.profile.CollapsedCircleProfile` : A 1D profile of the Line Pair region.
"""
circle_profile = CollapsedCircleProfile(
self.phan_center,
self.radius2linepairs,
image_array=self.image,
start_angle=self.start_angle + np.deg2rad(self.catphan_roll),
width_ratio=0.04, # change this to what you want
sampling_ratio=2,
ccw=self.ccw,
)
circle_profile.filter(0.001, kind="gaussian")
circle_profile.ground()
return circle_profile
class MyCatphan(CatPhan504):
modules = {
CTP404CP504: {"offset": 0},
CTP486: {"offset": -65},
MyCTP528CP504: {"offset": 30}, # use the custom class here
CTP515: {"offset": -30},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment