ANTsXMouseBrainMapping
The ANTsX Ecosystem for Mapping the Mouse Brain
Install / Use
/learn @ntustison/ANTsXMouseBrainMappingREADME
The ANTsX ecosystem for mapping the mouse brain
Two novel open-source contributions:
- Structural mouse brain morphology from T2-w imaging
- A general landmark-based velocity flow transformation model applied to DevCCF
Mouse brain extraction and structural labeling
<p align="middle"> <img src="https://github.com/ntustison/DevCCF-Velocity-Flow/blob/main/Manuscript/Figures/mousePipeline.png" width="700" /> </p>Description
To develop a structural morphological processing pipeline for the mouse brain
analogous to our human-based tools.
This repository includes reproducible code and resources for training and
applying mouse brain structural segmentation models using ANTsXNet. These
murine pipelines consist of (1) a brain extraction network
trained on high-resolution T2-weighted mouse MRI templates from public datasets,
and (2) a regional labeling model. Both networks follow a
standardized U-net architecture with aggressive data augmentation to support
generalization across varying acquisition protocols and resolutions. They have
been independently applied and refined by community users across multiple
imaging contexts, including serial two-photon tomography and alternate labeling
schemes. All models are available via ANTsPyNet and ANTsRNet. This work
also provides a more general framework for template-based, data
augmentation training for both isotropic and anisotropic mouse data.
Implementation details and self-contained examples
<details> <summary>Brain extraction</summary>Mouse brain extraction
ANTsPyNet example
>>> import ants
>>> import antspynet
>>>
>>> mouse_t2_file = tf.keras.utils.get_file(fname="mouse.nii.gz",
origin="https://figshare.com/ndownloader/files/45289309", force_download=True)
>>> mouse_t2 = ants.image_read(mouse_t2_file)
>>> mouse_t2_n4 = ants.n4_bias_field_correction(mouse_t2,
rescale_intensities=True,
shrink_factor=2,
convergence={'iters': [50, 50, 50, 50], 'tol': 0.0},
spline_param=20, verbose=True)
>>> mask = antspynet.mouse_brain_extraction(mouse_t2_n4, modality='t2', verbose=True)
ANTsRNet example
> library( ANTsR )
> library( ANTsRNet )
>
> mouseT2File <- tensorflow::tf$keras$utils$get_file( fname="mouse.nii.gz",
origin = "https://figshare.com/ndownloader/files/45289309", force_download = TRUE )
> mouseT2 <- antsImageRead( mouseT2File )
> mouseT2N4 <- n4BiasFieldCorrection( mouseT2,
rescaleIntensities = TRUE,
shrinkFactor = 2,
convergence = list( iters = c( 50, 50, 50, 50 ), tol = 0.0 ),
splineParam = 20, verbose = TRUE )
>>> mask <- mouseBrainExtraction( mouseT2N4, modality = 't2', verbose = TRUE )
Additional notes concerning training and evaluation data and training augmentation
-
Build two symmetric isotropic ANTsX templates from two publicly available datasets with different "defacing" aesthetics:
- CAMRI
- resolution = 0.16 x 0.16 x 0.16 $mm^3$
- $n = 16$
- Template and brain mask
- High resolution
- Three spatially aligned high-resolution orthogonal views
- resolution = 0.08 x 0.08 $mm^2$ in-plane, 0.5 mm slice thickness
- $n = 88$
- Combine three views using B-spline filter
- Template and brain mask
- CAMRI
-
Data augmentation of CAMRI and high resolution B-spline template:
- bias field simulation,
- histogram warping,
- added noise,
- random translation and warping, and
- random anisotropic resampling in the three canonical directions.
-
- Completely unseen data
- 12 specimens
- 7 time points (Day 0, Day 3, Week 1, Week 4, Week 8, Week 20)
- Whole brain masks are provided
Mouse brain structural labeling
ANTsPyNet example
>>> import ants
>>> import antspynet
>>>
>>> mouse_t2_file = tf.keras.utils.get_file(fname="mouse.nii.gz",
origin="https://figshare.com/ndownloader/files/45289309", force_download=True)
>>> mouse_t2 = ants.image_read(mouse_t2_file)
>>> mouse_t2_n4 = ants.n4_bias_field_correction(mouse_t2,
rescale_intensities=True,
shrink_factor=2,
convergence={'iters': [50, 50, 50, 50], 'tol': 0.0},
spline_param=20, verbose=True)
>>> parc_nick = antspynet.mouse_brain_parcellation(mouse_t2_n4,
mask=None,
which_parcellation="nick",
return_isotropic_output=True,
verbose=True)
>>> parc_tct = antspynet.mouse_brain_parcellation(mouse_t2_n4,
mask=None,
which_parcellation="tct",
return_isotropic_output=True,
verbose=True)
ANTsRNet example
> library( ANTsR )
> library( ANTsRNet )
>
> mouseT2File <- tensorflow::tf$keras$utils$get_file( fname="mouse.nii.gz",
origin = "https://figshare.com/ndownloader/files/45289309", force_download = TRUE )
> mouseT2 <- antsImageRead( mouseT2File )
> mouseT2N4 <- n4BiasFieldCorrection( mouseT2,
rescaleIntensities = TRUE,
shrinkFactor = 2,
convergence = list( iters = c( 50, 50, 50, 50 ), tol = 0.0 ),
splineParam = 20, verbose = TRUE )
> parcNick <- mouseBrainParcellation( mouseT2N4,
mask = NULL,
whichParcellation = 'nick',
returnIsotropicOutput = TRUE,
verbose = TRUE )
> parcTct <- mouseBrainParcellation( mouseT2N4,
mask = NULL,
whichParcellation = 'tct',
returnIsotropicOutput = TRUE,
verbose = TRUE )
Mouse cortical thickness
ANTsPyNet example
>>> import ants
>>> import antspynet
>>>
>>> mouse_t2_file = tf.keras.utils.get_file(fname="mouse.nii.gz",
origin="https://figshare.com/ndownloader/files/45289309", force_download=True)
>>> mouse_t2 = ants.image_read(mouse_t2_file)
>>> mouse_t2_n4 = ants.n4_bias_field_correction(mouse_t2,
rescale_intensities=True,
shrink_factor=2,
convergence={'iters': [50, 50, 50, 50], 'tol': 0.0},
spline_param=20, verbose=True)
>>> kk = antspynet.mouse_cortical_thickness(mouse_t2_n4,
mask=None,
return_isotropic_output=True,
