Jul 17, 2020

Public workspacePhenotyping 3D coral models in MeshLab V.1

  • 1University of Southern California
  • Coral Bleaching RCN protocols
Icon indicating open access to content
QR code linking to this content
Protocol CitationWyatt C Million, Carly Kenkel 2020. Phenotyping 3D coral models in MeshLab. protocols.io https://dx.doi.org/10.17504/protocols.io.bgbpjsmn
License: This is an open access protocol distributed under the terms of the Creative Commons Attribution License,  which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited
Protocol status: Working
We use this protocol and it's working
Created: May 13, 2020
Last Modified: July 17, 2020
Protocol Integer ID: 36943
Keywords: 3D photogrammetry, phenotyping, coral, morphology
Abstract
This protocol describes the process of phenotyping branching coral using the 3D model editing software, MeshLab. MeshLab is a free, straightforward software to analyze 3D models of corals that is especially useful in its ability to import color from Agisoft Metashape models. This protocol outlines the steps used by the Kenkel lab to noninvasively phenotype Acropora cervicornis colonies for total linear extension (TLE), surface area, volume, and volume of interstitial space. We incorporate Agisoft Metashape markers with our Tomahawk scaling system (see Image Capture Protocol) in our workflow which is useful for scaling and to improve model building. Other scaling objects can be used, however these markers provide a consistent scale that do not obstruct the coral during image capture. MeshLab measurements of TLE have been groundtruthed to field measures of TLE. 3D surface area and volume have not yet been compared to traditional methods of wax dipping, for surface area, and water displacement, for volume. However, in tests with shapes of known dimensions, i.e. cubes, MeshLab produced accurate measures of 3D surface area and volume when compared to calculated surface area and volume.

For directions to photograph coral for 3D photogrammetry see our Image Capture Protocol. For a walkthrough and scripts to run Agisoft Metashape on the command line, see https://github.com/wyattmillion/Coral3DPhotogram.

These protocols, while created for branching coral, can be applied to 3D models of any coral morphology or any object really. Our goal is to make easy-to-use protocols using accessible softwares in the hopes of creating a standardized method for 3D photogrammetry in coral biology.


Go to http://www.meshlab.net/#download to download the appropriate software for your operating system.
P. Cignoni, M. Callieri, M. Corsini, M. Dellepiane, F. Ganovelli, G. Ranzuglia
MeshLab: an Open-Source Mesh Processing Tool
Sixth Eurographics Italian Chapter Conference, page 129-136, 2008
Open your 3D model file in MeshLab. Wavefront (.obj) is one 3D file format that can be exported by Metashape. We recommend using this format because .obj files can be exported with color included. Having color in the models is especially important when cropping the model down to just the coral. You can test out this protocol using one of our previously built models which can be downloaded here: https://github.com/wyattmillion/Coral3DPhotogram/tree/master/Example

File > Import mesh > select file and open
Generate a scale factor for a model using scaling markers/objects.

This process can be completed using any object of known size that is built into the model. It is helpful to take replicate measures for different scaling objects. I use the 12 bit, 2mm sized "markers" provided by Metashape. These markers are unique targets that aid in model building as well as in scaling. For directions on where to find and how to include the markers in your models, see our Image Capture Protocol.
Metashape markers that can be used for scaling models. Each target has a unique design but maintains constant dimensions.

Measure 3 separate radii on the markers starting from the center of the inner black circle to the outside edge of the outer black ring (see below). The radius of the markers in our test model is 0.6 cm.

a) Select the Measuring Tool and click once to set the start point for a measure then move the mouse to make the measurement and click again. The measurement will appear in the top lefthand corner of the working space.
b) Press ESC to make another measurement. You can also press ESC in the middle of a measurement to rotate/zoom the model.
Screenshot from MeshLab showing the measurements for 3 separate markers in a coral model. The location of the measurement tool used for this step is indicated by the red circle. The orange lines indicate the measured length.

Calculate a scale factor from your measurements of the scaling object. In this case, because all of the scaling objects have identitcal dimensions you can average these lengths before creating a scale factor.

For the test model, you can use the following equation:
0.6 cm /(average of radii)=scale factor
In general, you can determine the scale factor with:
(actual measure of scaling object/ (average of replicate 3D measures of scaling object))= scale factor

*Note the units you are measuring in
Apply the scale factor to the model.

