-
Notifications
You must be signed in to change notification settings - Fork 24
Extracting meshes
In this tutorial, we'll extract a surface mesh from a set of CT images.
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.
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.
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).
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.
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.
Edit the operation parameters using the image array number and voxel range your found earlier.
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.
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.
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!
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).
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.
If you opted for automatic filename selection then after running the script, check the terminal for the file's name.
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.