Thursday, March 5, 2009

3D Slicer: The Tutorial Part VI

Nick (of why I hate theropods) posted a question today on this blog, asking if there was a way to save models from Slicer as STL files. So, here's a quick post explaining how to do just this.

Why would you want to do this, if there's a perfectly good VTK-format model exported by Slicer already? Well, VTK is an industry standard that is good for many open source software packages, but most commercial packages don't deal well with the format. So, STL ("stereolithography") files are a happy medium. STL format has its own issues, but is nearly universally read by computer modeling programs.

In order to get a start on exporting STL's from Slicer, let's return to where we picked up from the last tutorial. Load all of your files (you saved the model and label map after the last tutorial, right?). This should give you the brain in the middle of the 3D viewer. For some unknown reason, say you want to export this brain as an STL for post-processing in another program. Luckily, it's a relatively easy thing to do!

First, switch to the "Models" module, by selecting under the "Modules" drop-down menu.
Then, click on the "Save" tab, to expand this option. Hit the "Save Model" button.

A dialog box comes up, and you can choose an alternative from the default (VTK) under the "Files of Type" option. In this case, select "STL."
Choose the name and location for your file, hit save, and you're done!

9 comments:

Nick Gardner said...
This comment has been removed by the author.
Nick Gardner said...

Thanks, this is helpful to those of us who haven't quite made (or aren't quite ready to make) the switch to 100% open source software.

(I deleted my previous comment because I messed up the syntax...)

mape2k said...

Hello Andy!

I'm using 3DSlicer in order to create a 3D model of my head out of DICOM images.
Loading Data and segmenting works just fine and the model is already made and working.


I have one big problem however:
I cannot save models as .stl files. I need them in this format so i can use them in some other software. When i try to save them as .stl with 3DSlicer 3.3.2.2008-08-08(stable release, linux(x64)) i get only a 21B big file which is empty. You mentioned in your tutorial that you use a 3.3.3alpha version. I've downloaded one 3.3.3alpha version from the 3DSlicer webpage, but under the models module there is no "save model" option anymore. Could you tell me which 3.3.3alpha version you are using exactly?

I've already tried to save the .vtk models as .stl on several machines and OS, none of them have worked so far. Do you know of any requirements for .stl that i might have missed in the process of making the model?

Another approach would be to use VTK directly, but i am no expert in scripting and it would take some work getting into VTK.

BTW: Thanks for the great tutorials that you have made, they saved me a lot of time getting into 3DSlicer. I really appreciate them.


Kind regards from Germany,

mape2k

Anonymous said...

Hello to mape2k,

just have the same problem, that my export of the .stl file is just 23 Bytes... does anybody know a different way to do this process?

Thanks a lot and kind regards,

flo

spinemodeler said...

Great post!
Can you give some insight on how you further convert STL surface models to finite element models? Which FE software are you using?

Andrei said...

Hello,

I got the same problem as mape2k and Anonymous/flo. When I save my model as an STL file, this file is only 23bytes and contains only two lines: solid ascii
endsolid

Do you know the reason why it's not saving the model correctly?

Thanks,
Andrei

Steve said...

Hi -

Just FYI for anyone following these instructions for making stl files from slicer: the Save functionality is unified under the File->Save menu in newer versions of slicer. You can still save in .stl format and the feature is working fine in current releases.

See the full documentation here:


http://www.slicer.org/slicerWiki/index.php/Documentation-3.6

-Steve

xdelphi said...

Hey Guy, can you help me to do the opposite thing?

I have create 3D model using autocad, and can save it to .stl. How can I open .stl file using Slicer?

Please, it will be breakthrough to introduce Slicer into engineering community.

logit said...

I'm trying to figure out what the scaling is for the final output STL files -- if I send something for 3d printing, will this pipeline preserve the scale info in the original DICOM file so the final product's real size? Any idea? It seems like some of the 3d printers require manual input of a scale factor during printing..

Otherwise, great tutorial -- I managed just finally managed to get a good STL model of a skull I need to print after flailing in matlab for a week :-)

Thanks!