DMC-BrainMap is an open-source, end-to-end tool for multi-feature brain mapping in different species
Felix Jung, Xiao Cao, Loran Heymans, Marie Carlén

TL;DR
DMC-BrainMap is a user-friendly, open-source tool for mapping and analyzing brain data from multiple species, streamlining neuroscience research.
Contribution
DMC-BrainMap introduces an end-to-end GUI-based solution for multi-feature brain mapping across species without requiring programming skills.
Findings
DMC-BrainMap supports whole-brain analysis of anatomical data from mice, rats, and zebrafish.
The tool enables segmentation, quantification, and visualization of diverse features like cell bodies and axonal densities.
It improves rigor and reproducibility by eliminating the need for programming and proprietary software.
Abstract
Rigid anatomical mapping is a necessity in current neuroscience research. Here, we introduce DMC-BrainMap, an open-source napari plugin designed as a user-friendly tool for streamlined processing and whole-brain analysis of anatomical data. Its core functionalities include all steps after image acquisition, i.e., preprocessing of images, registration of images to a reference atlas, segmentation of different anatomical features, and data analysis/visualization. DMC-BrainMap can be applied to histological data obtained from a variety of model organisms at different developmental stages to map a diverse range of features. We demonstrate the utility of DMC-BrainMap by mapping and quantifying the location of cell bodies, axonal densities, injection sites, optical fiber and Neuropixels tracts, (single-cell) spatial transcriptomics, as well as neuron morphology data in mice, rats, and…
Genes, proteins, chemicals, diseases, species, mutations and cell lines named across the full text — each resolved to its canonical identifier and authoritative record.
Click any figure to enlarge with its caption.
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSingle-cell and spatial transcriptomics · Cell Image Analysis Techniques · Neurogenesis and neuroplasticity mechanisms
Introduction
Understanding how computations underlying complex behaviors are implemented in brain-wide circuits is a central goal of current neuroscience research.1^,^2^,^3 For this, viral tracing, large-scale in vivo electrophysiology and imaging, activity perturbations, and “spatial-omics” have become standardized tools in neuroscience laboratories to study circuit components and their physiology. A commonality of current studies is the need for anatomical mapping of the data, e.g., the location of cell bodies, implanted electrodes and optical fibers, and the spread of viral vectors. A variety of tools for mapping anatomical data to standardized coordinate systems, so-called reference atlases, has been developed in recent years, tailored to specific anatomical features and tissue preparations (brain sections [2D data] versus volumetric [3D] data; Table S1). With a focus on volumetric data, the BrainGlobe Initiative (https://brainglobe.info/) has generated tools allowing users to segment4 and register anatomical features to reference atlases5 and create high-quality data visualizations6 (see also ClearMap,7 SMART,8 MIRACL,9 and ABBA10 for volumetric data). However, brain sections are still the most commonly used preparation.1 Several tools are available for registration of images of (mouse) brain slices to a reference atlas and mapping of anatomical data, all holding their specific advantages and limitations.10^,^11^,^12^,^13^,^14^,^15^,^16^,^17 Most tools, however, do not cover the whole process from image preprocessing to data visualization. Other common limitations are the need for multiple or proprietary software and programming skills.
To overcome these hurdles, we developed DMC-BrainMap, a plugin for the Python-based image viewer napari (https://napari.org/). DMC-BrainMap is an interactive end-to-end tool tailored for 2D brain section data that covers all steps from image preprocessing to data visualization. We also provide DMC-FluoImager, a software for scanning 2D brain sections (https://github.com/hejDMC/dmc-fluoimager). The DMC-BrainMap pipeline is installed, run, and controlled through a graphical user interface (GUI), eliminating the need for programming by the user. The pipeline focuses on user-friendly operation and facilitates manual curation of image registration and anatomical feature segmentation. As the pipeline integrates the BrainGlobe Atlas API,18 it can be applied to data from, e.g., mice, rats, and zebrafish at different developmental stages. The provided pycro-manager-based19 DMC-FluoImager software can be used for customized scanning of 2D brain sections using any microscope equipped with a motorized XYZ stage. Data obtained via DMC-FluoImager is natively structured for seamless use within the DMC-BrainMap workflow. Alternatively, any single-channel 16-bit .tif/.tiff images can be used as input to the DMC-BrainMap pipeline. The DMC-BrainMap pipeline provides solutions for convenient batch preprocessing of the microscopic images, fast and interactive image registration to reference atlases, and semi-automatic segmentation of a variety of anatomical features, including (labeled) cell bodies, axonal densities, injection sites, and tracts from optical fibers or Neuropixels probes 1.0. The integrated software ProbeViewer offers voxel-wise inspection of reconstructed Neuropixels tracts. In addition, the pipeline enables users to analyze and visualize data, including spatial transcriptomics (ST) data, in a variety of ways. The DMC-BrainMap pipeline is open-source, compatible with Windows, Mac, and Linux operating systems, and can be integrated with other napari plugins.
Results
The DMC-BrainMap pipeline is designed as a user-friendly tool for streamlined processing and whole-brain analysis of anatomical data. The working principle and core functionalities include all steps after image acquisition, i.e., preprocessing of images, registration of images to a reference atlas, segmentation of anatomical features, and data analysis/visualization (Figures 1A and 1B). We also provide a solution for image acquisition, DMC-FluoImager, a script for automatic imaging of 2D brain sections with a fluorescence microscope (Figure 1A). The output data format and structure of DMC-FluoImager are readily compatible with the DMC-BrainMap pipeline (Figure 1B).Figure 1. Schematic of the DMC-BrainMap workflow(A and B) The DMC-BrainMap workflow provides streamlined processing and whole-brain analysis of anatomical data (i). The pipeline integrates all steps (iii–vi) after image acquisition. (A) (ii) We provide DMC-FluoImager (https://github.com/hejDMC/dmc-fluoimager), a stand-alone solution for automatic imaging of 2D brain sections with a fluorescence microscope. (B) (iii) The DMC-BrainMap can be used for image preprocessing of stitched images to generate image stacks, composite (RGB), binary, or single-channel images. (iv) Image registration to a reference atlas is performed using SHARPy-track. (v) Various experimental or biological features can be segmented, including cell bodies, injection sites, axonal densities, tracts of Neuropixels probes and optical fibers, as well as ST spots. (vi) The anatomical data can be quantified and visualized in many different ways.ACAd, anterior cingulate area, dorsal part; ACAv, anterior cingulate area, ventral part; ACB, nucleus accumbens; CP, caudoputamen; ILA, infralimbic area; MOs; secondary motor cortex; NA, not assessed; OT, olfactory tubercle; PL, prelimbic area.Schematic in (i) generated using brainrender.6
Preprocessing of histological images
To start any type of data analysis for an animal for the first time, the user creates a parameter file (params.json). This file specifies mandatory information such as the orientation of brain slices (coronal/horizontal/sagittal), acquired fluorophore emission channels, and the reference atlas of choice and optional experimental information (e.g., the specimen’s experimental group/genotype). The DMC-BrainMap is compatible with all reference atlases incorporated in the BrainGlobe Atlas API18 and, thus, enables registration of images from various species, including mouse, rat (Figures S1A and S1B), and zebrafish (Figures S2A and S2B) at different developmental stages. The parameter file keeps a record of analysis steps performed.
The first step in the DMC-BrainMap pipeline is image preprocessing. The user can stitch image tiles (a step with integrated padding), or, if working with already stitched images, perform an image padding step (recommended) to align the aspect ratio of acquired images to that of the reference atlas. Various options of batch image processing can be performed on the stitched images (e.g., image contrast adjustment and downsampling) to create single-channel, binarized, or composite (RGB) images, respectively, as well as multichannel image stacks.
Registration of brain section images to reference atlases using SHARPy-track
The DMC-BrainMap registers images of histological 2D brain sections into a standardized coordinate system, i.e., the reference atlas selected by the user (Figure 2A). For fast, interactive (immediate feedback) image registration, we developed a tool called SHARPy-track (Figures 2B–2F). The user starts by specifying the fluorophore emission channel to be used for aligning images of brain sections to planes of the reference atlas. The user thereafter launches a window that will display a plane in the reference atlas (Figure 2B, left) and a brain section image to be registered (Figure 2B, right). The window holds four scrollbars: one for scrolling through and selecting a brain section image, and three for modulating the plane within the reference volume. The user scrolls through the reference volume, following the axis of brain sectioning, to identify the plane matching the brain section image. A common problem when registering histological 2D data is that brains are sectioned at angles slightly deviating from the strictly coronal/sagittal/horizontal reference atlas planes. SHARPy-track allows users to correct tissue sectioning angles—the reference plane can be freely rotated (top + left scrollbar) in any direction around the center point of the plane (Figure 2C). For registration of a set of images, the integrated Registration Helper tool can be used to set the corresponding reference planes for all images at once (Figure 2D). For this, the user assigns an anchor to an arbitrary number of ordered brain section images, e.g., to the first and the last brain section image. The Registration Helper tool will interpolate the reference planes of the brain section images between pairs of neighboring anchor images.Figure 2. Registration of brain section images to a reference atlas using SHARPy-track(A) The goal of image registration is to anatomically map images of brain sections to a coordinate system (reference atlas).(B) The DMC-BrainMap pipeline uses the tool SHARPy-track for semi-automatic image registration.(C) SHARPy-track allows free rotation of the reference atlas plane to compensate for tissue sectioning deviating from a strict coronal/sagittal/horizontal plane.(D) The Registration Helper tool integrated in SHARPy-track enables batch setting of reference planes for a set of ordered images.(E) SHARPy-track enables registration of images of coronal, horizontal, or sagittal brain sections. Images of complete, incomplete, or parts of brain sections can also be registered.(F) Registration accuracy as indicated by the target registration error (TRE) can be estimated using SHARPy-track. Mouse, rat, and zebrafish schematic adopted from scidraw.io.See also Video S1.
To register a brain section image, the user manually sets reference points on the reference plane—corresponding (paired) points are automatically generated on the brain section images (the user can easily identify paired points by hovering the cursor over points). The user drags the points on the brain section images to match the location of the reference points. After five (paired) points are set, SHARPy-track calculates a perspective transformation matrix to warp the brain section image. The warped image is transparently blended with the reference plane, allowing the user to assess the alignment. An advantage of SHARPy-track is that the transformation matrix is calculated in real time, directly warping the brain section image when the user modifies the position of points. This immediate feedback speeds up the registration process and supports user modifications improving the registration accuracy (Video S1). Importantly, SHARPy-track allows users to register images of coronal, sagittal, or horizontal brain sections to a reference atlas (Figure S3A), as well as incomplete or parts of brain section images (Figures 2E and S4A). To optimize the correspondence between the brain section image and the reference plane, a prediction function keeps track of the latest transformation matrix, allowing SHARPy-track to perform an up-to-date “best guess” in the generation of paired points. Consequently, generating reference points and adjusting the location of corresponding points, updates the transformation matrix and refines the anatomical precision. Further, SHARPy-track incorporates means to estimate the registration accuracy in terms of calculating the target registration error (TRE) between points set manually on the brain section and reference atlas images, respectively (Figures 2F, S1C, S2C, S3B, S3C, S4B, and S4C).
Video S1. Registration of brain section images using SHARPy-track, related to Figure 2. Registration of coronal mouse brain sections to the Allen Mouse Brain Atlas (CCFv3).
Segmentation and data visualization
Segmentation is the process of assigning labels to distinct features in images. The DMC-BrainMap pipeline can segment an array of features, e.g., cell bodies, axonal densities, Neuropixels 1.0 probe tracts, injection sites, and tracts of lenses or optical fibers. In addition, analysis and visualization of (single cell) ST and single-neuron morphology data are feasible. Importantly, different types of features can be segmented in the same image. The DMC-BrainMap pipeline offers a range of options for analysis and visualization of the data (see further below). The data underlying every visualization plot are saved as an individual .csv file, allowing users to run additional, custom analysis or visualization workflows.
Quantification and visualization of data at the whole-brain level
To demonstrate the utilization of DMC-BrainMap for segmentation and visualization of cell bodies at the whole-brain level, we used rabies virus (RV) tracing in adult wild-type (WT; C57BL/6J) mice to label monosynaptic input to neurons in the dorsomedial and ventromedial prefrontal cortex (dm/vmPFC, respectively; Figures 3A, S5A, and S5B; see also Figures S1D–S1F, S2D–S2F, S3D, and S4D). Segmentation of input neurons, labeled by only RV-EGFP, was performed semi-automatically (Figure S5C). First, the input neurons were automatically segmented using the integrated presegmentation tool (adapted from The Allen Cell and Structure Segmenter (https://github.com/AllenCell/aics-segmentation workflow).20 The generated (pre)segmentation dataset was subsequently manually curated—segmented artifacts were removed, and unsegmented neurons were added. Starter neurons (labeled by both helper virus and RV-EGFP21; Figure S5C) were manually segmented (see the online Wiki for details) and visualized on schematic brain sections, integrating data from several animals (Figure 3B). Quantified starter neurons across prefrontal cortex (PFC) subregions can be visualized as pie charts (not shown) and in the form of a bar graph (Figure 3C, see also Figure S1H). As expected, the locations of starter neurons reflected the injection site in the dmPFC versus the vmPFC, respectively.Figure 3. Quantification and visualization of data at the whole-brain level(A) To generate exemplifying data of retrograde, monosynaptic circuit tracing at the whole-brain level, an AAV helper virus cocktail (1:5 AAV5-hSyn-Cre and AAV5-EF1a-DIO-TVA-V5-RG) was injected into the dmPFC (purple) or vmPFC (green) of adult WT mice (n = 1 + 1). Four weeks later, RV-EGFP was injected at the same location.(B) Segmented starter neurons (V5^+^/RV-EGFP^+^) plotted on a schematic coronal brain section (one hemisphere). Colors as in (A), one dot = one neuron.(C) Bar graph with quantification of the number of starter neurons across the subregions of the PFC.(D) Segmented input neurons (V5^−^/RV-EGFP^+^) plotted on schematic coronal brain sections (anterior to posterior). Monosynaptic input to the dmPFC: purple; to the vmPFC: green. One dot = one neuron.(E) Density estimate of input neurons along the AP axis of the brain.(F) Bar graph with quantification of the number of input neurons in subregions of the thalamus.(G) Schematic coronal brain sections (anterior to posterior) with heatmaps displaying the distribution of local input neurons to the dmPFC (top) and vmPFC (bottom), respectively, across the subregions of the PFC.(H) Heatmaps displaying the laminar distribution of local input neurons to the dmPFC (left) and vmPFC (right), respectively, along the AP axis of subregions of the PFC.Included data in (B) and (D): ±0.15 mm to the respective brain section.AM, anteromedial nucleus; AD, anterodorsal nucleus; ATN, anterior group of the dorsal thalamus; AV, anteroventral nucleus of thalamus; CL, central lateral nucleus of the thalamus; CM, central medial nucleus of the thalamus; DORpm, thalamus, polymodal association cortex related; DORsm, thalamus, sensory-motor cortex related; DP, dorsal peduncular nucleus; IAD, interanterodorsal nucleus of the thalamus; IG, induseum griseum; ILM, intralaminar nucleus of the dorsal thalamus; IMD, intermediodorsal nucleus of the thalamus; LAT, lateral group of the dorsal thalamus; LSr, lateral septal nucleus, rostral (rostroventral) part; MD, mediodorsal nucleus of thalamus; MED, medial group of the dorsal thalamus; MTN, midline group of the dorsal thalamus; OLF, olfactory areas; ORBl, orbital area, lateral part; ORBm, orbital area, medial part; ORBvl, orbital area, ventrolateral part; PF, parafascicular nucleus; PO, posterior complex of the thalamus; PT, paratenial nucleus; PVT, paraventricular nucleus of the thalamus; RE, nucleus of reuniens; RH, rhomboid nucleus; SH, septohippocampal nucleus; STR, striatum; TTd, taenia tecta, dorsal part; VAL, ventral anterior-lateral nucleus of the thalamus; VENT, ventral group of the dorsal thalamus; VM, ventral medial nucleus of the thalamus.See also Figures S5, S6, and S7.
Users can compile and visualize segmented cells on the whole-brain level on schematic brain sections, classifying the data based on different criteria, e.g., specimen identity, experimental group (Figure 3D), or marker protein expression (Figure S6A). Cells can also be visualized per anatomical annotations in a specific atlas (Figure S6B), including on schematized coronal, horizontal, or sagittal brain sections, irrespective of how the brain slicing was oriented (Figures S6C and S6D). Moreover, integration of datasets obtained from different brain slicing orientations is feasible (Figures S3D and S3E). In addition to visualizing the localization of individual cells, DMC-BrainMap allows users to visualize the density of segmented cells on schematic brain sections (Figures S1G and S2G).
Density estimates can be used to exemplify the distribution of neurons along different axes of the brain. DMC-BrainMap allows users to calculate density estimates along the antero-posterior/dorso-ventral/medio-lateral (AP/DV/ML) axes as well as along a combination of axes. Here, we calculated density estimates of input neurons along the AP axis (Figure 3E). Visualization of the distribution of neurons in selected brain (sub)regions is also straightforward, e.g., in the form of a bar graph (Figure 3F). The absolute number, or proportion of neurons relative to a selected dataset, can be plotted (Figures S7A and S7B). Heatmaps provide an informative illustration of the distribution of anatomical features in layered structures that can be plotted on schematic brain sections (Figures 3G and S1J) as well as “pure” heatmaps (Figures 3H, S1I, S7C, and S7D). Additionally, differential heatmaps comparing data between animals, channels, hemispheres, or experimental groups can be created using DMC-BrainMap (Figure S6E).
ProbeViewer for reconstruction and visualization of Neuropixels probe tracts
DMC-BrainMap integrates the tool ProbeViewer for reconstructing Neuropixels (1.0) probe tracts, a core functionality of the pipeline (Video S2). Using the 10 μm Allen Mouse Brain Atlas (CCFv3)22 or the Waxholm Space (WHS) Atlas of the Sprague-Dawley rat brain23 users can anatomically trace the tracts of multiple Neuropixels probes in a single brain and assign each probe recording site to an anatomical location. For demonstration, we implanted a Neuropixels probe 1.0 labeled with DiO in an adult WT mouse, inserting the probe through the secondary motor cortex (MOs) to the caudoputamen (CP; Figure 4A). The first step is to manually mark the DiO-labeled probe tract with reference points in all relevant images. The objects.Line.best_fit function of the scikit-spatial Python package is thereafter used to reconstruct the probe path based on the set of reference points. The probe insertion depth can be specified by the user or automatically calculated using the segmented probe tract points. The reconstructed probe tract can be plotted on coronal brain sections using the visualization functions of the DMC-BrainMap pipeline (Figure 4B).Figure 4. Reconstruction and visualization of Neuropixels probe tracts(A) Coronal brain sections (anterior to posterior) with a Neuropixels probe track labeled with DiO (white). Scale bars: 1 mm.(B) Reconstruction of the anatomical localization of the probe in (A; black line) based on manual segmentation of the labeled probe tract. Traversed brain regions are custom color-coded using a DMC-BrainMap functionality. Included data: ±0.1 mm to the respective brain section.(C) The ProbeViewer tool can be used to visually inspect the reconstructed probe tract (green) in different orientations in 3D space.(D) Visualization of the brain regions along the reconstructed probe track. The confidence that the brain-region label is correct is indicated by estimation of the distance to the closest brain (sub)region within a 100 μm radius. This confidence is reflected by the thickness along the x axis. Brain regions color-coded as in (B).(E) High-pass filtered electrophysiological traces, color-coded for brain region as in (B). 1 trace = 1 recording channel. fa, corpus callosum, anterior forceps; MOs1, secondary motor area, layer 1; MOs2/3, secondary motor area, layer 2/3; MOs5; secondary motor area, layer 5; MOs6a; secondary motor area, layer 6a; MOs6b, secondary motor area, layer 6b; scwm, supra-callosal cerebral white matter.See also Video S2.
Video S2. ProbeViewer for visualization of reconstructed Neuropixels tracts, related to Figure 4. Demonstration of visualization of reconstructed Neuropixels tracts using ProbeViewer in Allen Mouse Brain Atlas (CCFv3) space.
Using the ProbeViewer tool, the user can load the data from multiple probes (from one or more animals) and follow the tracts along the AP, DV, and ML axes of the brain, visually inspecting the reconstructed anatomical paths and their relative positions (Figure 4C). The individual recording sites can be calculated and graphically represented (Figure 4D). The accuracy of the anatomical location of the individual recording sites is indicated by calculation of a confidence metric estimating the distance to the closest neighboring brain (sub)region within a 100-μm radius (see the online Wiki for details). Ultimately, users can integrate the location of the individual recording site in their analysis of neuronal activity signals (Figure 4E).
Reconstruction and visualization of injection sites, optical fibers, and axonal densities
The DMC-BrainMap can be efficiently used for characterizing the spread of tracers or viral vectors and for validation of optical fiber placement in, e.g., optogenetic or imaging experiments. To demonstrate this functionality, we targeted an adeno-associated virus (AAV) with pan-neuronal expression of an opsin fused to the fluorophore eYFP to orbital areas (ORB) of adult WT mice (n = 2) and implanted a CM-DiI-labeled optical fiber dorsal to the injection site (Figure 5A). Users can manually segment the anatomical territory holding viral expression using the polygon or polygon lasso objects11^,^24 from the shapes layer of napari. The proportion of segmented pixels across different brain regions can be calculated and visualized as pie charts and bar graphs (Figures 5B and 5C).Figure 5. Combined reconstruction of viral labeling and optical fiber tracts(A) To generate exemplifying data for characterizing the spread of viral vectors and validation of optical fiber placement, AAV1-hSyn-ChR2-eYFP (cyan) was targeted to the ORB of adult mice (n = 2). An optical fiber labeled with CM-DiI (pink) was subsequently implanted 0.2 mm dorsal to the injection site. Coronal brain sections (one hemisphere, anterior to posterior) from one of the mice (BM-003). Scale bars: 1 mm.(B) Quantification of the viral labeling (manually segmented) across brain regions in the two mice, visualized as pie charts.(C) The same data as in (B), visualized as a bar graph with breakdown of the viral labeling in the orbital subregions and all other brain regions (pooled as NA), respectively.(D) Schematic coronal brain sections (anterior to posterior) with reconstruction of the anatomical location of the optical fiber (red) and the viral labeling (blue) based on manual segmentation (mouse BM-003).(E) Same as (D) but with the data for both mice.(F) Left: same data as in (E), visualized on schematic horizontal brain sections (dorsal to ventral). Right: magnification of boxes on the left.(G) Top: same data as in (E), visualized on a schematic sagittal brain section. Bottom: magnification of box on the top.Included data: (D) and (E) ± 0.15 mm, (F) ± 0.25 mm, and (G) ± 0.5 mm to the respective brain section.AId, agranular insular area, dorsal part; AIv, agranular insular area, ventral part; AOBgl, accessory olfactory bulb, glomerular layer; FRP, frontal pole, cerebral cortex.
The segmentation of the optical fiber tract mirrors the process for Neuropixels probes (as mentioned earlier), and the reconstructed fiber tract can be visualized on schematized brain sections (Figure 5D). Again, different types of segmentation data can be visualized in combination, including data from multiple animals, and the data can be plotted on coronal, horizontal, or sagittal schematized brain sections, irrespective of how the brain slicing was oriented (Figures 5E–5G). The output data can be used for experimental evaluation and definition of inclusion/exclusion criteria.
While the anatomical location of neuronal cell bodies is a key parameter in many experiments, assessment of axonal tracts can also be of importance, and the DMC-BrainMap therefore encompasses the analysis of axonal densities and the visualization of single-neuron morphology data (Figures S2J and S2K). To highlight this functionality, we targeted an AAV with Cre-dependent expression of an opsin fused to the fluorophore mCherry to the ventral tegmental area (VTA) in an adult TH-Cre mouse (Figure 6A). The opsin ensures membrane-bound expression of mCherry, including in axons. As a first step, we characterized the viral targeting by segmenting the cell bodies expressing mCherry. As expected, the absolute majority of viral labeling was found in the VTA (Figure 6B). Segmentation of axonal densities using the DMC-BrainMap pipeline is done during the preprocessing step, by intensity threshold-based binarization of images, i.e., pixels containing labeled axon segments (high fluorescence: pixel value > threshold) are automatically identified as 1 and pixels without axons (low fluorescence: pixel value < threshold) as 0. This approach is simple and fast, but error-prone. It is also possible to perform the segmentation operation using external tools and software (e.g., D-LMBmap25 or TrailMap26 for volumetric data) and to subsequently integrate the obtained data into the DMC-BrainMap workflow. In both cases, the automated segmentation/binarization step is followed by manual curation of the data. The user loads the segmented axonal data and manually removes segmented artifacts. For data analysis and visualization, we used DMC-BrainMap to calculate 2D estimates of axonal densities along both the AP and ML axes of the brain, in our example of axons of TH-positive neurons specifically in the striatum (STR; Figure 6C). Axonal densities in brain (sub)regions can be quantified and plotted e.g., in bar graphs (Figure 6D), and detailed heatmaps can be generated to outline axonal densities along the AP axis with brain region specificity (Figure 6E). Alternatively, axonal densities can be visualized on schematized brain sections (coronal, horizontal, or sagittal orientation; Figures 6F–6H).Figure 6. Quantification of axonal densities(A) To generate exemplifying data for assessment of axonal densities, AAV-EF1a-DIO-ChR2-mCherry was unilaterally targeted to the VTA (pink) in an adult TH-Cre mouse (n = 1).(B) Segmented mCherry-positive neurons plotted on schematic coronal brain sections. One dot = one neuron. Inlets: quantification of labeled neurons across brain regions (left) and across the two hemispheres (relative to the injection site; right), plotted as bar graphs.(C) Axonal densities were segmented by threshold-based binarization of images and manually curated. 2D plot of the axonal density (Gaussian kernel) along the AP and ML axes of the STR. Purple cross: bregma; dashed blue line: midline.(D) Bar graph with quantification of axonal density in subregions of the STR, ipsilateral versus contralateral to the injection.(E) Heatmaps displaying the axonal density along the AP axis in subregions of the STR.(F–H) Axonal densities in the STR, plotted on schematic coronal (F; anterior to posterior), sagittal (G; medial to lateral), and horizontal (H; dorsal to ventral) brain sections.Included data: (B) ± 0.1 mm, (F) ± 0.15 mm, (G) ± 0.5 mm, and (H) ± 0.25 mm to the respective brain section.
Analysis and visualization of whole-brain ST data
Sequencing directly in sectioned tissue provides data on the spatial organization of gene expression.27^,^28 DMC-BrainMap accommodates analysis and visualization of ST data (as well as single-cell ST data; Figures S2H and S2I), and we here used a publicly available dataset (https://www.molecularatlas.org/)29 for proof-of-concept demonstration. The dataset holds adult WT mouse whole-brain ST data (75 coronal sections, one hemisphere). As a first step, we registered the dataset’s hematoxylin and eosin (H&E)-stained sections to the 10 μm Allen Mouse Brain Atlas (CCFv3)22 to map the anatomical location of each spot of the ST array (Figures 7A and 7B). The expression of single genes can be visualized on schematized brain sections in three different ways; here, we used the (normalized) expression of the Slc17a7 gene encoding the vesicular glutamate transporter (Vglut1) to exemplify this; the expression level in individual ST spots can be color-coded, or brain (sub)regions can be color-coded based on the average, normalized gene expression (Figures 7C and 7D). As an alternative, the pipeline can generate a Voronoi tessellation of the reference atlas to visualize expression levels on brain sections (Figure S8A).Figure 7. Analysis and visualization of whole-brain spatial transcriptomics dataFor demonstrating DMC-BrainMap’s functionality to analyze whole-brain ST data, a publicly available adult mouse dataset (75 coronal sections, one hemisphere, https://www.molecularatlas.org/)29 was registered to the Allen Mouse Brain Atlas (CCFv3).22(A) Schematic sagittal brain section with the AP location of six representative brain sections (6/75; red vertical lines) displayed in (B)–(D), (H), and (I).(B) Schematic coronal brain sections (one hemisphere; anterior to posterior) with spots color-coded according to the Allen Mouse Brain Atlas. One dot = one ST spot.(C) As (B), but spots color-coded according to Slc17a7 expression (normalized).(D) Schematic coronal brain sections (one hemisphere; anterior to posterior) with brain regions color-coded according to Slc17a7 expression (normalized).(E) Bar graph with quantification of Slc17a7 and Slc6a1 expression (normalized), respectively, in subregions of the PFC.(F) Heatmap displaying the laminar Slc17a7 expression (normalized) along the AP axis of the subregions of the PFC.(G) Left: horizontal brain section (one hemisphere) with heatmap displaying the Slc17a7 expression (normalized) along the AP and ML axes. Right: schematic horizontal brain section (one hemisphere).(H) As (B), but spots color-coded according to cluster identity.(I) As (D), but brain regions color-coded according to the dominant cluster (“winner-takes-all”). Included data: (B) and (C) ± 0.0 mm, and (D) and (I) ± 0.05 mm to the respective brain section.See also Figure S8.
Quantification of the (normalized) expression levels of a set of genes in selected brain regions is possible by using the bar graph functionality of the pipeline (Figure 7E). Likewise, users can use the heatmap functionality to visualize the (normalized) expression of a gene based on a combination of anatomical parameters, e.g., brain (sub)regions, layers, and an axis of the brain (Figure 7F). Density estimates of a gene’s expression along two axes of the reference atlas, plotted on schematized brain sections, provide an informative illustration of the data at the whole-brain level (Figure 7G).
Clustering of gene expression levels in ST spots is a common strategy to identify molecularly distinct subregions in the sequenced tissue.29 This type of data can also be visualized using the DMC-BrainMap pipeline. The ST spots can be color-coded by their cluster identity (Figure 7H), or brain (sub)regions can be color-coded by the majority of clusters present (“winner-takes-all”; Figure 7I). As for gene expression, a cluster identity-based Voronoi tessellation of the reference atlas is also possible (Figure S8B). As for any other anatomical feature, gene expression or clustering data can be visualized on coronal, horizontal, or sagittal schematized brain sections, irrespective of how the brain slicing was oriented (Figures S8C and S8D).
Discussion
Streamlining quantitative, whole-brain anatomical data analysis
We here introduce the DMC-BrainMap, a napari plugin for quantitative image analysis and visualization of whole-brain anatomical data across species. From the plethora of anatomical data analysis tools released in recent years (Table S1), three features set the DMC-BrainMap pipeline apart. First, while several tools provide excellent solutions to individual steps in anatomical data analysis,10^,^11^,^12^,^13^,^14^,^15^,^16^,^30 execution of the whole workflow generally demands integration of several tools. The DMC-BrainMap provides users with a “one software solution” covering all steps from image preprocessing to data visualization. Second, tools like the WholeBrain package13 and HERBS11 cover most steps in anatomical data analysis but are limited to analysis of tissue from mice (WholeBrain, HERBS) and rats (HERBS; both species)—the DMC-BrainMap pipeline, through its use of the BrainGlobe Atlas API,18 allows users to analyze data obtained across a range of model animals including mice, rats, and zebrafish at developmental and adult stages as well as Mexican cavefishes, lemurs, axolotls, and prairie voles. In addition, a range of mouse brain atlases are included in the BrainGlobe Atlas API. DMC-BrainMap provides increased flexibility and versatility also regarding the anatomical features to be segmented (cell bodies, probe/optical fiber tracts, injection sites, axonal densities, gene expression, etc.), which is not possible in existing solutions without extensive customization and programming.10 Third, the DMC-BrainMap pipeline is intuitive and easy to use and installed and run via a GUI, eliminating the requirement of programming skills. The DMC-BrainMap is completely written in Python, eliminating the need for software licenses while achieving cross-platform compatibility—the pipeline works for Windows, Mac, and Linux operating systems. All analyzed data are exported in a standardized and organized format, enabling users with programming skills to conduct further sophisticated analysis. Furthermore, data generated by DMC-BrainMap are readily formatted to be imported into brainrender workflows,6 enabling users to generate, e.g., visually appealing 3D renderings of their data (Figure S3E).
Limitations of the study
We intentionally developed the DMC-BrainMap to allow for manual curation of image registration and anatomical feature segmentation, giving users versatile control over the performed operations. However, manual operations are time-consuming compared to automated approaches. In recent years, approaches such as DeepSlice31 have significantly improved automatic image registration, with the potential to dramatically reduce the user’s time investment. Intended developments of the DMC-BrainMap pipeline include automated options for image registration and anatomical feature segmentation (e.g., axonal densities). In line with this, the DMC-BrainMap is fully open-source, enabling the pipeline to be a community-based tool open to iterative improvement and expansion by the scientific community.
Resource availability
Lead contact
Requests for further information and resources should be directed to and will be fulfilled by the lead contact, Marie Carlén ([email protected]).
Materials availability
This study did not generate new materials.
Data and code availability
- •All data were deposited on figshare and are publicly available (https://doi.org/10.6084/m9.figshare.28429478).
- •The DMC-BrainMap (RRID: SCR_027433) software is open-source and available online (https://doi.org/10.6084/m9.figshare.30906578 and https://github.com/hejDMC/napari-dmc-brainmap).
- •Any additional information required to reanalyze the data reported in this paper is available from the lead contact upon request.
Acknowledgments
This research was supported by a Wallenberg Scholar grant (2023.0353) and a project grant (2020.0125) from the 10.13039/501100004063Knut and Alice Wallenberg Foundation (https://kaw.wallenberg.org/en) and funding from the 10.13039/501100004359Swedish Research Council (www.vr.se, grant 2021-02662) and 10.13039/501100004047Karolinska Institutet (www.ki.se) to M.C.
Author contributions
Conceptualization, F.J.; investigation, F.J.; methodology, F.J. and X.C.; validation, F.J., X.C., and L.H.; formal analysis, F.J.; visualization, F.J. and M.C.; writing – original draft, F.J.; writing – review and editing, F.J., M.C., X.C., and L.H.; funding acquisition, M.C.; resources, M.C.; supervision, M.C.
Declaration of interests
The authors declare no competing interests.
STAR★Methods
Key resources table
REAGENT OR RESOURCESOURCEIDENTIFIERAntibodiesAnti-V5, ChickenabcamCat# ab9113, RRID: AB_307022Cy3-anti-chicken, DonkeyJackson ImmunoResearchCat# 703-165-155, RRID: AB_2340363Anti-PV, MouseSwantCat# 235, RRID: AB_10000343Cy5-anti-mouse, DonkeyJackson ImmunoResearchCat# 715-175-151, RRID: AB_2340820Bacterial and virus strainspENN.AAV5.hSyn.Cre.WPRE.hGHaddgeneCat# 105553-AAV5, RRID: Addgene_105553AAV5-EF1a-DIO-TVA-V5-RG-WRPE-hGHpAAddgene (plasmid)Cat# 119743, RRID: Addgene_119743EnvA-dG-eGFP-RVÄhrlund-Richter et al.21In house (1x10^10^*infection units per mL)*AAV1-hSyn-ChR2-eYFPaddgeneCat# 26973-AAV1, RRID: Addgene_26973AAV5-EF1a-DIO-ChR2-mCherryaddgeneCat# 20297-AAV5, RRID: Addgene_20297Deposited dataFluorescence microscopy data of mouse brain sections (manuscript)This paperFigshare: https://doi.org/10.6084/m9.figshare.28429478Fluorescence microscopy data of mouse brain sections (tutorial)This paperFigshare: https://doi.org/10.6084/m9.figshare.28944935Experimental models: Organisms/strainsMouse: C57BL/6JThe Jackson LaboratoryRRID: IMSR_JAX:000664Mouse: Tg(TH-Cre)12GsatGong et al.32MGI:3836640Software and algorithmsDMC-BrainMapThis paperRRID: SCR_027433https://github.com/hejDMC/napari-dmc-brainmapDMC-FluoImagerThis paperRRID: SCR_027435https://github.com/hejDMC/dmc-fluoimageraicsimageio 4.14.0Brown et al.33https://github.com/AllenCellModeling/aicsimageioaicspylibczi 3.1.2https://github.com/AllenCellModeling/aicspylibcziaicssegmentation 0.5.3Chen et al.20https://github.com/AllenCell/aics-segmentationbg_atlasapi 1.0.2Claudi et al.18https://github.com/brainglobe/brainglobe-atlasapidistinctipy 1.3.4Roberts et al.34https://github.com/alan-turing-institute/distinctipyImagecodecs 2024.1.1Gohlke35https://github.com/cgohlke/imagecodecsMagicgui 0.8.1https://github.com/pyapp-kit/magicguiMatplotlib 3.7.5/3.8.3Hunter36https://matplotlib.org/Mergedeep 1.3.4https://github.com/clarketm/mergedeepNapari 0.6.1napari contributors37https://napari.org/Natsort 8.4.0https://github.com/SethMMorton/natsortNumpy 1.26.4Harris et al.38https://numpy.org/Opencv-python 4.9.0.80https://github.com/opencv/opencv-pythonPandas 2.0.1/2.0.3McKinney39https://pandas.pydata.org/Python 3.8/3.10Van Rossum and Drake40RRID: SCR_008394Qtpy 2.4.1https://github.com/spyder-ide/qtpyScikit-image 0.22.0van der Walt et al.41https://scikit-image.org/Scikit-learn 1.4.1.post1Pedregosa et al.42https://scikit-learn.orgScikit-spatial 7.2.0https://scikit-spatial.readthedocs.ioScipy 1.10.1Virtanen et al.43https://scipy.org/Seaborn 0.12.2/0.13.2Waskom44https://seaborn.pydata.org/Shapely 2.0.1https://github.com/shapely/shapelyTifffile 2023.2.28Gohlke45https://github.com/cgohlke/tifffile
Experimental model and study participant details
All procedures and experiments on mice (sex: 6 male/7 female; age: 11–34 weeks) were performed according to the guidelines of the Stockholm Municipal Committee for animal experiments and the Karolinska Institutet in Sweden (approval number 7362-2019). See Table S2 for a complete list of mice and details. Animals were housed in groups with up to four animals per cage, in a temperature (23°C) and humidity (55%) controlled environment in standard cages on a 12:12 h light/dark cycle with ad libitum access to food and water.
Method details
Surgical procedures
General surgical procedures
The animals were deeply anesthetized with isoflurane in oxygen (4% for induction, 1–2% for maintenance), fixed in a stereotaxic frame (Harvard Apparatus), and buprenorphine (0.1 mg/kg s.c.) was thereafter injected. Lidocaine (4 mg/kg s.c.) was injected locally before skin incision. An ocular ointment (Bepanthen) was applied over the eyes, and the body temperature was maintained at 37°C using a heating pad. After surgery (details below), animals were injected with carprofen (5 mg/kg s.c.) and returned to their homecage. An additional dose of carprofen was delivered 18–24 h after surgery.
Intracerebral virus injections
For virus injections, an incision into the skin overlying the skull was made and the skin was carefully moved aside. A small craniotomy (0.5 mm diameter) was drilled over the target coordinates (AP relative to bregma, DV relative to dura, ML relative to midline; Table S2). The virus was delivered by a glass capillary attached to a motorized Quintessential Stereotaxic Injector (Stoelting) at a rate of 30–50 nL/min. The capillary was held in place for 5 min before and 10 min after the injection. The incision was closed with stitches (Ethicon). For retrograde tracing, pseudotyped rabies virus (RV) was injected 4 weeks after the first surgery at the same coordinates as the helper AAV injection. General surgical procedures and post-operative care were followed.
Optical fiber implant surgery
For optical fiber implant surgeries, the skin overlying the skull was removed and the bone was gently cleaned*.* Custom-build optical fibers (Thorlabs) were labeled with CM-DiI (V22888, Thermo Fisher) and implanted immediately after intracerebral virus injection. Optical fibers were slowly lowered into the existing craniotomy and secured 0.2 mm dorsal to the viral injection site using UV-curable dental cement (Pluline). General surgical procedures and post-operative care were followed.
Head-post implant surgery and habituation
For head-post implant surgeries, the skin overlying the skull was removed and the bone was gently cleaned. A thin layer of super glue (Loctite) was applied to the skull and a lightweight metal head-post was fixed with super glue and UV-curable dental cement (Pluline). For Neuropixels recordings, a chamber (4 mm diameter) was made using UV-curable dental cement centered around the coordinates for probe insertion. General surgical procedures and post-operative care were followed. Following 7 days of surgery recovery, the mouse was handled and progressively habituated to the head-fixation procedure over 3 days by increasing the head-fixation time from 15 min to 1 h.
Neuropixels recordings
For acute recordings, two small craniotomies (<0.5 mm diameter) were opened >3 h before the experiments. One craniotomy was made above the targeted probe insertion site, and one craniotomy was made postero-lateral of bregma and used for reference electrode placement. General surgical procedures and post-operative care were followed. The open craniotomies were covered with Silicone sealant (Kwik-Cast, WPI), and the mouse was returned to its home cage for recovery. For the recordings, the mouse was head-fixed and the DiO-labeled (V22886, Thermo Fisher) Neuropixels probe was gradually lowered (∼20 μm s−1) into the brain until reaching the target coordinates using a micromanipulator (uMp-4, Sensapex). The electrode reference was connected to a silver wire positioned over the pia in the second craniotomy, using a separate micromanipulator. The Neuropixels probe was allowed to sit in the brain for 20–30 min before the recordings started. The spike band data were digitized with a sampling frequency of 30 kHz with gain 500, transferred to the data acquisition system (a PXIe acquisition module PXI-Express chassis: PXIe-1071 and MXI-Express interface: PCIe-8381 and PXIe-8381; National Instruments) and written to disk using SpikeGLX (Bill Karsh, Janelia). The spike band data were filtered between 0.3 and 10 kHz and amplified (see also Calvigioni, Fuzik, Le Merre et al.46 and Le Merre and Heining et al;47).
Tissue collection and processing
General procedure
For perfusions, the animals were deeply anesthetized with pentobarbital and transcardially perfused with 0.1 M phosphate buffered saline (PBS) followed by 4% formaldehyde (FA, VWR) in 0.1 M PBS. The perfused brain was removed from the skull and postfixed in 4% FA in 0.1 M PBS at 4°C for 16 h. The brains were thoroughly washed in 0.1 M PBS and thereafter sectioned (50–100 μm thickness) using a vibratome (Leica VT1000, Leica Microsystems) and mounted on glass slides (Superfrost Plus, Thermo Scientific).
Immunofluorescence staining
The mounted brain sections were permeabilized with TBST (0.3% Triton X-100 in Tris-buffered saline (42 mM Trizma hydrochloride (Sigma-Aldrich), 8 mM Trizma base (Sigma-Aldrich), 120 mM NaCl (Merck) in demineralized H2O; TBS) for 1 h, blocked with 10% normal donkey serum in TBST for 1 h, and thereafter incubated with primary antibodies (1:500) in TBST at room temperature for 12–24 h. The sections were thereafter washed three times in TBST and incubated with a species-specific fluorophore-conjugated secondary antibody (1:500) in TBST for 4 h. The sections were thereafter consecutively washed with TBST, TBS, and 0.1 M PBS (10 min each) and stained with 4′,6-Diamidine-2′-phenylindole dihydrochloride (DAPI; Sigma-Aldrich, #10236276001). All sections were coverslipped (Thermo Scientific) using Mowiol 4–88 (Sigma-Aldrich, #81381).
Fluorescence microscopy
Tiled images were semi-automatically acquired at magnification ×10 (0.64 μm/pixel) using a Leica DM6000B fluorescent microscope with a Hamamatsu Orca-FLASH 4.0 C11440 digital camera at 16-bit depth resolution using the DMC-FluoImager script (https://github.com/hejDMC/dmc-fluoimager).
Rat and zebrafish data
Two public datasets were used for analysis of rat and larval zebrafish data, respectively. The rat dataset (https://doi.org/10.25493/8KCQ-3C7)48 contains horizontal brain sections stained for parvalbumin (PV; only data from animal PVRat_25203 was used). Only the red channel of the respective RGB image was used. The larval zebrafish dataset (https://doi.org/10.5281/zenodo.14146655)49 contains horizontally imaged larval zebrafish brains expressing GCaMP6s with concurrent molecular profiling of imaged neurons using mutliplexed hybridization chain reaction (HCR). Only data from fish2 imaged on 2021/02/25 was used. To allow for mapping of neuronal molecular identity, cell coordinates from suite2p analysis included in the dataset were used and mapped to the reference atlas using SHARPy-track registration data. For analysis, only cells in the optic tectum (OT) were included. For visualization of single cell morphologies, mapped .swc data from the public dataset was used.
Quantification and statistical analysis
DMC-BrainMap was used for all data analysis and visualization, except for electrophysiological traces shown in Figure 4E and TRE scores shown in Figures S1C, S2C, S3B, S3C, S4B and S4C. TRE scores were visualized using in Python (3.8) using the following packages: pandas (2.0.3), matplotlib (3.7.5) and seaborn (0.13.2). For statistical evaluation of registration accuracy between brain slicing orientations (Figures S3B and S4B), normality distribution of data was tested using the Shapiro–Wilk test and equality of variances tested using Levene’s test. Subsequently, Kruskal-Wallis test was performed. All statistics were computed using scipy.stats (1.10.1). Figures were assembled in Inkscape and Adobe Illustrator. The DMC-BrainMap pipeline is entirely written in Python (3.10) using the following packages: aicsimageio (4.14.0), aicspylibczi (3.1.2), aicssegmentation (0.5.3), bg_atlasapi (1.0.2), distinctipy (1.3.4), imagecodecs (2024.1.1), magicgui (0.8.1), matplotlib (3.8.3), mergedeep (1.3.4), natsort (8.4.0), numpy (1.26.4), opencv-python (4.9.0.80), pandas (2.0.1), qtpy (2.4.1), scikit-image (0.22.0), scikit-learn (1.4.1.post1), scikit-spatial (7.2.0), seaborn (0.12.2), shapely (2.0.1), tifffile (2023.2.28). The software was tested on Windows, Mac (both Intel and Apple Silicon), and Linux operating systems. In general, no limits pertaining to image resolution, file size, or numbers of brain sections exist other than that the size of a single image should not exceed half the random-access memory (RAM) of the computer*.* Currently, DMC-BrainMap processes are entirely CPU bound, and stitching, padding, and preprocessing operations are using parallel processing.
Additional resources
The software is open-source, and available online (https://github.com/hejDMC/napari-dmc-brainmap). Detailed installation guides, documentation and a tutorial are provided online. All data used in this study (https://doi.org/10.6084/m9.figshare.28429478) as well as for the tutorial (https://doi.org/10.6084/m9.figshare.28944935) was deposited on figshare.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1Bassett D.S.Sporns O.Network neuroscience Nat. Neurosci.2020173533642823084410.1038/nn.4502 PMC 5485642 · doi ↗ · pubmed ↗
- 2Luo L.Callaway E.M.Svoboda K.Genetic Dissection of Neural Circuits: A Decade of Progress Neuron 9820182562812967347910.1016/j.neuron.2018.03.040PMC 5912347 · doi ↗ · pubmed ↗
- 3Sporns O.The complex brain: connectivity, dynamics, information Trends Cognit. Sci.262022106610673620726010.1016/j.tics.2022.08.002 · doi ↗ · pubmed ↗
- 4Tyson A.L.Rousseau C.V.Niedworok C.J.Keshavarzi S.Tsitoura C.Cossell L.Strom M.Margrie T.W.A deep learning algorithm for 3D cell detection in whole mouse brain image datasets P Lo S Comput. Biol.172021 e 100907410.1371/journal.pcbi.1009074 PMC 819199834048426 · doi ↗ · pubmed ↗
- 5Tyson A.L.Vélez-Fort M.Rousseau C.V.Cossell L.Tsitoura C.Lenzi S.C.Obenhaus H.A.Claudi F.Branco T.Margrie T.W.Accurate determination of marker location within whole-brain microscopy images Sci. Rep.1220228673504288210.1038/s 41598-021-04676-9PMC 8766598 · doi ↗ · pubmed ↗
- 6Claudi F.Tyson A.L.Petrucco L.Margrie T.W.Portugues R.Branco T.Visualizing anatomically registered data with brainrendere Life 102021 e 6575110.7554/e Life.65751 PMC 807914333739286 · doi ↗ · pubmed ↗
- 7Renier N.Adams E.L.Kirst C.Wu Z.Azevedo R.Kohl J.Autry A.E.Kadiri L.Umadevi Venkataraju K.Zhou Y.Mapping of Brain Activity by Automated Volume Analysis of Immediate Early Genes Cell 1652016178918022723802110.1016/j.cell.2016.05.007PMC 4912438 · doi ↗ · pubmed ↗
- 8Jin M.Nguyen J.D.Weber S.J.Mejias-Aponte C.A.Madangopal R.Golden S.A.SMART: An Open-Source Extension of Whole Brain for Intact Mouse Brain Registration and Segmentatione Neuro 92022 ENEURO.ENEURO.0482-21.2022.202210.1523/ENEURO.0482-21.2022 PMC 907073035396258 · doi ↗ · pubmed ↗
