High-throughput micro-CT scanning and deep learning segmentation workflow for analyses of shelly invertebrates and their fossils: Examples from marine Bivalvia

The largest source of empirical data on the history of life largely derives from the marine invertebrates. Their rich fossil record is an important testing ground for macroecological and macroevolutionary theory, but much of this historical biodiversity remains locked away in consolidated sediments. Manually preparing invertebrate fossils out of their matrix can require weeks to months of careful excavation and cannot guarantee the recovery of important features on specimens. Micro-CT is greatly improving our access to the morphologies of these fossils, but it remains difficult to digitally separate specimens from sediments of similar compositions, e.g., calcareous shells in a carbonate rich matrix. Here we provide a workflow for using deep learning—a subset of machine learning based on artificial neural networks—to augment the segmentation of these difficult fossils. We also provide a guide for bulk scanning fossil and Recent shells, with sizes ranging from 1 mm to 20 cm, enabling the rapid acquisition of large-scale 3D datasets for macroevolutionary and macroecological analyses (300–500 shells in 8 hours of scanning). We then illustrate how these approaches have been used to access new dimensions of morphology, allowing rigorous statistical testing of spatial and temporal patterns in morphological evolution, which open novel research directions in the history of life.


Introduction
The skeletons of marine invertebrates are a robust system for analyzing patterns of biodiversity, both today and through deep time (Valentine, 1973;Stanley, 1979;Foote, 1997;Seilacher and Gishlick, 2014;Sepkoski, 2015). Bivalvia, the group containing clams, cockles, mussels, oysters and more, contains an estimated 6,000 extant species across the shallow continental shelf (Edie et al., 2017), and shells from across the class are abundantly preserved in the fossil record: tens of thousands of species occur across 520 million years of evolution (Johnston and Haggart, 1998). These shells are shaped by internal factors such as developmental interactions and modularity (Matsukuma, 1996;Vermeij, 2013;Sherratt et al., 2017;Edie et al., 2022b), and external factors such as selection on life history and ecological function (Stanley, 1970;Vermeij, 1987), providing key insights into questions on the evolution of form (Serb et al., 2011Collins et al., 2016), the dynamics of mass extinctions and recoveries (Jablonski, 2005), the tempo and mode of evolution (Jablonski, 2017a), and the origins of spatial diversity gradients (Jablonski et al., 2013). However, such analyses require a wide-ranging inventory of shell form, and much of bivalve diversity is embedded as fossils in consolidated or lithified sediments (Foote et al., 2015;Daley and Bush, 2020). Manual excavation of delicate features, especially those important for taxonomic identification such as the hinge teeth, can require hours to days of preparation (Feldmann et al., 1989;Prôa et al., 2021), and is often impossible.
X-ray computed tomography expands access to and discovery of new diversity in fossil invertebrates (Cunningham et al., 2014;Sutton et al., 2017;Claussen et al., 2019;Reid et al., 2019;Bauer and Rahman, 2021;Collins et al., 2021;Leshno Afriat et al., 2021;Thompson et al., 2021), much like the recent boom in vertebrate paleontology (Racicot, 2016;Schwarzhans et al., 2018;Coates et al., 2019;Goswami et al., 2022). For fossil invertebrates known from molds-the imprints of the original animal left in the surrounding rock-CT scanning can virtually cast the internal or external surfaces of the original animals in bulk, and can recover specimens otherwise inaccessible to manual peels (Reid et al., 2019). Fossils preserved either as primary or remineralized material can be digitally extracted from their enclosing rock or sediments, but to be fair, this virtual preparation sometimes requires as much time as manual preparation given the limited compositional contrast between the materials. Still, unlike physical preparation, digital excavations can "undo" any accidental removal of key features from a fossil, such as the delicate hinge teeth in bivalves. Phase contrast imaging, mostly from synchrotron sources and increasingly in laboratory settings, is improving the separation of fossil material from surrounding matrix (i.e., low attenuation contrast settings, Sutton et al., 2017;Birnbacher et al., 2021), but recent advances in post-processing, namely from deep learning, can also greatly accelerate the "cleaning" of matrix from shell. Deep learning is a powerful tool for image segmentation, helping to denoise X-ray images (Huang et al., 2022) and improve the digital excavation of fossils embedded in matrix (Liu and Song, 2020;Borowiec et al., 2022;Yu et al., 2022 for other applications in evolutionary biology).
Here, we provide a guide for digitally excavating fossil specimens using micro-CT scanning and a workflow for using deep learning to segment calcareous shelly material from calcareous matrix-a situation that inhibits segmentation using material density alone. We walk through bulk scanning fossil and Recent shells, with sizes ranging from 1 mm to 20 cm, which enables the rapid acquisition of large 3D datasets for macroevolutionary and macroecological analyses (300-500 shells in 8 hours of scanning). We then illustrate how these approaches have been used to access new dimensions of morphology, allowing rigorous statistical testing of spatial and temporal patterns in morphological evolution. As with the discoveries of novel morphological and taxonomic observations in vertebrates embedded in nodules, high-throughput X-ray microcomputed tomography (micro-CT) coupled with deep learning segmentation is primed to revolutionize invertebrate evolutionary biology and paleobiology-arguably the largest source of empirical data on the history of life.

Specimen sampling Specimen selection and packing
Nearly all specimens sampled to date in the bivalve-3D project ("biv3d") are from museum collections. Sampling strategy will vary according to the arrangement of collections, but the following protocol has been applied in a variety of settings with no loss of specimens. Pulling and preparing specimens for scanning is best practiced with a joint physical and digital paper trail. From a given lot, the selected valve(s) are separated from the remainder of the lot and arranged for a photograph with the lot tag ( Figure 1A). A high visibility tag (e.g., neon colored) is placed in the lot noting how many specimens have been pulled. Specimens are then prepped for transport and scanning depending on their size. If larger than 1 cm, the specimen is wrapped in low-density polystyrene foam (often sold as "dish wrapping foam"), which is secured with painter's tape; both materials are transparent to X-rays so that specimens need not leave their packing for scanning, which greatly reduces risk of loss or breakage ( Figure 1B). Crumpling the dish foam by hand makes it more pliable, helping to wrap more delicate specimens. Both the specimen's registration number and its physical location are recorded with a pen on the painter's tape. If the specimen is smaller than 1 cm, it is placed inside a gelcap and carefully secured in place with foam. The registration number and the physical location of the specimen (e.g., floor, row, cabinet, and drawer number) in the collection are written on a piece of paper and placed inside the gel cap.

Specimen metadata
At a minimum, we find that databasing the information in Table 1 is crucial to maintaining unique object identifiers and their associated metadata. It is important to record verbatim copies of the ID, locality and stratigraphy info as provided on the museum labels in order to maintain connections back to the museum database, even if those pieces of information are updated for analyses (see "lot photo" in Figure 1A). Each specimen picked for scanning receives a specimen ID (Table 1). In the case of specimens where both valves are to be scanned, a specimen ID refers to both valves, as they are part of the same specimen. This is necessary so that the two digital mesh objects representing those valves can continue to be associated in analyses by their specimen ID (each unique valve is then referenced by a mesh ID, Table 1).

Pre-scan preparation
Grouping specimens For all scans, the size of the smallest feature of interest determines how specimens are grouped for bulk scanning. In bivalves, a key taxonomic character-the hinge teeth-are often an order of magnitude smaller than the shell, which sets an upper limit on how many specimens may fit into the field of view of the detector. For example, on the GE Phoenix v|tome|x M 240/180 kV Dual Tube μCT Frontiers in Ecology and Evolution 03 frontiersin.org with a DXR250 (16″, 4 M pixel) X-ray detector at the U.S. National Museum of Natural History (NMNH, also USNM), specimens with approximately 1 mm (1,000 μm) features of interest are sufficiently resolved using <20 μm resolution, which would characterize such features with 50 pixels in the image plane. This resolution translates to a 40 mm by 40 mm field of view on a detector 2000 × 2000 pixel detector, which can typically accommodate 4-5 approximately 10-20 mm specimens in a cylindrical arrangement. Larger specimens have larger sizes of their smallest features of interest and can be packed to similar numbers for scanning at lower resolutions; however, most bivalves have scanned best at resolutions finer than 50 μm. Fossil specimens embedded in sedimentary matrix are often scanned alone because multiple fossil specimens, particularly those in dense siliciclastics, can require higher voltage to penetrate the full object; this may exceed the power limits of the micro-CT, and it will likely reduce the contrast between the edges of the specimens and matrix, Workflow for sampling and packaging specimens from collections for scanning. (A) Museum lot with target specimen of Late Cretaceous fossil "Lucina" parvilineata Shumard 1861 to be imaged and temporary note marking number of specimens or valves sampled (as "biv3d sampling tag"). Location code gives the physical location of the specimen in the museum, here: Floor 3 North, Row 10, Case 21 upper, Drawer 4. (B) Macro specimens (>1 cm) are wrapped in pliable foam and secured with painter's tape, noting the registration number and the specimen's physical location code in the museum. Micro specimens (<1 cm) are placed in gel caps with a tag containing registration number and the specimen's physical location in the museum (on the back of tag in this image).  Mount of specimens for micro-CT imaging. (A) Macro specimens (>1 cm) are placed inside a cylindrical plastic container in an imbricated manner, with commissures perpendicular to the foam support at the base of the container. The scan map records the position of specimens in the scan mount using registration numbers or unique specimen IDs relative to the scan marker (e.g., an eraser). (B) Micro specimens (<1 cm) are placed inside plastic or paper straws, which are then placed inside a 15 ml or 50 ml centrifuge tube. making segmentation more difficult or virtually impossible (advances in laboratory phase contrast CT could improve segmentation of materials with subtle differences in signal, see Birnbacher et al., 2021). Additionally, scanning fossils embedded in matrix at the highest possible resolution reduces artifacts such as partial volume effects, which arise as the averaging of gray values from materials with different densities in a single voxel (described further in Abel et al., 2012;Racicot, 2016).

Mounting specimens
Once specimens have been grouped for scanning, they can be mounted into cylindrical containers. Straight-sided, thin-walled plastic soda bottles with a flat, level foam insert supporting specimens from the bottom work best for holding specimens (Figure 2A). For macro specimens (>1 cm), arrange in an imbricated fashion with the shell commissure perpendicular to the base of the container (Figure 2A, i.e., mounting with the long-axis perpendicular to the X-ray source as in Sutton et al., 2014, p. 53); this arrangement reduces Feldkamp artifacts and provides the sharpest boundaries between surfaces. Specimens can be mounted in vertical layers up to a height equaling the diameter of the container (i.e., a square field of view), and packed with additional foam to prevent movement during scanning. For micro specimens (<1 cm), use paper or plastic drinking straws to hold gel caps; straws can then be inserted into 50 ml or 15 ml conical centrifuge tubes ( Figure 2B), making sure to keep specimens level with each other.

Mapping specimens
To orient the scan, place a marker into the scanning container with lower X-ray density than the specimens, such as an eraser; using markers that are more X-ray dense can shade specimens, which makes them more difficult to segment in post-processing. Draw a plan view "scan map" of the specimens relative to the marker, identifying positions using the unique identification code labeled on the specimen wrap or gel cap ( Figure 2). Each scanning "cartridge" can be prepared before scanning, which is a crucial step for maximizing machine time.

Scan settings and reconstruction Parameter tuning
Once specimens are mounted in the micro-CT, several parameters should be tuned to optimize the X-ray imaging. Each scan can, and often does, have different parameter settings, which vary according to the material density of the specimens and the number of specimens in the scan scene-or, for fossils, by the volume and mineralogy of the surrounding matrix. Because specific scanning parameters will vary by micro-CT system, we emphasize that the tuning process outlined below is intended to be generalizable; nevertheless, the parameters reported here are likely good starting points (for a comprehensive overview of optimizing scanning parameters, see Sutton et al., 2014, pp. 56-60). For all steps that follow, monitor the histogram of gray values in the imaging software; this is the crucial tool for maximizing contrast between materials in the scan.
Because we aim for high throughput, we first set parameters that affect the length of the scan to their lowest values: i.e., set exposure timing to lowest value, frame averaging to 1, and frame skips to 0. Next, we rotate the mounted specimens until viewed through the thickest portion of the scan scene; this will correspond to the lowest intensity gray values in the live image. We increase or decrease the voltage until the minimum gray value intensity recommended for the machine is reached (this ranges between 100 and 200 for the micro-CT at NMNH, trending towards the higher end as the filament ages). We aim for the lowest energy X-rays necessary to penetrate the specimen, which maximizes the contrast between materials (Sutton et al., 2014, pp. 56-57). Next, we adjust the current to maximize the Frontiers in Ecology and Evolution 05 frontiersin.org total range, contrast ratio, and signal to noise of the histogram (Table 2). Increasing the current also increases the power, and tends to increase the minimum gray value, which can reduce both the signal to noise and contrast ratios (compare values in Table 2); if so, step back to previous settings. If the minimum gray cannot be reached within the power limits of the X-ray tube or without oversaturating the detector, add a physical filter (see next section) or increase the exposure timing, which may require adding frame skips so that the detector panel can discharge between images (this timing can be highly system-dependent). Similarly, it is important to check that the X-ray spot size is not 1.3 times larger than the expected voxel size (i.e., resolution) of the scan. Increasing exposure time and frame averaging will also increase the signal to noise ratio, helping to define sharper boundaries between shell and matrix if needed (often a good setting to adjust when the shell is a calcareous matrix).

Physical filters
Filters can reduce beam hardening, an artifact where soft X-rays are absorbed at the sample surface leaving only the higher energy X-rays to penetrate the sample; this creates streak or cupping artifacts, where gray values grade from high to low intensity towards the interior of the specimen (see Sutton et al., 2014;Wellenberg et al., 2018). Fossil shells in matrix frequently show cupping artifacts, which can complicate simple segmentation on gray value intensity. Metal filters, typically aluminum, copper, or tin sheets ranging from 0.1 to 1 mm in thickness, can minimize this gradient in gray value intensities, but at the cost of diminished compositional contrast. Because many of our fossil shells are in calcareous matrix, meaning there is minimal compositional contrast between specimen and rock, we generally do not use filters in order to maximize what little contrast may exist. For Recent specimens free of matrix, a 0.1 mm copper filter does reduce beam hardening, simplifying segmentation of shell material from air and foam, but segmentation of scans lacking a filter is not any more difficult.

Number of image projections
All of our scans use 360° rotation, and while the rule of thumb for setting the number of projections images is the width of the scan in pixels multiplied by π (Keklikoglou et al., 2019, p. 17), we find that shells with simple, large morphologies (i.e., smooth shells with large hinge teeth) can be scanned with projections equaling the greatest width of the scan scene (for a detector 2000 pixels wide, this would be 2000 projections). This can reduce scan times to as low as 7-10 min, depending also on the exposure time, frame averaging and skips. Thus, it is important to group specimens for bulk scanning according to the desired resolution for their smallest features of interest. For shells with relatively finer details, or for those embedded in matrix, setting a higher number of projections can better resolve those features (Sutton et al., 2014, p. 58;Keklikoglou et al., 2019, p. 7), although we find N*1.5 to usually be sufficient.

Reconstruction
We have reconstructed all scans using the proprietary software of the micro-CT systems (i.e., GE phoenix datos|x), but alternative solutions are available (Sutton et al., 2014, pp. 149-150). We have always scanned with settings to compensate for any drift in the center of rotation, changes in focal spot size, and any small movement of the specimens (in the GE system, this would be using the Autoscan Optimizer followed by the Automatic Geometry Calibration before reconstruction). Scanning using detector shifts (i.e., small adjustments in the detector panel to reduce hot pixels), can reduce beam hardening (for additional mitigation techniques, see Wellenberg et al., 2018). Streaks, ring artifacts, and beam hardening are often in our scans and could be further mitigated during the reconstruction step-but we find these artifacts to rarely impact the

Scan segmentation
Segmentation with isovalue thresholding Once reconstructed, Recent and fossil material that is free of matrix can often be isolated from air and packing materials by simply thresholding out the non-target values in the image stack (see a recent list of commercial software and freeware for this operation in Keklikoglou et al., 2019, their Table 15, but also see 3D Slicer Kikinis et al., 2014; we primarily use ORS Dragonfly; Object Research Systems (ORS) Inc., 2022). If the organic content of shells varies within a bulk scan (i.e., nacre vs. calcite), the scan scene may require separate threshold values for generating shell-specific regions of interest (ROIs). These shell ROIs can be further refined using manual segmentation tools, or by removing any pixels isolated from the targeted shells with simple region of interest tools, such as island processing algorithms that remove pixel sets less than a certain value (e.g., "Processing Islands" in ORS Dragonfly). From these refined ROIs, contour meshes can be generated and exported for further cleaning and morphological analysis. For many fossil shells embedded in matrix, particularly those in calcareous matrix, this simple thresholding approach will not work given the limited compositional contrast between the specimen and sediment. Here, deep learning can facilitate segmentation.

Workflow for segmentation with deep learning
Deep learning has become a powerful tool for image segmentation, especially for digital excavation of fossils embedded in matrix (Liu and Song, 2020;Yu et al., 2022). However, we note that to date, our applications of deep learning have yet to perfectly segment a bivalve fossil from matrix (as Yu et al., 2022 also noted for segmenting dinosaur bones from matrix). Thus, we use deep learning as a technique to speed up segmentation, which almost always requires manual tuning to complete; this means finding a compromise between the time spent fitting the model(s) and then manually finalizing the segmentation. We use the deep learning interface developed by ORS Dragonfly (the "Segmentation Wizard, " Badran et al., 2020), which creates an interactive session for fitting and refining multiple deep learning models for segmentation. Regardless of the software used, we suggest that this approach is a good, generalizable workflow. Continued research into model architectures will undoubtedly bring faster and more accurate initial segmentations of these low compositional contrast materials, but our emphasis here is on producing sizable datasets of workable 3D models for quantitative evolutionary analysis. Thus, the trade-off in time spent tuning hyperparameters and fitting models in search of a perfect segmentation should be weighed against using an adequate model to provide a strong starting point for manual segmentation.
Within the ORS Dragonfly Segmentation Wizard, we begin segmentation by selecting a slice from the image stack that best represents the full diversity of features; often this is an image slice containing hinge teeth or fine ornamentation (e.g., Figure 3A). We then define the segmentation frame (i.e., a rectangular mask) that brackets the shell and manually set ROIs corresponding to shell material and background (i.e., matrix and/or air, Figure 3A, bottom row). We then train a series of deep learning models using this single frame and visually inspect the predicted segmentation ( Figure 3B). Usually, the U-Net architecture (Ronneberger et al., 2015) is the fastest and most accurate approach, but Sensor3D, and variations on the U-Net such as Attention U-Net and U-Net++ can sometimes better separate the boundaries between fossil shell and matrix (hyperparameters for the U-Net fit here are in Figure 3C). The resulting model accuracies provide a general estimate of segmentation performance, but high accuracies can sometimes characterize models with poor definition of the boundary between fossil shell and matrix (e.g., frame 1 in Figure 3B for Round 1 of training, which had an accuracy score of 0.97 Figure 3D). In this example, the model trained for one round cleanly separates shell from air, but confuses parts of the matrix and shell (compare Figures 3A,B for frame 1, particularly around the hinge area). Therefore, the additional training data was labeled, and the model weights updated through continued training.
Subsequent rounds of training improved the segmentation of shell from matrix (compare better capture of the hinge area in rounds 2-4, Figure 3B). The training data in frames 3 and 4 were selected to improve segmentation of shell from matrix where streak artifacts impacted the shell boundary at the edge of the specimen. Frame 5 was selected to improve segmentation of shell from matrix for a region of the hinge area that was not well predicted through the third training round. We could continue to iterate the process at this point, expanding the training set to include image slices with poor predicted segmentation. However, as mentioned above, we weigh the continued time in fine-tuning these segmentation models against manually tuning the segmentation. In general, we find that one or two rounds of creating training data and fitting models is sufficient to produce a strong starting segmentation. From there, we manually segment regions where the model failed to define the boundary between shell and matrix. Without any manual segmentation, the resulting 3D model has noise, but captures nearly all of the relevant taxonomic details (Figure 4). Timing required for segmentation via deep learning compared to fully manual operation depends, in part, on compute power. The process described for the fossil in Figure 3 required approximately 3 h, from labeling training data to fitting the model and predicting the segmentation, and half of that time was fitting the initial model (compute power: Intel Xeon Silver 4214R CPU @2.40 GHz with 512 GB RAM and 2 × 16 GB NVIDIA Quadro RTX5000 GPU). Fully manual segmentation of this fossil is estimated to take 8 or more hours of constantly engaged work.

New morphological measurements, new macroevolutionary and macroecological insights
Bivalves have been a good model system for testing macroecological and macroevolutionary theories. Aspects of their shell morphologies largely align with molecular phylogenies (Jablonski and Finarelli, 2009;Bieler et al., 2014), allowing morphologically derived phylogenetic analyses of their biogeographic, functional, and morphological evolution through deep time. Three-dimensional micro-CT scans of bivalve shells provide access to previously unseen morphologies and to measurements of morphological dimensions Frontiers in Ecology and Evolution 07 frontiersin.org that have been difficult to quantify at large sample sizes. These new data are helping to address long-standing questions about evolutionary processes within the group, which we example in the following sections. Such approaches add broader phylogenetic context for general tests of ecological and evolutionary processes acting across other model systems such as fishes and birds.
Accessing hidden morphology highlights the termination of an evolutionary pathway following mass extinction Quantitative analyses of how mass extinctions reorganize the dimensions of biodiversity require rigorous phylogenetic, ecologic, and morphologic hypotheses, and micro-CT will strengthen paleontological efforts on each of these fronts. The bivalve genus Legumen was lost in the end-Cretaceous mass extinction around 66 Ma, and its phylogenetic placement and thus the impact of its loss on the subsequent morphological and ecological evolution of its higher clade was uncertain (Collins et al., 2020). This genus is known almost entirely from its external shell shape (as in Figure 5), which is notoriously homoplastic across bivalves (Stanley, 1970;Oliver and Holmes, 2006). Using micro-CT and deep learning segmentation, we were able to segment key fossil specimens from sedimentary matrix, revealing their taxonomically important hinge morphology (Collins et al., 2020). Comparing these digital excavations to the rare specimens with physical preparations of their hinge teeth confirmed the phylogenetic placement of Legumen within the most diverse Segmentation of shell from matrix using deep learning for specimen USNM PAL 20943, "Lucina" parvilineata. (A) Selected image slices cropped to training frames in the top row, with frame number in white text. Bottom row shows ground-truth labeled training data. (B) Predicted segmentation for image slices per round of model training, i.e., only frame 1 was trained in round 1, but frames 1 and 2 were used to train round 2, so both have predicted segmentations for this round. Both frames 3 and 4 were included in round 3 of training. Frame 5 was only included in round 4. Frontiers in Ecology and Evolution 08 frontiersin.org bivalve family, Veneridae. Further, 3D morphometrics of its shell shape showed Legumen to be atypical for the family, occupying a distinct region of morphospace and ecospace-one that was never regained by the family during its Cenozoic diversification, instead being invaded, and perhaps preempted, by other family-level clades ( Figure 5; Collins et al., 2020). Thus, the loss of Legumen becomes an important data point in larger analyses of how developmental biases and priority effects from competing clades may interact to shape the re-diversification of biodiversity following mass extinctions.

Volumetric morphometrics and the derivation of the latitudinal diversity gradient
Trade-offs in organismal form can reflect interactions of developmental constraint with ecological and environmental selection. The bivalve shell is a good vehicle for analyzing the relative impact of these factors on the sequence of evolutionary events, and their tempo and mode. For example, the volume of the bivalve's shell compared to its soft-internal anatomy may reflect energetic trade-offs (Collins et al., 2019) and/or may proxy shell strength (Stanley, 1970), but these measurements have required molding the shell and its interior cavity (the space holding the internal soft anatomy; see Stanley, 1970, p. 109). Measuring such volumes from micro-CTderived 3D models is now computationally simple, where volumes of triangular surface meshes can be approximated by integrating the signed tetrahedral volumes of each triangular face to the centroid of the mesh (Collins et al., 2019). Applying this approach in the comparison of a warm-to cool-temperate fauna has challenged the macroecological hypothesis that lower nutrient availability and decreased aragonite saturation states at high latitudes should filter and/or reduce the volume of the animal that is shell; both large and relatively thick-shelled bivalves are found from the Florida Keys to the Gulf of Maine (Figure 6; Collins et al., 2019). This same highthroughput approach could be used to generate high-precision estimates of intraspecific variation in relative shell volumes for taxa with known responses to gradients in ocean acidification (e.g., bimineralic Mytilus species, Bullard et al., 2021). Taxonomically important views of the previously inaccessible interior features of Late Cretaceous (Early Maastrichtian) "Lucina" parvilineata, USNM PAL 20943. Top row shows the 'raw' mesh surface directly produced by deep learning segmentation after round 4 of training in Figure 3. Bottom row shows the final mesh surface after removal of streak artifacts and manual cleaning of noisy surface data where the model struggled to segment the shell from its surrounding matrix. Considerable care should be taken at this step so as not to erode any genuine, biological features. Using CT data to capture and analyze extinct morphologies. Fossils embedded in sediment, such as the Legumen ellipticum Conrad 1858 photographed here, can be micro-CT scanned and segmented from matrix using the deep learning approach from Figure 3. This analysis showed that the venerid genus Legumen (F, G), which was lost at the end-Cretaceous mass extinction, had an atypical shape that has yet to evolve again within the family (adapted from Collins et al., 2020).

Frontiers in Ecology and Evolution 09 frontiersin.org
Predation intensity is another factor hypothesized to be a strong determinant of the latitudinal diversity gradient (Vermeij, 1987;Schemske et al., 2009;Freestone et al., 2021). Predation's impact on diversity may operate on longer timescales than can be observed in real-time, and phylogenetically controlled comparative approaches are needed to augment field-based experiments. Some morphological aspects of prey have evidently evolved in direct response to modes and intensities of predation (Vermeij, 1987), and the evolution and variation of bivalve shell spines, ribs, flanges, and other elements of ornamentation are hypothesized to be anti-predatory adaptations (Vermeij, 1987;Harper and Skelton, 1993). Volumetric scans of shells have allowed us to quantify these features and analyze a significant decline in the complexity, or spininess, of shell surfaces among species from low to high latitudes, a shift that occurred by sorting among taxonomic families rather than by evolutionary transformation of genera or species (Figure 6; Collins et al., 2019). While this pattern is consistent with highest predation intensity in the tropics, it primes the investigation of other, potentially underlying factors, such as using fossils to analyze temporal lags in the biogeographic dispersion of species towards higher latitudes, and more generally to analyze regional changes in morphology that might be expected to accompany long-term climate shifts.

3D shape morphometrics and the evolution of disparity
Since the origin of the class more than half a billion years ago, bivalves have evolved in and out of broad swaths of ecological and morphological space, offering many comparative experiments of convergence and divergence. Most analyses of morphological evolution have used 2D morphometrics of the shell, focusing primarily on its outline within the commissural plane (sagittal plane). The commissural profile captures some of the relationship between shell shape and ecological function but misses a key axis of shape variation within the transverse plane-its curvature or inflation. This morphological axis also relates to the shell's interaction with the substratum, from the hydrodynamics of swimming in scallops to the infaunal clam's penetration of substrata, that is, the animal's ability to burrow away from predators and buffer open-water environmental conditions. Analyses of 3D shell shape using surface semi-landmarking capture considerable variation in shell inflation (Collins et al., 2019, p. 9;Edie et al., 2022b, p. 4), which should be taken into account when identifying instances of convergence and divergence. For example, bivalves that bore into rocks-an ecological function that can require excavating substrata that is materially harder than the shell-show a remarkable disparity of shell forms within the usually measured commissural plane, suggesting multiple, divergent evolutionary pathways into the niche. In theory, this function might drive convergence along the "hidden" third axis of variation, shell inflation, but tests including this dimension indicate this is not the case, and that rock-boring is indeed one of the most morphologically disparate functions across the class today (Collins et al., 2023).
Access to phylogenetically and morphologically broad characterizations of shell shape has introduced complications to shape-based morphometrics. For example, aligning specimens on point-based biological homology is complicated by Bivalvia having only one such point across the entire class, the origin of shell growth at the beak (Carter et al., 2012, p. 21;Edie et al., 2022a). Thus, shapebased comparative morphometrics requires alignment using a biomechanical axis that reflects how the animals interact with their environment. The hinge line-the line about which the two valves rotate during the opening and closing of the valves-is functionally Using 3D data to identify latitudinal gradients in shell morphology along the east coast of North America. The proportion of the animal that is shell remains similar between the subtropical Florida Keys and temperate Gulf of Maine, but taxa with the most pronounced ornamentation do not reach the Gulf of Maine (adapted from Collins et al., 2019).
Frontiers in Ecology and Evolution 10 frontiersin.org Geometric morphometric landmarking of shell features and hypotheses of modularity and integration in the venerid bivalve Chionopsis amathusia (Philippi 1844). Hypothesis of modularity "H1" was the working hypothesis, with all potential modules varying independently, but H2, with just two discrete modules, was best supported by morphometric analysis (adapted from Edie et al., 2022a,b).
analogous across the class, and can be defined using clade-specific features (Edie et al., 2022a). While not strictly adhering to the conventions of geometric morphometrics, this approach gives intuitive gradients and clusters in shell morphology that can be combined with other means of aligning shells to test hypotheses of how tightly coupled form and function are to modes of shell growth (Edie et al., 2022a). 3D morphometrics of shell shape can also address morphological integration and modularity in bivalves, with their simple skeletons that grow by accretion, and how they might contrast with clades exhibiting more complex segmented skeletons (e.g., arthropods and vertebrates). The features of the bivalve shell and the enclosed soft parts might fall into discrete functional or developmental units (Figure 7), e.g., the hinge teeth possibly showing tight covariation with the relative sizes and positions of the muscles and the springlike ligament that together form the functional complex that opens and closes the shell. Alternatively, the shell may form a discrete, integrated module from the soft-internal anatomy. At least for the most speciose group in today's ocean, the Veneridae, the latter appears to be true (Figure 7; Edie et al., 2022b). Thus, unlike the many modules in segmented invertebrates, the vertebrate skeleton, or even in vertebrate crania, bivalves appear to have tighter integration of their major morphological elements and a lower overall modularity Edie et al., 2022b). Broader comparisons with other major bivalve groups could reveal a more varied pattern of modularity, integration and disparity, particularly those groups that break bilateral symmetry in shell growth and shape (Jablonski, 2020).

Conclusion
The paleontologist's remit in evolutionary biology has grown substantially since the Modern Synthesis (Gould, 2002;Sepkoski, 2015;Marshall, 2017;Jablonski, 2017a,b). Direct access to evolutionary sequences of morphologies is critical for understanding how innovations and other factors drive diversifications along phylogenetic, functional, and morphological lines, and how the extinction or pruning of forms impacted the trajectories of diversification. Analyses of extant-only data can sometimes proxy the former, particularly for shallow-time radiations, but they cannot address or even approximate the latter. Both patterns of morphological gain and loss are needed for robust considerations of how determinism and contingency affect evolutionary trajectories. Still, accessing this library of timestratified morphologies remains difficult. Discovery of new fossil diversity was once limited by the scale and number of field campaigns, then by "reburial" in under-cataloged and underdigitized museums, and always by physical access to collections. Extensive efforts have steadily grown deep-time biodiversity databases, but many fossils remain locked away in consolidated sediments-in the field and in collections-making them difficult to access without painstaking collection and preparation. X-ray computed tomography overcomes some of these limitations, mobilizing virtual data and spurring substantial discovery and description of new fossils, mostly vertebrates. However, most of life today and in the past belongs to invertebrate phyla, many of which have an abundance of fossilized hard parts. Scanning and digitally excavating these fossils has been a challenge given the compositional similarity between their hard parts and the surrounding sediments, but advances in segmentation using deep learning is speeding up this process. Now, for the first time, we have views into rarely or never seen shell morphologies, such as the previously inaccessible, taxonomically important interior morphology of the "Lucina" parvilineata segmented here, laying the foundation for more complete phylogenetic consideration. Bivalves, and other invertebrates with strong fossil records including snails, echinoderms, brachiopods, trilobites, sponges, corals, and many more, are ripe for new phylogenetic and morphological evolutionary analyses facilitated by X-ray micro-CT.
Frontiers in Ecology and Evolution 11 frontiersin.org

Data availability statement
The original contributions presented in the study are included in the article. Mesh of USNM PAL 20943 available on Morphosource (ark:/87602/m4/497818). Further inquiries can be directed to the corresponding author.

Author contributions
All authors listed have made a substantial, direct, and intellectual contribution to the work, and approved it for publication.

Funding
The study was supported by National Science Foundation EAR-1633535, DEB 2049627, National Aeronautics and Space Administration EXOB08-0089, and a CDAC Data Science Discovery grant, University of Chicago.