Skip to content

Extracting meshes

Hal Clark edited this page Feb 17, 2022 · 1 revision

In this tutorial, we'll extract a surface mesh from a set of CT images.

Loading image files

First, load your CT images using File -> Open. If you don't have any, you can generate a synthetic set using the GeneratVirtualDataImageSphereV1 operation. In the following example, we'll use a phantom scan taken with a real CT scanner.

Generating images

Isolate images

Your files may contain several sets of image arrays ('series') that need to be separated before attempting to extract a surface mesh. We'll use the built-in DICOM image partition action for this.

Partitioning

Select your image array

Using the Image Navigation window, determine which image array contains the images of interest. Often the first few arrays will contain irrelevant data, like pilot/scout scans or images with inferior settings (e.g., incorrect energy, low-quality image, insufficient field-of-view).

At this point we only need the Array number (in the screenshot it is 3).

Identify image array

Identify voxel intensity range

Use the mouse to inspect voxel (pixel) intensity throughout the image array. Mesh extraction works by including all image voxels that fall within the range.

CT images will often use a Hounsfield scale where air has intensity -1000 HU, water has intensity 0 HU, and bone and metals have a range that hovers around 1000-5000 HU.

Note that the range can include infinity and -infinity if the range needs to include everything larger/smaller than a given number.

Identify voxel intensity range

Extract mesh

We're now ready to extract a mesh. To do this, we'll need to create and edit a script.

Append the 'ConvertImagesToMeshes' operation using the Script menu.

Create script

Edit the operation parameters using the image array number and voxel range your found earlier.

Edit script

Click the Validate button above the script to check for syntax errors. A Script Feedback dialog will appear, and the corresponding line numbers in the script will be highlighted. Information about the available options are also provided.

Script feedback

If everything looks OK, run the script using the Run button. Parts of the interface will become unavailable. If you launched DICOMautomaton via a terminal, you can watch progress of the script running in the background by peeking at the stdout. On Windows, a terminal should also appear in the background when you first opened DICOMautomaton.

Running script

When the script finishes, a mesh should appear. Play with the settings to get a clear picture. In particular, the wireframe option can make the surface hard to see when there are lots of triangles. Meshes extracted from image arrays tend to have lots of triangles -- this one has 11 million!

View of extracted mesh

Export mesh

If you want to export the mesh, another script will be needed. There are a few choices for export format. Pick whichever you prefer and append it to a new script (or append and delete the prior script).

Export script

Like before we need to edit the script, validate, and run. In this case the 'Filename' argument can be left empty -- DICOMautomaton will create a new file in your temp directory.

Export script

If you opted for automatic filename selection then after running the script, check the terminal for the file's name.

Mesh filename

Conclusion

This concludes the mesh extraction tutorial.

Meshes are a fundamental, versatile data type in DICOMautomaton, and there are various things we can use them for. This functionality will be covered in a later tutorial.