Skip to content

Generating cortical thickness maps for population level statistics

Gabriel A. Devenyi edited this page Jul 21, 2016 · 3 revisions

While minclaplace will calculate cortical thickness on any properly labelled mouse brain, the default the cortical thickness maps will be generated on a grid of points which are unique to each individual brain. This makes direct comparisons for statistical purposes difficult.

In order to produce useful cortical thickness measures, all subjects must have their cortex measured at the same points to allow 1:1 correspondence.

This entry will describe one possible method to achieve consistent cortical thickness measures across a population for later statistical analysis.

Generally, the steps are:

  1. Locate (or generate) an atlas with labels consistent with https://github.com/Mouse-Imaging-Centre/minclaplace/wiki/LaplaceGrid
  2. Generate a cortical surface from that atlas using minclapalce
  3. Cleanup, smooth and possibly subsample that surface using AMIRA or meshlab
  4. Use pydpiper's MAGeT toolchain to generate a consensus label set for each subject
  5. Use the MAGeT transforms to generate a consensus cortical surface from the surface generated in 3
  6. Generate the grid files using minclaplace for each subject as per https://github.com/Mouse-Imaging-Centre/minclaplace/wiki/LaplaceGrid
  7. Calculate cortical thickness at each vertex on the subject-specific surface using minclapalace

Script for step 5:

#!/bin/bash
for subject in $(find . -maxdepth 1 -mindepth 1 -type d | grep -v input_atlases)
do
    mkdir -p $subject/objects/transforms
    echo $subject
    #Transform candidate objects into subject space
    for transform in $subject/transforms/*base_7.xfm
    do
        templatename=$(echo $(basename $transform) | sed "s/$(basename $subject)//g" | cut -c5- | sed 's/_base_7.xfm//g')
        if [[ "$templatename" != "$(ls input_atlases)" ]]
        then
            if [[ ! -f "$subject/objects/transforms/${templatename}_inv.xfm" ]]
            then
            xfmconcat -clobber $transform $templatename/transforms/*$(ls input_atlases)_base_7.xfm $subject/objects/transforms/${templatename}.xfm
            xfminvert -clobber $subject/objects/transforms/${templatename}.xfm $subject/objects/transforms/${templatename}_inv.xfm
            fi
            transform_objects $1 $subject/objects/transforms/${templatename}_inv.xfm $subject/objects/$(basename $1 .obj)-$(basename $templatename).obj
        else
            if [[ ! -f $subject/objects/transforms/$(basename $transform .xfm)_inv.xfm ]]
            then
            xfminvert -clobber $transform $subject/objects/transforms/$(basename $transform .xfm)_inv.xfm
            fi
            transform_objects $1 $subject/objects/transforms/$(basename $transform .xfm)_inv.xfm $subject/objects/$(basename $1 .obj)-$(basename $transform .xfm).obj
        fi
    done
    #Tool from magetbrain's morpho toolchain
    #Make a median surface from all the candidates
    if [[ ! -f $subject/objects/$(basename $1) ]]
    then
        morpho_make_median_surfaces_new.pl $subject/objects/$(basename $1)  $subject/objects/$(basename $1 .obj)-*.obj
    fi
    #Custom hack from mallar, source at /project/m/mchakrav/quarantine/minc-toolkit-extras/1.0/src/
    if [[ ! -f $subject/objects/$(basename $1 .obj)_recon.obj ]]
    then
        recompute_normals $subject/objects/$(basename $1) $subject/objects/$(basename $1 .obj)_recon.obj
    fi
    #From CIVET/1.1.12
    /project/m/mchakrav/quarantine/CIVET/1.1.12/build/Linux-x86_64/bin/depth_potential -area_voronoi $subject/objects/$(basename $1 .obj)_recon.obj $subject/objects/$(basename $1 .obj)_recon.txt
    vertstats_math -old_style_file -div $subject/objects/$(basename $1 .obj)_recon.txt $(dirname $1)/$(basename $1 .obj).txt $subject/objects/$(basename $1 .obj)_recon-SA.txt
    /project/m/mchakrav/quarantine/CIVET/1.1.12/build/Linux-x86_64/bin/depth_potential -smooth 0.5 $subject/objects/$(basename $1 .obj)_recon-SA.txt $1 $subject/objects/$(basename $1 .obj)_recon-SA-0.5mm_blur.txt
done
Clone this wiki locally