Last active
August 29, 2015 14:27
-
-
Save mattsouth/8dc99382d74d00687d17 to your computer and use it in GitHub Desktop.
Upload mulitple dicom sessions as outlined in a spreadsheet
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 | |
# uploads dicom images for a set of subject sessions to the tng xnat instance | |
# takes three parameters: | |
# 1: csv - the filename a csv file that contains three columns: | |
# a: subject_id | |
# b: directory | |
# c: scan date | |
# 2: xnat-username | |
# 3: xnat-password | |
# 4: xnat-project_id | |
# check for correct number of arguments | |
if [ "$#" -ne 4 ]; then | |
echo -e "Incorrect number of arguments - expected 4" | |
echo "Usage: csvupload.sh csvfilepath user password project" | |
else | |
# check that csvfile can be found | |
if [ -e $1 ]; then | |
cat $1 | while read line | |
do | |
subject_id=$(echo $line | cut -d',' -f1) | |
dir=$(echo $line | cut -d',' -f2) | |
scan_date=$(echo $line | cut -d',' -f3) | |
echo "subject_id: WH_$subject_id, directory: $dir, scan date: $scan_date" | |
./uploaddcmtk.sh $2 $3 $4 $dir WH_$subject_id | |
# todo: check scan-dates match | |
done | |
else | |
echo "csvfile $1 not found - no session uploaded." | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment