Rasterizing planar contours

23 views
Skip to first unread message

Andrey Fedorov

unread,
Oct 2, 2020, 4:25:14 PM10/2/20
to Plastimatch
Hi,

I have annotations that are defined as closed planar contours (ordered list of in-plane points) - similar to RTSTRUCT, but not in RTSTRUCT objects.

Is there any way I can use Plastimatch tools to fill and rasterize those planar contours to the image slice geometry?

Andrey

Sharp, Gregory C.

unread,
Oct 2, 2020, 5:59:27 PM10/2/20
to plast...@googlegroups.com

Hi Andrey,

 

Probably yes.  Plastimatch has an ASCII format, but it does require that the point locations are sorted around the polygon. The ASCII format also requires 3D coordinates and a few other caveats.  Please let give a bit more detail and I can give cleaner suggestion of the difficulty of marshalling over.

 

Greg

 

From: plast...@googlegroups.com <plast...@googlegroups.com> On Behalf Of Andrey Fedorov
Sent: Friday, October 02, 2020 4:25 PM
To: Plastimatch <plast...@googlegroups.com>
Subject: [Plastimatch] Rasterizing planar contours

 

        External Email - Use Caution        

--
You received this message because you are subscribed to the Google Groups "Plastimatch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plastimatch...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/plastimatch/2eec75be-0ce3-4927-b959-955ced4a233en%40googlegroups.com.

The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at http://www.massgeneralbrigham.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.

Andrey Fedorov

unread,
Oct 2, 2020, 6:08:26 PM10/2/20
to Plastimatch
Greg,

sounds promising!

What I am trying to do is to rasterize annotations created in md.ai (https://docs.md.ai/data/json/). I do NOT recommend you try to decipher their documentation - IMHO it is not complete and requires reverse-engineering, but I asked experts of md.ai to clarify few things, so hopefully will get it resolved. Currently, they may have multiple contours in the same plane, and it is not clear what set of "id"s is needed to separate groups of points corresponding to the individual in-plane contours.

In a nutshell, when I get the missing info, what I should be able to have is 1) in-plane list of points with 3d coordinates of a closed contour, with points listed in order of contour traversal; 2) DICOM instance corresponding to the plane of the contour.

At this point, I am rasterizing consecutive points with lines, and was going to next use some binary filling filter from ITK to fill the contour, but somehow I feel plastimatch might have something more robust than that (e.g., what I have in mind will fail if the outer edges of the contour touch).

Does this give all the details you need?

Andrey

Sharp, Gregory C.

unread,
Oct 2, 2020, 6:26:26 PM10/2/20
to plast...@googlegroups.com

Hi AF,

Yes.  Perhaps plm might better than your script, it implements the standard line-scan polygon fill algorithm.  But there are always caveats as you know.

 

The plastimatch ASCII format has a specification, albeit bare-boned.  The easiest way to understand how to marshall data would be to create a segmentation and then convert it using plastimatch with the --output-cxt option.  The specification is below, but making an example will be easy and useful.  Happy to help any questions!

 

http://plastimatch.org/cxt_file_format.html

Andrey Fedorov

unread,
Oct 2, 2020, 9:59:45 PM10/2/20
to Plastimatch
Thanks a lot Greg, this is very helpful! I will follow up if I run into issues.

For the sake of completeness of this thread, below is an example CXT file I generated usinig an RTSTRUCT instance from this TCIA public dataset: https://doi.org/10.7937/K9/TCIA.2015.PF0M9REI (feel free to reuse it for the Plastimatch documentation - I think it will not hurt ;-) ).

CT_SERIES_UID 1.2.826.0.1.3680043.8.274.1.1.0.67877.1601689250.182098
CT_STUDY_UID 1.2.826.0.1.3680043.8.274.1.1.0.67877.1601689250.182114
CT_FRAME_OF_REFERENCE_UID 1.2.826.0.1.3680043.8.274.1.1.0.67877.1601689250.182115
PATIENT_NAME ANONYMOUS
PATIENT_ID PL428899027484971
PATIENT_SEX O
STUDY_ID
OFFSET -149.79 -354.415 -612.5
DIMENSION 512 512 88
SPACING 0.613614 0.613614 3
ROI_NAMES
2|0 255 120|GTV-1
6|255 192 96|Spinal-Cord
7|64 64 255|Lung-Left
8|64 64 255|Lung-Right
END_OF_ROI_NAMES
2||22|42||75.199997\-218.009995\-486.500000\77.150002\-218.009995\-486.500000\77.370003\-217.839996\-486.500000\78.059998\-215.880005\-486.500000\77.750000\-213.929993\-486.500000\77.150002\-212.740005\-486.500000\76.750000\-211.979996\-486.500000\76.059998\-210.020004\-486.500000\75.199997\-208.899994\-486.500000\74.430000\-208.070007\-486.500000\73.239998\-207.149994\-486.500000\71.290001\-206.539993\-486.500000\69.339996\-206.520004\-486.500000\67.449997\-208.070007\-486.500000\67.440002\-210.020004\-486.500000\68.089996\-211.979996\-486.500000\69.339996\-213.699997\-486.500000\69.519997\-213.929993\-486.500000\71.290001\-215.699997\-486.500000\71.500000\-215.880005\-486.500000\73.239998\-217.100006\-486.500000\74.870003\-217.839996\-486.500000
<....>

Reply all
Reply to author
Forward
0 new messages