Skip to content

Commit

Permalink
Merge pull request #84 from AICONSlab/jo-STA_workflow_fix
Browse files Browse the repository at this point in the history
Release v2.2.2
  • Loading branch information
mgoubran authored Jan 26, 2023
2 parents 5edeaa9 + 4a76966 commit 513f38d
Show file tree
Hide file tree
Showing 7 changed files with 491 additions and 261 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
# Change permissions for code directory for any Singularity user
sed -i '/#STOPUNCOMMENT#/a # Change permissions for code dir\nchmod -R 777 /code' miracl.def && \
# Log in to cloud.sylabs.io
echo $SYLABS_TOKEN_OCT_26 > tokenfile && \
echo $SYLABS_TOKEN_JAN_25_2023 > tokenfile && \
singularity remote login -u aiconslab --tokenfile tokenfile && \
# Setting trap in case image cannot be deleted
set -e
Expand Down
13 changes: 8 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Build MIRACL Docker image with user information from host system
#
# - Checks if Docker and Docker-Compose are installed
# - Checks if Docker and Docker Compose are installed
# - Dynamically adds and removes user information to
# prevent errors in Singularity container creation
# - Container user is the same as host user to prevent
Expand Down Expand Up @@ -46,7 +46,7 @@ do
if [ "$*" = "-h" ] || [ "$*" = "--help" ];
then
usage
exit
exit 0
elif [ "$*" = "-l" ] || [ "$*" = "--log" ];
then
write_log=true
Expand Down Expand Up @@ -113,16 +113,18 @@ if [ -x "$(command -v docker)" ]; then
# Check if build process exited without errors
build_status_code=$?
if [ $build_status_code -eq 0 ]; then
printf "\nBuild was successful! Checking docker-compose installation.\n"
printf "\nBuild was successful! Checking Docker Compose installation.\n"
# Remove $USER_TEXT from Dockerfile
rm_USER_TEXT

# Test if docker-compose is installed
# Should come by default with Docker-Desktop
if [ -x "$(command -v docker-compose)" ]; then
printf "Docker-Compose installation found. Run 'docker-compose up -d' to start the MIRACL container in background.\n"
printf "Docker Compose installation found <<$(docker-compose --version)>>). Run 'docker-compose up -d' to start the MIRACL container in background.\n"
elif dcex=$(docker compose --version); then
printf "Docker Compose installation found (<<%s>>). Run 'docker compose up -d' or use Docker Desktop (if installed) to start the MIRACL container in background.\n" "$dcex"
else
printf "Docker-Compose installation not found. Please install docker-compose to run the MIRACL container.\n"
printf "Docker Compose installation not found. Please install Docker Compose plugin or standalone version to run the MIRACL container. Instructions on how to install Docker Compose can be found here: https://docs.docker.com/compose/install/\n"
fi
else
# Return error code if build was not successful
Expand All @@ -135,4 +137,5 @@ else
di_status_code=$?
printf "\nDocker installation not found. Please install Docker first.\n"
printf "Exiting with status code $di_status_code\n"
exit di_status_code
fi
38 changes: 36 additions & 2 deletions miracl/flow/cli_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ def run_sta(parser, args):
subprocess.Popen('%s/flow/miracl_workflow_sta.sh -h' % miracl_home,
shell=True)
else:
bash_args = '-f %s -o %s -l %s -r %s -m %s -g %s -k %s -a %s' % (
bash_args = '-f %s -o %s -l %s -r %s -m %s -g %s -k %s -a %s -d %s -c %s --out_dir %s -b %s -u %s -s %s -n %s -p %s -x %s -z %s --downz %s --dilationfx %s --dilationfy %s --dilationfz %s --rk %s' % (
args['folder'], args['out_nii'], args['seed_label'],
args['clar_reg'], args['hemi'], args['dog'],
args['sigma'], args['angle'])
args['sigma'], args['angle'], args['down'], args['chan'],
args['out_dir'], args['brain_mask'], args['lbl_mask'],
args['step_length'], args['chan_num'], args['chan_pre'],
args['vx'], args['vz'], args['downz'], args['dilationfx'],
args['dilationfy'], args['dilationfz'], args['rk'])

subprocess.check_call('%s/flow/miracl_workflow_sta.sh %s' % (miracl_home, bash_args), shell=True,
stderr=subprocess.STDOUT)
Expand Down Expand Up @@ -119,6 +123,36 @@ def get_parser():
help="Gaussian smoothing sigma")
parser_sta.add_argument('-a', '--angle', metavar='',
help="Tracking angle threshold")
parser_sta.add_argument('-d', '--down', metavar='',
help="Downsample ratio")
parser_sta.add_argument('-c', '--chan', metavar='',
help="Output channel name")
parser_sta.add_argument('--out_dir', metavar='',
help="Output directory")
parser_sta.add_argument('-b', '--brain_mask', metavar='',
help="Brain mask")
parser_sta.add_argument('-u', '--lbl_mask', metavar='',
help="Seed mask")
parser_sta.add_argument('-s', '--step_length', metavar='',
help="Step length")
parser_sta.add_argument('-n', '--chan_num', metavar='',
help="Extracting single channel")
parser_sta.add_argument('-p', '--chan_pre', metavar='',
help="Channel prefix")
parser_sta.add_argument('-x', '--vx', metavar='',
help="Original res in x-z plane")
parser_sta.add_argument('-z', '--vz', metavar='',
help="Original thickness")
parser_sta.add_argument('--downz', metavar='',
help="Downsample in z")
parser_sta.add_argument('--dilationfx', metavar='',
help="Dilation factor x")
parser_sta.add_argument('--dilationfy', metavar='',
help="Dilation factor y")
parser_sta.add_argument('--dilationfz', metavar='',
help="Dilation factor z")
parser_sta.add_argument('--rk', metavar='',
help="rk2")
parser_sta.add_argument('-h', '--help', action='store_true')

parser_sta.set_defaults(func=run_sta)
Expand Down
Loading

0 comments on commit 513f38d

Please sign in to comment.