-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
735ac80
commit 3722e33
Showing
1 changed file
with
22 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,36 @@ | ||
#!/bin/bash | ||
CURRENT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Get the directory of the script | ||
|
||
# Get the directory of the script | ||
CURRENT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
# Default values | ||
DEFAULT_INPUT_DIR="${CURRENT_DIR}/example_tool/example_data/CAIPIRINHA_SPACE_Neuro_Head_Examples" | ||
DEFAULT_OUTPUT_DIR="${CURRENT_DIR}/example_tool/example_output" | ||
DEFAULT_STUDY_ID="12345" | ||
|
||
# Use provided arguments if they exist, otherwise use default values | ||
INPUT_DIR=${1:-$DEFAULT_INPUT_DIR} | ||
OUTPUT_DIR=${2:-$DEFAULT_OUTPUT_DIR} | ||
STUDY_ID=${3:-$DEFAULT_STUDY_ID} | ||
INPUT_DIR=${1:-"${DEFAULT_INPUT_DIR}"} | ||
OUTPUT_DIR=${2:-"${DEFAULT_OUTPUT_DIR}"} | ||
STUDY_ID=${3:-"${DEFAULT_STUDY_ID}"} | ||
|
||
if [ ! -d "$INPUT_DIR" ]; then | ||
echo "Input directory does not exist: $INPUT_DIR" | ||
# Check if input directory exists | ||
if [ ! -d "${INPUT_DIR}" ]; then | ||
echo "Input directory does not exist: ${INPUT_DIR}" | ||
exit 1 | ||
fi | ||
if [ ! -d "$OUTPUT_DIR" ]; then | ||
echo "Output directory does not exist: $OUTPUT_DIR" | ||
echo "Creating output directory: $OUTPUT_DIR" | ||
mkdir -p "$OUTPUT_DIR" | ||
fi | ||
|
||
# Check if output directory exists, if not create it | ||
if [ ! -d "${OUTPUT_DIR}" ]; then | ||
echo "Output directory does not exist: ${OUTPUT_DIR}" | ||
echo "Creating output directory: ${OUTPUT_DIR}" | ||
mkdir -p "${OUTPUT_DIR}" | ||
fi | ||
|
||
# Run the docker command | ||
docker run --rm \ | ||
-v "$INPUT_DIR":/input \ | ||
-v "$OUTPUT_DIR":/output \ | ||
brainmasktool:v0.1\ | ||
-v "${INPUT_DIR}":/input \ | ||
-v "${OUTPUT_DIR}":/output \ | ||
brainmasktool:v0.1 \ | ||
-s /input \ | ||
-o /output\ | ||
-i "$STUDY_ID" | ||
-o /output \ | ||
-i "${STUDY_ID}" |