Skip to content

Commit

Permalink
add proprocess-nifti.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ksarink committed Jan 29, 2021
1 parent 95a26ec commit 1feaafd
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
These scripts can be helpfull while you use the cat12 pipeline
## check.sh
Check if all files are created. See usage with `$ ./check.sh --help`
## preprocess-nifti.sh
Allows to quickly process a nifti when your pipeline is set up. Please adjust the variables on top of the script to your needs. Afterwards usage is easy with: `$ ./preprocess-nifti.sh <path_to_nifti>`. This script creates a working directory, derives a batch file from the template and then starts the pipeline for this nifti. Only works for one nifti file!
43 changes: 43 additions & 0 deletions scripts/preprocess-nifti.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# Usage: ./preprocess-nifti.sh <path_to_nifti>
# Author: Kelvin Sarink <[email protected]>


# Edit the following variables to your needs:
path_to_compiled_spm="/scratch/tmp/e0trap/software/cat12_joint_pipeline/ksarink-cjp_v0008-spm12_v7771-cat12_r1720/"
path_to_mcr="/scratch/tmp/e0trap/software/mcr/v96"
path_to_batch_template="/scratch/tmp/e0trap/software/cat12_joint_pipeline/cat12_complete_joint_pipeline.mat"

# path_which_needs_to_be_replaced does not need to be changed as long as you use cjp8
path_which_needs_to_be_replaced="/spm-data/Scratch/spielwiese_kelvin/cat12_joint_pipeline/cjp_v0008-spm12_v7771-cat12_r1720-modifiedcatdefaults/"



# Do not edit anything below:
[ -z "$1" ] && exit 1
nifti=`realpath $1`
id=`basename $nifti | sed 's|.nii||g'`
timestamp=`date +'%Y-%m-%d_%H-%M-%S'`
workingdir="./workingdir/${id}_$timestamp"
mkdir -p $workingdir
workingdir=`realpath $workingdir`
cd $workingdir

export MCR_INHIBIT_CTF_LOCK=1


batchfilename=$workingdir/${id}-spm12batch.mat
#Create SPM12 batch
$path_to_compiled_spm/run_spm12.sh \
$path_to_mcr \
adjust_input \
$path_to_batch_template \
$batchfilename \
$nifti \
$path_which_needs_to_be_replaced &> ./adjusting.log;

#Execute SPM12 batch
$path_to_compiled_spm/run_spm12.sh \
$path_to_mcr \
batch $batchfilename &> ./spm12.log

0 comments on commit 1feaafd

Please sign in to comment.