Creating mask of the structure from contour data points

420 views
Skip to first unread message

Suman Gautam

unread,
Aug 22, 2022, 10:33:10 AM8/22/22
to dicompyler
Hello 

How to plot the mask of the structure from three dimension contour data points? I have three dimesional data points of the structure file. I wnat to plot the structure of that file and say that the oixel value inside the contour points is 0 and outside the contour points is 1. I have attached belwo the contour points.

Thank you 
cont.PNG

Stephen Terry

unread,
Aug 22, 2022, 1:42:22 PM8/22/22
to dicom...@googlegroups.com
For me, the most straightforward way is to use the Shapely library to convert the contour to a Shapely Polygon. You can see it used this way in the CalculateStructureVolume method of the dicomparser class in dicompylercore. A Shapely Polygon has a contains() method that tests if another shapely object (like a Point) lies within it. It can even be vectorized so you can use a 2D numpy array of coordinates. See https://gist.github.com/pelson/9785576

Steve  

--
-- You received this message because you are subscribed to the Google Groups dicompyler group. To post to this group, send email to dicom...@googlegroups.com. To unsubscribe from this group, send email to dicompyler+...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/dicompyler?hl=en
---
You received this message because you are subscribed to the Google Groups "dicompyler" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dicompyler+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dicompyler/a346b644-6c4e-41ee-9df3-b739b309aecan%40googlegroups.com.

Suman Gautam

unread,
Aug 24, 2022, 11:10:26 AM8/24/22
to dicom...@googlegroups.com
Thank you very much for the information. 

I have seen some examples for 2D but not for 3D. Calculating structure volume from the class  Dicomplyercore is not obvious for me. I am struggling a lot in spite of these references you provided. Could you please help me creating from those contour data points? 
I appreciate your help.

Thank you very much.



image.png




With Best Regards

Suman Gautam


Mailtrack Sender notified by
Mailtrack
08/24/22, 11:07:45 AM

Stephen Terry

unread,
Aug 24, 2022, 11:46:38 AM8/24/22
to dicom...@googlegroups.com
Whoops, sorry. I missed that the contour type in your first example was nonplanar. I've only worked with contours like in the example you just posted where the contour is entirely in the z=-52.5 plane. If the contour is entirely in one plane, you can just create a 2D mask for each z slice and stack them together to make a 3D mask. But for non-coplanar contours, I'm not sure how you would do that.

Steve

Andrew Miller

unread,
Aug 24, 2022, 6:45:35 PM8/24/22
to dicom...@googlegroups.com
within the python code for DICOMpyler and OnkoDICOM you will find coding examples of how to calculate volumes (i.e., 3D) from RTSTRUCT files which give 2D coordinates.

A



--
Prof. Andrew Miller
B.Med, B.Sc, Grad.Dip.Ed, M.Inf.Comm.Tech(Res), FRANZCR, FAIDH, PHF
---------------------------------------------------
“Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened.” ― Winston S. Churchill

A committee is a cul-de-sac down which ideas are lured and then quietly strangled.

Andrew Miller

unread,
Aug 24, 2022, 6:47:26 PM8/24/22
to dicom...@googlegroups.com
DICOMpyler does the calculation and displays it on the GUI.
OnkoDICOM does the calculation and saves it inside RTDOSE, and can output it into a CSV file for a single study or a directory of studies.

A

Suman Gautam

unread,
Oct 3, 2022, 11:12:06 AM10/3/22
to dicompyler
Hi 

I have an issues in creating a mask for tandem and ovoid in BT. The error is attached below. 


tandem mask.PNG

Andrew Miller

unread,
Oct 3, 2022, 6:14:08 PM10/3/22
to dicom...@googlegroups.com
Are you trying to create ROIs?

A

Suman Gautam

unread,
Oct 3, 2022, 7:27:29 PM10/3/22
to dicom...@googlegroups.com
I am trying to create binary mask for tandem and ovoids. ROIs in my restructure files are shown.

--





----------------
Regards,
Suman Gautam 
PhD Student
Department of Radiation Oncology.
Division of Medical Physics
VIRGINIA COMMONWEALTH UNIVERSITY

Suman Gautam

unread,
Oct 31, 2022, 10:24:36 AM10/31/22
to dicom...@googlegroups.com
Hi 

I have an issue creating mask with the DICOM files.


rectu.PNG



reter1.PNG




reter2.PNG


With Best Regards

Suman Gautam


Mailtrack Sender notified by
Mailtrack
10/31/22, 10:24:20 AM

You received this message because you are subscribed to a topic in the Google Groups "dicompyler" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dicompyler/dF8jlWm16ec/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dicompyler+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dicompyler/CAGLPkGM_VvRUwuVVhJN5B3v4CMjF0tvwqHbzfntaKPoae9hVkg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages