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

gt_image_to_dicom_rt_struct ? #32

Open
tbaudier opened this issue Jun 19, 2020 · 3 comments
Open

gt_image_to_dicom_rt_struct ? #32

tbaudier opened this issue Jun 19, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@tbaudier
Copy link
Contributor

Hi all, Hi @djboersma ,

Do you think it's possible to create a tool converting binary mask to DicomRTStruct; the opposite of gt_dicom_rt_struct_to_image?

Thank you

@tbaudier tbaudier added the enhancement New feature or request label Jun 19, 2020
@djboersma
Copy link
Contributor

djboersma commented Jun 19, 2020

I think it is "kind of possible": for every layer, draw contours around the contiguous islands of "enabled" voxels. There are many ways to do this, probably, each with their pros and cons. The algorithm for identifying the "contiguous islands" is an interesting intellectual exercise, though it probably has been solved many times already in mathematics and in code; it's probably part of lots of pattern recognition algorithms. Maybe the "shapely" module has something to offer here?

I wrote "kind of possible" instead of "possible" because the tool will not be an exact inverse of gt_dicom_rt_struct_to_image, even when the mask/image has the z-step identical to the distance between the contours in the structure set. But if you do the following ...

  1. use the existing gt_dicom_rt_struct_to_image to convert a given ROI from DICOM structure and a given image into a mask
  2. use the new gt_image_to_dicom_rt_struct to convert that mask and the given image into a new ROI
  3. use the existing gt_dicom_rt_struct_to_image to convert the new ROI and the given image (same as in 1.) into another mask

... then the masks created in step 1 and 3 should be identical. So the original ROI and the new ROI have different contours but are "equivalent" in the sense that they include/exclude the same sets of voxels (only for the "given image", because for other images with different voxel geometry they may not be equivalent, due to the slightly different contours).

@djboersma
Copy link
Contributor

Do we have use cases for this?

@tbaudier
Copy link
Contributor Author

tbaudier commented Jun 19, 2020

Thank you for you answer,

We already have a tool in c++ (the code is here https://github.com/open-vv/vv/blob/master/common/clitkImage2DicomRTStructFilter.txx but it's complicated to install it with an external GDCM) and it use VTK to convert binary image to a mesh.

But I wondered if what you implemented in roi_utils.py could be useful to do such a tool in Python.
If I have time I will investigate using vtk python wrapping.

Yes we have use case, usually to put ROI in clinical software we already drew.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants