Regulation of autism-related self-injurious behavior by electrical stimulation of corticostriatal circuits in mice and humans.
The 2 matches
- [1] § MATERIALS AND METHODS › Statistical analyses › Deformation-based morphometry ↔ dbm.sh, lines 394–449 · score 0.62 · deformation field, Jacobian determinants, geometric, mask, DBM
- [2] § MATERIALS AND METHODS › Statistical analyses › Deformation-based morphometry ↔ twolevel_dbm.py, lines 742–810 · score 0.53 · Jacobian determinants, mni, deformation, morphometry, DBM, field
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Shell · 592 lines · 26 KB · other · 1 match
- #!/usr/bin/env bash
- # ARG_HELP([DBM post-processing for modelbuild.sh from optimized_antsMultivariateTemplateConstruction])
- # ARG_OPTIONAL_SINGLE([output-dir],[],[Output directory for modelbuild],[output])
- # ARG_OPTIONAL_BOOLEAN([float],[],[Use float instead of double for calculations (reduce memory requirements, reduce precision)],[])
- # ARG_OPTIONAL_SINGLE([mask],[],[Mask file for average to improve delin estimates],[])
- # ARG_OPTIONAL_SINGLE([target-space],[],[Target space for DBM outputs, requires --final-target be used with modelbuild.sh],[unbiased])
- # ARG_TYPE_GROUP_SET([spacegroup],[SPACE],[target-space],[unbiased,final-target])
- # ARG_OPTIONAL_SINGLE([delin-affine-ratio],[],[Ratio of voxels within mask used to estimate delin affine],[0.25])
- # ARG_OPTIONAL_BOOLEAN([use-geometric],[],[Use geometric estimate of Jacobian instead of finite-difference],[on])
- # ARG_OPTIONAL_SINGLE([jacobian-smooth],[],[Comma separated list of smoothing gaussian FWHM, append "vox" for voxels, "mm" for millimeters],[4vox])
- # ARG_OPTIONAL_SINGLE([walltime],[],[Walltime for short running stages (averaging, resampling)],[00:15:00])
- # ARG_OPTIONAL_BOOLEAN([block],[],[For qbatch SGE, PBS and SLURM, blocks execution until jobs are finished.],[])
- # ARG_OPTIONAL_BOOLEAN([debug],[],[Debug mode, print all commands to stdout],[])
- # ARG_OPTIONAL_BOOLEAN([dry-run],[],[Dry run, don't run any commands, implies debug],[])
- # ARG_OPTIONAL_SINGLE([jobname-prefix],[],[Prefix to add to front of job names, used by twolevel wrapper],[])
- # ARG_POSITIONAL_INF([inputs],[Input text files, one line per input, one file per spectra],[1])
- # ARGBASH_SET_INDENT([ ])
- # ARGBASH_GO()
- # needed because of Argbash --> m4_ignore([
- ### START OF CODE GENERATED BY Argbash v2.10.0 one line above ###
- # Argbash is a bash code generator used to get arguments parsing right.
- # Argbash is FREE SOFTWARE, see https://argbash.dev for more info
- die()
- {
- local _ret="${2:-1}"
- test "${_PRINT_HELP:-no}" = yes && print_help >&2
- echo "$1" >&2
- exit "${_ret}"
- }
- # validators
- spacegroup()
- {
- local _allowed=("unbiased" "final-target") _seeking="$1"
- for element in "${_allowed[@]}"
- do
- test "$element" = "$_seeking" && echo "$element" && return 0
- done
- die "Value '$_seeking' (of argument '$2') doesn't match the list of allowed values: 'unbiased' and 'final-target'" 4
- }
- begins_with_short_option()
- {
- local first_option all_short_options='h'
- first_option="${1:0:1}"
- test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0
- }
- # THE DEFAULTS INITIALIZATION - POSITIONALS
- _positionals=()
- _arg_inputs=('' )
- # THE DEFAULTS INITIALIZATION - OPTIONALS
- _arg_output_dir="output"
- _arg_float="off"
- _arg_mask=
- _arg_target_space="unbiased"
- _arg_delin_affine_ratio="0.25"
- _arg_use_geometric="on"
- _arg_jacobian_smooth="4vox"
- _arg_walltime="00:15:00"
- _arg_block="off"
- _arg_debug="off"
- _arg_dry_run="off"
- _arg_jobname_prefix=
- print_help()
- {
- printf '%s\n' "DBM post-processing for modelbuild.sh from optimized_antsMultivariateTemplateConstruction"
- printf 'Usage: %s [-h|--help] [--output-dir <arg>] [--(no-)float] [--mask <arg>] [--target-space <SPACE>] [--delin-affine-ratio <arg>] [--(no-)use-geometric] [--jacobian-smooth <arg>] [--walltime <arg>] [--(no-)block] [--(no-)debug] [--(no-)dry-run] [--jobname-prefix <arg>] <inputs-1> [<inputs-2>] ... [<inputs-n>] ...\n' "$0"
- printf '\t%s\n' "<inputs>: Input text files, one line per input, one file per spectra"
- printf '\t%s\n' "-h, --help: Prints help"
- printf '\t%s\n' "--output-dir: Output directory for modelbuild (default: 'output')"
- printf '\t%s\n' "--float, --no-float: Use float instead of double for calculations (reduce memory requirements, reduce precision) (off by default)"
- printf '\t%s\n' "--mask: Mask file for average to improve delin estimates (no default)"
- printf '\t%s\n' "--target-space: Target space for DBM outputs, requires --final-target be used with modelbuild.sh. Can be one of: 'unbiased' and 'final-target' (default: 'unbiased')"
- printf '\t%s\n' "--delin-affine-ratio: Ratio of voxels within mask used to estimate delin affine (default: '0.25')"
- printf '\t%s\n' "--use-geometric, --no-use-geometric: Use geometric estimate of Jacobian instead of finite-difference (on by default)"
- printf '\t%s\n' "--jacobian-smooth: Comma separated list of smoothing gaussian FWHM, append \"vox\" for voxels, \"mm\" for millimeters (default: '4vox')"
- printf '\t%s\n' "--walltime: Walltime for short running stages (averaging, resampling) (default: '00:15:00')"
- printf '\t%s\n' "--block, --no-block: For qbatch SGE, PBS and SLURM, blocks execution until jobs are finished. (off by default)"
- printf '\t%s\n' "--debug, --no-debug: Debug mode, print all commands to stdout (off by default)"
- printf '\t%s\n' "--dry-run, --no-dry-run: Dry run, don't run any commands, implies debug (off by default)"
- printf '\t%s\n' "--jobname-prefix: Prefix to add to front of job names, used by twolevel wrapper (no default)"
- }
- parse_commandline()
- {
- _positionals_count=0
- while test $# -gt 0
- do
- _key="$1"
- case "$_key" in
- -h|--help)
- print_help
- exit 0
- ;;
- -h*)
- print_help
- exit 0
- ;;
- --output-dir)
- test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
- _arg_output_dir="$2"
- shift
- ;;
- --output-dir=*)
- _arg_output_dir="${_key##--output-dir=}"
- ;;
- --no-float|--float)
- _arg_float="on"
- test "${1:0:5}" = "--no-" && _arg_float="off"
- ;;
- --mask)
- test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
- _arg_mask="$2"
- shift
- ;;
- --mask=*)
- _arg_mask="${_key##--mask=}"
- ;;
- --target-space)
- test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
- _arg_target_space="$(spacegroup "$2" "target-space")" || exit 1
- shift
- ;;
- --target-space=*)
- _arg_target_space="$(spacegroup "${_key##--target-space=}" "target-space")" || exit 1
- ;;
- --delin-affine-ratio)
- test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
- _arg_delin_affine_ratio="$2"
- shift
- ;;
- --delin-affine-ratio=*)
- _arg_delin_affine_ratio="${_key##--delin-affine-ratio=}"
- ;;
- --no-use-geometric|--use-geometric)
- _arg_use_geometric="on"
- test "${1:0:5}" = "--no-" && _arg_use_geometric="off"
- ;;
- --jacobian-smooth)
- test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
- _arg_jacobian_smooth="$2"
- shift
- ;;
- --jacobian-smooth=*)
- _arg_jacobian_smooth="${_key##--jacobian-smooth=}"
- ;;
- --walltime)
- test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
- _arg_walltime="$2"
- shift
- ;;
- --walltime=*)
- _arg_walltime="${_key##--walltime=}"
- ;;
- --no-block|--block)
- _arg_block="on"
- test "${1:0:5}" = "--no-" && _arg_block="off"
- ;;
- --no-debug|--debug)
- _arg_debug="on"
- test "${1:0:5}" = "--no-" && _arg_debug="off"
- ;;
- --no-dry-run|--dry-run)
- _arg_dry_run="on"
- test "${1:0:5}" = "--no-" && _arg_dry_run="off"
- ;;
- --jobname-prefix)
- test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
- _arg_jobname_prefix="$2"
- shift
- ;;
- --jobname-prefix=*)
- _arg_jobname_prefix="${_key##--jobname-prefix=}"
- ;;
- *)
- _last_positional="$1"
- _positionals+=("$_last_positional")
- _positionals_count=$((_positionals_count + 1))
- ;;
- esac
- shift
- done
- }
- handle_passed_args_count()
- {
- local _required_args_string="'inputs'"
- test "${_positionals_count}" -ge 1 || _PRINT_HELP=yes die "FATAL ERROR: Not enough positional arguments - we require at least 1 (namely: $_required_args_string), but got only ${_positionals_count}." 1
- }
- assign_positional_args()
- {
- local _positional_name _shift_for=$1
- _positional_names="_arg_inputs "
- _our_args=$((${#_positionals[@]} - 1))
- for ((ii = 0; ii < _our_args; ii++))
- do
- _positional_names="$_positional_names _arg_inputs[$((ii + 1))]"
- done
- shift "$_shift_for"
- for _positional_name in ${_positional_names}
- do
- test $# -gt 0 || break
- eval "$_positional_name=\${1}" || die "Error during argument parsing, possibly an Argbash bug." 1
- shift
- done
- }
- parse_commandline "$@"
- handle_passed_args_count
- assign_positional_args 1 "${_positionals[@]}"
- # OTHER STUFF GENERATED BY Argbash
- # Validation of values
- ### END OF CODE GENERATED BY Argbash (sortof) ### ])
- # [ <-- needed because of Argbash
- set -uo pipefail
- set -eE -o functrace
- # Load up helper scripts and define helper variables
- # shellcheck source=helpers.sh
- source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/helpers.sh"
- # Set magic variables for current file, directory, os, etc.
- __file="${__dir}/$(basename "${BASH_SOURCE[${__b3bp_tmp_source_idx:-0}]}")"
- __base="$(basename "${__file}" .sh)"
- # shellcheck disable=SC2034,SC2015
- __invocation="$(printf %q "${__file}")$( (($#)) && printf ' %q' "$@" || true)"
- # Preflight check for required programs
- preflight_check
- # Setup a directory which contains all commands run
- # for this invocation
- mkdir -p ${_arg_output_dir}/dbm/jobs/${__datetime}
- mkdir -p ${_arg_output_dir}/dbm/logs/${__datetime}
- export QBATCH_SCRIPT_FOLDER="${_arg_output_dir}/dbm/qbatch/${__datetime}"
- # Store the full command line for each run
- echo ${__invocation} >${_arg_output_dir}/dbm/jobs/${__datetime}/invocation
- info "Checking input files"
- # Load input file into array
- if [[ ! -s ${_arg_inputs[0]} ]]; then
- failure "Input file ${_arg_inputs[0]} is non-existent or zero size"
- else
- mapfile -t _arg_inputs <${_arg_inputs[0]}
- fi
- for file in "${_arg_inputs[@]}"; do
- if [[ ! -s ${file} ]]; then
- failure "Input file ${file} is non-existent or zero size"
- fi
- done
- # Enable float mode for ants commands
- if [[ ${_arg_float} == "on" ]]; then
- _arg_float="--float"
- else
- _arg_float=""
- fi
- # Enable block for qbatch job submission
- if [[ ${_arg_block} == "on" ]]; then
- _arg_block="--block"
- else
- _arg_block=""
- fi
- # Convert smoothing jacobians to a list
- IFS=',' read -r -a _arg_jacobian_smooth <<<${_arg_jacobian_smooth}
- # Preflight check for required programs
- preflight_check
- # Make output directories
- mkdir -p ${_arg_output_dir}/dbm/intermediate/delin/{affine,warp,jacobian}
- mkdir -p ${_arg_output_dir}/dbm/intermediate/nlin/jacobian
- mkdir -p ${_arg_output_dir}/dbm/intermediate/affine/{warp,jacobian}
- mkdir -p ${_arg_output_dir}/dbm/jacobian/{final-target,}/{relative,full}//smooth
- # Convert geometric option to ANTs option
- if [[ ${_arg_use_geometric} == "on" ]]; then
- _arg_use_geometric=1
- else
- _arg_use_geometric=0
- fi
- _arg_log_jacobian=1
- # Generate jacobian from nlin field
- # Log, values > 0, voxel expands towards subject (i.e. subject voxel is larger)
- # Log, values < 0, voxel contracts towards subject (i.e. subject voxel is smaller)
- info "Computing Jacobians from non-linear warp fields"
- for file in "${_arg_inputs[@]}"; do
- if [[ ! -s ${_arg_output_dir}/final/transforms/$(basename ${file} | extension_strip)_1Warp.nii.gz ]]; then
- failure "Expected deformation file ${_arg_output_dir}/final/transforms/$(basename ${file} | extension_strip)_1Warp.nii.gz does not exist"
- fi
- if [[ ! -s ${_arg_output_dir}/dbm/intermediate/nlin/jacobian/$(basename ${file} | extension_strip).nii.gz ]]; then
- echo "CreateJacobianDeterminantImage 3 ${_arg_output_dir}/final/transforms/$(basename ${file} | extension_strip)_1Warp.nii.gz \
- ${_arg_output_dir}/dbm/intermediate/nlin/jacobian/$(basename ${file} | extension_strip).nii.gz ${_arg_log_jacobian} ${_arg_use_geometric}"
- fi
- done >${_arg_output_dir}/dbm/jobs/${__datetime}/nlin_jacobian
- debug "$(cat ${_arg_output_dir}/dbm/jobs/${__datetime}/nlin_jacobian)"
- if [[ ${_arg_dry_run} == "off" ]]; then
- qbatch ${_arg_block} --logdir ${_arg_output_dir}/dbm/logs/${__datetime} \
- --walltime ${_arg_walltime} \
- -N ${_arg_jobname_prefix}dbm_${__datetime}_nlin_jacobian \
- ${_arg_output_dir}/dbm/jobs/${__datetime}/nlin_jacobian
- fi
- # Generate warp field from affine transform
- info "Computing warp fields from affine transforms"
- for file in "${_arg_inputs[@]}"; do
- if [[ ! -s ${_arg_output_dir}/dbm/intermediate/affine/warp/$(basename ${file} | extension_strip).nii.gz ]]; then
- echo "antsApplyTransforms -d 3 --verbose ${_arg_float} \
- -r ${_arg_output_dir}/final/average/template_sharpen_shapeupdate.nii.gz \
- -t ${_arg_output_dir}/final/transforms/$(basename ${file} | extension_strip)_0GenericAffine.mat \
- -o [ ${_arg_output_dir}/dbm/intermediate/affine/warp/$(basename ${file} | extension_strip).nii.gz,1 ]"
- fi
- done >${_arg_output_dir}/dbm/jobs/${__datetime}/affine_warp
- debug "$(cat ${_arg_output_dir}/dbm/jobs/${__datetime}/affine_warp)"
- if [[ ${_arg_dry_run} == "off" ]]; then
- qbatch ${_arg_block} --logdir ${_arg_output_dir}/dbm/logs/${__datetime} \
- --walltime ${_arg_walltime} \
- -N ${_arg_jobname_prefix}dbm_${__datetime}_affine_warp \
- ${_arg_output_dir}/dbm/jobs/${__datetime}/affine_warp
- fi
- # Generate jacobian from affine warp field
- # Log, values > 0, voxel expands towards subject (i.e. subject voxel is larger)
- # Log, values < 0, voxel contracts towards subject (i.e. subject voxel is smaller)
- info "Computing Jacobians from affine warp fields"
- for file in "${_arg_inputs[@]}"; do
- if [[ ! -s ${_arg_output_dir}/dbm/intermediate/affine/jacobian/$(basename ${file} | extension_strip).nii.gz ]]; then
- echo "CreateJacobianDeterminantImage 3 ${_arg_output_dir}/dbm/intermediate/affine/warp/$(basename ${file} | extension_strip).nii.gz \
- ${_arg_output_dir}/dbm/intermediate/affine/jacobian/$(basename ${file} | extension_strip).nii.gz ${_arg_log_jacobian} ${_arg_use_geometric}"
- fi
- done >${_arg_output_dir}/dbm/jobs/${__datetime}/affine_jacobian
- debug "$(cat ${_arg_output_dir}/dbm/jobs/${__datetime}/affine_jacobian)"
- if [[ ${_arg_dry_run} == "off" ]]; then
- qbatch ${_arg_block} --logdir ${_arg_output_dir}/dbm/logs/${__datetime} \
- --walltime ${_arg_walltime} \
- -N ${_arg_jobname_prefix}dbm_${__datetime}_affine_jacobian \
- --depend ${_arg_jobname_prefix}dbm_${__datetime}_affine_warp \
- ${_arg_output_dir}/dbm/jobs/${__datetime}/affine_jacobian
- fi
- # Check for mask to use for delin
- if [[ -s ${_arg_mask} ]]; then
- info "Using supplied file ${_arg_mask} for delin calculation"
- elif [[ -s ${_arg_output_dir}/final/average/mask_shapeupdate.nii.gz ]]; then
- info "Using modelbuild mask ${_arg_output_dir}/final/average/mask_shapeupdate.nii.gz for delin calculation"
- _arg_mask=${_arg_output_dir}/final/average/mask_shapeupdate.nii.gz
- else
- if [[ ! -s ${_arg_output_dir}/dbm/intermediate/mask.nii.gz ]]; then
- info "No average mask available (provide via --mask), estimating mask using thresholding for delin calculation"
- # Otsu threshold, erode, get largest component, dilate
- echo "ThresholdImage 3 ${_arg_output_dir}/final/average/template_sharpen_shapeupdate.nii.gz \
- ${_arg_output_dir}/dbm/intermediate/mask.nii.gz Otsu 1 && \
- iMath 3 ${_arg_output_dir}/dbm/intermediate/mask.nii.gz ME ${_arg_output_dir}/dbm/intermediate/mask.nii.gz 1 1 ball 1 && \
- ImageMath 3 ${_arg_output_dir}/dbm/intermediate/mask.nii.gz GetLargestComponent ${_arg_output_dir}/dbm/intermediate/mask.nii.gz && \
- iMath 3 ${_arg_output_dir}/dbm/intermediate/mask.nii.gz MD ${_arg_output_dir}/dbm/intermediate/mask.nii.gz 1 1 ball 1"
- _arg_mask=${_arg_output_dir}/dbm/intermediate/mask.nii.gz
- fi
- fi >${_arg_output_dir}/dbm/jobs/${__datetime}/delin_mask
- debug "$(cat ${_arg_output_dir}/dbm/jobs/${__datetime}/delin_mask)"
- if [[ ${_arg_dry_run} == "off" && -s ${_arg_output_dir}/dbm/jobs/${__datetime}/delin_mask ]]; then
- qbatch ${_arg_block} --logdir ${_arg_output_dir}/dbm/logs/${__datetime} \
- --walltime ${_arg_walltime} \
- -N ${_arg_jobname_prefix}dbm_${__datetime}_delin_mask \
- -- bash ${_arg_output_dir}/dbm/jobs/${__datetime}/delin_mask
- fi
- # Generate delin affine from warp field
- info "Estimate delin affine from nlin warp fields"
- for file in "${_arg_inputs[@]}"; do
- if [[ ! -s ${_arg_output_dir}/dbm/intermediate/delin/affine/$(basename ${file} | extension_strip).mat ]]; then
- echo "ANTSUseDeformationFieldToGetAffineTransform ${_arg_output_dir}/final/transforms/$(basename ${file} | extension_strip)_1Warp.nii.gz \
- ${_arg_delin_affine_ratio} affine ${_arg_output_dir}/dbm/intermediate/delin/affine/$(basename ${file} | extension_strip).mat \
- ${_arg_mask}"
- fi
- done >${_arg_output_dir}/dbm/jobs/${__datetime}/delin_affine_from_warp
- debug "$(cat ${_arg_output_dir}/dbm/jobs/${__datetime}/delin_affine_from_warp)"
- if [[ ${_arg_dry_run} == "off" ]]; then
- qbatch ${_arg_block} --logdir ${_arg_output_dir}/dbm/logs/${__datetime} \
- --walltime ${_arg_walltime} \
- -N ${_arg_jobname_prefix}dbm_${__datetime}_delin_affine_from_warp \
- --depend ${_arg_jobname_prefix}dbm_${__datetime}_delin_mask \
- ${_arg_output_dir}/dbm/jobs/${__datetime}/delin_affine_from_warp
- fi
- # Generate warp from delin affine
- info "Generate composite warp field from delin affine"
- for file in "${_arg_inputs[@]}"; do
- if [[ ! -s ${_arg_output_dir}/dbm/intermediate/delin/warp/$(basename ${file} | extension_strip).nii.gz ]]; then
- echo "antsApplyTransforms -d 3 --verbose ${_arg_float} \
- -r ${_arg_output_dir}/final/average/template_sharpen_shapeupdate.nii.gz \
- -t [ ${_arg_output_dir}/dbm/intermediate/delin/affine/$(basename ${file} | extension_strip).mat,1 ] \
- -o [ ${_arg_output_dir}/dbm/intermediate/delin/warp/$(basename ${file} | extension_strip).nii.gz,1 ]"
- fi
- done >${_arg_output_dir}/dbm/jobs/${__datetime}/delin_warp_from_delin_affine
- debug "$(cat ${_arg_output_dir}/dbm/jobs/${__datetime}/delin_warp_from_delin_affine)"
- if [[ ${_arg_dry_run} == "off" ]]; then
- qbatch ${_arg_block} --logdir ${_arg_output_dir}/dbm/logs/${__datetime} \
- --walltime ${_arg_walltime} \
- -N ${_arg_jobname_prefix}dbm_${__datetime}_delin_warp_from_delin_affine \
- --depend ${_arg_jobname_prefix}dbm_${__datetime}_delin_affine_from_warp \
- ${_arg_output_dir}/dbm/jobs/${__datetime}/delin_warp_from_delin_affine
- fi
- # Generate jacobians from delin warp field
- info "Computing Jacobians from delin affine warp fields"
- for file in "${_arg_inputs[@]}"; do
- if [[ ! -s ${_arg_output_dir}/dbm/intermediate/delin/jacobian/$(basename ${file} | extension_strip).nii.gz ]]; then
- echo "CreateJacobianDeterminantImage 3 ${_arg_output_dir}/dbm/intermediate/delin/warp/$(basename ${file} | extension_strip).nii.gz \
- ${_arg_output_dir}/dbm/intermediate/delin/jacobian/$(basename ${file} | extension_strip).nii.gz ${_arg_log_jacobian} ${_arg_use_geometric}"
- fi
- done >${_arg_output_dir}/dbm/jobs/${__datetime}/jacobian_from_delin_warp
- debug "$(cat ${_arg_output_dir}/dbm/jobs/${__datetime}/jacobian_from_delin_warp)"
- if [[ ${_arg_dry_run} == "off" ]]; then
- qbatch ${_arg_block} --logdir ${_arg_output_dir}/dbm/logs/${__datetime} \
- --walltime ${_arg_walltime} \
- -N ${_arg_jobname_prefix}dbm_${__datetime}_jacobian_from_delin_warp \
- --depend ${_arg_jobname_prefix}dbm_${__datetime}_delin_warp_from_delin_affine \
- ${_arg_output_dir}/dbm/jobs/${__datetime}/jacobian_from_delin_warp
- fi
- # Generate final full jacobians
- info "Generating Full Jacobians"
- for file in "${_arg_inputs[@]}"; do
- if [[ ! -s ${_arg_output_dir}/dbm/jacobian/full/$(basename ${file} | extension_strip).nii.gz ]]; then
- echo "ImageMath 3 \
- ${_arg_output_dir}/dbm/jacobian/full/$(basename ${file} | extension_strip).nii.gz \
- + ${_arg_output_dir}/dbm/intermediate/affine/jacobian/$(basename ${file} | extension_strip).nii.gz \
- ${_arg_output_dir}/dbm/intermediate/nlin/jacobian/$(basename ${file} | extension_strip).nii.gz"
- fi
- done >${_arg_output_dir}/dbm/jobs/${__datetime}/gen_full_jacobian
- debug "$(cat ${_arg_output_dir}/dbm/jobs/${__datetime}/gen_full_jacobian)"
- if [[ ${_arg_dry_run} == "off" ]]; then
- qbatch ${_arg_block} --logdir ${_arg_output_dir}/dbm/logs/${__datetime} \
- --walltime ${_arg_walltime} \
- -N ${_arg_jobname_prefix}dbm_${__datetime}_gen_full_jacobian \
- --depend ${_arg_jobname_prefix}dbm_${__datetime}_affine_jacobian \
- --depend ${_arg_jobname_prefix}dbm_${__datetime}_nlin_jacobian \
- ${_arg_output_dir}/dbm/jobs/${__datetime}/gen_full_jacobian
- fi
- # Generate final relative jacobians
- info "Generating Relative Jacobians"
- for file in "${_arg_inputs[@]}"; do
- if [[ ! -s ${_arg_output_dir}/dbm/jacobian/relative/$(basename ${file} | extension_strip).nii.gz ]]; then
- echo "ImageMath 3 \
- ${_arg_output_dir}/dbm/jacobian/relative/$(basename ${file} | extension_strip).nii.gz \
- + ${_arg_output_dir}/dbm/intermediate/delin/jacobian/$(basename ${file} | extension_strip).nii.gz \
- ${_arg_output_dir}/dbm/intermediate/nlin/jacobian/$(basename ${file} | extension_strip).nii.gz"
- fi
- done >${_arg_output_dir}/dbm/jobs/${__datetime}/gen_rel_jacobian
- debug "$(cat ${_arg_output_dir}/dbm/jobs/${__datetime}/gen_rel_jacobian)"
- if [[ ${_arg_dry_run} == "off" ]]; then
- qbatch ${_arg_block} --logdir ${_arg_output_dir}/dbm/logs/${__datetime} \
- --walltime ${_arg_walltime} \
- -N ${_arg_jobname_prefix}dbm_${__datetime}_gen_rel_jacobian \
- --depend ${_arg_jobname_prefix}dbm_${__datetime}_nlin_jacobian \
- --depend ${_arg_jobname_prefix}dbm_${__datetime}_jacobian_from_delin_warp \
- ${_arg_output_dir}/dbm/jobs/${__datetime}/gen_rel_jacobian
- fi
- # # Generate unlogged relative jacobians
- # if [[ ${_arg_unlog_jacobian} == "on" ]]; then
- # info "Generating Un-logged Relative Jacobians"
- # for file in "${_arg_inputs[@]}"; do
- # if [[ ! -s ${_arg_output_dir}/dbm/jacobian/relative/unlog/$(basename ${file} | extension_strip).nii.gz ]]; then
- # command=("python" "-c" "'import SimpleITK as sitk; sitk.WriteImage(sitk.Exp(sitk.ReadImage(\"${_arg_output_dir}/dbm/jacobian/relative/$(basename ${file} | extension_strip).nii.gz\")),\"${_arg_output_dir}/dbm/jacobian/relative/unlog/$(basename ${file} | extension_strip).nii.gz\")'" )
- # echo "${command[@]}"
- # fi
- # done >${_arg_output_dir}/dbm/jobs/${__datetime}/gen_unlog_rel_jacobian
- # debug "$(cat ${_arg_output_dir}/dbm/jobs/${__datetime}/gen_unlog_rel_jacobian)"
- # if [[ ${_arg_dry_run} == "off" ]]; then
- # qbatch ${_arg_block} --logdir ${_arg_output_dir}/logs/${__datetime} \
- # --walltime ${_arg_walltime} \
- # -N ${_arg_jobname_prefix}dbm_${__datetime}_gen_unlog_rel_jacobian \
- # --depend ${_arg_jobname_prefix}dbm_${__datetime}_gen_frel_jacobian \
- # ${_arg_output_dir}/dbm/jobs/${__datetime}/gen_unlog_rel_jacobian
- # fi
- # fi
- # If requested, resample DBM outputs into final-target space
- if [[ ${_arg_target_space} == "final-target" ]]; then
- mkdir -p ${_arg_output_dir}/dbm/jacobian/{relative,full}/{unlog,}/final-target
- info "Resampling DBM"
- for file in "${_arg_inputs[@]}"; do
- for type in relative full; do
- if [[ ! -s ${_arg_output_dir}/dbm/jacobian/final-target/${type}/$(basename ${file} | extension_strip).nii.gz ]]; then
- echo antsApplyTransforms -d 3 --verbose -n Linear \
- -i ${_arg_output_dir}/dbm/jacobian/${type}/$(basename ${file} | extension_strip).nii.gz \
- -o ${_arg_output_dir}/dbm/jacobian/final-target/${type}/$(basename ${file} | extension_strip).nii.gz \
- -t ${_arg_output_dir}/final-target/to_target_1Warp.nii.gz \
- -t ${_arg_output_dir}/final-target/to_target_0GenericAffine.mat \
- -r ${_arg_output_dir}/final-target/final_target.nii.gz
- fi
- done
- # if [[ ${_arg_unlog_jacobian} == "on" ]]; then
- # if [[ ! -s ${_arg_output_dir}/dbm/jacobian/relative/unlog/final-target/$(basename ${file} | extension_strip).nii.gz ]]; then
- # true
- # fi
- # if [[ ! -s ${_arg_output_dir}/dbm/jacobian/full/unlog/final-target/$(basename ${file} | extension_strip).nii.gz ]]; then
- # true
- # fi
- # fi
- done >${_arg_output_dir}/dbm/jobs/${__datetime}/resample_jacobians_final_target
- debug "$(cat ${_arg_output_dir}/dbm/jobs/${__datetime}/resample_jacobians_final_target)"
- if [[ ${_arg_dry_run} == "off" ]]; then
- qbatch ${_arg_block} --logdir ${_arg_output_dir}/dbm/logs/${__datetime} \
- --walltime ${_arg_walltime} \
- -N ${_arg_jobname_prefix}dbm_${__datetime}_resample_jacobians_final_target \
- --depend ${_arg_jobname_prefix}dbm_${__datetime}_gen_rel_jacobian \
- --depend ${_arg_jobname_prefix}dbm_${__datetime}_gen_full_jacobian \
- ${_arg_output_dir}/dbm/jobs/${__datetime}/resample_jacobians_final_target
- fi
- fi
- # Smooth jacobians files
- info "Smoothing Jacobians"
- for file in "${_arg_inputs[@]}"; do
- for fwhm in "${_arg_jacobian_smooth[@]}"; do
- sigma_num=$(calc "$(echo ${fwhm} | grep -o -E '^[0-9]+')/(2*sqrt(2*log(2)))")
- if [[ ${fwhm} =~ [0-9]+mm$ ]]; then
- fwhm_type=1
- elif [[ ${fwhm} =~ [0-9]+vox$ ]]; then
- fwhm_type=0
- else
- failure "Parse error for FWHM entry \"${fwhm}\", must end with vox or mm"
- fi
- for type in relative full; do
- if [[ ! -s ${_arg_output_dir}/dbm/jacobian/${type}/smooth/$(basename ${file} | extension_strip)_fwhm_${fwhm}.nii.gz ]]; then
- echo SmoothImage 3 \
- ${_arg_output_dir}/dbm/jacobian/${type}/$(basename ${file} | extension_strip).nii.gz \
- ${sigma_num} \
- ${_arg_output_dir}/dbm/jacobian/${type}/smooth/$(basename ${file} | extension_strip)_fwhm_${fwhm}.nii.gz ${fwhm_type} 0
- fi
- if [[ ${_arg_target_space} == "final-target" ]]; then
- if [[ ! -s ${_arg_output_dir}/dbm/jacobian/final-target/${type}/smooth/$(basename ${file} | extension_strip)_fwhm_${fwhm}.nii.gz ]]; then
- echo SmoothImage 3 \
- ${_arg_output_dir}/dbm/jacobian/final-target/${type}/$(basename ${file} | extension_strip).nii.gz \
- ${sigma_num} \
- ${_arg_output_dir}/dbm/jacobian/final-target/${type}/smooth/$(basename ${file} | extension_strip)_fwhm_${fwhm}.nii.gz ${fwhm_type} 0
- fi
- fi
- done
- done
- done >${_arg_output_dir}/dbm/jobs/${__datetime}/smooth_jacobian
- debug "$(cat ${_arg_output_dir}/dbm/jobs/${__datetime}/smooth_jacobian)"
- if [[ ${_arg_dry_run} == "off" ]]; then
- qbatch ${_arg_block} --logdir ${_arg_output_dir}/dbm/logs/${__datetime} \
- --walltime ${_arg_walltime} \
- -N ${_arg_jobname_prefix}dbm_${__datetime}_smooth_jacobian \
- --depend ${_arg_jobname_prefix}dbm_${__datetime}_gen_full_jacobian \
- --depend ${_arg_jobname_prefix}dbm_${__datetime}_gen_rel_jacobian \
- --depend ${_arg_jobname_prefix}dbm_${__datetime}_resample_jacobians_final_target \
- ${_arg_output_dir}/dbm/jobs/${__datetime}/smooth_jacobian
- fi
- # ] <-- needed because of Argbash
dbm.sh at commit 477735b, under other · at the source
Overview
13 affiliations
- Institute of Medical Science, University of Toronto, Toronto, Ontario, Canada
- Neurosciences and Mental Health, The Hospital for Sick Children, Toronto, Ontario, Canada
- Krembil Brain Institute, University Health Network, Toronto, Ontario, Canada
- Division of Neurosurgery, The Hospital for Sick Children, Toronto, Ontario, Canada
- Mouse Imaging Centre, The Hospital for Sick Children, Toronto, Ontario, Canada
- Bloorview Research Institute, Holland Bloorview Kids Rehabilitation Hospital, Toronto, Ontario, Canada
- Department of Medical Biophysics, University of Toronto, Toronto, Ontario, Canada
- Oxford Centre for Integrative Neuroimaging, Nuffield Department of Clinical Neuroscience, University of Oxford, Oxford, UK
- Translational Medicine, The Hospital for Sick Children, Toronto, Ontario, Canada
- Diagnostic and Interventional Radiology, The Hospital for Sick Children, Toronto, Ontario, Canada
- Department of Medical Imaging, University of Toronto, Toronto, Ontario, Canada
- Department of Psychology, University of Toronto, Toronto, Ontario, Canada
- Division of Neurology, The Hospital for Sick Children, Toronto, Ontario, Canada
Abstract
Dysfunction of corticostriatal circuitry is related to the emergence of self-injurious behavior (SIB) in autism spectrum disorder (ASD). Despite mounting interest in circuit-based interventions for severe, refractory SIB, the lack of causal evidence linking modulation of corticostriatal networks to changes in SIB has limited the advancement of effective, targeted therapies. In this study, we demonstrate that electrical stimulation of the nucleus accumbens (NAcc) mitigates SIB and induces structural changes along corticostriatal circuits in a mouse model relevant for ASD and children with severe SIB undergoing NAcc-targeted deep brain stimulation. In BTBR T+ Itpr3tf/
Reproduced under the paper's license (CC BY-NC), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.
lead-dbs.org
Availability: 1 check, the latest on 26 September 2026: the link answers (HTTP 200)
- 26 September 2026: the link answers (HTTP 200)
CoBrALab/twolevel_ants_dbm
c51e45ac513106b03bdaac61aca58d60c51bba64, 16 May 2025Availability: 1 check, the latest on 29 September 2026: the link answers
- 29 September 2026: the link answers
3 files
- twolevel_dbm.py, Python, 944 lines, 1 match
- LICENSE, License, 76 lines
- README.md, Text, 240 lines
CoBrALab/optimized_antsMultivariateTemplateConstruction
477735b38736f9ba91f7e6372ab8eb77d8629bed, 21 September 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
16 files
- commonspace_resample.sh, Shell, 385 lines
- dbm.sh, Shell, 592 lines, 1 match
- helpers.sh, Shell, 155 lines
- interp_transform.py, Python, 99 lines
- modelbuild.sh, Shell, 1,459 lines
- sitk_average_affine_tran
sforms.py , Python, 131 lines - sitk_image_math.py, Python, 382 lines
- sitk_invert_scale_warp_f
ield.py , Python, 48 lines - subjectspace_resample.sh
, Shell, 391 lines - testing/
test_affine_convergence. , Shell, 39 linessh - twolevel_commonspace_res
ample.sh , Shell, 246 lines - twolevel_dbm.sh, Shell, 492 lines
- twolevel_modelbuild.sh, Shell, 327 lines
- twolevel_subjectspace_re
sample.sh , Shell, 307 lines - LICENSE, License, 76 lines
- README.md, Text, 422 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 3 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 15 scripts, each with its path and the digest of its content;
- 2 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- doi:10.7910/
dvn/ , at the source; found in “Data, code, and materials availability:”kktjqc
Data, code, and materials availability
All data and code needed to evaluate and reproduce the results in the paper are present in the paper and/
Reproduced under the paper's license (CC BY-NC), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 29 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 15 authors, 15 MeSH terms, 1 funder, 141 references.
Cite
This paper
Zhang, K., Germann, J., Matin, R., Mithani, K., Ellegood, J., Suresh, H., Wong, S., Lerch, J. P., Nieman, B. J., Taylor, M. J., Breitbart, S., Fasano, A., Gorodetsky, C., Gouveia, F. V., & Ibrahim, G. M. (2026). Regulation of autism-related self-injurious behavior by electrical stimulation of corticostriatal circuits in mice and humans. Science advances, 12(15), eaeb5842. https://
BibTeX
@article{zhang2026regula
author = {Zhang, Kristina and Germann, Jurgen and Matin, Rafi and Mithani, Karim and Ellegood, Jacob and Suresh, Hrishikesh and Wong, Sammi and Lerch, Jason P and Nieman, Brian J and Taylor, Margot J and Breitbart, Sara and Fasano, Alfonso and Gorodetsky, Carolina and Gouveia, Flavia Venetucci and Ibrahim, George M},
title = {{Regulation of autism-related self-injurious behavior by electrical stimulation of corticostriatal circuits in mice and humans}},
journal = {Science advances},
year = {2026},
month = apr,
volume = {12},
number = {15},
pages = {eaeb5842},
publisher = {American Association for the Advancement of Science},
issn = {2375-2548},
doi = {10.1126/
url = {https://
pmid = {41961929},
pmcid = {PMC13068066}
}
RIS
TY - JOUR
AU - Zhang, Kristina
AU - Germann, Jurgen
AU - Matin, Rafi
AU - Mithani, Karim
AU - Ellegood, Jacob
AU - Suresh, Hrishikesh
AU - Wong, Sammi
AU - Lerch, Jason P
AU - Nieman, Brian J
AU - Taylor, Margot J
AU - Breitbart, Sara
AU - Fasano, Alfonso
AU - Gorodetsky, Carolina
AU - Gouveia, Flavia Venetucci
AU - Ibrahim, George M
TI - Regulation of autism-related self-injurious behavior by electrical stimulation of corticostriatal circuits in mice and humans
T2 - Science advances
J2 - Sci Adv
PY - 2026
DA - 2026/
VL - 12
IS - 15
SP - eaeb5842
SN - 2375-2548
PB - American Association for the Advancement of Science
DO - 10.1126/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1126/
"type": "article-journal",
"title": "Regulation of autism-related self-injurious behavior by electrical stimulation of corticostriatal circuits in mice and humans",
"container-title": "Science advances",
"author": [
{
"family": "Zhang",
"given": "Kristina"
},
{
"family": "Germann",
"given": "Jurgen"
},
{
"family": "Matin",
"given": "Rafi"
},
{
"family": "Mithani",
"given": "Karim"
},
{
"family": "Ellegood",
"given": "Jacob"
},
{
"family": "Suresh",
"given": "Hrishikesh"
},
{
"family": "Wong",
"given": "Sammi"
},
{
"family": "Lerch",
"given": "Jason P"
},
{
"family": "Nieman",
"given": "Brian J"
},
{
"family": "Taylor",
"given": "Margot J"
},
{
"family": "Breitbart",
"given": "Sara"
},
{
"family": "Fasano",
"given": "Alfonso"
},
{
"family": "Gorodetsky",
"given": "Carolina"
},
{
"family": "Gouveia",
"given": "Flavia Venetucci"
},
{
"family": "Ibrahim",
"given": "George M"
}
],
"container-title-short":
"volume": "12",
"issue": "15",
"page": "eaeb5842",
"DOI": "10.1126/
"PMID": "41961929",
"PMCID": "PMC13068066",
"ISSN": "2375-2548",
"publisher": "American Association for the Advancement of Science",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
10
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1038/s41467-026-71555-0 [code]
- A deep representation learning model to predict response to vagus nerve stimulation.Journal: Nature communicationsIn common: ANTs, SciPy, NumPy, 2 references, 4 authors
- [2] doi:10.1038/s41586-026-10515-6 [code]
- An X-linked long non-coding RNA, PTCHD1-AS, and the core features of autism.Journal: NatureIn common: SciPy, NumPy, autism, mouse, 4 references, author Jacob Ellegood
- [3] doi:10.1126/sciadv.adq6577 [code]
- Autism-like phenotypes and increased NMDAR2D expression in mice with KDM5B histone lysine demethylase deficiency.Journal: Science advancesIn common: SciPy, NumPy, autism, mouse, 3 references, author Jacob Ellegood
- [4] doi:10.1038/s41593-026-02228-w [code]
- Circuit response to neuromodulation characterized with simultaneous deep brain stimulation and precision neuroimaging in humans.Journal: Nature neuroscienceIn common: ANTs, statsmodels, SciPy, 1 other tool, systems, 4 references
- [5] doi:10.3389/fnins.2026.1843319 [code]
- Humanized APOE mouse brain volume increases over age irrespective of sex and APOE genotype: implications for translational validity to the human.Journal: Frontiers in neuroscienceIn common: SimpleITK, ANTs, statsmodels, 2 other tools, mouse, 1 reference
- [6] doi:10.1038/s41467-026-75706-1 [code]
- Dissociable roles of prefrontal plasticity in decision-making strategy and execution of habitual behavior.Journal: Nature communicationsIn common: SciPy, NumPy, mouse, 4 references
- [7] doi:10.1038/s41467-026-72437-1 [code]
- High-speed whole-brain imaging in Drosophila.Journal: Nature communicationsIn common: SimpleITK, ANTs, statsmodels, 2 other tools, systems, 1 reference
- [8] doi:10.1016/j.isci.2026.117278
- Altered striatal long-term potentiation in the eIF4E-TG mouse model of autism spectrum disorder.Journal: iScienceIn common: autism, mouse, 4 references
- [9] doi:10.7554/elife.108408 [code]
- Frequency and laminar profile of feature-specific visual activity revealed by interleaved EEG-fMRI.Journal: eLifeIn common: ANTs, statsmodels, SciPy, 1 other tool, systems, 2 references
- [10] doi:10.1002/ana.78206 [code]
- Multimodal Image Guidance in Subthalamic Deep Brain Stimulation for Parkinson's Disease.Journal: Annals of neurologyIn common: ANTs, SciPy, NumPy, 3 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 3 repositories of the authors' code, each at its verified commit and with its license, 15 scripts, and 2 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:49a70ecd3dea58f4…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
