Skip to content

Instantly share code, notes, and snippets.

@dtxe
Last active March 9, 2021 01:12
Show Gist options
  • Save dtxe/ce135d25897c2083ec9a7105fc89e9c3 to your computer and use it in GitHub Desktop.
Save dtxe/ce135d25897c2083ec9a7105fc89e9c3 to your computer and use it in GitHub Desktop.
#!/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
@dtxe
Copy link
Author

dtxe commented Jun 19, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment