qurit / rt-utils

A minimal Python library to facilitate the creation and manipulation of DICOM RTStructs.
MIT License
181 stars 56 forks source link

Add ROI from coordinates #107

Open gacou54 opened 4 months ago

gacou54 commented 4 months ago

This PR adds a new method, RTStruct.add_from_coordinates() where users can add a polygon from coordinates of x, y, z values.

This is how it looks for the user

rtstruct.add_roi_from_coordinates(
    coordinates=[
        [
            # Example of a contour
            [-20.0, -170.0, -559.0],
            [30.0, -170.0, -559.0],
            [30.0, -110.0, -559.0],
            [-20.0, -110.0, -559.0],
        ],
        [
            [-20.0, -170.0, -562.4],
            [30.0, -170.0, -562.4],
            [30.0, -110.0, -562.4],
            [-20.0, -110.0, -562.4],
        ]
    ]
)
gacou54 commented 4 months ago

I just saw the issue #77 and PR #79. I had the same issue and made this PR but didn't see it. I imagine that the 2 PRs are equivalent. You can delete this one if #79 is better