This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from pylinac import ACRMRILarge | |
class MyACRMRI(ACRMRILarge): | |
def _ensure_physical_scan_extent(self) -> bool: | |
"""Ensure that all the modules of the phantom have been scanned. If a CBCT isn't | |
positioned correctly, some modules might not be included.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pylinac import LeedsTOR | |
class LeedsTOR311(LeedsTOR): | |
high_contrast_roi_settings = { | |
"roi 1": { | |
"distance from center": 0.3, | |
"angle": 54.8, | |
"roi radius": 0.04, | |
"lp/mm": 0.5, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pylinac | |
class CatphanFOV(pylinac.CatPhan504): | |
@property | |
def mm_per_pixel(self) -> float: | |
return super().mm_per_pixel * 0.81 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# override how pylinac finds the phantom position and angle | |
import pylinac | |
class FixedCatPhan604(pylinac.CatPhan604): | |
def localize(self) -> None: | |
super().localize() | |
self._phantom_center_func = (lambda x: 250, lambda y: 250) | |
def find_origin_slice(self) -> int: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pylinac.cheese import CheeseModule, CheesePhantomBase | |
class GammexRMIModule(CheeseModule): | |
"""The pluggable module with user-accessible holes. | |
The ROIs of each circle are ~45 degrees apart. | |
""" | |
common_name = "Gammex electron density" | |
outer_radius_mm = 106 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We assume there is a central picket in the image | |
# We use the demo image for repeatability even though it's not representative of your specific image | |
# REMEMBER: leaves are enumerated from the bottom up. I.e. leaf 12 is near the bottom of the image, not the top | |
# This might not correspond with reality, but that's the convention as it stands currently. | |
# setup | |
pf = pylinac.PicketFence.from_demo() | |
pf.analyze() | |
# method 1: Get picket distances from the CAX: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pylinac | |
from pylinac.core.profile import MultiProfile | |
pf = pylinac.PicketFence.from_demo_image() | |
pf.analyze() | |
# the secret sauce. This gives the y-value for each leaf kiss. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pylinac | |
logo_path = r"C:/my/logo/path.png" | |
pf = pylinac.PicketFence(...) | |
pf.analyze(...) | |
pf.publish_pdf(..., logo=logo_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pylinac | |
ct = pylinac.CatPhan504.from_demo_images() | |
ct.analyze() | |
data = ct.results_data() | |
center_unif_roi = data.ctp486.rois['Center'] | |
for name, roi in data.ctp486.rois.items(): | |
if name == 'Center': | |
continue | |
if abs(roi.value - center_unif_roi.value) > 30: |
NewerOlder