# Model Generation : Creating 3D models with 3D Slicer

3D Slicer is an open-source program that allows for the three-dimensional visualization and processing of CT scans. The steps to go from a raw CT image sequence to a segmented 3D mesh are outlined below.

To import your images into 3D Slicer, you will need an .nrrd file. If you do not already have an existing .nrrd file, you can generate one using Fiji, a free image processing package available here:  <https://fiji.sc/>

**Generating an NRRD File** <br>

1. Open Fiji and go into: File → Import, and select  ***Image Sequence***
2. Select the file that contains your desired image sequence.
   1. If your file is large, you can increase the increment size
   2. Here, you can also determine which portions of the sequence you wish to export, and also change parameters such scaling.
   3. <img src="https://lh6.googleusercontent.com/IgAVTy_evrgEhPD0EINA6PrspR0jV_xvfnAY32_0xrIhha-dUu_DemA43evaBP7sN_G8tnXyaHjuRoyqH3YBCKndgFlgJvAHNQ8xbelY6F7qSPr5-soku15yvUA-0xsY2-LezIYU" alt="" data-size="original">\ <br>
3. To save your .nrrd, go to: File → Save As→ Nrrd
4. You now have a 3D Slicer-compatible NRRD image sequence!&#x20;

**Using 3D Slicer**

1. In 3D Slicer, load in the .nrrd file
   1. File → Add Data → Choose File(s) to Add → select the .nrrd file
   2. Click ***OK*** to load in the images
   3. ***IMPORTANT:*** 3D Slicer will by default set Image Spacing dimensions to 1mm x 1mm x 1mm. Select the ***Volumes*** module in the drop-down menu in the top left.

      ![](https://lh6.googleusercontent.com/GuiwHYm5pmuzPHRdMOF1qWWFGZLiSl-wIiLum4rLbkP15B8q_0aLrwln_LCnbt2jkp__NygknFO01_Q5B-dg2atOOj8tkd6zaz3MDgX8XkX-RDDwHIGB6HBj3qkwYfbxDQaNMIVP)
   4. In ***Volumes***, set Image Spacing to the dimensions of the original image sequence, which can usually be found in a metadata file. If using a scan from *MorphoSource*, the dimensions are listed in the specimen scan description.
   5. You should now have a workspace that looks like this:

![](https://lh4.googleusercontent.com/0WGhGQTjS_df9LlL7es4Zrv0h3ocw9JTLATZceU2AQipfWtBw7z3X6QNAgSyr1cm5mDAMGkKYPnaD092s9gu0TwHd6iU0IG8xv7Su0tpVYjWXLraRa1k1Bced6aBKm2Fle-tiPlV)

&#x20;      2\. You can adjust your workspace in: View  → Layout ( ***Conventional*** is the layout option used in the visuals provided here).

&#x20;      3\. Next, let’s generate a 3D mesh.

1. 1. Navigate to the ***Segment Editor*** module in the modules drop-down menu and click Add.\
      ![](https://lh4.googleusercontent.com/Nn7fHPoEVbHM0Gnk-SMyYtcEx8x-HpmTBVSgSXRji5yqyZ4Ay4DJuIOGlngfLGAo_N4OUKbLzAVHuqpjRuT9CPYr0EudazyzQKVZZa2wuQWoNiXoeMwKOWzHNE_7merf3EXrM5rp)<br>
   2. Double-click on the segment name to rename it (e.g. “catfish\_skull”) or change other properties such as color.
   3. In the ***Effects*** menu, you can use various tools to select a region of interest (ROI) for your mesh. It is easiest to select ***Threshold*** to generate a desired ROI.
   4. Adjust the ***Threshold*** slider to ensure that all desired bone areas are highlighted. You may also manually adjust the Threshold Range using the arrow keys.&#x20;
   5. Click ***Apply*** to apply your threshold settings.
   6. You can click on the ***Show 3D*** icon to see your current 3D mesh.
   7. If any adjustments have to be made, the ***Scissors*** tool is handy in removing unwanted artifacts. It is also useful for creating different meshes in 3D Slicer. To do so, simply ***Add*** a new segment and repeat these steps.
      1. *NOTE:* The ***Scissors*** tool applies ROI changes for the *entire* image sequence, not just the current frame. To eliminate an undesired portion of a *single* frame, the ***Erase*** tool can be used either in the 2D image window or in the 3D view window.&#x20;

![](https://lh4.googleusercontent.com/TltIQjob6PEWX3AkkF6Uh9E7Tt072MqhHOvppDl2GgLGMZTD3sRnKbfI_5D6vKpdW25OEr0kXSkp2GdwmxjEsx3iFmh-oC_xT-hZixpQPgBC-2JjPFL9_9uKpnNMAPTDm82vuS2Q)

&#x20;    4\. To export your mesh, click on the ***Segmentations*** icon.

![](https://lh4.googleusercontent.com/glWuPKdkn-e46TT9xVt68BQZ2kxHcnxCrRX6_gBjsb85R4oB1RnnERaEYAwmyGE6IhX8eLSaTyaGPLhJicBdgfnsWoonJHlBxxUmJk5crRMnD024TjTAqAV0lNxl8TSg5q1A5bxN)

1. 1. Scroll down to the *Export/Import* models and labelmaps section
   2. Make sure the Output Type is set to ***Models***\
      ![](https://lh3.googleusercontent.com/KIS7_dGkdfI-QKnDbZIfRj5VVnX0O6XiYIYjH20y41U4b_ZqCMOYQmRyZu6m1uXXNd7gAKwAvn8eXliYrkRGdxSJU5DLFeCxeNymrl2AWxjMEI4A4krZhmvcqSsnM7DQ-J2um0Kc)<br>
   3. Click  ***Export***
   4. Click ***Save*** at the top left of 3D Slicer
   5. In the popup window, uncheck all boxes on the left except for your desired segment (e.g. “catfish\_skull.vtk”)
   6. ***IMPORTANT:*** Change the file name and file directory as desired, but make sure to set the file format to OBJ (.obj)
   7. Click ***Save*** when finished.

&#x20;    5\. You now have a segmented 3D mesh! However, final mesh changes (e.g. polygon reduction, mesh cleaning, etc.) can be done in MeshLab.&#x20;
