Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return ROI names of geometric type #99

Open
mffield opened this issue Oct 30, 2023 · 0 comments
Open

Return ROI names of geometric type #99

mffield opened this issue Oct 30, 2023 · 0 comments

Comments

@mffield
Copy link

mffield commented Oct 30, 2023

Hello,
In using the package I tended to call get_roi_names() to obtain a list of structures that I would like to retrieve a mask for, then retrieved the masks with the function get_roi_mask_by_name(). However, it ran into problems when there are different geometric types in the RTSTRUCT, especially the 'POINT' geometries. Generally if all of the contours are described as 'CLOSED_PLANAR' then the process works fine. But some datasets have these POINT ROIs and it is not always clear that they are from the name. So my proposal is to have another optional argument to get_roi_names() to specify the geometries we want to return. Default behaviour is the original version of listing all names. To get all CLOSED_PLANAR structures only we would call rtstruct_ds.get_roi_names('CLOSED_PLANAR') where rtstruct_ds is the rtstruct object from this repository. Here is the modified function below in rtstruct.py.

def get_roi_names(self, geometry = 'ALL') -> List[str]:
        """
        Returns a list of the names of all ROI within the RTStruct
        Optional argument to return only ROI of specific geometric type. E.g. CLOSED_PLANAR, POINT
        """
        
        if not self.ds.StructureSetROISequence:
            return []
        
        if geometry == 'ALL':
            return [
                structure_roi.ROIName for structure_roi in self.ds.StructureSetROISequence
            ]
        
        return [
                self.ds.StructureSetROISequence[i].ROIName 
                for i in range(0,len(self.ds.ROIContourSequence)) 
                if self.ds.ROIContourSequence[i].ContourSequence[0].ContourGeometricType==geometry
            ]

Let me know if this is useful to incorporate, it certainly is for my work as I had to do this check separately outside this package.

Best wishes,
Matt

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

No branches or pull requests

1 participant