From a59fe630f0326151c4d555cc46946e7d3f0920ff Mon Sep 17 00:00:00 2001 From: Adam Thomas Date: Sun, 22 Feb 2015 17:46:29 +0000 Subject: [PATCH 1/7] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 355c263..0816a58 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,11 @@ Similar strategies may be used for brains with missing data e.g. lesions Both cases are illustrated in this [example script](https://github.com/stnava/BasicBrainMapping/blob/master/bbm.sh). +Before running the script make sure the ANTs binary directory is in your default path. + +Run the script from the BasicBrainMapping direcory like this: +./bbm.sh data/IXI/T_template2.nii.gz ./data/IXI594-Guys-1089-T1.nii.gz ./data/IXI/T_templateExtractionMask.nii.gz + ![T1_lesioned](https://raw.github.com/stnava/BasicBrainMapping/master/T1_lesioned.jpg?raw=true) ![Template2T1_lesioned](https://raw.github.com/stnava/BasicBrainMapping/master/Template2T1_lesioned.jpg?raw=true) From 3e9f52d2c30cde9d08b23847a6a099b8313abade Mon Sep 17 00:00:00 2001 From: Adam Thomas Date: Sun, 22 Feb 2015 17:48:09 +0000 Subject: [PATCH 2/7] Update README.md Added command line --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0816a58..a2622f7 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,12 @@ Similar strategies may be used for brains with missing data e.g. lesions Both cases are illustrated in this [example script](https://github.com/stnava/BasicBrainMapping/blob/master/bbm.sh). -Before running the script make sure the ANTs binary directory is in your default path. +Before running the script make sure the ANTs executable directory is in your default path. Run the script from the BasicBrainMapping direcory like this: +``` ./bbm.sh data/IXI/T_template2.nii.gz ./data/IXI594-Guys-1089-T1.nii.gz ./data/IXI/T_templateExtractionMask.nii.gz - +``` ![T1_lesioned](https://raw.github.com/stnava/BasicBrainMapping/master/T1_lesioned.jpg?raw=true) ![Template2T1_lesioned](https://raw.github.com/stnava/BasicBrainMapping/master/Template2T1_lesioned.jpg?raw=true) From ef53bfdae2065d6e14e3bc719e9ab16ad6778cdd Mon Sep 17 00:00:00 2001 From: Adam Thomas Date: Sun, 22 Feb 2015 17:48:27 +0000 Subject: [PATCH 3/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a2622f7..ef2d43d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Both cases are illustrated in this [example script](https://github.com/stnava/Ba Before running the script make sure the ANTs executable directory is in your default path. -Run the script from the BasicBrainMapping direcory like this: +Run the script from the BasicBrainMapping directory like this: ``` ./bbm.sh data/IXI/T_template2.nii.gz ./data/IXI594-Guys-1089-T1.nii.gz ./data/IXI/T_templateExtractionMask.nii.gz ``` From ff74aac315e2ac411840208cb83f1a78bee834b7 Mon Sep 17 00:00:00 2001 From: Adam Thomas Date: Sun, 22 Feb 2015 17:48:44 +0000 Subject: [PATCH 4/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ef2d43d..790f4d1 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Before running the script make sure the ANTs executable directory is in your def Run the script from the BasicBrainMapping directory like this: ``` -./bbm.sh data/IXI/T_template2.nii.gz ./data/IXI594-Guys-1089-T1.nii.gz ./data/IXI/T_templateExtractionMask.nii.gz +./bbm.sh ./data/IXI/T_template2.nii.gz ./data/IXI594-Guys-1089-T1.nii.gz ./data/IXI/T_templateExtractionMask.nii.gz ``` ![T1_lesioned](https://raw.github.com/stnava/BasicBrainMapping/master/T1_lesioned.jpg?raw=true) From b04e2bf3d7ba9c4f8ebf62afe3ec85ea822cac5b Mon Sep 17 00:00:00 2001 From: Adam Thomas Date: Thu, 18 Feb 2016 14:51:27 -0500 Subject: [PATCH 5/7] antspath update --- bbm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bbm.sh b/bbm.sh index eb57efd..b330cca 100755 --- a/bbm.sh +++ b/bbm.sh @@ -1,6 +1,6 @@ #!/bin/bash dim=3 # image dimensionality -AP="" # /home/yourself/code/ANTS/bin/bin/ # path to ANTs binaries +AP=$ANTSPATH # /home/yourself/code/ANTS/bin/bin/ # path to ANTs binaries ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=4 # controls multi-threading export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS f=$1 ; m=$2 ; mask=$3 # fixed and moving image file names From 8ff9ac88d13c63daa42e924bec75d599c0f1deee Mon Sep 17 00:00:00 2001 From: Adam Thomas Date: Thu, 18 Feb 2016 16:42:35 -0500 Subject: [PATCH 6/7] path fixes --- bbm.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/bbm.sh b/bbm.sh index b330cca..4d9227a 100755 --- a/bbm.sh +++ b/bbm.sh @@ -1,10 +1,11 @@ #!/bin/bash +set -x -e dim=3 # image dimensionality AP=$ANTSPATH # /home/yourself/code/ANTS/bin/bin/ # path to ANTs binaries ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=4 # controls multi-threading export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS f=$1 ; m=$2 ; mask=$3 # fixed and moving image file names -if [[ ${#f} -eq 0 ]] ; then +if [ $# -lt 3 ] ; then echo usage is echo $0 fixed.nii.gz moving.nii.gz fixed_brain_mask.nii.gz exit @@ -50,10 +51,10 @@ echo here we assume the affine map is not corrupted by the lesion. echo We do, however, mask the deformation estimation with a lesion mask. origmat=${nm}0GenericAffine.mat nm=BBM_Lesion -SmoothImage 3 data/lesion.nii.gz 2 data/neg_lesion.nii.gz -ImageMath 3 data/neg_lesion.nii.gz CorruptImage data/neg_lesion.nii.gz -ImageMath 3 data/neg_lesion.nii.gz Neg data/neg_lesion.nii.gz -MultiplyImages 3 data/neg_lesion.nii.gz $2 data/T1_lesioned.nii.gz +$AP/SmoothImage 3 data/lesion.nii.gz 2 data/neg_lesion.nii.gz +$AP/ImageMath 3 data/neg_lesion.nii.gz CorruptImage data/neg_lesion.nii.gz +$AP/ImageMath 3 data/neg_lesion.nii.gz Neg data/neg_lesion.nii.gz +$AP/MultiplyImages 3 data/neg_lesion.nii.gz $2 data/T1_lesioned.nii.gz m=data/T1_lesioned.nii.gz imgs=" $m, $f " myit=1000 @@ -64,7 +65,7 @@ $reg -d $dim -r [${origmat},1] \ -s 1x0.5x0vox \ -f 4x2x1 -l 1 -u 1 -z 1 -x data/neg_lesion.nii.gz \ -o [${nm},${nm}_diff.nii.gz,${nm}_inv.nii.gz] -ExtractSliceFromImage 3 data/T1_lesioned.nii.gz temp.nii.gz 1 120 -ConvertImagePixelType temp.nii.gz T1_lesioned.jpg 1 -ExtractSliceFromImage 3 ${nm}_diff.nii.gz temp.nii.gz 1 120 -ConvertImagePixelType temp.nii.gz Template2T1_lesioned.jpg 1 +$AP/ExtractSliceFromImage 3 data/T1_lesioned.nii.gz temp.nii.gz 1 120 +$AP/ConvertImagePixelType temp.nii.gz T1_lesioned.jpg 1 +$AP/ExtractSliceFromImage 3 ${nm}_diff.nii.gz temp.nii.gz 1 120 +$AP/ConvertImagePixelType temp.nii.gz Template2T1_lesioned.jpg 1 From 4dacc39543e29e6874343e75ef5f2d1b50128498 Mon Sep 17 00:00:00 2001 From: Adam Thomas Date: Thu, 18 Feb 2016 16:50:50 -0500 Subject: [PATCH 7/7] Remove verbosity --- bbm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bbm.sh b/bbm.sh index 4d9227a..4470345 100755 --- a/bbm.sh +++ b/bbm.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -x -e +set -e dim=3 # image dimensionality AP=$ANTSPATH # /home/yourself/code/ANTS/bin/bin/ # path to ANTs binaries ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=4 # controls multi-threading