A Semi-Automated Workflow for Brain Slice Histology Alignment, Registration, and Cell Quantification (SHARCQ)

Visual Abstract


Introduction
A major neuroscientific goal is to delineate the cytoarchitectural organization of the brain. The discovery of population-like cell body clusters prompted the demarcation of distinct brain territories, which in turn developed into whole-brain atlases with standardized nomenclature across multiple species, including rodents (Lein et al., 2007;Franklin and Paxinos, 2013;Paxinos and Watson, 2014). These brain atlases have their origins in morphological and some immunohistochemical preparations. However, transcriptional and genetic assays indicate far more cell-types across the brain than have been previously appreciated (Welch et al., 2019;Yao et al., 2021). Current histological processes involve targeted protein or gene expression and light microscopy to generate qualitative data in the form of brain section images that fluorescently or chromogenically label neurons of interest. The modern neuroscientist exists in a scientific renaissance in which there are neuroanatomical methods that have become ever more complex and refined for interrogating the genetic and circuit identity of neurons (Saleeba et al., 2019). Yet there are still few options for robust, reproducible, and easily accessible post-imaging analysis to map histology to brain atlases. This can be depicted by the trend of publications with the keyword "histology" versus publications that include "automated, brain atlas, and histology" as keywords (Fig. 1). As the techniques for neuro-histology have improved and their scale of use has increased, development in the methods used for registering and quantifying histology data within existing, standardized atlas spaces has become necessary. While automated cell counting options exist (Brey et al., 2003;Kopec et al., 2011;Schüffler et al., 2013;Morriss et al., 2020;Courtney et al., 2021;Paglia et al., 2021;Sekar et al., 2021), few take into consideration the unbiased approach of whole-brain mapping, thus requiring a pipeline for cell counting that includes registering histology to border-defined structures in the whole brain. In the context of whole-brain imaging and mapping, where the volume of data is exceedingly large, the need for these processes to become automated has become apparent.
Advances in digital-based atlases (Hjornevik et al., 2007;Lein et al., 2007) set the stage for the development of tools for registering histology to atlas reference spaces (Kopec et al., 2011;Pallast et al., 2019). Atlas registration along with the quantification of brain region populations for labeled cells are critical steps for accurate post-imaging analysis. Atlas registration involves a warping mechanism to align histology sections onto an idealized atlas (Kopec et al., 2011;Shamash et al., 2018;Pallast et al., 2019;Bourgeois et al., 2021;Claudi et al., 2021). Deformations, angled images from non-zero anterior-posterior or medial-lateral tilt, and other imperfections in the slice image can complicate the warping process that is necessary to map sections to the atlas space. Therefore, accuracy in atlas registration is essential.
The SHARP-Track toolkit (Slice Histology Alignment, Registration, and Probe-Track analysis) was developed as a method for user-identification of landmark points between a section image and the mouse brain atlas to accurately register histology data containing electrode tracks, thus accommodating tissue imperfections (Shamash et al., 2018). The SHARP-Track toolkit allows intuitive interaction with the Allen CCF Mouse Brain Atlas (Wang et al., 2020) and can incorporate images collected on various angles. Here, we introduce a modified SHARP-Track that is a semi-automated pipeline of slice to mouse brain atlas registration and cell counting of fluorescently labeled neurons called SHARCQ (Slice Histology Alignment, Registration, and Cell Quantification).

Materials and Methods
Whole-brain fluorescent labeling of neurons Male and female VGluT2-IRES::Cre mice (10-16 weeks) were anesthetized with isoflurane (1-3%) and injected in the ventral tegmental area (VTA) with adeno-associated viral vectors (AAVs) encoding Cre-dependent avian tumor virus receptor A (TVA) tethered to mCherry and Cre-dependent optimized glycoprotein (Kim et al., 2016; AP: À3.2, ML: 0, DV: À4.3). Three weeks later, mice were anesthetized with isoflurane (1-3%) and injected in VTA with EnvA G-deleted rabies GFP (Salk Institute). One week following rabies injection, mice were anesthetized with isoflurane and transcardially perfused with phosphate buffer (0.1 M) followed by 4% paraformaldehyde. Brains were left in paraformaldehyde for 2 h and transferred to 18% sucrose in phosphate buffer overnight at 4°C. Brains were frozen in dry ice, sectioned (30 mm) in the coronal plane, mounted to gelatin-coated slides, and cover-slipped with Prolong Diamond containing DAPI, while minimizing tissue folding and the appearance of bubbles. DAPI was used as the cell marker for histology, and it is highly advised for the purposes of SHARCQ to use any cell marker as a background channel to easily discern the edges and landmarks of brain sections. Cover-slipped slides were weighed down by a wellplate for 3 days to promote a flat imaging plane across the entire slide. For some sections before coverslipping, guinea pig anti-c-Fos (Sysy, 1:1000) or mouse anti-tyrosine hydroxylase (TH; Millipore, 1:500) were washed overnight at 4°C and secondaries were applied for 2 h at room temperature (anti-guinea pig Alexa Fluor 647, anti-mouse DyLight405, or anti-mouse Alexa Fluor 488, The Jackson Laboratory, 1:200).

