Process to Import an STL File and Convert/Export a Series of DICOM Files?

Hi,

I’m hoping someone can help with a workflow to import an STL file into Slicer, convert it to a series of DICOM files and export those DICOM files. I’ve checked other forums and can’t find anything that gives a step-by-step of the process. Thank you in advance for the help!

Andrew

How would you like to export the segmentation: DICOM segmentation object, RT structure set, or fake CT/MRI?

Hi Andras, I’m interested in exporting a series of DICOM files similar to what is typically imported into Slicer from a CT scan.

So, would you like to generate a synthetic CT scan from an original CT scan, blanking out regions that are outside a selected segment?

Not necessarily. I have a 3D model that I’ve saved in STL format that I need to generate DICOM file for. The DICOM files should be the same format as what is generated from a CT or MRI scan.

STL is a mesh, while CT and MRI are images, so you cannot save in the same format. They are very different kind of data.

You can convert the STL surface mesh to an image for example by blanking out areas inside and/or outside the surface mesh.

Can you tell more about your use case? What software will use the exported STL mesh and how?

Here’s my process:

  1. Import DICOM data from a patient CT scan into Slicer.
  2. Export patient 3D volume to STL file.
  3. Create a 3D component in SolidWorks.
  4. Export 3D component from SolidWorks to STL file.
  5. Combine STL files generated from both Slicer and SolidWorks in Meshmixer and export as a new STL file (3D mesh - not just surface mesh)
  6. Import new STL file into Slicer.
  7. Create 3D segments and export to DICOM files.
  8. Open and review DICOM files in a piece of equipment designed to open and review standard CT/MRI scan DICOM files.

I just need help defining the process for steps 6 and 7. Thanks!

If I understand your needs correctly, given that you will need labelmaps anyway, you can skip the Meshmixer step and do that in Slicer as well. What I can imagine:

  1. Do not export it to STL
  2. No change
  3. No change
  4. Import SolidWorks STL into Slicer -> Convert it to segmentation node (if you want to make sure the labelmap geometry matches the CT, you can create empty segmentation in Segmentations module, change master to Closed surface, import STL part, and “advanced create” the labelmap specifying the CT as reference volume) -> Change master to Binary labelmap -> Import “patient 3D volume” that you mention in step 2 (whatever it means…) in this segmentation node -> In Segment Editor, use the Logical operators to unify the part and the “patient volume”
  5. Not needed
  6. In Segmentations module, Export segmentation to labelmap, specifying the CT as reference volume (in Advanced section of Import/Export) -> In Volumes module, change the volume type from labelmap to scalar volume -> In Data module, drag&drop it in the same study as the CT -> Right-click it, Export to DICOM
2 Likes

@cpinter this is very useful advice.

My only comment would be that @aleesdesigner probably needs to design something around the patient’s bone/tissue geometry so would need to export the file at step 2 in order to load it into Solidworks.

If I am interpreting your need correctly, my suggestion would be:

  1. Import DICOM data from a patient CT scan into Slicer.
  2. Export patient 3D volume to STL file.
  3. Import patient STL into Solidworks and create a 3D component in SolidWorks WITHOUT moving the location of the patient STL file in 3D space in Solidworks.
  4. Export 3D component from SolidWorks to STL file.
  5. Import the 3D component STL from Solidworks into Slicer. As long as you have not changed the coordinate system in Solidworks then it should appear in exactly the right place on the patient’s bone/tissue in slicer.
  6. Go to Segmentations module (not segment editor). Select the segmentation node which you used to originally segment the patient’s bone/tissue. Go to Import/Export models and labelmaps area and import the model into the segmentation node.
  7. Go to segment editor, click on you original patient bone/tissue segment and then click the logical operators effect. Select Add and add the solidworks model segment to the original segment. (Instead of using meshmixer)
  8. Go back to the segmentations module, click on the newly combined segment and using the same Import/Export area export the segment as a label map.
  9. Go to the volumes module and convert the new label map to a scalar volume.
  10. Go to data module and right click on the new volume and select export to DICOM.
  11. Open and review DICOM files in a piece of equipment designed to open and review standard CT/MRI scan DICOM files.

Note that the dicom file is just a completely black and white image. All the bone contrast is lost. You might have to do something a bit more fancy to combine your model volume on top of the original volume if you still want the original bone contrast but I am pretty sure it would be possible.

I tried this out and it worked well for me. Thanks to @cpinter for the extra tips about converting back to a scalar volume etc.

1 Like

Hi there. My use case for Slicer is similar, but with a key difference: I need to import an STL surface mesh of a physical object (either from an optical scanner or a CAD design) and then export it as a stack of DICOM images representing cross-sectional slices of the surface contours.

So far, I have successfully opened my STL file as a “model,” but I am unable to visualize any slice images from it. (Importing the same data as a “segmentation” does not display any object information.) This STL was not generated by SolidWorks.

What specific characteristics does the STL file require for this to work? I am exploring alternative software options, but I would first like to determine if Slicer can accomplish this task—specifically, exporting the 3D object as a stack of 2D DICOM images.

After you import model as segmentation, right click on the segmentation and choose export labelmap. Then you can use that labelmap to export to dicom.

1 Like

Great, this works good. Unfortunately on Blender I safe the object file very tiny. Can I ajust the scene in 3D Slicer? The section images on default only alow me three steps: -1, 0, 1 mm. I would love to refine these steps.

I would appreciate, if zooming into the 3D volume would adjust the three predefined section images… This might not be the case, this I only recognize green dots in the center. How can I zoom into the section images?

Slicer assumes the unit in your STL are millimeters, since mm is its default unit and STL does not have a way to tell Slicer what those units are. You can use the transforms module to scale your model up/down and then you can do the conversions again.

Thank you very much for your attention. I checked the Tranforms Model and attach some outcome. Still, I am on the wrong way. Could you help me out, please? I still believe Slicer is my option on this task. Best regard, Verena

Actually just use the Scale Model option of the Surface Toolbox module and increase the scale on XYZ and up to the maximum. Then check the resultant model, if it is sufficiently large, then proceed with conversion. If not, apply the scaling again.

Note that you are now arbitrarily scaling things, not sure if this is compatible with your end goal.

Hi Murat, thank you for your attention. Scaling sounds great, yet I am not sure how to “apply“ your idea. I found the corresponding toolbox, as atteched in the screenshots. However, I have no clue hoy to perform the scalinging. Can you help me out, please?

My end goal is to collect section images of this 3D object (hollow cylinder), where the surface projects as concentric circles. I am looking forward to compare these image stack with a CT tomography (DICOM image stack) and possibly use some design imformation on the iterative reconstruction task. The real cylinder is a metal one and causes beam hardening.

to accomplish what you need to do, you need to get familiar with Slicer’s UI and how these types of modules are set to work. I think you should begin with Slicer’s official documentation

and then specifically see the section on Surface Toolbox.

Yes, now I unterstand my operational error of the UI. Thank you!

1 Like