Skip to content

Commit

Permalink
Merge pull request #6 from sct-pipeline/jqm/nifti_debugging
Browse files Browse the repository at this point in the history
add wrapper script for fsl-based data orientation
  • Loading branch information
jqmcginnis authored Aug 11, 2022
2 parents 9551481 + 754aace commit 0c00398
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions source/utility/reorient.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
#
# Reorient sagittally scanned MRI images to axial orientation, complying to
#
# the stitching convention of the stitching algorithm by Ben Glocker.
#
# Usage:
# ./reorient.sh <SCAN>
#
# Authors: Julian McGinnis

# Retrieve input params
SCAN=$1

# assemble name
SCAN_NAME=${SCAN%%.*}
FILE_ENDING="_axial_ornt.nii.gz"
FILE_PATH="$SCAN_NAME$FILE_ENDING"

echo "Creating $FILE_PATH"

# get starting time:
start=`date +%s`

echo "Swaping Dimensions"
fslswapdim ${SCAN} LR AP IS ${FILE_PATH}
echo "Forcing neurological orientation"
fslorient -forceneurological ${FILE_PATH}

# Display useful info for the log
end=`date +%s`
runtime=$((end-start))
echo "Duration: $(($runtime / 3600))hrs $((($runtime / 60) % 60))min $(($runtime % 60))sec"

0 comments on commit 0c00398

Please sign in to comment.