MyelTracer: A Semi-Automated Software for Myelin g-Ratio Quantification

Visual Abstract


Visual Abstract
MyelTracer (semiautomated) In the central and peripheral nervous systems, the myelin sheath promotes neuronal signal transduction. The thickness of the myelin sheath changes during development and in disease conditions like multiple sclerosis. Such changes are routinely detected using electron microscopy through g-ratio quantification. While g-ratio is one of the most critical measurements in myelin studies, a major drawback is that g-ratio quantification is extremely laborious and time-consuming. Here, we report the development and validation of MyelTracer, an installable, stand-alone software for semiautomated g-ratio quantification based on the Open Computer Vision Library (OpenCV). Compared with manual g-ratio quantification, using MyelTracer produces consistent results across multiple tissues and animal ages, as well as in remyelination after optic nerve crush, and reduces total quantification time by 40-60%. With g-ratio measurements via MyelTracer, a known hypomyelination phenotype can be detected in a Williams syndrome mouse model. MyelTracer is easy to use and freely available for Windows and Mac OS X (https://github.com/HarrisonAllen/MyelTracer).

Introduction
The myelin sheath is essential for proper neuronal functions in central and peripheral nervous systems. Oligodendrocytes and Schwann cells produce the myelin sheath through lamellar enwrapping of axons (Simons and Trotter, 2007;Salzer, 2015;Hughes and Appel, 2016;Stadelmann et al., 2019). The myelin sheath insulates axons, thereby preserving axonal integrity and promoting neuronal signal transduction (Sherman and Brophy, 2005;Nave, 2010). Under physiological conditions, changes in myelin contribute to behaviorally relevant neural plasticity mechanisms and experience-dependent sensory adaptations (Gibson et al., 2014;McKenzie et al., 2014;Hughes et al., 2018).
In both preclinical and clinical settings, pathologic myelin abnormalities are often identified by studying myelin ultrastructure. Specifically, researchers use g-ratio as a metric for the relative thickness of the myelin sheath in cross-sectional micrographs (Rushton, 1951). Since manual myelin tracing is a major bottleneck in g-ratio quantification, tools that streamline this process will tremendously facilitate future studies investigating activity-dependent homeostatic and pathologic changes to the myelin sheath.
Several non-automated, semi-automated, and fully automated toolboxes are currently available. They include G-ratio for ImageJ, AxonSeg, and AxonDeepSeg (Goebbels et al., 2010;More et al., 2011;Bégin et al., 2014;Zaimi et al., 2016Zaimi et al., , 2018Janjic et al., 2019). Collectively, these tools have facilitated different quantitative measurements of myelin ultrastructure, such as the number of axons and g-ratio. However, the current tools with more automation impose difficult requirements on their users, such as preprocessing data or modifying parameters by writing code. These drawbacks have impeded the tools' widespread adoption by the scientific community. We identified four major requirements of an open access toolbox that would significantly facilitate myelin analyses: (1) an intuitive graphical user interface that can be installed and used without running code; (2) consistent quantification results compared with manual analysis; (3) significantly less time-consuming; and (4) well-organized output data files and overlay images for publication and post hoc quality control.
Here, we report the development and validation of MyelTracer, an easy-to-use software that fulfills these critical requirements. Built using OpenCV and PyQt5's GUI toolkit, MyelTracer replaces the manual tracing of axons and myelin with semi-automated, threshold-dependent outlining. Compared with manual quantification, semi-automated quantification of axon diameters and g-ratio via MyelTracer produces consistent results across several tissues and developmental time points while reducing total quantification time by 40-60% depending on the region. Furthermore, using g-ratio measured with MyelTracer, we can detect a known hypomyelination phenotype in a Williams syndrome mouse model, as well as in remyelination after optic nerve crush, indicating the applicability of MyelTracer for studies in disease contexts. To ensure MyelTracer's all-in-one output functionality, we included a manual tracing function and counters for quantification of abnormally shaped sheaths and fraction of myelinated axons, respectively. MyelTracer is a valuable tool for the study of myelin ultrastructure and is freely available to the public as an installable software for Mac and PC (https:// github.com/HarrisonAllen/MyelTracer).

Animal work
All animal procedures were performed in accordance with the Massachusetts Institute of Technology animal care committee's regulations.

Code accessibility
The code/software described in the paper is freely available online at https://github.com/HarrisonAllen/ MyelTracer. The code is available as Extended Data 1.

Software development
Outline extraction of axons is performed using an implementation of OpenCV in Python. The processing is done as follows. First, the color space of the image is converted from RGB to grayscale, so that all pixels have a scalar magnitude between 0 and 255. cvtColor(src, COLOR_BGR2GRAY) Then, a bilateral filter is applied to the source image to reduce noise and smooth edges.
bilateralFilter(src, d = 9, sigmaColor = 75, sigmaSpace = 75) A binary thresholding filter converts pixel values below the user defined threshold, t, to black, and those above t to white.
threshold (src,thresh=t,maxval = 255,type=THRESH_ BINARY) Lines drawn by the user are then applied to the thresholded image using the polylines function.
Contours are extracted as the boundaries between the black and white pixels of the thresholded image.
findContours (src, mode=RETR_TREE, method=CHAIN_ APPROX_SIMPLE) Contours with fewer than five vertices are filtered out using the len function as well as contours that do not fall within the user-defined area constraints, Min Size and Max Size, calculated using the contourArea function.
Once selected, contours for each feature, axon, inner myelin sheath, and outer myelin sheath, are grouped together by checking whether the features nest within one another using pointPolygonTest.
Exported data are written in a plain-text csv document for compatibility with most spreadsheet softwares. The exported features are organized by the order in which the user selected the axon feature. Area is calculated using contourArea, perimeter is calculated using arcLength, diameter is calculated using 2 Á ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ffi area=p p , and g-ratio is calculated using ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi innerMyelinArea=OuterMyelinArea: p The extraction software is wrapped in a custom-designed PyQt5 GUI, and both Windows and MacOS installers are generated using the fman Build System (fbs). MyelTracer has been tested and proven to work on Windows 10 and MacOS Catalina 10.15.
Electron microscopy and g-ratio tracing Sample preparation and imaging One-and two-month-old male and female C57BL/6J mice were deeply anesthetized with isoflurane and transcardially perfused with 30 ml ice-cold saline solution followed by 30-ml fresh ice-cold 2.5% glutaraldehyde 1 2% PFA in 0.1 M sodium cacodylate buffer (pH 7.4). Brains, optic nerves and sciatic nerves were dissected and kept in the fixation solution overnight at 4°C. Small pieces (1to 2-mm cubes) of tissue samples from the dorsal corpus callosum at the level of the fornix (bregma À0.94 mm), optic nerve, and sciatic nerve were postfixed for at least 2 h at room temperature in the fixation solution. They were then washed in 0.1 M sodium cacodylate buffer and postfixed with 1% osmium tetroxide/1.5% potassium ferrocyanide for 1 h before being washed in water three times and incubated in 1% aqueous uranyl acetate for 1 h. This was followed by two washes in water and subsequent dehydration in grades of alcohol (10 min each; 50, 70, 90 and 2 Â 10 min 100%). The samples were then put in propylene oxide for 1 h and infiltrated overnight in a 1:1 mixture of propylene oxide and epoxy resin mixture (TAAB Epon; Marivac Canada). The following day, the samples were embedded in TAAB Epon and polymerized at 60°C for 48 h. Ultrathin sections (;60 nm) were cut on a Reichert Ultracut S microtome (Leica), picked up on copper grids stained with lead citrate and examined in a JEOL 1200EX transmission electron microscope (JEOL USA). The images were recorded with a 2k CCD camera (Advanced Microscopy Techniques).

Quantification of g-ratio
To compare manually quantified g-ratio and those quantified with MyelTracer, three images for each region of interest were analyzed manually and using MyelTracer. Each image was analyzed first with MyelTracer, which automatically numbered every quantified axon. For manual g-ratio quantification, the same axons were manually numbered and then traced using ImageJ. To compare the control and Gtf2i-knock-out group, raw images were obtained from Barak and coworkers (Barak et al., 2019), blinded of their genotypes and quantified using MyelTracer. To test MyelTracer's ability to quantify g-ratios in remyelinating tissues, raw images of the optic nerve from control animals and animals 28 d post-injury with Montelukast and Pexidartinib treatment were obtained from Wang et al. (2020). For each experiment comparing manual tracing with MyelTracer, several micrographs were obtained from preparations of two to three mice per anatomic region. Within these micrographs, at least 100-300 axons were analyzed depending on the anatomic region. For testing MyelTracer's capability to detect a hypomyelination phenotype in a Williams syndrome model, several micrographs from three mice per genotype with a total of 332 and 455 axons were analyzed for control and Gtf2i fl/fl; Nex-Cre mice, respectively. For optic nerve, sciatic nerve, and corpus callosum, three different researchers recorded image quantification times. Numbers denoting measured axons in representative images were enlarged for easier visualization. MyelTracer was run on a MacBook Pro (

Results
MyelTracer is a semi-automated software using computer vision G-ratio quantification requires measuring the crosssectional areas of axons and myelin sheaths, which is typically performed via manual tracing. Done manually, this process can be immensely time-consuming and laborious. To facilitate g-ratio quantification, we created MyelTracer by wrapping the powerful Python libraries provided by OpenCV in an easy-to-use GUI using PyQt5. MyelTracer performs automatic detection of contours using dynamic thresholding and separation of adjacent myelin sheaths based on user input. We packaged MyelTracer as a readily installable software for Windows and Mac OS X operating systems. Conceptually, MyelTracer takes a raw electron micrograph input image (Fig. 1A), converts it to grayscale, applies a bilateral filter, and thresholds it to a black and white binary image (Fig. 1B). MyelTracer extracts boundaries between the black and white pixels on the binary image and creates a contour image based on user-defined filtering parameters (Fig. 1C). For g-ratio plotting, MyelTracer is configured to measure the inner and outer myelin sheath as well as the axon diameter to account for periaxonal space present in electron micrographs (Fig. 1A). Using the GUI (Fig.  1G), the user can select the contours of axon, inner myelin, and outer myelin while adjusting the threshold to closely match the displayed contours to the underlying myelin ultrastructure. Once selected, MyelTracer groups the corresponding axons, inner myelin, and outer myelin together and overlays those selections on top of the original image (Fig. 1D). The software automatically computes diameters of perfect circles from area measurements and derives g-ratios by dividing inner myelin diameters by outer myelin diameters, which can then be plotted against the axon diameter ( Fig. 1E,F).
To use MyelTracer efficiently, we recommend the following workflow (Fig. 1H, Extended Data 2). First, select all axons in the image by adjusting the threshold parameter to match contours to the axon shape. Second, adjust the threshold to match myelin sheaths. Third, check for contiguous contours of adjacent myelin sheaths as well as discontinuous contours around myelin sheaths. If necessary, use the cut tool to separate adjacent myelin sheaths, or use the draw tool to connect discontinuous myelin sheaths. Fourth, select the inner and outer myelin sheath contours, adjusting the threshold parameter to fit. Fifth, save the progress and export the result, which includes g-ratio measurements and an overlay (Fig. 1D). MyelTracer also provides a manual tracing option for otherwise untraceable features and a counting tool to calculate the percentage of myelinated axons. Together, these functions make MyelTracer an all-in-one software suite for studying myelin ultrastructure.

MyelTracer saves quantification time while maintaining accuracy
Myelin g-ratio quantification is routinely done by manually tracing the myelin sheath. Manual tracing is very time consuming but considered the standard practice for accurate results. To compare the accuracy of MyelTracer to manual tracing in moderately myelinated tissues, we measured g-ratios using both methods in the same electron micrographs of corpus callosum from one-month-old mice (Fig. 1I). Plotting the g-ratio as a function of axonal diameter, we did not find a significant difference between MyelTracer and manual quantification results (Fig. 1J, MyelTracer: slope 0.061, y-intercept 0.77, n = 173, manual: slope 0.057, y-intercept 0.77, n = 173; slopes p = 0.8996, intercept p = 0.7044 a ) and their averages (Fig. 1K, MyelTracer mean 6 SD: 0.8072 6 0.04417, n = 173, manual: 0.8066 6 0.04220, p = 0.9045 b ). Next, to examine the amount of quantification time MyelTracer saves, the average amount of quantification time spent per axon was compared between these two methods. Using MyelTracer, significantly less time was spent per axon compared with manual tracing (Fig. 1L, MyelTracer mean: 0.593, manual: mean 1.0, n = 173 axons, three images, p = 0.0069 c ). Further, to exemplify that MyelTracer can trace myelin sheets containing folds, several such sheets were analyzed. Taking advantage of the cut tool, MyelTracer readily detects myelin folds and correctly quantifies the myelin sheet without including the area in the fold (Fig. 1M-P). Together, these data show that MyelTracer maintains a high level of accuracy, comparable to manual tracing, while saving ;40% of time for the user.
Myelination is spatiotemporally regulated (Mayoral and Chan, 2016;Sun et al., 2018). As a result, there are variations in myelin sheath thickness and spatial density of myelinated axons across different types of tissues and developmental time points. To assess the feasibility of using MyelTracer for different types of tissue samples, electron micrographs from optic nerves and sciatic nerves were examined ( Fig. 2A,E). In the optic nerve of twomonth-old mice, plotting g-ratio as a function of axon diameter revealed no significant difference between the results from using MyelTracer and those from manual quantification (Fig. 2B, MyelTracer: slope 0.1046, y-intercept 0.7372, n = 193, manual: slope 0.1001, y-intercept 0.7427, n = 193, slopes p = 0.8311, intercept p = 0.4695 d ).

Myelin thickness abnormalities can be detected using MyelTracer
Using MyelTracer for g-ratio quantification saves a significant amount of time and produces accurate results across different types of tissues from wild-type mice (Figs. 1, 2). In research settings, however, most investigators seek a tool to detect differences between genotypes or treatment paradigms. To test whether MyelTracer is suitable for detecting differences

Workflow example
Step 1: Enter calibration factor Step 2: Set a threshold and mark all Step 5: Save ROIs and export results Step 3: Use cut/draw tools to separate/connect myelin sheets Step 4: Change threshold and mark inner and outer myelin boundaries at once for each axon between two experimental groups, its performance was tested using electron micrographs from control (Gtf2i fl/fl , Nex-CreÀ/À) and Gtf2i fl/fl ; Nex-Cre 1/À mice, a model for Williams syndrome with a known hypomyelination phenotype (Barak et al., 2019). With their genotypes blinded, electron micrographs of corpus callosum from both groups at one month of age were analyzed using MyelTracer (Fig. 3A,B). Regression relationships between g-ratio and axon diameter were significantly different between control and Gtf2i fl/fl ; Nex-Cre 1/À mice (Fig. 3C, control: slope 0.1649, y-intercept 0.6447, n = 332 axons, n = 3 mice, Gtf2i fl/fl ; Nex-Cre 1/À : slope 0.1487, y-intercept 0.7132, n = 787, n = 3 mice, slopes p = 0.1484, intercept p , 0.001 j ). The g-ratio measurements were higher in Gtf2i fl/fl ; Nex-Cre 1/À mice than those in control mice, indicating a reduction in myelin sheath thickness, a result consistent with the original report (Barak et al., 2019). Together, these data demonstrate that MyelTracer is suitable for detecting differences in myelin g-ratios across different genotypes.
MyelTracer can be used to quantify g-ratios in remyelination MyelTracer readily recognizes well-developed myelin sheaths in micrographs of both central and peripheral nerves and axon tracts. In contrast to the relatively thick and compact myelin in these tissues, myelin in remyelinating tissues after injury is characterized by a thinner morphology (Franklin and ffrench-Constant, 2008;Duncan et al., 2017). To test MyelTracer's ability to quantify g-ratios in tissues undergoing remyelination, we analyzed micrographs from an optic nerve crush model 28 d after the injury (Fig. 3D). Comparing the results from MyelTracer and those from manual quantification in this model, there was no difference in g-ratio (Fig. 3E,   To further test whether MyelTracer is suitable to detect the thinned myelin sheets in remyelination compared with native myelin sheets, its performance was tested using region-matched electron micrographs from remyelinated axons and axons from matched native control animals (Fig. 3G). Comparison of the average g-ratio per animal revealed significantly increased g-ratios in the remyelinated group compared with the native control group (Fig.  3H, native control mean 6 SD: 0.7821 6 0.01162, n = 3 mice, remyelinated: 0.8324 6 0.01942, n = 3 mice, p = 0.0183 m ). Regression relationships between g-ratio and axon diameter were significantly different between the optic nerve axons in native control and remyelinated mice (Fig. 3I, native control: slope 0.03137, y-intercept 0.7627, n = 183 axons, remyelinated: slope 0.1281, y-intercept 0.7449, n = 116, n = 3 mice, slopes p , 0.0001 n ). Together, these results indicate that MyelTracer is suitable for g-ratio measurements in remyelination.

Discussion
In this study, we show that MyelTracer can address the need for an easy-to-use, stand-alone software for streamlining g-ratio quantification. OpenCV, PyQt5, and fbs were used in Python to develop and package MyelTracer, an easy to install software with an intuitive GUI. MyelTracer utilizes contrast in electron micrographs to generate contours around axons and myelin sheaths. The user can select contours outlining myelin features of interest (axons, inner myelin, and outer myelin), which then allow MyelTracer to group corresponding features, measure their areas and calculate g-ratios. As an all-in-one platform for myelin analyses, MyelTracer can also be used to calculate the percentage of myelinated axons. Using MyelTracer, user quantification time is reduced by 40-60% depending on the region, and its accuracy is comparable to manual tracing. Using MyelTracer, a known hypomyelination phenotype of the Williams syndrome mouse model can be detected, confirming its suitability for studies assessing phenotypic changes in myelin sheaths. MyelTracer is freely available at https://github.com/ HarrisonAllen/MyelTracer. Myelin ultrastructure is highly heterogeneous with a wide range of axon calibers and myelin sheath morphologies, presenting a challenge for automated analysis. MyelTracer uses OpenCV to automatically contour crosssections of axons and myelin sheaths in electron micrographs ( Fig. 1A-C). The easy-to-use GUI allows users to intuitively interact with and fine-tune the results generated by the underlying computer vision algorithms (Fig. 1D,G). MyelTracer decreases analysis time by dramatically accelerating axon and myelin sheath contouring compared with manual tracing. This automated feature differentiates MyelTracer from existing non-automated tools, such as GRatio for ImageJ, which is an ImageJ plugin that facilitates grouping of traced structures and data export (Goebbels et al., 2010).
In addition to MyelTracer, several semi-automated and automated tools are available that exhibit different strengths and weaknesses. AxonSeg and AxonDeepSeg are MATLAB-based segmentation algorithms that are fully automated, enabling high-throughput measurements (Zaimi et al., 2016(Zaimi et al., , 2018. These tools are useful for processing large datasets but require image preprocessing, adjustment of parameters in MATLAB, or additional training of the neural network using manually labeled images from user-specific datasets, which can be hurdles for implementation. Janjic et al. (2019) developed a high-fidelity tool using deep neural networks, which suits researchers with a computer science background seeking an advanced g-ratio quantification tool. While there are other useful tools available, MyelTracer's intuitive GUI makes it a powerful tool allowing researchers to quantify myelin without computer science knowledge.
G-ratio quantification using MyelTracer was demonstrated to be accurate across different tissues, such as corpus callosum, optic nerve, and sciatic nerve (Figs. 1,2). For these types of samples, there was a 40-60% reduction in time spent on quantification (Figs. 1L, 2D,H). The variation in the amount of time-reduction depended on the type of tissue. The smallest time-reduction was for corpus callosum of one-month-old mice. This is likely because of the heterogeneity in axonal caliber, axonal density, and the contrast level among the axon, periaxonal space, inner tongue, and the myelin sheath (Fig. 1A,I). In contrast, the greatest time-reduction was observed for sciatic nerve, which has clearly defined myelinated axons with homogeneous morphology, minimal periaxonal space and minimal myelin contiguity between adjacent axons (Fig. 2E,H). Comparing MyelTracer workflows for corpus callosum versus sciatic nerve, a major difference was that the latter required less manual input to separate contiguous myelin sheaths (step 3; Fig. 1H). Similar to manual tracing and other computational toolboxes, MyelTracer also relies on the quality of input images and therefore shows less effective performance for images with poor contrast levels, artifacts from inadequate perfusion or tissue handling.
The analysis of electron micrographs from Williams syndrome mice shows that MyelTracer readily detects abnormalities in myelination ( Fig. 3A-C), demonstrating the suitability of MyelTracer for detecting differences in myelin g-ratio across different genotypes or treatment groups. In such studies, MyelTracer will decrease user quantification time, and streamline data generation for publication purposes.
Extending the application for MyelTracer, analysis of remyelinating axons 28 d after optic nerve crush shows that the software is suitable for g-ratio measurements in studies of remyelination ( Fig. 3D-I). Myelin sheaths in remyelinating tissues are generally found to be thinner (Franklin and ffrench-Constant, 2008;Duncan et al., 2017), and they can appear almost discontinuous in a given sectioning plane. This presents a challenge Open Source Tools and Methods to automation and may require user input using MyelTracer's Cut and Draw tools as extensively outlined in the Users' Manual (Extended Data 2). Notwithstanding these challenges, MyelTracer is suitable for the semi-automated tracing of micrographs in studies of remyelination provided that the myelin sheaths and axons display good contrast.
As a user-friendly all-in-one software suite, MyelTracer will also allow researchers to quantify the percentage of myelinated axons, which together with g-ratio, are the most commonly reported metrics in myelin studies. Beyond existing tools and MyelTracer, advances in computer vision and artificial intelligence may further advance data analysis methods and produce more powerful toolboxes to streamline quantitative analysis of myelin ultrastructure.