jrkerns / pylinac

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

SNC Advanced Electron Density analysis #496

Open SafirZouzout opened 1 month ago

SafirZouzout commented 1 month ago

Describe the bug

The SNC Advanced Electron Density phantom analysis doesn't seem to work. I saw that you needed data to improve the Cheese module so I sent the dicoms here I believe that the issue might be because this is not the right phantom. When clicking on the link on the pylinac doc this leads to this page but I suspect that the class is designed for this phantom

To Reproduce

I used the following code:

from pylinac import CIRS062M
cheese_folder = r"my_path"
cheese = CIRS062M(cheese_folder)
cheese.analyze()
cheese.plot_analyzed_image()

and got the following message

Detected shift of 8.554868624420408 was >5 degrees; automatic roll compensation aborted. Setting roll to 0.

Expected behavior

Correct placement of the ROIs

Screenshots

CIRS_marche_pas

Additional context

I wrote this that gives some results, feel free to use it in pylinac if it can be of any help. I know this might not be the place to write some code but I don't feel very confident sending merge requests as I'm not very good at coding.


from pylinac.cheese import CheeseModule
from pylinac.cheese import CheesePhantomBase

class GammexModule(CheeseModule):
    common_name = 'Gammex'
    roi_settings = {
        "1": {
            "angle": 0,
            "distance": 0,
            "radius": 14.3,
        },
        "2": {
            "angle": 0,
            "distance": 37.5,
            "radius": 14.3,
        },
        "3": {
            "angle": 0,
            "distance": 75,
            "radius": 14.3,
        },
        "4": {
            "angle": 45,
            "distance": 75,
            "radius": 14.3,
        },
        "5": {
            "angle": 90,
            "distance": 75,
            "radius": 14.3,
        },
        "6": {
            "angle": 135,
            "distance": 75,
            "radius": 14.3,
        },
        "7": {
            "angle": 180,
            "distance": 75,
            "radius": 14.3,
        },
        "8": {
            "angle": 225,
            "distance": 75,
            "radius": 14.3,
        },
        "9": {
            "angle": 270,
            "distance": 75,
            "radius": 14.3,
        },
        "10": {
            "angle": 315,
            "distance": 75,
            "radius": 14.3,
        },
        "11": {
            "angle": 0,
            "distance": 140,
            "radius": 14.3,
        },
        "12": {
            "angle": 45,
            "distance": 140,
            "radius": 14.3,
        },
        "13": {
            "angle": 135,
            "distance": 140,
            "radius": 14.3,
        },
        "14": {
            "angle": 180,
            "distance": 140,
            "radius": 14.3,
        },
        "15": {
            "angle": 225,
            "distance": 140,
            "radius": 14.3,
        },
        "16": {
            "angle": 315,
            "distance": 140,
            "radius": 14.3,
        },
    }

class GammexPhantom(CheesePhantomBase):
    model = "Advanced Electron Density Phantom"
    air_bubble_radius_mm=14
    localization_radius = 75
    min_num_images=15
    catphan_radius_mm= 164.3
    module_class = GammexModule
    module: GammexModule

swiss= GammexPhantom(r"dicoms_folder_path")
swiss.analyze()
swiss.plot_analyzed_image()
print(swiss.results())
swiss.publish_pdf(filename=r"gamex\lepdf.pdf")

analyse_gammex_image