Last active
March 9, 2021 01:12
-
-
Save dtxe/ce135d25897c2083ec9a7105fc89e9c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage dicom_to_nifti_anonymize [source dir] [dest dir] [participant ID] | |
if [[ $# -lt 2 ]]; then | |
DEST=$1 | |
else | |
# make the directory if it doesn't exist | |
if [ ! -d $2 ]; then | |
mkdir $2 | |
fi | |
DEST=$2 | |
fi | |
TEMPDIR=/tmp/dicom_to_nifti_anonymize/$3 | |
mkdir -p $TEMPDIR | |
cp -r $1 $TEMPDIR | |
echo "===============================================" >> "$DEST/conversion_log.txt" | |
date >> "$DEST/conversion_log.txt" | |
echo "===============================================" >> "$DEST/conversion_log.txt" | |
dcm2niix -b y -o "$DEST" -x n -z y -t n "$TEMPDIR" | tee -a "$DEST/conversion_log.txt" | |
rm -rf $TEMPDIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires: https://github.com/rordenlab/dcm2niix