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