Skip to content

Conversation

@gacou54
Copy link

@gacou54 gacou54 commented Mar 4, 2024

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
Copy link
Author

gacou54 commented Mar 4, 2024

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

@zeakey
Copy link

zeakey commented Apr 5, 2025

Actually, this is a very important feature that avoids unnecessary and inaccurate computation of the polygons (coordinates) from binary masks.

The current state of rt-utils only supports binary masks as input, and then recovers the polygons from the masks. This process is not perfect and may introduce errors.

In many applications, the ROIs are in the form of polygons (coordinates). The "polygons -> masks -> polygons" routine introduces unnecessary computation and errors.

@qurit-frizi would you please consider merge either this PR or my implementation in #79 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants