OSCR

Improved dietary control results in improvements in indices of white matter structure in adults with phenylketonuria: the ReDAPT study.

Code ↔ Paper

2 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 2 matches
  1. [1] § Methods › Calculation of the T1w/T2w ratio ↔ antsCorticalThickness.sh, lines 30–156 · score 0.56 · buildtemplateparallel.sh, deep, ROI, ITK, space, posterior
  2. [2] § Methods › Calculation of the T1w/T2w ratio ↔ antsLongitudinalCorticalThickness.sh, lines 30–147 · score 0.51 · buildtemplateparallel.sh, deep, ITK, space, posterior, ANTs

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 · 1,450 lines · 60 KB · no license · 1 match

  1. #!/bin/bash
  2. VERSION="0.0"
  3. # Check dependencies
  4. PROGRAM_DEPENDENCIES=( 'antsRegistration' 'antsApplyTransforms' 'N4BiasFieldCorrection' 'Atropos' 'KellyKapowski' )
  5. SCRIPTS_DEPENDENCIES=( 'antsBrainExtraction.sh' 'antsAtroposN4.sh' )
  6. for D in ${PROGRAM_DEPENDENCIES[@]};
  7. do
  8. if [[ ! -s ${ANTSPATH}/${D} ]];
  9. then
  10. echo "Error: we can't find the $D program."
  11. echo "Perhaps you need to \(re\)define \$ANTSPATH in your environment."
  12. exit
  13. fi
  14. done
  15. for D in ${SCRIPT_DEPENDENCIES[@]};
  16. do
  17. if [[ ! -s ${ANTSPATH}/${D} ]];
  18. then
  19. echo "We can't find the $D script."
  20. echo "Perhaps you need to \(re\)define \$ANTSPATH in your environment."
  21. exit
  22. fi
  23. done
  24. function Usage {
  25. cat <<USAGE
  26. `basename $0` performs T1 anatomical brain processing where the following steps are currently applied:
  27. 1. Brain extraction
  28. 2. Brain n-tissue segmentation
  29. 3. Cortical thickness
  30. 4. (Optional) registration to a template
  31. Usage:
  32. `basename $0` -d imageDimension
  33. -a anatomicalImage
  34. -e brainTemplate
  35. -m brainExtractionProbabilityMask
  36. -p brainSegmentationPriors
  37. <OPTARGS>
  38. -o outputPrefix
  39. Example:
  40. bash $0 -d 3 -a t1.nii.gz -e brainWithSkullTemplate.nii.gz -m brainPrior.nii.gz -p segmentationPriors%d.nii.gz -o output
  41. Required arguments:
  42. We use *intensity* to denote the original anatomical image of the brain.
  43. We use *probability* to denote a probability image with values in range 0 to 1.
  44. We use *label* to denote a label image with values in range 0 to N.
  45. -d: Image dimension 2 or 3 (for 2- or 3-dimensional image)
  46. -a: Anatomical image Structural *intensity* image, typically T1. If more than one
  47. anatomical image is specified, subsequently specified
  48. images are used during the segmentation process. However,
  49. only the first image is used in the registration of priors.
  50. Our suggestion would be to specify the T1 as the first image.
  51. -e: Brain template Anatomical *intensity* template (possibly created using a population
  52. data set with buildtemplateparallel.sh in ANTs). This template is
  53. *not* skull-stripped.
  54. -m: Brain extraction probability mask Brain *probability* mask created using e.g. LPBA40 labels which
  55. have brain masks defined, and warped to anatomical template and
  56. averaged resulting in a probability image.
  57. -p: Brain segmentation priors Tissue *probability* priors corresponding to the image specified
  58. with the -e option. Specified using c-style formatting, e.g.
  59. -p labelsPriors%02d.nii.gz. We assume that the first four priors
  60. are ordered as follows
  61. 1: csf
  62. 2: cortical gm
  63. 3: wm
  64. 4: deep gm
  65. -o: Output prefix The following images are created:
  66. * ${OUTPUT_PREFIX}BrainExtractionMask.${OUTPUT_SUFFIX}
  67. * ${OUTPUT_PREFIX}BrainSegmentation.${OUTPUT_SUFFIX}
  68. * ${OUTPUT_PREFIX}BrainSegmentation*N4.${OUTPUT_SUFFIX} One for each anatomical input
  69. * ${OUTPUT_PREFIX}BrainSegmentationPosteriors*1.${OUTPUT_SUFFIX} CSF
  70. * ${OUTPUT_PREFIX}BrainSegmentationPosteriors*2.${OUTPUT_SUFFIX} GM
  71. * ${OUTPUT_PREFIX}BrainSegmentationPosteriors*3.${OUTPUT_SUFFIX} WM
  72. * ${OUTPUT_PREFIX}BrainSegmentationPosteriors*4.${OUTPUT_SUFFIX} DEEP GM
  73. * ...
  74. * ${OUTPUT_PREFIX}BrainSegmentationPosteriors*N.${OUTPUT_SUFFIX} where there are N priors
  75. * Number formatting of posteriors matches that of the priors.
  76. * ${OUTPUT_PREFIX}CorticalThickness.${OUTPUT_SUFFIX}
  77. Optional arguments:
  78. -s: image file suffix Any of the standard ITK IO formats e.g. nrrd, nii.gz (default), mhd
  79. -t: template for t1 registration Anatomical *intensity* template (assumed to be skull-stripped). A common
  80. use case would be where this would be the same template as specified in the
  81. -e option which is not skull stripped.
  82. We perform the registration (fixed image = individual subject
  83. and moving image = template) to produce the files.
  84. The output from this step is
  85. * ${OUTPUT_PREFIX}TemplateToSubject0GenericAffine.mat
  86. * ${OUTPUT_PREFIX}TemplateToSubject1Warp.${OUTPUT_SUFFIX}
  87. * ${OUTPUT_PREFIX}TemplateToSubject1InverseWarp.${OUTPUT_SUFFIX}
  88. * ${OUTPUT_PREFIX}TemplateToSubjectLogJacobian.${OUTPUT_SUFFIX}
  89. -f: extraction registration mask Mask (defined in the template space) used during registration
  90. for brain extraction.
  91. -k: keep temporary files Keep brain extraction/segmentation warps, etc (default = 0).
  92. -g: denoise anatomical images Denoise anatomical images (default = 0).
  93. -i: max iterations for registration ANTS registration max iterations (default = 100x100x70x20)
  94. -w: Atropos prior segmentation weight Atropos spatial prior *probability* weight for the segmentation (default = 0.25)
  95. -n: number of segmentation iterations N4 -> Atropos -> N4 iterations during segmentation (default = 3)
  96. -b: posterior formulation Atropos posterior formulation and whether or not to use mixture model proportions.
  97. e.g 'Socrates[1]' (default) or 'Aristotle[1]'. Choose the latter if you
  98. want use the distance priors (see also the -l option for label propagation
  99. control).
  100. -j: use floating-point precision Use floating point precision in registrations (default = 0)
  101. -u: use random seeding Use random number generated from system clock in Atropos (default = 1)
  102. -v: use b-spline smoothing Use B-spline SyN for registrations and B-spline exponential mapping in DiReCT.
  103. -r: cortical label image Cortical ROI labels to use as a prior for ATITH.
  104. -l: label propagation Incorporate a distance prior one the posterior formulation. Should be
  105. of the form 'label[lambda,boundaryProbability]' where label is a value
  106. of 1,2,3,... denoting label ID. The label probability for anything
  107. outside the current label
  108. = boundaryProbability * exp( -lambda * distanceFromBoundary )
  109. Intuitively, smaller lambda values will increase the spatial capture
  110. range of the distance prior. To apply to all label values, simply omit
  111. specifying the label, i.e. -l [lambda,boundaryProbability].
  112. -c Add prior combination to combined gray and white matters. For example,
  113. when calling KK for normal subjects, we combine the deep gray matter
  114. segmentation/posteriors with the white matter segmentation/posteriors.
  115. An additional example would be performing cortical thickness in the presence
  116. of white matter lesions. We can accommodate this by specifying a lesion mask
  117. posterior as an additional posterior (suppose label '7'), and then combine
  118. this with white matter by specifying '-c WM[7]' or '-c 3[7]'.
  119. -q: Use quick registration parameters If = 1, use antsRegistrationSyNQuick.sh as the basis for registration
  120. during brain extraction, brain segmentation, and (optional) normalization
  121. to a template. Otherwise use antsRegistrationSyN.sh (default = 0).
  122. -x: Number of iterations within Atropos (default 5).
  123. -y: Which stage of ACT to run (default = 0, run all). Tries to split in 2 hour chunks.
  124. Will produce OutputNameACTStageNComplete.txt for each completed stage.
  125. 1: brain extraction
  126. 2: template registration
  127. 3: tissue segmentation
  128. 4: template registration (improved, optional)
  129. 5: DiReCT cortical thickness
  130. 6: qc, quality control and summary measurements
  131. -z: Test / debug mode If > 0, runs a faster version of the script. Only for testing. Implies -u 0.
  132. Requires single thread computation for complete reproducibility.
  133. USAGE
  134. exit 1
  135. }
  136. # Check outputs exist, runs at the end of the script
  137. # List of outputs is taken from the usage
  138. function checkOutputExists() {
  139. singleOutputs=( ${OUTPUT_PREFIX}BrainExtractionMask.${OUTPUT_SUFFIX} ${OUTPUT_PREFIX}BrainSegmentation.${OUTPUT_SUFFIX} ${OUTPUT_PREFIX}CorticalThickness.${OUTPUT_SUFFIX} )
  140. singleOutputs=( ${singleOutputs[@]} ${OUTPUT_PREFIX}BrainSegmentationTiledMosaic.png ${OUTPUT_PREFIX}CorticalThicknessTiledMosaic.png )
  141. if [[ -f ${REGISTRATION_TEMPLATE} ]];
  142. then
  143. singleOutputs=( ${singleOutputs[@]} ${REGISTRATION_TEMPLATE_OUTPUT_PREFIX}0GenericAffine.mat ${REGISTRATION_TEMPLATE_OUTPUT_PREFIX}1Warp.${OUTPUT_SUFFIX} ${REGISTRATION_TEMPLATE_OUTPUT_PREFIX}1InverseWarp.${OUTPUT_SUFFIX} ${REGISTRATION_TEMPLATE_OUTPUT_PREFIX}LogJacobian.${OUTPUT_SUFFIX} )
  144. fi
  145. missingOutput=0
  146. for img in $singleOutputs;
  147. do
  148. if [[ ! -f $img ]];
  149. then
  150. echo "Missing output image $img"
  151. missingOutput=1
  152. fi
  153. done
  154. # Now check numbered output, numbers based on images
  155. for (( i = 0; i < ${#ANATOMICAL_IMAGES[@]}; i++ ))
  156. do
  157. if [[ ! -f ${OUTPUT_PREFIX}BrainSegmentation${i}N4.${OUTPUT_SUFFIX} ]];
  158. then
  159. echo "Missing output image ${OUTPUT_PREFIX}BrainSegmentation${i}N4.${OUTPUT_SUFFIX}"
  160. missingOutput=1
  161. fi
  162. done
  163. # Segmentation output depends on the number of priors and the numbering format
  164. segNumWidth=${#GRAY_MATTER_LABEL_FORMAT}
  165. for (( j = 1; j <= ${NUMBER_OF_PRIOR_IMAGES}; j++ ));
  166. do
  167. num=$(printf "%0${segNumWidth}d" $j)
  168. if [[ ! -f ${OUTPUT_PREFIX}BrainSegmentationPosteriors${num}.${OUTPUT_SUFFIX} ]];
  169. then
  170. echo "Missing output image ${OUTPUT_PREFIX}BrainSegmentationPosteriors${num}.${OUTPUT_SUFFIX}"
  171. missingOutput=1
  172. fi
  173. done
  174. if [[ $missingOutput -gt 0 ]];
  175. then
  176. echo "Some of the output does not exist"
  177. return 1
  178. fi
  179. return 0
  180. }
  181. echoParameters() {
  182. cat <<PARAMETERS
  183. Using antsCorticalThickness with the following arguments:
  184. image dimension = ${DIMENSION}
  185. anatomical image = ${ANATOMICAL_IMAGES[@]}
  186. brain template = ${BRAIN_TEMPLATE}
  187. extraction prior = ${EXTRACTION_PRIOR}
  188. extraction reg. mask = ${EXTRACTION_REGISTRATION_MASK}
  189. segmentation prior = ${SEGMENTATION_PRIOR}
  190. output prefix = ${OUTPUT_PREFIX}
  191. output image suffix = ${OUTPUT_SUFFIX}
  192. registration template = ${REGISTRATION_TEMPLATE}
  193. ANTs parameters:
  194. metric = ${ANTS_METRIC}[fixedImage,movingImage,${ANTS_METRIC_PARAMS}]
  195. regularization = ${ANTS_REGULARIZATION}
  196. transformation = ${ANTS_TRANSFORMATION}
  197. max iterations = ${ANTS_MAX_ITERATIONS}
  198. DiReCT parameters:
  199. convergence = ${DIRECT_CONVERGENCE}
  200. thickness prior = ${DIRECT_THICKNESS_PRIOR}
  201. gradient step size = ${DIRECT_GRAD_STEP_SIZE}
  202. smoothing sigma = ${DIRECT_SMOOTHING_PARAMETER}
  203. Other parameters:
  204. run quick = ${RUN_QUICK}
  205. debug mode = ${DEBUG_MODE}
  206. denoise images = ${DENOISE_ANATOMICAL_IMAGES}
  207. float precision = ${USE_FLOAT_PRECISION}
  208. use random seeding = ${USE_RANDOM_SEEDING}
  209. prior combinations = ${PRIOR_COMBINATIONS[@]}
  210. PARAMETERS
  211. }
  212. # Echos a command to stdout, then runs it
  213. # Will immediately exit on error unless you set debug flag here
  214. DEBUG_MODE=0
  215. ACT_STAGE=0 # run all stages
  216. function logCmd() {
  217. cmd="$*"
  218. echo "BEGIN >>>>>>>>>>>>>>>>>>>>"
  219. echo $cmd
  220. $cmd
  221. cmdExit=$?
  222. if [[ $cmdExit -gt 0 ]];
  223. then
  224. echo "ERROR: command exited with nonzero status $cmdExit"
  225. echo "Command: $cmd"
  226. echo
  227. if [[ ! $DEBUG_MODE -gt 0 ]];
  228. then
  229. exit 1
  230. fi
  231. fi
  232. echo "END <<<<<<<<<<<<<<<<<<<<"
  233. echo
  234. echo
  235. return $cmdExit
  236. }
  237. ################################################################################
  238. #
  239. # Main routine
  240. #
  241. ################################################################################
  242. HOSTNAME=`hostname`
  243. DATE=`date`
  244. CURRENT_DIR=`pwd`/
  245. OUTPUT_DIR=${CURRENT_DIR}/tmp$RANDOM/
  246. OUTPUT_PREFIX=${OUTPUT_DIR}/tmp
  247. OUTPUT_SUFFIX="nii.gz"
  248. KEEP_TMP_IMAGES=0
  249. DIMENSION=3
  250. ANATOMICAL_IMAGES=()
  251. REGISTRATION_TEMPLATE=""
  252. DO_REGISTRATION_TO_TEMPLATE=0
  253. USE_RANDOM_SEEDING=1
  254. RUN_QUICK=0
  255. DENOISE_ANATOMICAL_IMAGES=0
  256. BRAIN_TEMPLATE=""
  257. EXTRACTION_PRIOR=""
  258. EXTRACTION_REGISTRATION_MASK=""
  259. SEGMENTATION_PRIOR=""
  260. CORTICAL_LABEL_IMAGE=""
  261. CSF_MATTER_LABEL=1
  262. GRAY_MATTER_LABEL=2
  263. WHITE_MATTER_LABEL=3
  264. DEEP_GRAY_MATTER_LABEL=4
  265. ATROPOS_SEGMENTATION_PRIOR_WEIGHT=0.25
  266. ################################################################################
  267. #
  268. # Programs and their parameters
  269. #
  270. ################################################################################
  271. ANTS=${ANTSPATH}/antsRegistration
  272. ANTS_MAX_ITERATIONS="100x100x70x20"
  273. ANTS_TRANSFORMATION="SyN[0.1,3,0]"
  274. ANTS_LINEAR_METRIC_PARAMS="1,32,Regular,0.25"
  275. ANTS_LINEAR_CONVERGENCE="[1000x500x250x100,1e-8,10]"
  276. ANTS_METRIC="CC"
  277. ANTS_METRIC_PARAMS="1,4"
  278. WARP=${ANTSPATH}/antsApplyTransforms
  279. N4=${ANTSPATH}/N4BiasFieldCorrection
  280. N4_CONVERGENCE_1="[50x50x50x50,0.0000001]"
  281. N4_CONVERGENCE_2="[50x50x50x50,0.0000001]"
  282. N4_SHRINK_FACTOR_1=4
  283. N4_SHRINK_FACTOR_2=2
  284. N4_BSPLINE_PARAMS="[200]"
  285. ATROPOS=${ANTSPATH}/Atropos
  286. ATROPOS_SEGMENTATION_INITIALIZATION="PriorProbabilityImages"
  287. ATROPOS_SEGMENTATION_LIKELIHOOD="Gaussian"
  288. ATROPOS_SEGMENTATION_CONVERGENCE="[5,0.0]"
  289. ATROPOS_SEGMENTATION_POSTERIOR_FORMULATION="Socrates[1]"
  290. ATROPOS_SEGMENTATION_NUMBER_OF_ITERATIONS=3
  291. ATROPOS_SEGMENTATION_INTERNAL_ITERATIONS=5 # to be backward compatible but i like 25
  292. ATROPOS_SEGMENTATION_LABEL_PROPAGATION=()
  293. DIRECT=${ANTSPATH}/KellyKapowski
  294. DIRECT_CONVERGENCE="[45,0.0,10]"
  295. DIRECT_THICKNESS_PRIOR="10"
  296. DIRECT_GRAD_STEP_SIZE="0.025"
  297. DIRECT_SMOOTHING_PARAMETER="1.5"
  298. DIRECT_NUMBER_OF_DIFF_COMPOSITIONS="10"
  299. PRIOR_COMBINATIONS=( 'WM[4]' )
  300. USE_FLOAT_PRECISION=0
  301. USE_BSPLINE_SMOOTHING=0
  302. if [[ $# -lt 3 ]] ; then
  303. Usage >&2
  304. exit 1
  305. else
  306. while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z:" OPT
  307. do
  308. case $OPT in
  309. a) #anatomical t1 image
  310. ANATOMICAL_IMAGES[${#ANATOMICAL_IMAGES[@]}]=$OPTARG
  311. ;;
  312. b) # posterior formulation
  313. ATROPOS_SEGMENTATION_POSTERIOR_FORMULATION=$OPTARG
  314. ;;
  315. c) # prior combinations
  316. PRIOR_COMBINATIONS[${#PRIOR_COMBINATIONS[@]}]=$OPTARG
  317. ;;
  318. d) #dimensions
  319. DIMENSION=$OPTARG
  320. if [[ ${DIMENSION} -gt 3 || ${DIMENSION} -lt 2 ]];
  321. then
  322. echo " Error: ImageDimension must be 2 or 3 "
  323. exit 1
  324. fi
  325. ;;
  326. e) #brain extraction anatomical image
  327. BRAIN_TEMPLATE=$OPTARG
  328. ;;
  329. f) #brain extraction registration mask
  330. EXTRACTION_REGISTRATION_MASK=$OPTARG
  331. ;;
  332. g) # denoise anatomical images
  333. DENOISE_ANATOMICAL_IMAGES=$OPTARG
  334. ;;
  335. h) #help
  336. Usage >&2
  337. exit 0
  338. ;;
  339. i) #max_iterations
  340. ANTS_MAX_ITERATIONS=$OPTARG
  341. ;;
  342. j) #use floating point precision
  343. USE_FLOAT_PRECISION=$OPTARG
  344. ;;
  345. k) #keep tmp images
  346. KEEP_TMP_IMAGES=$OPTARG
  347. ;;
  348. l)
  349. ATROPOS_SEGMENTATION_LABEL_PROPAGATION[${#ATROPOS_SEGMENTATION_LABEL_PROPAGATION[@]}]=$OPTARG
  350. ;;
  351. m) #brain extraction prior probability mask
  352. EXTRACTION_PRIOR=$OPTARG
  353. ;;
  354. n) #atropos segmentation iterations
  355. ATROPOS_SEGMENTATION_NUMBER_OF_ITERATIONS=$OPTARG
  356. ;;
  357. x) #atropos segmentation internal iterations
  358. ATROPOS_SEGMENTATION_INTERNAL_ITERATIONS=$OPTARG
  359. ;;
  360. o) #output prefix
  361. OUTPUT_PREFIX=$OPTARG
  362. ;;
  363. p) #brain segmentation label prior image
  364. SEGMENTATION_PRIOR=$OPTARG
  365. ;;
  366. q) # run quick
  367. RUN_QUICK=$OPTARG
  368. ;;
  369. r) #cortical label image
  370. CORTICAL_LABEL_IMAGE=$OPTARG
  371. ;;
  372. s) #output suffix
  373. OUTPUT_SUFFIX=$OPTARG
  374. ;;
  375. t) #template registration image
  376. REGISTRATION_TEMPLATE=$OPTARG
  377. DO_REGISTRATION_TO_TEMPLATE=1
  378. ;;
  379. u) #use random seeding
  380. USE_RANDOM_SEEDING=$OPTARG
  381. ;;
  382. v) #use b-spline smoothing in registration and direct
  383. USE_BSPLINE_SMOOTHING=$OPTARG
  384. ;;
  385. w) #atropos prior weight
  386. ATROPOS_SEGMENTATION_PRIOR_WEIGHT=$OPTARG
  387. ;;
  388. y) #which stage
  389. ACT_STAGE=$OPTARG
  390. ;;
  391. z) #debug mode
  392. DEBUG_MODE=$OPTARG
  393. ;;
  394. *) # getopts issues an error message
  395. echo "ERROR: unrecognized option -$OPT $OPTARG"
  396. exit 1
  397. ;;
  398. esac
  399. done
  400. fi
  401. if [[ $USE_BSPLINE_SMOOTHING -ne 0 ]];
  402. then
  403. ANTS_TRANSFORMATION="BSplineSyN[0.1,26,0,3]"
  404. DIRECT_SMOOTHING_PARAMETER="5.75"
  405. fi
  406. if [[ $DEBUG_MODE -gt 0 ]];
  407. then
  408. echo " WARNING - Running in test / debug mode. Results will be suboptimal "
  409. OUTPUT_PREFIX="${OUTPUT_PREFIX}testMode_"
  410. # Speed up by doing fewer its. Careful about changing this because
  411. # certain things are hard coded elsewhere, eg number of levels
  412. ANTS_MAX_ITERATIONS="40x40x20x0"
  413. ANTS_LINEAR_CONVERGENCE="[100x100x50x0,1e-8,10]"
  414. ANTS_METRIC_PARAMS="1,2"
  415. # I think this is the number of times we run the whole N4 / Atropos thing, at the cost of about 10 minutes a time
  416. ATROPOS_SEGMENTATION_NUMBER_OF_ITERATIONS=1
  417. ATROPOS_SEGMENTATION_INTERNAL_ITERATIONS=5 # internal to atropos
  418. DIRECT_CONVERGENCE="[5,0.0,10]"
  419. # Fix random seed to replicate exact results on each run
  420. USE_RANDOM_SEEDING=0
  421. fi
  422. ################################################################################
  423. #
  424. # Preliminaries:
  425. # 1. Check existence of inputs
  426. # 2. Figure out output directory and mkdir if necessary
  427. #
  428. ################################################################################
  429. for (( i = 0; i < ${#ANATOMICAL_IMAGES[@]}; i++ ))
  430. do
  431. if [[ ! -f ${ANATOMICAL_IMAGES[$i]} ]];
  432. then
  433. echo "The specified image \"${ANATOMICAL_IMAGES[$i]}\" does not exist."
  434. exit 1
  435. fi
  436. done
  437. FORMAT=${SEGMENTATION_PRIOR}
  438. PREFORMAT=${FORMAT%%\%*}
  439. POSTFORMAT=${FORMAT##*d}
  440. FORMAT=${FORMAT#*\%}
  441. FORMAT=${FORMAT%%d*}
  442. REPCHARACTER=''
  443. TOTAL_LENGTH=0
  444. if [ ${#FORMAT} -eq 2 ]
  445. then
  446. REPCHARACTER=${FORMAT:0:1}
  447. TOTAL_LENGTH=${FORMAT:1:1}
  448. fi
  449. # MAXNUMBER=$(( 10 ** $TOTAL_LENGTH ))
  450. MAXNUMBER=1000
  451. PRIOR_IMAGE_FILENAMES=()
  452. WARPED_PRIOR_IMAGE_FILENAMES=()
  453. BRAIN_SEGMENTATION_OUTPUT=${OUTPUT_PREFIX}BrainSegmentation
  454. SEGMENTATION_WARP_OUTPUT_PREFIX=${BRAIN_SEGMENTATION_OUTPUT}Prior
  455. SEGMENTATION_PRIOR_WARPED=${SEGMENTATION_WARP_OUTPUT_PREFIX}Warped
  456. for (( i = 1; i < $MAXNUMBER; i++ ))
  457. do
  458. NUMBER_OF_REPS=$(( $TOTAL_LENGTH - ${#i} ))
  459. ROOT='';
  460. for(( j=0; j < $NUMBER_OF_REPS; j++ ))
  461. do
  462. ROOT=${ROOT}${REPCHARACTER}
  463. done
  464. FILENAME=${PREFORMAT}${ROOT}${i}${POSTFORMAT}
  465. WARPED_FILENAME=${SEGMENTATION_PRIOR_WARPED}${ROOT}${i}.${OUTPUT_SUFFIX}
  466. if [[ -f $FILENAME ]];
  467. then
  468. PRIOR_IMAGE_FILENAMES=( ${PRIOR_IMAGE_FILENAMES[@]} $FILENAME )
  469. WARPED_PRIOR_IMAGE_FILENAMES=( ${WARPED_PRIOR_IMAGE_FILENAMES[@]} $WARPED_FILENAME )
  470. else
  471. break 1
  472. fi
  473. done
  474. NUMBER_OF_REPS=$(( $TOTAL_LENGTH - ${#DEEP_GRAY_MATTER_LABEL} ))
  475. ROOT='';
  476. for(( j=0; j < $NUMBER_OF_REPS; j++ ))
  477. do
  478. ROOT=${ROOT}${REPCHARACTER}
  479. done
  480. DEEP_GRAY_MATTER_LABEL_FORMAT=${ROOT}${DEEP_GRAY_MATTER_LABEL}
  481. NUMBER_OF_REPS=$(( $TOTAL_LENGTH - ${#WHITE_MATTER_LABEL} ))
  482. ROOT='';
  483. for(( j=0; j < $NUMBER_OF_REPS; j++ ))
  484. do
  485. ROOT=${ROOT}${REPCHARACTER}
  486. done
  487. WHITE_MATTER_LABEL_FORMAT=${ROOT}${WHITE_MATTER_LABEL}
  488. NUMBER_OF_REPS=$(( $TOTAL_LENGTH - ${#GRAY_MATTER_LABEL} ))
  489. ROOT='';
  490. for(( j=0; j < $NUMBER_OF_REPS; j++ ))
  491. do
  492. ROOT=${ROOT}${REPCHARACTER}
  493. done
  494. GRAY_MATTER_LABEL_FORMAT=${ROOT}${GRAY_MATTER_LABEL}
  495. NUMBER_OF_REPS=$(( $TOTAL_LENGTH - ${#CSF_MATTER_LABEL} ))
  496. ROOT='';
  497. for(( j=0; j < $NUMBER_OF_REPS; j++ ))
  498. do
  499. ROOT=${ROOT}${REPCHARACTER}
  500. done
  501. CSF_MATTER_LABEL_FORMAT=${ROOT}${CSF_MATTER_LABEL}
  502. SEGMENTATION_PRIOR_WARPED=${SEGMENTATION_PRIOR_WARPED}\%${FORMAT}d.${OUTPUT_SUFFIX}
  503. NUMBER_OF_PRIOR_IMAGES=${#WARPED_PRIOR_IMAGE_FILENAMES[*]}
  504. if [[ ${NUMBER_OF_PRIOR_IMAGES} -lt 4 ]];
  505. then
  506. echo "Expected at least 4 prior images (${NUMBER_OF_PRIOR_IMAGES} are specified). Check the command line specification."
  507. exit 1
  508. fi
  509. for(( j=0; j < $NUMBER_OF_PRIOR_IMAGES; j++ ))
  510. do
  511. if [[ ! -f ${PRIOR_IMAGE_FILENAMES[$j]} ]];
  512. then
  513. echo "Prior image $j ${PRIOR_IMAGE_FILENAMES[$j]} does not exist."
  514. exit 1
  515. fi
  516. done
  517. # These arrays contain the formatted labels that will be used to combine with the white
  518. # and gray matter posteriors for the cortical thickness section.
  519. CORTICAL_THICKNESS_WHITE_MATTER_OTHER_LABELS=()
  520. CORTICAL_THICKNESS_GRAY_MATTER_OTHER_LABELS=()
  521. for(( j=0; j < ${#PRIOR_COMBINATIONS[@]}; j++ ))
  522. do
  523. echo ${PRIOR_COMBINATIONS[$j]}
  524. COMBINATION=( $( echo ${PRIOR_COMBINATIONS[$j]} | tr "[]," "\n" ) )
  525. echo ${COMBINATION[@]}
  526. if [[ ${COMBINATION[0]} == ${WHITE_MATTER_LABEL} || ${COMBINATION[0]} == 'WM' ]];
  527. then
  528. for(( k=1; k < ${#COMBINATION[@]}; k++ ))
  529. do
  530. OTHER_LABEL=${COMBINATION[$k]}
  531. CORTICAL_THICKNESS_WHITE_MATTER_OTHER_LABELS[${#CORTICAL_THICKNESS_WHITE_MATTER_OTHER_LABELS[@]}]=${OTHER_LABEL}
  532. done
  533. elif [[ ${COMBINATION[0]} == ${GRAY_MATTER_LABEL} || ${COMBINATION[0]} == 'GM' ]];
  534. then
  535. for(( k=1; k < ${#COMBINATION[@]}; k++ ))
  536. do
  537. OTHER_LABEL=${COMBINATION[$k]}
  538. CORTICAL_THICKNESS_GRAY_MATTER_OTHER_LABELS[${#CORTICAL_THICKNESS_GRAY_MATTER_OTHER_LABELS[@]}]=${OTHER_LABEL}
  539. done
  540. else
  541. echo "We only combine with the gray matter or the white matter."
  542. echo "The label ${COMBINATION[0]} does not correspond to the gray or white matters."
  543. exit 1
  544. fi
  545. done
  546. CORTICAL_THICKNESS_GRAY_MATTER_OTHER_LABELS_FORMAT=( $( echo "${CORTICAL_THICKNESS_GRAY_MATTER_OTHER_LABELS_FORMAT[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ' ) )
  547. CORTICAL_THICKNESS_WHITE_MATTER_OTHER_LABELS_FORMAT=( $( echo "${CORTICAL_THICKNESS_WHITE_MATTER_OTHER_LABELS_FORMAT[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ' ) )
  548. if [[ $DO_REGISTRATION_TO_TEMPLATE -eq 1 ]];
  549. then
  550. if [[ ! -f ${REGISTRATION_TEMPLATE} ]]
  551. then
  552. echo "Template for registration, ${REGISTRATION_TEMPLATE}, does not exist."
  553. exit 1
  554. fi
  555. fi
  556. OUTPUT_DIR=${OUTPUT_PREFIX%\/*}
  557. if [[ ! -d $OUTPUT_DIR ]];
  558. then
  559. echo "The output directory \"$OUTPUT_DIR\" does not exist. Making it."
  560. mkdir -p $OUTPUT_DIR
  561. fi
  562. echoParameters >&2
  563. echo "--------------------- Running `basename $0` on $HOSTNAME ---------------------"
  564. time_start=`date +%s`
  565. ################################################################################
  566. #
  567. # Output images
  568. #
  569. ################################################################################
  570. BRAIN_EXTRACTION_MASK=${OUTPUT_PREFIX}BrainExtractionMask.${OUTPUT_SUFFIX}
  571. BRAIN_SEGMENTATION=${OUTPUT_PREFIX}BrainSegmentation.${OUTPUT_SUFFIX}
  572. CORTICAL_THICKNESS_IMAGE=${OUTPUT_PREFIX}CorticalThickness.${OUTPUT_SUFFIX}
  573. ################################################################################
  574. #
  575. # Brain extraction
  576. #
  577. ################################################################################
  578. EXTRACTED_SEGMENTATION_BRAIN=${OUTPUT_PREFIX}BrainExtractionBrain.${OUTPUT_SUFFIX}
  579. EXTRACTION_GENERIC_AFFINE=${OUTPUT_PREFIX}BrainExtractionPrior0GenericAffine.mat
  580. EXTRACTED_BRAIN_TEMPLATE=${OUTPUT_PREFIX}ExtractedTemplateBrain.${OUTPUT_SUFFIX}
  581. if [[ ! -s ${OUTPUT_PREFIX}ACTStage1Complete.txt ]]; then
  582. if [[ ${ACT_STAGE} -eq 0 ]] || [[ ${ACT_STAGE} -eq 1 ]] ; then # BAStages bxt
  583. if [[ ! -f ${BRAIN_EXTRACTION_MASK} ]];
  584. then
  585. if [[ ! -f ${BRAIN_TEMPLATE} ]];
  586. then
  587. echo "The extraction template doesn't exist:"
  588. echo " $BRAIN_TEMPLATE"
  589. exit 1
  590. fi
  591. if [[ ! -f ${EXTRACTION_PRIOR} ]];
  592. then
  593. echo "The brain extraction prior doesn't exist:"
  594. echo " $EXTRACTION_PRIOR"
  595. exit 1
  596. fi
  597. if [[ -f ${EXTRACTION_REGISTRATION_MASK} ]]
  598. then
  599. logCmd ${ANTSPATH}/antsBrainExtraction.sh \
  600. -d ${DIMENSION} \
  601. -a ${ANATOMICAL_IMAGES[0]} \
  602. -e ${BRAIN_TEMPLATE} \
  603. -f ${EXTRACTION_REGISTRATION_MASK} \
  604. -m ${EXTRACTION_PRIOR} \
  605. -o ${OUTPUT_PREFIX} \
  606. -k ${KEEP_TMP_IMAGES} \
  607. -s ${OUTPUT_SUFFIX} \
  608. -q ${USE_FLOAT_PRECISION} \
  609. -u ${USE_RANDOM_SEEDING} \
  610. -z ${DEBUG_MODE}
  611. else
  612. logCmd ${ANTSPATH}/antsBrainExtraction.sh \
  613. -d ${DIMENSION} \
  614. -a ${ANATOMICAL_IMAGES[0]} \
  615. -e ${BRAIN_TEMPLATE} \
  616. -m ${EXTRACTION_PRIOR} \
  617. -o ${OUTPUT_PREFIX} \
  618. -k ${KEEP_TMP_IMAGES} \
  619. -s ${OUTPUT_SUFFIX} \
  620. -q ${USE_FLOAT_PRECISION} \
  621. -u ${USE_RANDOM_SEEDING} \
  622. -z ${DEBUG_MODE}
  623. fi
  624. fi
  625. if [[ ! -f ${EXTRACTED_SEGMENTATION_BRAIN} ]];
  626. then
  627. logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${EXTRACTED_SEGMENTATION_BRAIN} m ${ANATOMICAL_IMAGES[0]} ${BRAIN_EXTRACTION_MASK}
  628. fi
  629. if [[ -f ${BRAIN_TEMPLATE} ]] && [[ ! -f ${EXTRACTED_BRAIN_TEMPLATE} ]];
  630. then
  631. logCmd ${ANTSPATH}/ThresholdImage ${DIMENSION} ${EXTRACTION_PRIOR} ${EXTRACTED_BRAIN_TEMPLATE} 0.1 1.01 1 0
  632. logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${EXTRACTED_BRAIN_TEMPLATE} m ${BRAIN_TEMPLATE} ${EXTRACTED_BRAIN_TEMPLATE}
  633. fi
  634. echo ${OUTPUT_PREFIX}ACTStage1Complete.txt > ${OUTPUT_PREFIX}ACTStage1Complete.txt
  635. fi # BAStages
  636. fi # check completion
  637. ################################################################################
  638. #
  639. # Brain segmentation
  640. #
  641. ################################################################################
  642. SEGMENTATION_WARP=${SEGMENTATION_WARP_OUTPUT_PREFIX}1Warp.nii.gz
  643. SEGMENTATION_INVERSE_WARP=${SEGMENTATION_WARP_OUTPUT_PREFIX}1InverseWarp.nii.gz
  644. SEGMENTATION_GENERIC_AFFINE=${SEGMENTATION_WARP_OUTPUT_PREFIX}0GenericAffine.mat
  645. SEGMENTATION_MASK_DILATED=${BRAIN_SEGMENTATION_OUTPUT}MaskDilated.nii.gz
  646. SEGMENTATION_CONVERGENCE_FILE=${BRAIN_SEGMENTATION_OUTPUT}Convergence.txt
  647. if [[ ! -s ${OUTPUT_PREFIX}ACTStage2Complete.txt ]] && \
  648. [[ -s ${OUTPUT_PREFIX}ACTStage1Complete.txt ]]; then
  649. if [[ ${ACT_STAGE} -eq 0 ]] || [[ ${ACT_STAGE} -eq 2 ]] ; then # BAStages reg
  650. echo
  651. echo "--------------------------------------------------------------------------------------"
  652. echo " Brain segmentation using the following steps:"
  653. echo " 1) Register ${EXTRACTED_BRAIN_TEMPLATE} and ${SEGMENTATION_PRIOR} to ${ANATOMICAL_IMAGES[0]}"
  654. echo " 2) Warp priors to ${ANATOMICAL_IMAGES[0]}"
  655. echo " 3) N-tissue segmentation using Atropos and N4"
  656. echo "--------------------------------------------------------------------------------------"
  657. echo
  658. time_start_brain_registration=`date +%s`
  659. # Check to see if the warped priors exist. If so, we don't need to warp
  660. # the template and priors to the individual subject.
  661. WARPED_PRIORS_ALREADY_EXIST=1;
  662. for (( i = 0; i < ${NUMBER_OF_PRIOR_IMAGES}; i++ ))
  663. do
  664. if [[ ! -f ${WARPED_PRIOR_IMAGE_FILENAMES[$i]} ]];
  665. then
  666. WARPED_PRIORS_ALREADY_EXIST=0
  667. break
  668. fi
  669. done
  670. TMP_FILES=()
  671. if [[ $WARPED_PRIORS_ALREADY_EXIST -eq 0 ]]
  672. then
  673. # Check inputs
  674. if [[ ! -f ${EXTRACTED_BRAIN_TEMPLATE} ]];
  675. then
  676. echo "The segmentation template doesn't exist:"
  677. echo " ${EXTRACTED_BRAIN_TEMPLATE}"
  678. rm ${OUTPUT_PREFIX}ACTStage1Complete.txt
  679. exit 1
  680. fi
  681. if [[ ! -f ${EXTRACTED_SEGMENTATION_BRAIN} ]];
  682. then
  683. echo "The extracted brain doesn't exist:"
  684. echo " ${EXTRACTED_SEGMENTATION_BRAIN}"
  685. rm ${OUTPUT_PREFIX}ACTStage1Complete.txt
  686. exit 1
  687. fi
  688. if [[ ! -f ${BRAIN_EXTRACTION_MASK} ]];
  689. then
  690. echo "The brain extraction mask does not exist:"
  691. echo " ${BRAIN_EXTRACTION_MASK}"
  692. rm ${OUTPUT_PREFIX}ACTStage1Complete.txt
  693. exit 1
  694. fi
  695. if [[ ! -f ${SEGMENTATION_WARP} ]];
  696. then
  697. logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${SEGMENTATION_MASK_DILATED} MD ${BRAIN_EXTRACTION_MASK} 20
  698. basecall=''
  699. if [[ ${RUN_QUICK} -ne 0 ]];
  700. then
  701. TMP_FILES=( ${TMP_FILES[@]} "${SEGMENTATION_WARP_OUTPUT_PREFIX}Warped.nii.gz" )
  702. basecall="${ANTSPATH}/antsRegistrationSyNQuick.sh -d ${DIMENSION} -f ${EXTRACTED_SEGMENTATION_BRAIN}"
  703. basecall="${basecall} -m ${EXTRACTED_BRAIN_TEMPLATE} -o ${SEGMENTATION_WARP_OUTPUT_PREFIX} -j 1"
  704. if [[ ${USE_FLOAT_PRECISION} -ne 0 ]];
  705. then
  706. basecall="${basecall} -p f"
  707. fi
  708. else
  709. basecall="${ANTS} -d ${DIMENSION} -u 1 -w [0.01,0.99] -o ${SEGMENTATION_WARP_OUTPUT_PREFIX} --float ${USE_FLOAT_PRECISION} --verbose 1"
  710. IMAGES="${EXTRACTED_SEGMENTATION_BRAIN},${EXTRACTED_BRAIN_TEMPLATE}"
  711. if [[ -f ${EXTRACTION_GENERIC_AFFINE} ]];
  712. then
  713. basecall="${basecall} -r [${EXTRACTION_GENERIC_AFFINE},1]"
  714. else
  715. basecall="${basecall} -r [${IMAGES},1]"
  716. fi
  717. basecall="${basecall} -x [${SEGMENTATION_MASK_DILATED}]"
  718. stage1="-m MI[${IMAGES},${ANTS_LINEAR_METRIC_PARAMS}] -c ${ANTS_LINEAR_CONVERGENCE} -t Affine[0.1] -f 8x4x2x1 -s 4x2x1x0"
  719. stage2="-m CC[${IMAGES},1,4] -c [${ANTS_MAX_ITERATIONS},1e-9,15] -t ${ANTS_TRANSFORMATION} -f 6x4x2x1 -s 3x2x1x0"
  720. basecall="${basecall} ${stage1} ${stage2}"
  721. fi
  722. exe_brain_segmentation_1=${basecall}
  723. # Precision errors in .nii (which stores things as float) headers can cause problems, so attempt to make everything consistent.
  724. # Won't be perfectly consistent because we don't change ${ANATOMICAL_IMAGES[0]} and CopyImageHeaderInformation does not make
  725. # a perfect copy. But hopefully close enough
  726. for img in ${BRAIN_EXTRACTION_MASK} ${EXTRACTED_SEGMENTATION_BRAIN} ${SEGMENTATION_MASK_DILATED};
  727. do
  728. logCmd ${ANTSPATH}/CopyImageHeaderInformation ${ANATOMICAL_IMAGES[0]} ${img} ${img} 1 1 1
  729. done
  730. logCmd $exe_brain_segmentation_1
  731. fi
  732. ## check to see if the output registration transforms exist
  733. if [[ ! -f ${SEGMENTATION_GENERIC_AFFINE} ]];
  734. then
  735. echo "The registration component of the segmentation step didn't complete properly."
  736. echo "The transform file ${SEGMENTATION_GENERIC_AFFINE} does not exist."
  737. exit 1
  738. fi
  739. if [[ ! -f ${SEGMENTATION_WARP} ]];
  740. then
  741. echo "The registration component of the segmentation step didn't complete properly."
  742. echo "The transform file ${SEGMENTATION_WARP} does not exist."
  743. exit 1
  744. fi
  745. ## Step 2 ##
  746. for (( i = 0; i < ${NUMBER_OF_PRIOR_IMAGES}; i++ ))
  747. do
  748. if [[ ! -f ${PRIOR_IMAGE_FILENAMES[$i]} ]];
  749. then
  750. echo "The prior image file name does not exist:"
  751. echo " ${PRIOR_IMAGE_FILENAMES[$i]}"
  752. exit 1
  753. fi
  754. exe_brain_segmentation_2="${WARP} -d ${DIMENSION} -i ${PRIOR_IMAGE_FILENAMES[$i]} -o ${WARPED_PRIOR_IMAGE_FILENAMES[$i]} -r ${ANATOMICAL_IMAGES[0]} -n Gaussian -t ${SEGMENTATION_WARP} -t ${SEGMENTATION_GENERIC_AFFINE} --float ${USE_FLOAT_PRECISION} --verbose 1"
  755. logCmd $exe_brain_segmentation_2
  756. done
  757. fi
  758. echo ${OUTPUT_PREFIX}ACTStage2Complete.txt > ${OUTPUT_PREFIX}ACTStage2Complete.txt
  759. time_end_brain_registration=`date +%s`
  760. time_elapsed_brain_registration=$((time_end_brain_registration - time_start_brain_registration))
  761. echo
  762. echo "--------------------------------------------------------------------------------------"
  763. echo " Done with brain registration: $(( time_elapsed_brain_segmentation / 3600 ))h $(( time_elapsed_brain_registration %3600 / 60 ))m $(( time_elapsed_brain_registration % 60 ))s"
  764. echo "--------------------------------------------------------------------------------------"
  765. echo
  766. fi # BAStages check reg
  767. fi # BAStages check reg
  768. # We do two stages of antsAtroposN4. The first stage is to get a good N4
  769. # bias corrected image(s). This bias corrected image(s) is used as input to the
  770. # second stage where we only do 2 iterations.
  771. if [[ ! -s ${OUTPUT_PREFIX}ACTStage3Complete.txt ]] && \
  772. [[ -s ${OUTPUT_PREFIX}ACTStage2Complete.txt ]] && \
  773. [[ -s ${OUTPUT_PREFIX}ACTStage1Complete.txt ]] ; then
  774. if [[ ${ACT_STAGE} -eq 0 ]] || [[ ${ACT_STAGE} -eq 3 ]] ; then # BAStages seg
  775. time_start_brain_segmentation=`date +%s`
  776. ATROPOS_ANATOMICAL_IMAGES_COMMAND_LINE='';
  777. for (( j = 0; j < ${#ANATOMICAL_IMAGES[@]}; j++ ))
  778. do
  779. ATROPOS_ANATOMICAL_IMAGES_COMMAND_LINE="${ATROPOS_ANATOMICAL_IMAGES_COMMAND_LINE} -a ${ANATOMICAL_IMAGES[$j]}"
  780. done
  781. ATROPOS_LABEL_PROPAGATION_COMMAND_LINE=''
  782. for (( j = 0; j < ${#ATROPOS_SEGMENTATION_LABEL_PROPAGATION[@]}; j++ ))
  783. do
  784. ATROPOS_LABEL_PROPAGATION_COMMAND_LINE="${ATROPOS_LABEL_PROPAGATION_COMMAND_LINE} -l ${ATROPOS_SEGMENTATION_LABEL_PROPAGATION[$j]}";
  785. done
  786. # include everything but the csf
  787. N4_INCLUDE_PRIORS_COMMAND_LINE=''
  788. for (( j = 2; j <= ${NUMBER_OF_PRIOR_IMAGES}; j++ ))
  789. do
  790. N4_INCLUDE_PRIORS_COMMAND_LINE="${N4_INCLUDE_PRIORS_COMMAND_LINE} -y $j";
  791. done
  792. logCmd ${ANTSPATH}/antsAtroposN4.sh \
  793. -d ${DIMENSION} \
  794. -b ${ATROPOS_SEGMENTATION_POSTERIOR_FORMULATION} \
  795. ${ATROPOS_ANATOMICAL_IMAGES_COMMAND_LINE} \
  796. ${ATROPOS_LABEL_PROPAGATION_COMMAND_LINE} \
  797. -x ${BRAIN_EXTRACTION_MASK} \
  798. -m ${ATROPOS_SEGMENTATION_NUMBER_OF_ITERATIONS} \
  799. -n ${ATROPOS_SEGMENTATION_INTERNAL_ITERATIONS} \
  800. -c ${NUMBER_OF_PRIOR_IMAGES} \
  801. ${N4_INCLUDE_PRIORS_COMMAND_LINE} \
  802. -p ${SEGMENTATION_PRIOR_WARPED} \
  803. -w ${ATROPOS_SEGMENTATION_PRIOR_WEIGHT} \
  804. -o ${OUTPUT_PREFIX}Brain \
  805. -u ${USE_RANDOM_SEEDING} \
  806. -g ${DENOISE_ANATOMICAL_IMAGES} \
  807. -k ${KEEP_TMP_IMAGES} \
  808. -s ${OUTPUT_SUFFIX} \
  809. -z ${DEBUG_MODE}
  810. ATROPOS_ANATOMICAL_IMAGES_COMMAND_LINE=''
  811. for (( j = 0; j < ${#ANATOMICAL_IMAGES[@]}; j++ ))
  812. do
  813. ATROPOS_ANATOMICAL_IMAGES_COMMAND_LINE="${ATROPOS_ANATOMICAL_IMAGES_COMMAND_LINE} -a ${OUTPUT_PREFIX}BrainSegmentation${j}N4.${OUTPUT_SUFFIX}";
  814. done
  815. logCmd ${ANTSPATH}/antsAtroposN4.sh \
  816. -d ${DIMENSION} \
  817. -b ${ATROPOS_SEGMENTATION_POSTERIOR_FORMULATION} \
  818. ${ATROPOS_ANATOMICAL_IMAGES_COMMAND_LINE} \
  819. ${ATROPOS_LABEL_PROPAGATION_COMMAND_LINE} \
  820. -x ${BRAIN_EXTRACTION_MASK} \
  821. -m 2 \
  822. -n ${ATROPOS_SEGMENTATION_INTERNAL_ITERATIONS} \
  823. -c ${NUMBER_OF_PRIOR_IMAGES} \
  824. ${N4_INCLUDE_PRIORS_COMMAND_LINE} \
  825. -p ${SEGMENTATION_PRIOR_WARPED} \
  826. -w ${ATROPOS_SEGMENTATION_PRIOR_WEIGHT} \
  827. -o ${OUTPUT_PREFIX}Brain \
  828. -u ${USE_RANDOM_SEEDING} \
  829. -g ${DENOISE_ANATOMICAL_IMAGES} \
  830. -k ${KEEP_TMP_IMAGES} \
  831. -s ${OUTPUT_SUFFIX} \
  832. -z ${DEBUG_MODE}
  833. ## Step 3 ###
  834. TMP_FILES=( ${TMP_FILES[@]} $EXTRACTION_GENERIC_AFFINE $EXTRACTED_SEGMENTATION_BRAIN $SEGMENTATION_MASK_DILATED $EXTRACTED_BRAIN_TEMPLATE )
  835. TMP_FILES=( ${TMP_FILES[@]} ${WARPED_PRIOR_IMAGE_FILENAMES[@]} )
  836. if [[ $TEMPLATES_ARE_IDENTICAL -eq 0 ]];
  837. then
  838. TMP_FILES=( ${TMP_FILES[@]} $SEGMENTATION_WARP $SEGMENTATION_INVERSE_WARP $SEGMENTATION_GENERIC_AFFINE )
  839. fi
  840. if [[ $KEEP_TMP_IMAGES -eq 0 ]];
  841. then
  842. for f in ${TMP_FILES[@]}
  843. do
  844. if [[ -e $f ]];
  845. then
  846. logCmd rm $f
  847. else
  848. echo "WARNING: expected temp file doesn't exist: $f"
  849. fi
  850. done
  851. fi
  852. time_end_brain_segmentation=`date +%s`
  853. time_elapsed_brain_segmentation=$((time_end_brain_segmentation - time_start_brain_segmentation))
  854. echo
  855. echo "--------------------------------------------------------------------------------------"
  856. echo " Done with brain segmentation: $(( time_elapsed_brain_segmentation / 3600 ))h $(( time_elapsed_brain_segmentation %3600 / 60 ))m $(( time_elapsed_brain_segmentation % 60 ))s"
  857. echo "--------------------------------------------------------------------------------------"
  858. echo
  859. echo ${OUTPUT_PREFIX}ACTStage3Complete.txt > ${OUTPUT_PREFIX}ACTStage3Complete.txt
  860. fi
  861. fi # BAStages seg
  862. ################################################################################
  863. #
  864. # Registration to a template
  865. #
  866. ################################################################################
  867. # These affect output; keep them consistent with usage and checkOutputExists function
  868. REGISTRATION_TEMPLATE_OUTPUT_PREFIX=${OUTPUT_PREFIX}SubjectToTemplate
  869. REGISTRATION_TEMPLATE_GENERIC_AFFINE=${REGISTRATION_TEMPLATE_OUTPUT_PREFIX}0GenericAffine.mat
  870. REGISTRATION_TEMPLATE_WARP=${REGISTRATION_TEMPLATE_OUTPUT_PREFIX}1Warp.${OUTPUT_SUFFIX}
  871. REGISTRATION_TEMPLATE_INVERSE_WARP=${REGISTRATION_TEMPLATE_OUTPUT_PREFIX}1InverseWarp.${OUTPUT_SUFFIX}
  872. REGISTRATION_LOG_JACOBIAN=${REGISTRATION_TEMPLATE_OUTPUT_PREFIX}LogJacobian.${OUTPUT_SUFFIX}
  873. # Want to have transforms for both directions
  874. REGISTRATION_SUBJECT_OUTPUT_PREFIX=${OUTPUT_PREFIX}TemplateToSubject
  875. REGISTRATION_SUBJECT_GENERIC_AFFINE=${REGISTRATION_SUBJECT_OUTPUT_PREFIX}1GenericAffine.mat
  876. REGISTRATION_SUBJECT_WARP=${REGISTRATION_SUBJECT_OUTPUT_PREFIX}0Warp.${OUTPUT_SUFFIX}
  877. # Use first N4 corrected segmentation image, which we assume to be T1
  878. HEAD_N4_IMAGE=${OUTPUT_PREFIX}BrainSegmentation0N4.${OUTPUT_SUFFIX}
  879. EXTRACTED_SEGMENTATION_BRAIN_N4_IMAGE=${OUTPUT_PREFIX}ExtractedBrain0N4.nii.gz
  880. if [[ ! -s ${OUTPUT_PREFIX}ACTStage4Complete.txt ]] && \
  881. [[ -s ${OUTPUT_PREFIX}ACTStage3Complete.txt ]] && \
  882. [[ -s ${OUTPUT_PREFIX}ACTStage2Complete.txt ]] && \
  883. [[ -s ${OUTPUT_PREFIX}ACTStage1Complete.txt ]] ; then
  884. if [[ ${ACT_STAGE} -eq 0 ]] || [[ ${ACT_STAGE} -eq 4 ]] ; then # BAStages reg
  885. if [[ -f ${REGISTRATION_TEMPLATE} ]] && [[ ! -f $REGISTRATION_LOG_JACOBIAN ]];
  886. then
  887. TMP_FILES=()
  888. echo
  889. echo "--------------------------------------------------------------------------------------"
  890. echo " Registration brain masked ${HEAD_N4_IMAGE} to ${REGISTRATION_TEMPLATE} "
  891. echo "--------------------------------------------------------------------------------------"
  892. echo
  893. logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${EXTRACTED_SEGMENTATION_BRAIN_N4_IMAGE} m ${HEAD_N4_IMAGE} ${BRAIN_EXTRACTION_MASK}
  894. TMP_FILES=( ${TMP_FILES[@]} ${EXTRACTED_SEGMENTATION_BRAIN_N4_IMAGE} )
  895. time_start_template_registration=`date +%s`
  896. basecall=''
  897. if [[ ${RUN_QUICK} -ne 0 ]];
  898. then
  899. TMP_FILES=( ${TMP_FILES[@]} "${REGISTRATION_TEMPLATE_OUTPUT_PREFIX}Warped.nii.gz" )
  900. basecall="${ANTSPATH}/antsRegistrationSyNQuick.sh -d ${DIMENSION} -f ${REGISTRATION_TEMPLATE}"
  901. basecall="${basecall} -m ${EXTRACTED_SEGMENTATION_BRAIN_N4_IMAGE} -o ${REGISTRATION_TEMPLATE_OUTPUT_PREFIX} -j 1"
  902. if [[ ${USE_FLOAT_PRECISION} -ne 0 ]];
  903. then
  904. basecall="${basecall} -p f"
  905. fi
  906. else
  907. IMAGES="${REGISTRATION_TEMPLATE},${EXTRACTED_SEGMENTATION_BRAIN_N4_IMAGE}"
  908. basecall="${ANTS} -d ${DIMENSION} -v 1 -u 1 -w [0.01,0.99] -o ${REGISTRATION_TEMPLATE_OUTPUT_PREFIX} -r [${IMAGES},1] --float ${USE_FLOAT_PRECISION}"
  909. stage1="-m MI[${IMAGES},${ANTS_LINEAR_METRIC_PARAMS}] -c ${ANTS_LINEAR_CONVERGENCE} -t Rigid[0.1] -f 8x4x2x1 -s 3x2x1x0"
  910. stage2="-m MI[${IMAGES},${ANTS_LINEAR_METRIC_PARAMS}] -c ${ANTS_LINEAR_CONVERGENCE} -t Affine[0.1] -f 8x4x2x1 -s 3x2x1x0"
  911. stage3="-m CC[${IMAGES},1,4] -c [${ANTS_MAX_ITERATIONS},1e-9,15] -t ${ANTS_TRANSFORMATION} -f 6x4x2x1 -s 3x2x1x0"
  912. basecall="${basecall} ${stage1} ${stage2} ${stage3}"
  913. fi
  914. exe_template_registration_1="${basecall}"
  915. if [[ ! -f ${REGISTRATION_TEMPLATE_WARP} ]];
  916. then
  917. logCmd $exe_template_registration_1
  918. fi
  919. ## check to see if the output registration transforms exist
  920. if [[ ! -f ${REGISTRATION_TEMPLATE_GENERIC_AFFINE} ]];
  921. then
  922. echo "The registration component of the segmentation step didn't complete properly."
  923. echo "The transform file ${REGISTRATION_TEMPLATE_GENERIC_AFFINE} does not exist."
  924. exit 1
  925. fi
  926. if [[ ! -f ${REGISTRATION_TEMPLATE_WARP} ]];
  927. then
  928. echo "The registration component of the segmentation step didn't complete properly."
  929. echo "The transform file ${REGISTRATION_TEMPLATE_WARP} does not exist."
  930. exit 1
  931. fi
  932. ## Create symmetric transforms for template to subject warping
  933. if [[ -s ${REGISTRATION_TEMPLATE_INVERSE_WARP} ]] && [[ ! -s ${REGISTRATION_SUBJECT_WARP} ]] ; then
  934. logCmd mv ${REGISTRATION_TEMPLATE_INVERSE_WARP} ${REGISTRATION_SUBJECT_WARP}
  935. fi
  936. if [[ ! -s ${REGISTRATION_SUBJECT_WARP} ]] ; then
  937. echo "The transform file ${REGISTRATION_SUBJECT_WARP} does not exist."
  938. exit 1
  939. fi
  940. logCmd ${ANTSPATH}/antsApplyTransforms -d ${DIMENSION} -o Linear[$REGISTRATION_SUBJECT_GENERIC_AFFINE,1] -t $REGISTRATION_TEMPLATE_GENERIC_AFFINE --verbose 1
  941. time_end_template_registration=`date +%s`
  942. time_elapsed_template_registration=$((time_end_template_registration - time_start_template_registration))
  943. echo
  944. echo "--------------------------------------------------------------------------------------"
  945. echo " Done with registration: $(( time_elapsed_template_registration / 3600 ))h $(( time_elapsed_template_registration %3600 / 60 ))m $(( time_elapsed_template_registration % 60 ))s"
  946. echo "--------------------------------------------------------------------------------------"
  947. echo
  948. if [[ $KEEP_TMP_IMAGES -eq 0 ]];
  949. then
  950. for f in ${TMP_FILES[@]}
  951. do
  952. if [[ -e $f ]];
  953. then
  954. logCmd rm $f
  955. else
  956. echo "WARNING: expected temp file doesn't exist: $f"
  957. fi
  958. done
  959. fi
  960. logCmd ${ANTSPATH}/CreateJacobianDeterminantImage ${DIMENSION} ${REGISTRATION_TEMPLATE_WARP} ${REGISTRATION_LOG_JACOBIAN} 1 1
  961. fi # if registration template & jacobian check
  962. if [[ -s ${REGISTRATION_LOG_JACOBIAN} ]] ; then
  963. echo ${OUTPUT_PREFIX}ACTStage4Complete.txt > ${OUTPUT_PREFIX}ACTStage4Complete.txt
  964. fi
  965. fi # BAStages
  966. fi # check completion
  967. ################################################################################
  968. #
  969. # Cortical thickness
  970. #
  971. ################################################################################
  972. BRAIN_SEGMENTATION_GM=${BRAIN_SEGMENTATION_OUTPUT}Posteriors${GRAY_MATTER_LABEL_FORMAT}.${OUTPUT_SUFFIX}
  973. BRAIN_SEGMENTATION_WM=${BRAIN_SEGMENTATION_OUTPUT}Posteriors${WHITE_MATTER_LABEL_FORMAT}.${OUTPUT_SUFFIX}
  974. BRAIN_SEGMENTATION_DEEP_GM=${BRAIN_SEGMENTATION_OUTPUT}Posteriors${DEEP_GRAY_MATTER_LABEL_FORMAT}.${OUTPUT_SUFFIX}
  975. CORTICAL_THICKNESS_GM=${OUTPUT_PREFIX}CorticalThicknessPosteriors${GRAY_MATTER_LABEL_FORMAT}.${OUTPUT_SUFFIX}
  976. CORTICAL_THICKNESS_WM=${OUTPUT_PREFIX}CorticalThicknessPosteriors${WHITE_MATTER_LABEL_FORMAT}.${OUTPUT_SUFFIX}
  977. CORTICAL_THICKNESS_SEGMENTATION=${OUTPUT_PREFIX}CorticalThicknessSegmentation.${OUTPUT_SUFFIX}
  978. CORTICAL_THICKNESS_GM_SEGMENTATION=${OUTPUT_PREFIX}CorticalThicknessGMSegmentation.${OUTPUT_SUFFIX}
  979. CORTICAL_LABEL_THICKNESS_PRIOR=${OUTPUT_PREFIX}CorticalLabelThicknessPrior.${OUTPUT_SUFFIX}
  980. if [[ ! -s ${OUTPUT_PREFIX}ACTStage5Complete.txt ]] && \
  981. [[ -s ${OUTPUT_PREFIX}ACTStage3Complete.txt ]] && \
  982. [[ -s ${OUTPUT_PREFIX}ACTStage2Complete.txt ]] && \
  983. [[ -s ${OUTPUT_PREFIX}ACTStage1Complete.txt ]] ; then
  984. if [[ ${ACT_STAGE} -eq 0 ]] || [[ ${ACT_STAGE} -eq 5 ]] ; then # BAStages thk
  985. if [[ ! -f ${CORTICAL_THICKNESS_IMAGE} ]];
  986. then
  987. echo
  988. echo "--------------------------------------------------------------------------------------"
  989. echo " Cortical thickness using DiReCT (KellyKapowski)"
  990. echo "--------------------------------------------------------------------------------------"
  991. echo
  992. # combine posteriors
  993. logCmd cp ${BRAIN_SEGMENTATION_GM} ${CORTICAL_THICKNESS_GM}
  994. for(( i=0; i < ${#CORTICAL_THICKNESS_GRAY_MATTER_OTHER_LABELS[@]}; i++ ))
  995. do
  996. OTHER_LABEL=${CORTICAL_THICKNESS_GRAY_MATTER_OTHER_LABELS[$i]}
  997. NUMBER_OF_REPS=$(( $TOTAL_LENGTH - ${#OTHER_LABEL} ))
  998. ROOT='';
  999. for(( l=0; l < $NUMBER_OF_REPS; l++ ))
  1000. do
  1001. ROOT=${ROOT}${REPCHARACTER}
  1002. done
  1003. OTHER_LABEL_FORMAT=${ROOT}${OTHER_LABEL}
  1004. BRAIN_SEGMENTATION_OTHER_LABEL=${BRAIN_SEGMENTATION_OUTPUT}Posteriors${OTHER_LABEL_FORMAT}.${OUTPUT_SUFFIX}
  1005. logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${CORTICAL_THICKNESS_GM} + ${CORTICAL_THICKNESS_GM} ${BRAIN_SEGMENTATION_OTHER_LABEL}
  1006. logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${CORTICAL_THICKNESS_SEGMENTATION} ReplaceVoxelValue ${BRAIN_SEGMENTATION} ${OTHER_LABEL} ${OTHER_LABEL} ${GRAY_MATTER_LABEL}
  1007. done
  1008. logCmd cp ${BRAIN_SEGMENTATION_WM} ${CORTICAL_THICKNESS_WM}
  1009. for(( i=0; i < ${#CORTICAL_THICKNESS_WHITE_MATTER_OTHER_LABELS[@]}; i++ ))
  1010. do
  1011. OTHER_LABEL=${CORTICAL_THICKNESS_WHITE_MATTER_OTHER_LABELS[$i]}
  1012. NUMBER_OF_REPS=$(( $TOTAL_LENGTH - ${#OTHER_LABEL} ))
  1013. ROOT='';
  1014. for(( l=0; l < $NUMBER_OF_REPS; l++ ))
  1015. do
  1016. ROOT=${ROOT}${REPCHARACTER}
  1017. done
  1018. OTHER_LABEL_FORMAT=${ROOT}${OTHER_LABEL}
  1019. BRAIN_SEGMENTATION_OTHER_LABEL=${BRAIN_SEGMENTATION_OUTPUT}Posteriors${OTHER_LABEL_FORMAT}.${OUTPUT_SUFFIX}
  1020. logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${CORTICAL_THICKNESS_WM} + ${CORTICAL_THICKNESS_WM} ${BRAIN_SEGMENTATION_OTHER_LABEL}
  1021. logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${CORTICAL_THICKNESS_SEGMENTATION} ReplaceVoxelValue ${BRAIN_SEGMENTATION} ${OTHER_LABEL} ${OTHER_LABEL} ${WHITE_MATTER_LABEL}
  1022. done
  1023. # Check inputs
  1024. if [[ ! -f ${CORTICAL_THICKNESS_SEGMENTATION} ]];
  1025. then
  1026. echo "The brain segmentation image doesn't exist:"
  1027. echo " $CORTICAL_THICKNESS_SEGMENTATION"
  1028. exit 1
  1029. fi
  1030. if [[ ! -f ${CORTICAL_THICKNESS_GM} ]];
  1031. then
  1032. echo "The cortical gray matter probability image doesn't exist:"
  1033. echo " $CORTICAL_THICKNESS_GM"
  1034. exit 1
  1035. fi
  1036. if [[ ! -f ${CORTICAL_THICKNESS_WM} ]]
  1037. then
  1038. echo "The cortical white matter probability image doesn't exist:"
  1039. echo " $CORTICAL_THICKNESS_WM"
  1040. exit 1
  1041. fi
  1042. time_start_direct=`date +%s`
  1043. TMP_FILES=( $CORTICAL_THICKNESS_GM $CORTICAL_THICKNESS_WM $CORTICAL_THICKNESS_SEGMENTATION )
  1044. exe_direct="${DIRECT} -d ${DIMENSION} -s [${CORTICAL_THICKNESS_SEGMENTATION},${GRAY_MATTER_LABEL},${WHITE_MATTER_LABEL}] --verbose 1"
  1045. exe_direct="${exe_direct} -g ${CORTICAL_THICKNESS_GM} -w ${CORTICAL_THICKNESS_WM} -o ${CORTICAL_THICKNESS_IMAGE}"
  1046. exe_direct="${exe_direct} -c ${DIRECT_CONVERGENCE} -r ${DIRECT_GRAD_STEP_SIZE}"
  1047. exe_direct="${exe_direct} -m ${DIRECT_SMOOTHING_PARAMETER} -n ${DIRECT_NUMBER_OF_DIFF_COMPOSITIONS} -b ${USE_BSPLINE_SMOOTHING}"
  1048. if [[ -f ${CORTICAL_LABEL_IMAGE} ]] && [[ -f $REGISTRATION_SUBJECT_WARP ]] && [[ -f $REGISTRATION_SUBJECT_GENERIC_AFFINE ]] ;
  1049. then
  1050. # Calculate ATITH and multiply by a heuristically derived scalar factor
  1051. # logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${CORTICAL_LABEL_THICKNESS_PRIOR} LabelThickness2 ${CORTICAL_LABEL_IMAGE}
  1052. # logCmd ${ANTSPATH}/ThresholdImage ${DIMENSION} ${CORTICAL_THICKNESS_SEGMENTATION} ${CORTICAL_THICKNESS_GM_SEGMENTATION} 2 2 1 0
  1053. # logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${CORTICAL_LABEL_THICKNESS_PRIOR} m ${CORTICAL_LABEL_THICKNESS_PRIOR} ${CORTICAL_THICKNESS_GM_SEGMENTATION}
  1054. # logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${CORTICAL_LABEL_THICKNESS_PRIOR} m ${CORTICAL_LABEL_THICKNESS_PRIOR} 2.0
  1055. logCmd ${ANTSPATH}/antsApplyTransforms -d ${DIMENSION} -i ${CORTICAL_LABEL_IMAGE} -o ${CORTICAL_LABEL_THICKNESS_PRIOR} \
  1056. -t $REGISTRATION_SUBJECT_GENERIC_AFFINE -t $REGISTRATION_SUBJECT_WARP -r ${ANATOMICAL_IMAGES[0]} --verbose 1
  1057. exe_direct="${exe_direct} -a ${CORTICAL_LABEL_THICKNESS_PRIOR}"
  1058. TMP_FILES=( ${TMP_FILES[@]} $CORTICAL_LABEL_THICKNESS_PRIOR ${CORTICAL_THICKNESS_GM_SEGMENTATION} )
  1059. else
  1060. exe_direct="${exe_direct} -t ${DIRECT_THICKNESS_PRIOR}"
  1061. fi
  1062. logCmd $exe_direct
  1063. if [[ $KEEP_TMP_IMAGES -eq 0 ]];
  1064. then
  1065. for f in ${TMP_FILES[@]}
  1066. do
  1067. if [[ -e $f ]];
  1068. then
  1069. logCmd rm $f
  1070. else
  1071. echo "WARNING: expected temp file doesn't exist: $f"
  1072. fi
  1073. done
  1074. fi
  1075. if [[ ! -f ${CORTICAL_THICKNESS_IMAGE} ]];
  1076. then
  1077. echo "Expected output was not produced. The cortical thickness image doesn't exist:"
  1078. echo " $CORTICAL_THICKNESS_IMAGE"
  1079. exit 1
  1080. fi
  1081. time_end_direct=`date +%s`
  1082. time_elapsed_direct=$((time_end_direct - time_start_direct))
  1083. echo
  1084. echo "--------------------------------------------------------------------------------------"
  1085. echo " Done with cortical thickness estimation: $(( time_elapsed_direct / 3600 ))h $(( time_elapsed_direct %3600 / 60 ))m $(( time_elapsed_direct % 60 ))s"
  1086. echo "--------------------------------------------------------------------------------------"
  1087. echo
  1088. fi
  1089. echo ${OUTPUT_PREFIX}ACTStage5Complete.txt > ${OUTPUT_PREFIX}ACTStage5Complete.txt
  1090. fi # BAStages
  1091. fi # check completion
  1092. #### BA Edits Begin ####
  1093. if [[ ! -s ${OUTPUT_PREFIX}ACTStage6Complete.txt ]] && \
  1094. [[ -s ${OUTPUT_PREFIX}ACTStage5Complete.txt ]] && \
  1095. [[ -s ${OUTPUT_PREFIX}ACTStage3Complete.txt ]] && \
  1096. [[ -s ${OUTPUT_PREFIX}ACTStage2Complete.txt ]] && \
  1097. [[ -s ${OUTPUT_PREFIX}ACTStage1Complete.txt ]] ; then
  1098. if [[ ${ACT_STAGE} -eq 0 ]] || [[ ${ACT_STAGE} -eq 6 ]] ; then # BAStages qc
  1099. echo "--------------------------------------------------------------------------------------"
  1100. echo "Compute summary measurements"
  1101. echo "--------------------------------------------------------------------------------------"
  1102. if [[ ! -s ${OUTPUT_PREFIX}CorticalThickness.nii.gz ]] ; then
  1103. echo ${OUTPUT_PREFIX}CorticalThickness.nii.gz incomplete!
  1104. exit 1
  1105. fi
  1106. if [[ -f ${REGISTRATION_TEMPLATE_WARP} ]];
  1107. then
  1108. exe_template_registration_3="${WARP} -d ${DIMENSION} -i ${CORTICAL_THICKNESS_IMAGE} -o ${OUTPUT_PREFIX}CorticalThicknessNormalizedToTemplate.${OUTPUT_SUFFIX} -r ${REGISTRATION_TEMPLATE} -n Gaussian -t ${REGISTRATION_TEMPLATE_WARP} -t ${REGISTRATION_TEMPLATE_GENERIC_AFFINE} --float ${USE_FLOAT_PRECISION} --verbose 1"
  1109. logCmd $exe_template_registration_3
  1110. EXTRACTED_SEGMENTATION_BRAIN_DEFORMED=${OUTPUT_PREFIX}BrainNormalizedToTemplate.${OUTPUT_SUFFIX}
  1111. REGISTRATION_TEMPLATE_BRAIN_MASK=${OUTPUT_PREFIX}RegistrationTemplateBrainMask.nii.gz
  1112. logCmd ${ANTSPATH}/ThresholdImage 3 ${REGISTRATION_TEMPLATE} ${REGISTRATION_TEMPLATE_BRAIN_MASK} 1E-6 Inf
  1113. EXTRACTED_SEGMENTATION_BRAIN_N4_IMAGE=${OUTPUT_PREFIX}ExtractedBrain0N4.nii.gz
  1114. logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${EXTRACTED_SEGMENTATION_BRAIN_N4_IMAGE} m ${HEAD_N4_IMAGE} ${BRAIN_EXTRACTION_MASK}
  1115. TMP_FILES=( ${TMP_FILES[@]} ${EXTRACTED_SEGMENTATION_BRAIN_N4_IMAGE} ${EXTRACTED_SEGMENTATION_BRAIN_DEFORMED} ${REGISTRATION_TEMPLATE_BRAIN_MASK} )
  1116. logCmd ${WARP} -d ${DIMENSION} -i ${EXTRACTED_SEGMENTATION_BRAIN_N4_IMAGE} -o ${EXTRACTED_SEGMENTATION_BRAIN_DEFORMED} -r ${REGISTRATION_TEMPLATE} -n Linear -t ${REGISTRATION_TEMPLATE_WARP} -t ${REGISTRATION_TEMPLATE_GENERIC_AFFINE} --float ${USE_FLOAT_PRECISION} --verbose 1
  1117. fi
  1118. ccmetric=`${ANTSPATH}/ImageMath ${DIMENSION} a PearsonCorrelation ${REGISTRATION_TEMPLATE} ${EXTRACTED_SEGMENTATION_BRAIN_DEFORMED} ${REGISTRATION_TEMPLATE_BRAIN_MASK}`
  1119. bvol=`${ANTSPATH}/ImageMath ${DIMENSION} a total ${BRAIN_EXTRACTION_MASK} | cut -d ':' -f 2 | cut -d ' ' -f 2 `
  1120. gvol=`${ANTSPATH}/ImageMath ${DIMENSION} a total ${BRAIN_SEGMENTATION_GM} | cut -d ':' -f 2 | cut -d ' ' -f 2 `
  1121. wvol=`${ANTSPATH}/ImageMath ${DIMENSION} a total ${BRAIN_SEGMENTATION_WM} | cut -d ':' -f 2 | cut -d ' ' -f 2 `
  1122. thks=`${ANTSPATH}/ImageMath ${DIMENSION} a total ${CORTICAL_THICKNESS_IMAGE} | cut -d ':' -f 2 | cut -d ' ' -f 2 `
  1123. echo "PearsonCorrelation,BVOL,GVol,WVol,ThicknessSum" > ${OUTPUT_PREFIX}brainvols.csv
  1124. echo "${ccmetric},${bvol},${gvol},${wvol},${thks}" >> ${OUTPUT_PREFIX}brainvols.csv
  1125. if [[ -f ${ANTSPATH}/GetMeshAndTopology ]] && [[ ${DIMENSION} -eq 3 ]] ; then
  1126. ${ANTSPATH}/ThresholdImage ${DIMENSION} ${BRAIN_SEGMENTATION} ${OUTPUT_PREFIX}temp.nii.gz 3 3
  1127. ${ANTSPATH}/ImageMath ${DIMENSION} ${OUTPUT_PREFIX}temp.nii.gz ME ${OUTPUT_PREFIX}temp.nii.gz 1
  1128. ${ANTSPATH}/ImageMath ${DIMENSION} ${OUTPUT_PREFIX}temp.nii.gz GetLargestComponent ${OUTPUT_PREFIX}temp.nii.gz 1
  1129. ${ANTSPATH}/ImageMath ${DIMENSION} ${OUTPUT_PREFIX}temp.nii.gz MD ${OUTPUT_PREFIX}temp.nii.gz 2
  1130. ${ANTSPATH}/SmoothImage 3 ${CORTICAL_THICKNESS_IMAGE} 1 ${OUTPUT_PREFIX}temp2.nii.gz
  1131. # ${ANTSPATH}/GetMeshAndTopology ${OUTPUT_PREFIX}temp.nii.gz ${OUTPUT_PREFIX}temp2.nii.gz ${OUTPUT_PREFIX}.vtk thickness 0.3 0.001 ${OUTPUT_PREFIX}_Thickness.png
  1132. rm ${OUTPUT_PREFIX}temp.nii.gz ${OUTPUT_PREFIX}temp2.nii.gz
  1133. fi
  1134. echo "--------------------------------------------------------------------------------------"
  1135. #### BA Edits End ####
  1136. ################################################################################
  1137. #
  1138. # Create QA/QC output:
  1139. # - tiled mosaic of ${OUTPUT_PREFIX}BrainSegmentation0N4.nii.gz with
  1140. # ${OUTPUT_PREFIX}CorticalThickness.nii.gz overlay
  1141. ################################################################################
  1142. HEAD_N4_IMAGE=${OUTPUT_PREFIX}BrainSegmentation0N4.${OUTPUT_SUFFIX}
  1143. HEAD_N4_IMAGE_RESAMPLED="${OUTPUT_PREFIX}BrainSegmentation0N4Resampled.nii.gz"
  1144. CORTICAL_THICKNESS_IMAGE_RESAMPLED="${OUTPUT_PREFIX}CorticalThicknessHotResampled.nii.gz"
  1145. CORTICAL_THICKNESS_IMAGE_RGB="${OUTPUT_PREFIX}CorticalThicknessHotRGB.nii.gz"
  1146. CORTICAL_THICKNESS_MOSAIC="${OUTPUT_PREFIX}CorticalThicknessTiledMosaic.png"
  1147. CORTICAL_THICKNESS_MASK="${OUTPUT_PREFIX}CorticalThicknessMask.${OUTPUT_SUFFIX}"
  1148. BRAIN_EXTRACTION_MASK_RESAMPLED="${OUTPUT_PREFIX}BrainExtractionMaskResampled.nii.gz"
  1149. BRAIN_SEGMENTATION_IMAGE_RESAMPLED="${OUTPUT_PREFIX}BrainSegmentationResampled.nii.gz"
  1150. BRAIN_SEGMENTATION_IMAGE_RGB="${OUTPUT_PREFIX}BrainSegmentationRGB.nii.gz"
  1151. BRAIN_SEGMENTATION_MOSAIC="${OUTPUT_PREFIX}BrainSegmentationTiledMosaic.png"
  1152. ITKSNAP_COLORMAP="${OUTPUT_PREFIX}ItkSnapColormap.txt"
  1153. if [[ ! -f ${CORTICAL_THICKNESS_MOSAIC} || ! -f ${BRAIN_SEGMENTATION_MOSAIC} ]];
  1154. then
  1155. TMP_FILES=( $CORTICAL_THICKNESS_IMAGE_RGB $CORTICAL_THICKNESS_MASK $BRAIN_SEGMENTATION_IMAGE_RGB $ITKSNAP_COLORMAP )
  1156. TMP_FILES=( ${TMP_FILES[@]} $HEAD_N4_IMAGE_RESAMPLED $CORTICAL_THICKNESS_IMAGE_RESAMPLED $BRAIN_EXTRACTION_MASK_RESAMPLED $BRAIN_SEGMENTATION_IMAGE_RESAMPLED )
  1157. # Resample images
  1158. resample0="${ANTSPATH}/ResampleImageBySpacing ${DIMENSION} ${BRAIN_EXTRACTION_MASK}"
  1159. resample0="${resample0} ${BRAIN_EXTRACTION_MASK_RESAMPLED} 1 1"
  1160. resample1="${ANTSPATH}/ResampleImageBySpacing ${DIMENSION} ${HEAD_N4_IMAGE}"
  1161. resample1="${resample1} ${HEAD_N4_IMAGE_RESAMPLED} 1 1"
  1162. resample2="${ANTSPATH}/ResampleImageBySpacing ${DIMENSION} ${CORTICAL_THICKNESS_IMAGE}"
  1163. resample2="${resample2} ${CORTICAL_THICKNESS_IMAGE_RESAMPLED} 1 1"
  1164. resample3="${ANTSPATH}/ResampleImageBySpacing ${DIMENSION} ${BRAIN_SEGMENTATION}"
  1165. resample3="${resample3} ${BRAIN_SEGMENTATION_IMAGE_RESAMPLED} 1 1"
  1166. if [[ ${DIMENSION} -eq 3 ]];
  1167. then
  1168. resample0="${resample0} 1 0 0 1"
  1169. resample1="${resample1} 1"
  1170. resample2="${resample2} 1"
  1171. resample3="${resample3} 1 0 0 1"
  1172. else
  1173. resample0="${resample0} 0 0 1"
  1174. resample3="${resample3} 0 0 1"
  1175. fi
  1176. logCmd $resample0
  1177. logCmd $resample1
  1178. logCmd $resample2
  1179. logCmd $resample3
  1180. # Cortical thickness
  1181. mask="${ANTSPATH}/ThresholdImage ${DIMENSION} ${CORTICAL_THICKNESS_IMAGE_RESAMPLED} ${CORTICAL_THICKNESS_MASK} 0 0 0 1"
  1182. logCmd $mask
  1183. conversion="${ANTSPATH}/ConvertScalarImageToRGB ${DIMENSION} ${CORTICAL_THICKNESS_IMAGE_RESAMPLED}"
  1184. conversion="${conversion} ${CORTICAL_THICKNESS_IMAGE_RGB} none hot none 0 ${DIRECT_THICKNESS_PRIOR}"
  1185. logCmd $conversion
  1186. mosaic="${ANTSPATH}/CreateTiledMosaic -i ${HEAD_N4_IMAGE_RESAMPLED} -r ${CORTICAL_THICKNESS_IMAGE_RGB}"
  1187. mosaic="${mosaic} -o ${CORTICAL_THICKNESS_MOSAIC} -a 1.0 -t -1x-1 -d z -p mask"
  1188. mosaic="${mosaic} -s [2,mask,mask] -x ${CORTICAL_THICKNESS_MASK}"
  1189. logCmd $mosaic
  1190. # Segmentation
  1191. echo "0 1 0 0 1 0 1" > $ITKSNAP_COLORMAP
  1192. echo "0 0 1 0 1 1 0" >> $ITKSNAP_COLORMAP
  1193. echo "0 0 0 1 0 1 1" >> $ITKSNAP_COLORMAP
  1194. conversion="${ANTSPATH}/ConvertScalarImageToRGB ${DIMENSION} ${BRAIN_SEGMENTATION_IMAGE_RESAMPLED}"
  1195. conversion="${conversion} ${BRAIN_SEGMENTATION_IMAGE_RGB} none custom $ITKSNAP_COLORMAP 0 6"
  1196. logCmd $conversion
  1197. mosaic="${ANTSPATH}/CreateTiledMosaic -i ${HEAD_N4_IMAGE_RESAMPLED} -r ${BRAIN_SEGMENTATION_IMAGE_RGB}"
  1198. mosaic="${mosaic} -o ${BRAIN_SEGMENTATION_MOSAIC} -a 0.3 -t -1x-1 -d 2 -p mask"
  1199. mosaic="${mosaic} -s [2,mask,mask] -x ${BRAIN_EXTRACTION_MASK_RESAMPLED}"
  1200. logCmd $mosaic
  1201. if [[ $KEEP_TMP_IMAGES -eq 0 ]];
  1202. then
  1203. for f in ${TMP_FILES[@]}
  1204. do
  1205. if [[ -e $f ]];
  1206. then
  1207. logCmd rm $f
  1208. else
  1209. echo "WARNING: expected temp file doesn't exist: $f"
  1210. fi
  1211. done
  1212. fi
  1213. fi
  1214. echo ${OUTPUT_PREFIX}ACTStage6Complete.txt > ${OUTPUT_PREFIX}ACTStage6Complete.txt
  1215. fi # BAStages
  1216. fi # check completion
  1217. ################################################################################
  1218. #
  1219. # End of main routine
  1220. #
  1221. ################################################################################
  1222. if [[ ${ACT_STAGE} -eq 0 ]] || [[ ${ACT_STAGE} -ge 5 ]] ; then
  1223. logCmd checkOutputExists
  1224. fi
  1225. time_end=`date +%s`
  1226. time_elapsed=$((time_end - time_start))
  1227. echo
  1228. echo "--------------------------------------------------------------------------------------"
  1229. echo " Done with ANTs processing pipeline: stage $ACT_STAGE"
  1230. echo " Script executed in $time_elapsed seconds"
  1231. echo " $(( time_elapsed / 3600 ))h $(( time_elapsed %3600 / 60 ))m $(( time_elapsed % 60 ))s"
  1232. echo "--------------------------------------------------------------------------------------"
  1233. exit 0

antsCorticalThickness.sh at commit 623ac9c, no license · at the source

Overview

  1. Neuropsychiatry Centre, The Royal Melbourne Hospital, Melbourne, Australia
  2. Department of Psychiatry, The University of Melbourne, Australia
  3. Turner Institute for Brain and Mental Health, School of Psychological Sciences, Monash University, Melbourne, Australia
  4. Department of Medicine, The Royal Melbourne Hospital, Australia
  5. Melbourne School of Psychological Sciences, The University of Melbourne, Australia
  6. Department of Psychiatry, Alfred Hospital, Melbourne, Australia
  7. Department of Neuroscience, Monash University, Australia
  8. Department of Metabolic Medicine, Royal Melbourne Hospital, Melbourne, Australia
  9. Department of Radiology, The University of Melbourne, Australia
Institutions: The Royal Melbourne Hospital (Australia); The University of Melbourne (Australia); Monash University (Australia); The Alfred Hospital (Australia)
Journal: Acta neuropsychiatrica, volume 38, article e39
Dates: received 25 June 2025; accepted 25 March 2026; published online 17 April 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1017/neu.2026.10078 · PMID 41992913 · PMCID PMC13227302 · OpenAlex W7154706995
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: structural MRI / diffusion (modality), human (organism), clinical / translational (subfield)
Methods: Statistics, fMRI & imaging
Keywords: Phenylketonuria, myelination, white matter, neuroimaging, neuroprotective effects
MeSH: Phenylketonurias*, White Matter*, Adult, Brain, Female, Humans, Magnetic Resonance Imaging, Male, Phenylalanine, Treatment Outcome, Young Adult (* major topic)
Topic: Metabolism and Genetic Disorders (Clinical Biochemistry, Biochemistry, Genetics and Molecular Biology), according to OpenAlex
Citations: not cited yet (Europe PMC); 33 references in the paper

Abstract

Objective: We tested the hypothesis that resuming dietary control in early-treated phenylketonuria (PKU) is associated with improvements in white matter integrity, using data from the ReDAPT study, which previously demonstrated cognitive and psychiatric improvements with reduced phenylalanine (Phe) levels.

Methods: We re-initiated dietary control for early-treated patients with PKU and assessed the T1w/T2w ratio from standard T1-and T2-weighted magnetic resonance images, a marker of myelination and microstructural integrity. General linear mixed-effects model (GLMM) analyses were performed to assess change in the T1w/T2w ratio from baseline over twelve months after resumption of dietary control.

Results: Seven participants (mean age 31 years; five female) with neuroimaging were included, with a mean of 16 years off diet and baseline Phe levels of 1157 µmol/L. GLMM analyses showed significant increases in T1w/T2w ratio over time for the whole brain (β = 0.47 [95%CI = 0.28, 0.66]), left hemisphere (β = 0.36 [95%CI = 0.19, 0.54]) and right hemisphere regions of interest (β = 0.52 [95%CI = 0.30, 0.72]). Longer time off diet was also positively associated with greater T1w/T2w changes. There was no evidence for the effects of gender or age at baseline.

Conclusions: This study demonstrated significant increases in the T1w/T2w ratio in PKU patients as they resumed dietary control over a 12-month period. Raw Phe levels were not strongly associated with neuroimaging measures. These findings support the importance of lifelong treatment for PKU and also demonstrate the potential reversibility of white matter changes in the disease.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.

pennbbl/antsjlf

License: none: the authors keep all their rights
State: the link answers, verified on 29 September 2026
Evidence: files inventoried
Commit: 623ac9ca842eb61a68d8303d099958f5fdd7e297, 6 January 2019
Languages: Shell (50), Perl (9), R (6)
Size: 170 files, 65 scripts
Software Heritage: not archived
Found in: the text, “Calculation of the T1w/T2w ratio”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: ANTs (49 files), igraph (2 files), ggplot2 (1 file), psych (1 file)
Availability: 1 check, the latest on 29 September 2026: the link answers
  • 29 September 2026: the link answers
66 files

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:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 65 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

No dataset and no data link were found in the paper.

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, pages, dates, 11 authors, 5 keywords, 11 MeSH terms, 31 references.

Cite

This paper

Kang, M. J., Adamson, C., Malpas, C. B., Winton-Brown, T., Burgess, N., Fazio, T., Velakoulis, D., Desmond, P., Venkatraman, V., De Jong, G., & Walterfang, M. (2026). Improved dietary control results in improvements in indices of white matter structure in adults with phenylketonuria: the ReDAPT study. Acta neuropsychiatrica, 38, e39. https://doi.org/10.1017/neu.2026.10078

BibTeX

@article{kang2026improved,
author = {Kang, Matthew JY and Adamson, Christopher and Malpas, Charles B and Winton-Brown, Toby and Burgess, Nicholas and Fazio, Tim and Velakoulis, Dennis and Desmond, Patricia and Venkatraman, Vijay and De Jong, Gerard and Walterfang, Mark},
title = {{Improved dietary control results in improvements in indices of white matter structure in adults with phenylketonuria: the ReDAPT study}},
journal = {Acta neuropsychiatrica},
year = {2026},
month = apr,
volume = {38},
pages = {e39},
publisher = {Cambridge University Press},
issn = {0924-2708},
doi = {10.1017/neu.2026.10078},
url = {https://doi.org/10.1017/neu.2026.10078},
pmid = {41992913},
pmcid = {PMC13227302}
}

RIS

TY - JOUR
AU - Kang, Matthew JY
AU - Adamson, Christopher
AU - Malpas, Charles B
AU - Winton-Brown, Toby
AU - Burgess, Nicholas
AU - Fazio, Tim
AU - Velakoulis, Dennis
AU - Desmond, Patricia
AU - Venkatraman, Vijay
AU - De Jong, Gerard
AU - Walterfang, Mark
TI - Improved dietary control results in improvements in indices of white matter structure in adults with phenylketonuria: the ReDAPT study
T2 - Acta neuropsychiatrica
J2 - Acta Neuropsychiatr
PY - 2026
DA - 2026/04/17
VL - 38
SP - e39
SN - 0924-2708
PB - Cambridge University Press
DO - 10.1017/neu.2026.10078
UR - https://doi.org/10.1017/neu.2026.10078
LA - en
ER -

CSL-JSON

{
"id": "10.1017/neu.2026.10078",
"type": "article-journal",
"title": "Improved dietary control results in improvements in indices of white matter structure in adults with phenylketonuria: the ReDAPT study",
"container-title": "Acta neuropsychiatrica",
"author": [
{
"family": "Kang",
"given": "Matthew JY"
},
{
"family": "Adamson",
"given": "Christopher"
},
{
"family": "Malpas",
"given": "Charles B"
},
{
"family": "Winton-Brown",
"given": "Toby"
},
{
"family": "Burgess",
"given": "Nicholas"
},
{
"family": "Fazio",
"given": "Tim"
},
{
"family": "Velakoulis",
"given": "Dennis"
},
{
"family": "Desmond",
"given": "Patricia"
},
{
"family": "Venkatraman",
"given": "Vijay"
},
{
"family": "De Jong",
"given": "Gerard"
},
{
"family": "Walterfang",
"given": "Mark"
}
],
"container-title-short": "Acta Neuropsychiatr",
"volume": "38",
"page": "e39",
"DOI": "10.1017/neu.2026.10078",
"PMID": "41992913",
"PMCID": "PMC13227302",
"ISSN": "0924-2708",
"publisher": "Cambridge University Press",
"URL": "https://doi.org/10.1017/neu.2026.10078",
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
17
]
]
}
}

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.1162/netn.a.569 [code]
NeuroMArVL: An interactive and collaborative web-based tool for visualizing brain networks.
Journal: Network neuroscience (Cambridge, Mass.)
In common: igraph, ggplot2, author Christopher Leslie Adamson
[2] doi:10.1016/j.omta.2026.201760
&lt;i&gt;In vivo&lt;/i&gt; adenine base editing rescues brain biochemistry and improves motor deficits in a common phenylketonuria variant.
Journal: Molecular therapy. Advances
In common: 4 references
[3] doi:10.1002/acn3.70469 [code]
Quantitative MRI Uncovers Subtle Cortical Damage in Myelin Oligodendrocyte Glycoprotein Antibody-Associated Disease.
Journal: Annals of clinical and translational neurology
In common: ANTs, structural MRI / diffusion, 3 references
[4] doi:10.1186/s12883-026-05085-z
The use of routinely collected structural neuroimaging to identify cognitive impairment in multiple sclerosis.
Journal: BMC neurology
In common: structural MRI / diffusion, clinical / translational, author Charles B. Malpas
[5] doi:10.1093/braincomms/fcag129 [code]
Longitudinal changes of choroid plexus volumes and MRI ratios in multiple sclerosis.
Journal: Brain communications
In common: ANTs, structural MRI / diffusion, clinical / translational, 2 references
[6] doi:10.1016/j.isci.2026.115657 [code]
Integration of machine learning to develop a disulfidptosis model for predicting glioma prognosis, immunotherapy response, and drug.
Journal: iScience
In common: psych, igraph, ggplot2, clinical / translational
[7] doi:10.1162/imag.a.1197 [code]
Blood volume-sensitive laminar fMRI with VASO in human hippocampus: Capabilities and biophysical challenges at clinical 7T scanners.
Journal: Imaging neuroscience (Cambridge, Mass.)
In common: ANTs, ggplot2, 2 references
[8] doi:10.1038/s41467-026-73072-6 [code]
Mapping the spatiotemporal continuum of structural connectivity development across the human connectome in youth.
Journal: Nature communications
In common: psych, ggplot2, structural MRI / diffusion, 1 reference
[9] doi:10.1002/hbm.70512 [code]
Precision Imaging for Intraindividual Investigation of the Reward Response.
Journal: Human brain mapping
In common: psych, ANTs, ggplot2
[10] doi:10.1126/sciadv.aeg3223 [code]
The extreme diversity of retinal amacrine cells has deep evolutionary roots.
Journal: Science advances
In common: psych, igraph, ggplot2

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.

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.