Image acquisition
Images were collected with confocal microscopy using a PerkinElmer Opera Phenix High-Content Screening System using a 20Â 0.8 NA objective. All images were obtained as 16-bit multichannel images. Individual fluorophore channels were stitched together on a composite .tiff image using a custom-written MATLAB script (StitchLargeImage.m) available for download at https://www.root-lab.org/.

Code accessibility: installation and dependencies
The SHARCQ program uses functionality from the MATLAB SHARP-Track toolkit (https://github.com/cortexlab/allenCCF) with additional developments and a graphical user interface (GUI) that registers the Allen Mouse Brain Atlas onto brain slice images and quantifiable cell locations. The SHARCQ program can be accessed through the SHARCQ GitHub repository, which contains a full outline of installation, detailed requirements, and methods of use (https://github.com/wildrootlab/SHARCQ). The 2020b or later installation of MATLAB is required, along with the Image Processing toolbox. The reference brain atlas that was used to overlay brain regions over slice images was the Allen Institute's 10-mm voxel 2017 version from the Allen Mouse Brain Common Coordinate Framework version 3 (Wang et al., 2020). Cell quantification by brain region can be completed with either the Allen Mouse Brain Atlas (Wang et al., 2020) or the modified Franklin-Paxinos atlas (Chon et al., 2019).

Manual cell counting
The original 16-bit acquired images were opened in FIJI for experimenter-blinded counts of GFP-labeled cell bodies. If the images were in the incorrect anatomic orientation, they were rotated to the correct coronal orientation (dorsal side is "up" and ventral side is "down") and saved before starting manual cell counting. To avoid error, the X, Y coordinate file must be generated from an image of the same orientation, size, and aspect ratio. The "Multi-Point" tool was used to label cell body locations over the image. A, Articles from 1912 to 2020 that contained "histology" as a keyword. B, Articles from 1992 to 2020 containing the keywords "automated, brain atlas, histology." Open Source Tools and Methods The X,Y coordinates of counted cells were exported as a . csv file using the "measure" function. The same acquired images were also counted in Photoshop to assess the accuracy of our pipeline in counting cells from different software for quantification. The X,Y coordinates of counted cells were extracted using a custom-written JavaScript script (get_xy_photoshop.js), which is included in the SHARCQ GitHub repository.

Image pre-processing
The three-channel stitched histology .tif images and X,Y coordinate .csv or .txt files from cell counting were manually moved into the "Images" and "ROI Coordinates" subfolders, respectively, of the SHARCQ-master folder. Through the first step of the SHARCQ GUI, the contrast was manually adjusted using the imcontrast MATLAB function to increase visibility of landmarks. A region of interest (ROI) file for each image was automatically created by SHARCQ and stored in a newly generated "Processed" folder within the "Images" subfolder. The ROI file represents the counted cell locations in a binary matrix that equals the image size and aspect ratio. Both the image and ROI matrices were downsampled to match the resolution of the reference atlas (10 mm/pixel). After all files were processed in this way, a new window was prompted. The user must click through and review all images using the arrow keys. This step filled the borders of the images and ROI matrices to 800 Â 1140 pixels to match the aspect ratio of the Allen atlas for image-atlas registration.

Image-atlas registration
Using both the "Slice Viewer" and "Atlas Viewer" figures generated in the second step of the GUI, we registered slice images to reference slices in the Allen atlas by scrolling to the approximate bregma location in the Atlas Viewer window (Wang et al., 2020). Where applicable, we tilted the atlas image in the dorsoventral and mediolateral planes to match the slice image. Finding the approximate bregma location and tilt is at the discretion of the user, and it is advised that the user has moderate familiarity with neuroanatomy. It is recommended to use white matter tracts (i.e. anterior commissure, corpus callosum, medial lemniscus, etc.) as landmarks. After navigating to the approximate bregma location and tilt, at least 10 points of reference were clicked that matched between the Atlas Viewer and the Slice Viewer. SHARCQ later used these points of reference to transform and overlay the slice image over the atlas image, as well as transforming the ROI matrix with the cell locations.

ROI-atlas registration
Registration of the slice image to a reference atlas slice in the second step of the GUI generates a geometric transformation file. In the third step, this geometric transformation was applied to the separate ROI layer via the Warp_ROI.m script located under the "Code" and then the "ROI" folder of SHARCQ-master. As a result, the ROI matrix containing cell locations is geometrically warped onto the atlas image in an identical way to the slice image.

Image-ROI-atlas composition and quantification by brain region
In the fourth step of the GUI, the warped image-to-atlas and ROI-to-atlas files were compiled in the Analyze_ROI. m script to create a composite image with three overlays: the downsampled image, the counted cell locations, and the atlas slice borders. The Analyze_ROI.m script is stored under the "Code" then "ROI" folder of SHARCQmaster. At this step, the user can add, move, or delete the fully interactive ROI points to account for any insurmountable difficulties in registration. The output is one .txt file per slice image containing a list of each counted cell's brain region location and one slice image-atlas-ROI composite .tif file.

ROI-3D brain registration
In the fifth step of the GUI, the ROIs from all brain slice sections that were analyzed within the "Images" folder were compiled into one 3D rendering of the mouse brain. For 3D registration, all SHARCQ output .csv files generated in the fourth step should be contained in the following folder path: Images!Processed!ROIs!Brain_Points. 3D registration was accomplished with the Plot_Wire_Frame_Brain.m script under "Code" and then the "ROI" folder of SHARCQmaster.

Brain-wide ROI quantification by brain region
In the sixth and final step of the GUI, all SHARCQ output .csv files generated in the fourth step were compiled into one .csv file per brain. The final result is an automatic tally of the number of counted cells by brain region across the entire analyzed brain.

Results
Flowchart of the initial set-up and organization of SHARCQ folders required for operation Initial configuration of SHARCQ requires user-input at discrete steps. First, the user must download the SHARCQ-master repository from GitHub, the npy-matlab-master repository from GitHub, as well as the Allen Atlas data ( Fig. 2A). Once downloaded, the Allen Atlas content should be stored in the "Allen" folder within the "Atlas" folder of SHARCQ-master. Because of the data file size of the Allen Atlas, our pipeline requires the user to separately download the Allen Atlas. The npy-matlabmaster folder, which reads .npy files into MATLAB and is required for use of the digital Allen Atlas, should be stored in the "Code" folder of SHARCQ-master.
The SHARCQ-master folder contains the SHARCQ. mlapp application file to execute the program within MATLAB and four folders that are organized based on content: Atlas, Code, Images, and ROI Coordinates (Fig.  2B). The "Atlas" folder is further subdivided by the "Allen" folder and the "Chon" folder. The "Chon" folder contains all content necessary for the modified Franklin-Paxinos Atlas-related analysis and does not necessitate user modification. The "Code" folder should contain the following folders for full operation: Browsing Functions, Cell Counting Code, Histology Functions, npy-matlab-master, ROI, and SHARP-Track. For the inexperienced programmer, there is no need to directly open or manipulate any of the scripts within the "Code" folder, except to add the downloaded npy-matlab-master folder. All scripts within the "Code" folder contribute to the functionality of the SHARCQ MATLAB app and require no modifications by the user.
The "Images" folder is where the user places .tif image files for processing. There should be corresponding X,Y coordinate .csv files or .txt files for each image, and these files should be stored in the "ROI Coordinates" folder. For practice, example images and corresponding X,Y coordinates have been provided in the GitHub repository. It is important to note that the file name for the image must be the same in the corresponding X,Y coordinate file. In addition, the X,Y coordinate file should be generated from an image in the correct anatomic orientation (dorsal side is "up" and ventral side is "down" for coronal section). Both the X,Y coordinate file and image should be saved and stored in the correct anatomic orientation in the corresponding folder. Clicking the SHARCQ.mlapp file in the SHARCQ-master folder will open the SHARCQ GUI in MATLAB. User interaction with SHARCQ will generate several new folders and files in the process (Fig. 2C). Within the "Images" folder, the image-ROI-atlas composite .tif file and the region data .csv file will be stored in the corresponding atlas data folder. A new folder within the "Images" folder called "Processed" contains the transformation data and images that were used during image-ROI-atlas registration.
A simplified workflow for adapting multiple software for cell count quantification to atlas registration We created a workflow that utilizes secondary software for whole-brain slice imaging, cell quantification, and a MATLAB app that we designed for atlas registration (Fig. 3). The SHARCQ pipeline consists of three stages: image acquisition, cell counting, and the SHARCQ GUI. Understanding that there may be a variety of histology needs that contribute to different variables, such as number of channels, slice thickness, and image resolution, SHARCQ was designed so that the only image requirement at the acquisition stage is that it must be a .tif or .tiff file format. The next stage is cell counting. For the purposes of demonstrating the flexibility of the SHARCQ Figure 2. Setup and SHARCQ GitHub repository file organization. A, The pipeline for SHARCQ requires downloading the SHARCQ dependencies, which include the SHARCQ GitHub repository, the Allen Atlas from http://data.cortexlab.net/allenCCF, and the npymatlab GitHub repository. Red arrows denote required user action. B, There are several folders organized by content within the SHARCQ-master folder. Before opening the SHARCQ.mlapp, the user must input images and the corresponding X,Y coordinate files in the appropriate folders in SHARCQ-master. C, SHARCQ generates new folders and files within the Images folder. The overlayed image-ROI-Atlas.tif file and cell counts by region data.csv file are both stored in the corresponding Allen Data or Chon Data folder depending on the selected atlas. A new folder called "Processed" contains images and transformation data that were used during the image-ROI-atlas registration steps of SHARCQ.
Open Source Tools and Methods pipeline, we loaded images and manually counted cells using two different programs: FIJI and Adobe Photoshop.
FIJI is an open-source image analysis software with manual cell counting capabilities in the GUI that also outputs an X,Y coordinate .csv file (Schindelin et al., 2012). Automatic cell counts can also be accomplished with the Analyze Particles command following thresholding and binarization. Adobe Photoshop is a commercial software that also has a Figure 3. SHARCQ pipeline from image acquisition to cell counting and quantification. The brain slice image must be in a .tif/.tiff file format. If the image has multiple fluorescent channels, then the colors should be in RGB-TIF color formatting. There are a number of methods for cell counting, as long as the method generates a .csv or .txt file of X,Y coordinates of the counted cells within the dimensions of the image. Within the SHARCQ GUI, the user sets up the files that will become necessary for image-ROI-atlas registration. In the final three steps, the user has built-in options for visualization of data.
Open Source Tools and Methods "Count Tool" feature that can be purposed for manual cell counting. In order to export the X,Y coordinates as .txt files from the Adobe Photoshop cell counting feature, a Javascript file called "get_xy_photoshop.js" must be used. When these cell count files are moved into the correct folder, SHARCQ will automatically execute a separate MATLAB script called "importXY," which will convert the .txt files to .csv files. Both scripts are stored in the "Cell Counting Code" folder within SHARCQ-master.
The bulk of user-input occurs within the SHARCQ GUI. After launching the SHARCQ.mlapp GUI, the user will be prompted to identify certain features of the images to be analyzed: viewing plane, image resolution, and downsampling. The viewing plane can either be coronal, sagittal, or transverse, but if sagittal, cell count quantification using the Chon Atlas cannot be accomplished at this time. Keeping in mind that the Allen Atlas is set at a resolution of 10 mm/pixel, downsampling an image means saving the image at a lower resolution to have it registered onto the Allen Atlas. The provided example images in the SHARCQ-master folder have a resolution of 0.5 mm/pixel. In the first step, the user is prompted to click the "Pre-Process Images" button. Doing so results in a downsampling of both the image and the created ROI matrix from the X,Y coordinates.
At the preprocessing image step, the user can adjust the contrast of any RGB channel to highlight certain landmarks that will make registration easier in the next step. In the prompted new window, the user must click through all images, if there are multiple channels, for review. This step saves the images and ROI matrices in the same aspect ratio as the Allen atlas, which is required for the next step of image to atlas registration. In the subsequent step, the user is prompted to click the "Register Sections to Atlas" button, which will allow for registration of the image to the appropriate coordinate within the mouse brain. This is a feature of the SHARP-Track toolkit, which has been integrated with SHARCQ with some modification, mainly adding numbers to landmarks to easily keep track of landmark positions between the "Atlas Viewer" window and "Slice Viewer" window. Instructions in the MATLAB command window are meant to direct the user on how to register the slice image to the atlas. In the "Atlas Viewer" window, the user must scroll to the approximate location in the brain that matches the slice in the "Slice Viewer" window. It is at the discretion of the user to determine the correct coordinate and tilt, if necessary. It is highly advised that at least 10 landmark points are clicked and matching between the "Atlas Viewer" and "Slice Viewer" windows. If the registration was successful, a "transform saved" message will appear in the MATLAB command window and an imageatlas composite .tif file as well as a transformation .mat file will be generated in the "Processed" folder.
The third step "Register ROI" requires no explicit user input, except clicking the button, which will register the ROI matrices using the same transformation .mat file that was applied to the image. If registration of the ROI was successful, then an "Image and ROI processing complete!" message will appear in the MATLAB command window. In the fourth step, the user may choose to quantify the cell counts by brain region according to the Allen Atlas or the Chon Atlas. In the MATLAB command window, the user will be prompted to select the original, unprocessed image file, which should be located in the "Images" folder. After doing so, a new window will appear, allowing the user to drag, add, or delete individual or grouped ROI points by drawing a polygon. When completed, the user is to press the "enter" key in the MATLAB command window. After doing so, SHARCQ will generate an image-ROI-atlas composite .tif file and a Region Data .csv file within the corresponding atlas folder in "Images." In the fifth step, the user can choose to plot the ROIs of all the images that have been processed thus far onto a 3D rendering of a mouse brain. No additional user input is required for this step. For the sixth and final step, the user can obtain the cumulative cell counts per brain region for all images that have been processed in a MATLAB generated plot. Otherwise, the user can replicate the same plot using the Region Data .csv file stored in "Images."

SHARCQ accurately registers both the histological image and ROI of counted cells to the atlas
Here, for purposes of demonstration, we used GFP-expressing cell count data from VGluT2-IRES::Cre mice that were injected in the VTA with AAVs encoding Cre-dependent TVA-mCherry and Cre-dependent optimized rabies glycoprotein (OG). Three weeks following the initial helper virus infusion, the mice underwent stereotaxic surgery again and were injected in the VTA with EnvA G-deleted rabies GFP. The image that is being used for demonstration is the same one that is included in the SHARCQ GitHub repository for practice and is an example of retrograde tracing from VGluT2-expressing VTA neurons (Fig. 4A). Contrast for the GFP image layer was adjusted to optimize the appearance of labeled neurons, a feature that can be useful for highlighting labeled cells or making brain landmarks such as axon tracts more clear (Fig. 4B). When the user selects the "Register Sections to Atlas" action button in the second step, two pop-up windows will appear titled "Slice Viewer" (Fig. 4C) and "Atlas Viewer" (Fig. 4D). Before transformation, the user must scroll to the correct AP coordinate and DV/ML tilt in the Allen Brain Atlas. For the image used, it was visually determined that the best corresponding coordinate was 11.35 AP. Within both windows, the user must then press the "t" key to trigger the transform mode that will allow the user to click numbered and matching points between the "Slice Viewer" and "Atlas Viewer." After hitting the "h" key for atlas registration, the "Atlas Viewer" window will be updated with the brain slice overlayed. If the user is not satisfied with the registration, registration points can be added or deleted until the transformed histology matches the atlas, after which the transformation must be saved again. The final image-ROI-atlas composite is created when the user is prompted in the fourth step to "Analyze Section with Allen Atlas" (Fig. 4E) or "Analyze Section with Chon Atlas" (Fig. 4F). An additional visualization output in an optional fifth step is a 3D rendering of all cell counts from images that have been processed (Fig. 4G). In the 3D image window, the user may rotate and zoom in on the brain for optimal viewing. A video demonstrating this functionality can be found at https://www.root-lab.org/sharcq. Additionally, to showcase SHARCQ's ability to accurately register small brain regions, we immunolabeled TH, a ratelimiting enzyme in dopamine synthesis, in mouse brain slices that contain the locus coeruleus (LC; Fig. 5A). SHARCQ processing produced successful registration with TH-positive cells localized within the borders of the LC (Fig. 5B).

SHARCQ functionality is useful across diverse cell labeling techniques
To demonstrate the utility of SHARCQ for common neurohistological methods, we performed different cell labeling and counting techniques. In one method, sections containing the dorsal and median raphe were immunolabeled for tryptophan hydroxylase 2 (TPH2; Fig. 6A), a rate-limiting enzyme for the biosynthesis of serotonin. The image was then registered to the Allen Atlas using SHARCQ (Fig. 6B). The TPH21 cells were manually counted in FIJI, and the ROIs were registered using the warping function from the image and analyzed using the modified Franklin-Paxinos Atlas (Fig. 6C). This demonstrates SHARCQ's usefulness in whole-brain sampling of cell types of interest. In another method (Fig. 6D-F), mouse brain sections were immunolabeled for c-Fos, an immediate early gene indicator, and processed through SHARCQ. This method is particularly useful for unbiased identification of brain regions activated by experimentally-defined events. Further, it demonstrates SHARCQ's capacity to handle a large density of cells (.5000 c-Fos-expressing neurons within the whole image in this example). In the third method (Fig. 6G-O), Figure 4. Demonstration of SHARCQ functionality in atlas and cell count ROI registration with imperfect histology. A, Neuroanatomical tracing of neurons (green) projecting to VGluT2-expressing VTA neurons with whole cells in DAPI (blue) with the determined 11.35 AP coordinate. B, Contrast adjustment of the image in the second step within SHARCQ GUI. C, The "Slice Viewer" window with numbered matching landmarks between the (D) "Atlas Viewer" window. E, Image-ROI-Allen Brain Atlas composite. F, Image-ROI-Chon Atlas composite. G, 3D whole-brain mapping of cell counts from all images that have been processed. two separate groups of neurons were manually counted in Photoshop: the neurons co-expressing mCherry and EGFP ( Fig. 6G-I) and neurons expressing EGFP without mCherry ( Fig. 6J-L). After processing the mCherry-EGFP cell counts through SHARCQ, the same warping function was applied to the EGFP-only cell counts without the user needing to perform the registration a second time. This application is ideal for analyzing histology with multiple cell populations of interest because it applies identical registration and analysis across cell groups, thereby increasing throughput capacity and eliminating discrepancies in repeated registration.

Image-ROI-Atlas composition has a high degree of similarity across cell quantification method and atlases
In order to validate the reliability of SHARCQ features, we compared the cell quantification results by counting method and the provided atlas options. Immunofluorescent imaging data from Cre-dependent retrograde tracing of VGluT2-expressing neurons within the VTA were used. GFP cell bodies of an image (Fig. 7A) were manually counted using both Adobe Photoshop and FIJI (Fig. 7B). A separate image slice from the same viral strategy (Fig. 7C) was used to compare cell count quantification by brain structure according to the Allen Atlas and the modified Franklin-Paxinos Atlas (Fig.  7D). Across 35 brain structures, there was overlap in nomenclature of four structures between the Allen Atlas and modified Franklin-Paxinos Atlas in cell count quantification. While cell counts within images retained fidelity across the whole brain, regardless of atlas choice (Fig. 7E), there exists discrepancy between atlases in defined brain borders and structure terminology (Fig. 7F). For one whole brain, 57 images were analyzed, and a linear regression analysis was performed on total brain region counts from the Allen Atlas versus total brain region counts from the modified Franklin-Paxinos Atlas (r = 0.81, p = 7.70 Â 10 À22 ). While there was little to no difference in cell counts (r = 0.99, p = 1.34 Â 10 À146 ), there was significant incongruency in the number of brain structures accounted for between atlases (Franklin-Paxinos: 37.8, SD = 14.7; Allen: 30.1, SD = 12.8) with more brain structures defined in the modified Franklin-Paxinos atlas overall (t (56) = 9.13, p = 1.11 Â 10 À12 ). Together, this analysis illustrates that the choice of atlas or counting method will be best determined by each experimenter.

Discussion
Here, we demonstrate the functionality of a semi-automated workflow and GUI called SHARCQ for registering whole-brain slice images with fluorescently labeled cells onto a whole-brain atlas. The SHARCQ GUI integrates the SHARP-Track toolkit with significant modifications to create a user-friendly interface for registering individual cells of interest to a whole 3D brain atlas. Specific issues were circumvented to achieve this outcome. Namely, during the process of registration, high resolution images were downsampled to match the lower resolution of both the Allen Brain Atlas (Wang et al., 2020) and the Chon Atlas (Chon et al., 2019). With loss of high resolution, cell counting after registration would be imprecise and inaccurate. The SHARCQ GUI requires cell counting before registration, thereby circumventing the issue of down-sampling. As a result, areas of dense cell counts are preserved. The cell counting required before using SHARCQ can be obtained manually or automatically through other means.
MATLAB, a programming platform and language with many capabilities, is proprietary and therefore, not an open-source coding software. The commercial nature of MATLAB can make it difficult for scientists to learn, troubleshoot, and implement MATLAB-based code, especially for scientists with little to no computational background. The SHARCQ GUI was designed to be intuitive, leading a user through every step of the analysis. While options do exist for automated cell counting and atlas registration, it requires extensive code modification or, in the case of machine-learning algorithms, still some level of manual counting for pretraining or computationally intensive training (Fürth et al., 2018;Berg et al., 2019;Tyson et al., 2021). With the SHARCQ GUI, there is no need to interact with or make modifications to the code directly. Open Source Tools and Methods The SHARCQ features described here were presented using histology data from various methods, such as Cre-dependent retrograde tracing of VGluT2-expressing neurons within the VTA. SHARCQ was designed with the intention of scientists being able to use it for any type of whole-brain slice histology staining (i.e., HRP-DAB method, fluorescent histochemical methods, autoradiographic staining methods). The only image requirement of SHARCQ is for the image to be a .tif/.tiff file type, which is the most common image file type because of its ability to retain image quality.
A useful feature is the option to choose between the Allen Mouse Brain Atlas or the modified Franklin-Paxinos Atlas for cell count quantification by brain structure (Chon et al., 2019;Wang et al., 2020). The cell counting step exists outside of the SHARCQ interface, and therefore, quantification of cell counts is retained, regardless of the selected atlas. Understanding that there are discrepancies of brain region borders and even nomenclature between the Allen Mouse Brain Atlas and the Franklin-Paxinos Atlas, SHARCQ allows both atlases for cell count quantification. In addition, when quantifying cell counts by atlas, the user has the option to move individual or grouped counted cell ROIs Figure 7. Similar quantification across cell counting method and atlases but discrepancies in brain structure nomenclature between the Allen Atlas and the modified Franklin-Paxinos Atlas. A, Atlas registration example for an image with À0.18 AP coordinate of neurons (green) projecting to VGluT2-expressing VTA neurons with whole cells in DAPI (blue). B, Total cell counts per brain structure of the Allen Atlas between the FIJI counting method and Photoshop counting method. C, Image-to-Atlas registration for an image at À5.94 AP with neurons (green) projecting to VGluT2-expressing VTA neurons with whole cells in DAPI (blue). D, Comparison in cell counts between the Allen Atlas quantification and modified Franklin-Paxinos quantification. E, Whole-brain retrograde traced cell counts between the Allen Atlas and the modified Franklin-Paxinos Atlas (n = 57 images). F, Whole-brain structure counts between the Allen Atlas and the modified Franklin-Paxinos Atlas (n = 57 images). after warping. This feature allows for flexibility in adjusting the coordinates of counted cell ROIs after atlas registration for maximum precision and accuracy in the final cell counts by brain regions.
With regard to data sharing, substantial effort was made to be as transparent as possible with the development of SHARCQ, as well as with all code contributing to its functionality, including steps outside the SHARCQ GUI, such as sample preparation, image acquisition and cell counting. The MATLAB GUI was selected for the development of SHARCQ because of the easy nature of uploading files and point-and-click action buttons. SHARCQ is a conceptually simple framework of an image analysis pipeline. It not only reduces user input to what is only necessary, but in the command window of MATLAB are key stroke directions for navigation and manipulation. While html-based platforms, like RMarkdown or Jupyter Notebook, contribute to data reproducibility with recorded and reproducible code, it was not necessary for the purposes of SHARCQ. Rather, SHARCQ maintains data reproducibility by retaining the original image file and outputs the alterations that were made at every step of the pipeline, including contrast adjustments, down-sampling, and atlas registration.
The rapid development in digitized atlases and atlas registration of images has changed the onerous task of postimaging analysis into a quick, automated output. Instead of drawing borders by hand onto images, researchers can use a GUI such as SHARCQ to automatically determine the number of precounted cell bodies within discrete brain regions. Other programs exist that integrate both automated cell counting and atlas registration (Kopec et al., 2011;Fürth et al., 2018;Pallast et al., 2019;Bourgeois et al., 2021). Notably, some of these programs automate image warping by setting an intensity threshold or conducting a principal component analysis to detect tissue edges, but such an approach is less conducible with irregular tissue, such as a missing hemisphere or torn tissue edge (Kopec et al., 2011;Fürth et al., 2018). The advantage of landmarkbased registration, which is an integral feature of SHARCQ, is that regardless of tissue quality, image to atlas registration will occur with high precision based on user-defined landmarks.
In addition, many of these programs require moderate programming experience to achieve the goal of image to atlas registration. Some examples include line modifications to the code script, execution of additional code within the command window, or experience with multiple programs in the pipeline (Kopec et al., 2011;Fürth et al., 2018;Pallast et al., 2019;Bourgeois et al., 2021). SHARCQ was developed as a user-friendly, self-contained MATLAB interface for atlas and cell count registration that requires no coding and only point-and-click user actions. The SHARCQ GUI was designed for step-by-step registration and analysis with an intuitive layout.
While SHARCQ is a considerable improvement over manual brain border drawing and coding intensive programs, SHARCQ has limitations. We have shown that brain regions, regardless of size, can be accurately registered to the corresponding atlas region. However, differences in ventricle size between the slice image and the brain atlas can lead to difficulties accurately registering ventricles. Disproportionate ventricle size can be because of ventricle expansion during transcardial perfusions at the time of brain retrieval or variation between mouse lines. While expanded ventricles can compress the surrounding brain regions, we have found that careful selection of registration points produces a registration of sufficient quality to accurately assign cell counts to their brain regions. A best practice is to focus registration points on anatomic landmarks within the tissue rather than in or surrounding the ventricles. It is noteworthy that for SHARCQ, the user can manually move cell counts after atlas registration as a mechanism to verify and review that cell counts exist in the appropriate brain regions.
A second limitation is that SHARCQ has no integrated automated cell counting feature in its current form. It is worth noting that one of the SHARCQ requirements is an X,Y coordinate file of counts that match the dimensions of the image. Therefore, although it is not demonstrated here, it is possible to use another automated cell counting program that can output the described X,Y coordinate file and then use SHARCQ to register the image and counted cells to an atlas. Automated cell counting by establishing an intensity threshold and binarizing the image can be accomplished in FIJI or MATLAB. Automated cell counting was not integrated into SHARCQ because the process still requires significant user input to optimize thresholding and binarization. The intensity threshold can vary within and between images, establishing an intensity threshold would have to be manually determined by the user. For example, in our 16-bit .tiff image files, in which maximum intensity was 65,535, the manually counted cells did not always have an intensity value of 65,535, and the minimum intensity was not uniform across images.
A third limitation is that neuroscientists who use nonmouse species for research, such as rat, marmoset, or zebrafish, will not find utility in SHARCQ. Recently, the integration of multiple taxa brain atlases, including mouse, human, and larval zebrafish, was achieved by establishing an application programming interface (API) called BrainGlobe (Claudi et al., 2020). BrainGlobe was used to develop Brainrender, a Python-based tool that can integrate visualization of cell counts (Claudi et al., 2021). While Brainrender can produce high quality visualizations, its main limitation is that it is currently not a quantification tool. SHARCQ, while limited to the mouse brain, produces both 2D and 3D visualization of cell counts and also enabling quantification of cell counts by brain regions. With more open-source data sharing and development, SHARCQ can be substantially expanded to different species. For now, SHARCQ satisfies a need for quick, automated cell count quantification across whole mouse brains, made possible through the expansion of currently existing toolkits (e.g., SHARP-Track).