Skip to content

Add ROI from coordinates#107

Open
gacou54 wants to merge 6 commits into
qurit:mainfrom
paradim-platform:feature/from-coordinates
Open

Add ROI from coordinates#107
gacou54 wants to merge 6 commits into
qurit:mainfrom
paradim-platform:feature/from-coordinates

Conversation

@gacou54

@gacou54 gacou54 commented Mar 4, 2024

Copy link
Copy Markdown

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

gacou54 commented Mar 4, 2024

Copy link
Copy Markdown
Author

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

zeakey commented Apr 5, 2025

Copy link
Copy Markdown

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