Convert rt structure with hole to stl

Hi all,

I am able to convert a simple ROI (or rt sturcture) made in our treatment planning system into an STL file for 3D printing. What I want to do is convert an ROI with a hole in it into an STL file. To start out, I made a simple shape with a hole in the treatment planning system. I tried using the same process, but there was no hole. As you can see from the screenshot, Slicer is able to show the outline of the hole, but the hole is not visible in the 3D view nor is it visible in printer’s slicing software.

Please advise,

Ali

Hi,

you need to convert the models to segmentations.

The use the segmentation editor and use logical operator to subtract the one from the other.

Then you can use the the export it as a stl model from the segment editor.

Also you can simply export the created models as two separate models as stl files and use Blender or meshmixer and do the substraction. As long as you do not move the objects coordinates will be preserved and for planning purposes you can import it back to 3D Slicer as well. Just make sure you don’t move the objects around.

We use second workflow because blender allows much much more functionality when it come to modelling and 3D printing.

DICOM RTSTRUCT uses a set of parallel contours to define a segment.

Having a hole in a segment is a very special case as it actually cannot be represented with planar contours. The DICOM standard describes a workaround, the “keyhole” technique. What treatment planning system did you use to create the RTSTRUCT? Does it support “keyhole” technique? Can you provide a sample RTSTRUCT so that we can verify if Slicer’s importer works correctly?

Do DICOM import and STL export work as expected for structures that don’t have hole in the slicing plane?

Good news: With the suggestions from manjula, I was able to test this process to successfully make a box with holes in it.

Bad news: For my actual process, I will need to subtract 5-20 structures from the main structure. It will be possible, but tedious using 3DSlicer. Is there a more recommended software for this use case?

@lassoan We use RayStation. Reading about this “keyhole” technique here, I looked at some wall contours made my RayStation. However, these ROIs did not have the design described in the link. They simply had a contour inside another one.

That would be a pretty harsh violation of the DICOM standard. If you provide an example data set then I can follow up with them.

That’s fine. Once you figured out a processing workflow using GUI, you can automate all tedious steps by writing a short Python script. Look around for examples in the script repository and let us know if you cannot find an example for automating some of the steps in your workflow.

Thank you.

Actually, now that I got the “thing with holes” stl export process prototyped, the next phase is to write a (python) program to create the hole objects I need, given the main object. Glad to learn I can use python to interact with 3D Slicer. Looks like, I can then use 3D Slicer’s python extension capability to “put the holes into the main object”, so to speak.

I have not experience writing gui programs though. Do you think (down the line, with some help) it is reasonable to end up with a (single, self-contained) module in 3D Slicer for this (whole) procedure? That will help other professionals adopt this technique. Somehow, I thought I had to use C++ to interact with 3D Slicer on a programmatic level.

Yes you can write scripted modules (in python) for slicer which you can use just like any other module. You can add buttons, input selectors etc. You can call other modules to do things for you so you can do all your work in one ‘self contained module’.

See some info on python scripting here and the script repository above.

Once you have a script which works check out the developer tutorials on this page for tutorials on how to make your script into a scripted module

Although in python slicer uses a lot of libraries so it can be hard to get your head around all the syntax. I have figured out how to do most things I need from the script repository. Anything you can’t figure out you can post here on the forum.

1 Like