a) Filters > Normals, Curvatures, and Orientation > Transform: Scale, Normalize
b) Enter the scale factor into X Axis box, making sure 'Uniform Scaling', 'Freeze Matrix', and 'Apply to All Visible Layers' are all checked
c) Click “Apply” to scale your model
Scale, Normalize dialogue box from MeshLab with a random scale factor in the X Axis box.
Verify the model is the appropriate size by remeasuring your scaling object, ensuring it is now equal to the real-life size.
If you have not already removed the background from your model in Metashape, you can now crop out anything besides the coral, including the scaling object. Remove all non-coral background by highlighting the area to be removed with the Select Vertices tool (square selection tool along top toolbar) then deleting the selected area from the mesh.
Location of Square Selection tool (red circle) and Delete Selected Area tool (black circle)
Model with background
Model with background removed
Note: Including color in your models is important in this step to help visualize background to be removed.
We measure the surface area of the model first because subsequent steps require adding surface area to the mesh.
However, if there are holes in the coral itself you can fill these holes to approximate the missing surface area of the coral.

To do this, go to:
a) Filters > Remeshing, Simplification, and Reconstruction > Close Holes.
b) Set the "Max size to be closed" to increasingly larger sizes in increments of 50 until the hole(s) is closed.
c) Uncheck all boxes below "Max size to be closed" and click apply

Be careful here, setting the value too high can add surface area to the mesh that is not necessarily part of the coral (e.g. along the bottom of the model). If this happens, the surface area will be overestimated.

Measure the mesh surface area using the Compute Geometric Measure Filter

a) Filters > Quality Measure and Computations > Compute Geometric Measures
b) The output will be located in the software output panel on the bottom right of the MeshLab window. You can scroll through the output to find the surface area measurement in cm2 .

Location of software output panel and calculated surface area in cm2

In order to determine the volume of the coral, we need to fill holes to close the mesh and make it “watertight”. Usually, this means closing the bottom of the mesh where the coral meets the substrate. If the mesh is not watertight, the software output box will tell you.

To close holes:
a) Filters > Remeshing, Simplification, and Reconstruction > Close Holes
b) Set "Max size to be closed" to be large enough to encompass the hole (usually >3000) and uncheck all boxes below
c) Apply the Close Holes filter


`

If a non-manifold edges/vertices error pops up you must select then delete manifold edges/vertices.

To do this:
a) Filters > Cleaning and Repair > Select non Manifold edges or Select non Manifold vertices
b) Use Delete Selected Area tool to remove the selected edges/vertices

Measure volume of closed mesh

a) Filters > Quality Measure and Computations > Compute Geometric Measures
b) Look at software output on bottom right panel, scroll through to find the volume measurement in cm3

Measure linear extension of all coral branches.
a) For the main axial branch, measure from the tip to the base using the newly created base from Step 6 as the endpoint.
b) For remaining branches, measure from the tip to the point where the middle of the secondary branch joins with the main branch. See Below.

INCORRECT: This shows how measuring a coral branch to the top or bottom of its intersection with another branch can produce different results. This difference can be exacerbated by the angle or thickness of the measured branch.
CORRECT: Measuring a branch from the tip to the mid point of its intersection with another branch provides an intermediate measure for length. Follow this rule to measure all branches and all corals to reduce error in TLE measures.

Determine the volume of interstitial space between branches of the colony by finding the volume of the model's convex hull. Interstitial space of a colony provides a potential measure of the reef complexity and habitat space that is a critical characteristic for branching corals.

Apply a convex hull over the coral model to create a new mesh overlayed over the most extreme points of the model.
a) Filters > Remeshing, Simplification, and Reconstruction > Convex Hull
b) Make sure to check "Re-orient all faces coherently", then click apply.

Make sure to re-orient all faces coherently so that future geometric measures are accurate.
The resulting convex hull should look like the images below. You can change the view of the convex hull by clicking viewing options for a mesh in the Layer Dialog Box on the right of the MeshLab window.

Initial view after creating convex hull
Convex hull after changing mesh views Layer Dialog Box

Measure the volume of convex hull

a) Filters > Quality Measure and Computations > Compute Geometric Measures
b) Scroll through the software output box to find volume (and surface area) of the convex hull. These values will not indicate that they are associated with the convex hulll so be careful not to record the measurements produced earlier.

Note: A negative volume simply means the faces of the convex hull are oriented inward; this will not change the size of the convex hull. If you re-oriented all faces coherently when applying the convex hull, you can take the absolute value of the volume given in the software output box.


Calculate the volume of interstitial space by subtracting the volume of the coral from the volume of the convex hull.