diff --git a/manifest.json b/manifest.json index 7a4c34d..1a8d477 100644 --- a/manifest.json +++ b/manifest.json @@ -2,12 +2,12 @@ "name": "bids-fmriprep", "label": "BIDS fMRIPrep: A Robust Preprocessing Pipeline for fMRI Data", "description": "fMRIPrep (1.5.9 Feb. 15, 2020) is a functional magnetic resonance imaging (fMRI) data preprocessing pipeline that is designed to provide an easily accessible, state-of-the-art interface that is robust to variations in scan acquisition protocols and that requires minimal user input, while providing easily interpretable and comprehensive error and output reporting. It performs basic processing steps (coregistration, normalization, unwarping, noise component extraction, segmentation, skullstripping etc.) providing outputs that can be easily submitted to a variety of group level analyses, including task-based or resting-state fMRI, graph theory measures, surface or volume-based statistics, etc.", - "version": "1.0.9_1.5.9", + "version": "1.0.11_1.5.9", "custom": { - "docker-image": "flywheel/bids-fmriprep:1.0.9_1.5.9", + "docker-image": "flywheel/bids-fmriprep:1.0.11_1.5.9", "gear-builder": { "category": "analysis", - "image": "flywheel/bids-fmriprep:1.0.9_1.5.9" + "image": "flywheel/bids-fmriprep:1.0.11_1.5.9" }, "flywheel": { "suite": "BIDS Apps" @@ -56,47 +56,52 @@ "config": { "skip-bids-validation": { "description": "assume the input dataset is BIDS compliant and skip the validation", - "optional": true, + "default": false, "type": "boolean" }, "task-id": { "description": "select a specific task to be processed", - "optional": true, + "default": "", "type": "string" }, "echo-idx": { "description": "select a specific echo to be processed in a multiecho series", - "optional": true, + "default": "", "type": "string" }, "n_cpus": { "description": "Number of of CPUs/cores to use. Default is all available.", - "optional": true, + "default": 0, "type": "integer" }, "mem_mb": { "description": "upper bound memory limit for FMRIPREP processes", - "optional": true, - "type": "number" + "default": 0, + "type": "integer" }, "anat-only": { "description": "run anatomical workflows only", - "optional": true, + "default": false, "type": "boolean" }, "boilerplate": { "description": "generate boilerplate only", - "optional": true, + "default": false, + "type": "boolean" + }, + "md-only-boilerplate": { + "description": "skip generation of HTML and LaTeX formatted citation with pandoc", + "default": false, "type": "boolean" }, "error-on-aroma-warnings": { "description": "Raise an error if ICA_AROMA does not produce sensible output (e.g., if all the components are classified as signal or noise)", - "optional": true, + "default": false, "type": "boolean" }, "verbose": { "description": "increases log verbosity for each occurence, debug level is -vvv", - "optional": true, + "default": "", "enum": [ "", "v", @@ -107,17 +112,17 @@ }, "ignore": { "description": "Ignore selected aspects of the input dataset to disable corresponding parts of the workflow (a space delimited list) Possible choices: fieldmaps, slicetiming, sbref", - "optional": true, + "default": "", "type": "string" }, "longitudinal": { "description": "treat dataset as longitudinal - may increase runtime", - "optional": true, + "default": false, "type": "boolean" }, "t2s-coreg": { "description": "If provided with multi-echo BOLD dataset, create T2*-map and perform T2*-driven coregistration. When multi-echo data is provided and this option is not enabled, standard EPI-T1 coregistration is performed using the middle echo.", - "optional": true, + "default": false, "type": "boolean" }, "output-spaces": { @@ -128,32 +133,31 @@ "bold2t1w-dof": { "description": "Degrees of freedom when registering BOLD to T1w images. 6 degrees (rotation and translation) are used by default.", "enum": [ - "", - "6", - "9", - "12" + 6, + 9, + 12 ], - "optional": true, - "type": "string" + "default": 6, + "type": "integer" }, "force-bbr": { "description": "Always use boundary-based registration (no goodness-of-fit checks)", - "optional": true, + "default": false, "type": "boolean" }, "force-no-bbr": { "description": "Do not use boundary-based registration (no goodness-of-fit checks)", - "optional": true, + "default": false, "type": "boolean" }, "medial-surface-nan": { "description": "Replace medial wall values with NaNs on functional GIFTI files. Only performed for GIFTI files mapped to a freesurfer subject (fsaverage or fsnative).", - "optional": true, + "default": false, "type": "boolean" }, "dummy-scans": { "description": "Number of non steady state volumes.", - "optional": true, + "default": 0, "type": "integer" }, "use-aroma": { @@ -163,102 +167,101 @@ }, "aroma-melodic-dimensionality": { "description": "Exact or maximum number of MELODIC components to estimate (positive = exact, negative = maximum", - "optional": true, + "default": -200, "type": "integer" }, "return-all-components": { "description": "Include all components estimated in CompCor decomposition in the confounds file instead of only the components sufficient to explain 50 percent of BOLD variance in each CompCor mask", - "optional": true, + "default": false, "type": "boolean" }, "fd-spike-threshold": { "description": "Threshold for flagging a frame as an outlier on the basis of framewise displacement", - "optional": true, + "default": 0.5, "type": "number" }, "dvars-spike-threshold": { "description": "Threshold for flagging a frame as an outlier on the basis of standardised DVARS", - "optional": true, + "default": 1.5, "type": "number" }, "skull-strip-template": { "description": "select a template for skull-stripping with antsBrainExtraction (default is OASIS30ANTs)", "enum": [ - "", "OASIS30ANTs", "NKI" ], - "optional": true, + "default": "OASIS30ANTs", "type": "string" }, "skull-strip-fixed-seed": { "description": "do not use a random seed for skull-stripping - will ensure run-to-run replicability when used with –omp-nthreads 1", - "optional": true, + "default": false, "type": "boolean" }, "fmap-bspline": { "description": "fit a B-Spline field using least-squares (experimental)", - "optional": true, + "default": false, "type": "boolean" }, "fmap-no-demean": { "description": "do not remove median (within mask) from fieldmap", - "optional": true, + "default": false, "type": "boolean" }, "use-syn-sdc": { "description": "EXPERIMENTAL: Use fieldmap-free distortion correction", - "optional": true, + "default": false, "type": "boolean" }, "force-syn": { "description": "EXPERIMENTAL/TEMPORARY: Use SyN correction in addition to fieldmap correction, if available", - "optional": true, + "default": false, "type": "boolean" }, "no-submm-recon": { "description": "disable sub-millimeter (hires) reconstruction", - "optional": true, + "default": false, "type": "boolean" }, "cifti-output": { "description": "output BOLD files as CIFTI dtseries", - "optional": true, + "default": false, "type": "boolean" }, "fs-no-reconall": { "description": "disable FreeSurfer surface preprocessing", - "optional": true, + "default": false, "type": "boolean" }, "resource-monitor": { "description": "enable Nipype’s resource monitoring to keep track of memory and CPU usage", - "optional": true, + "default": false, "type": "boolean" }, "reports-only": { "description": "", - "optional": true, + "default": false, "type": "boolean" }, "run-uuid": { "description": "Specify UUID of previous run, to include error logs in report. No effect without –reports-only", - "optional": true, + "default": "", "type": "string" }, "write-graph": { "description": "Write workflow graph", - "optional": true, + "default": false, "type": "boolean" }, "stop-on-first-crash": { "description": "Force stopping on first crash, even if a work directory was specified", - "optional": true, + "default": false, "type": "boolean" }, "notrack": { "description": "Opt-out of sending tracking information of this run to the FMRIPREP developers. This information helps to improve FMRIPREP and provides an indicator of real world usage crucial for obtaining funding", - "optional": true, + "default": false, "type": "boolean" }, "gear-abort-on-bids-error": { @@ -315,7 +318,7 @@ "gear-FREESURFER_LICENSE": { "description": "Text from license file generated during FreeSurfer registration. *Entries should be space separated*", "type": "string", - "optional": true + "default": "" } }, "environment": { diff --git a/utils/args.py b/utils/args.py index c6e794c..0f0040e 100644 --- a/utils/args.py +++ b/utils/args.py @@ -1,10 +1,6 @@ -# If you edit this file, please consider updating bids-app-template +"""Handle arguments""" -import subprocess as sp -import os, os.path as op import logging -import re -import json from .licenses.freesurfer import find_freesurfer_license @@ -35,20 +31,13 @@ def get_inputs_and_args(context): for key in config.keys(): if key[:5] == 'gear-': # Skip any gear- parameters continue - # Use only those boolean values that are True - if type(config[key]) == bool: - if config[key]: - params[key] = True - # else ignore (could this cause a problem?) - else: - if len(key) == 1: + if type(config[key]) == str: + if config[key]: # only use non-empty strings params[key] = config[key] - else: - if config[key] != 0: # if zero, skip and use defaults - params[key] = config[key] - # else ignore (could this caus a problem?) - - context.gear_dict['param_list'] = params + else: + params[key] = config[key] + + context.gear_dict['param_list'] = params def validate(context): @@ -65,22 +54,24 @@ def validate(context): if 'n_cpus' in param_list: cpu_count = context.gear_dict['cpu_count'] - str_cpu_count = str(cpu_count) if param_list['n_cpus'] > cpu_count: - log.warning('n_cpus > number available, using ' + str_cpu_count) + log.warning('n_cpus > number available, using %d', cpu_count) param_list['n_cpus'] = cpu_count - else: # Default is to use all cpus available - # zoom zomm - param_list['n_cpus'] = context.gear_dict['cpu_count'] + elif param_list['n_cpus'] == 0: + log.info('n_cpus == 0, using %d (maximum available)', cpu_count) + param_list['n_cpus'] = cpu_count + + else: # Default is to use all cpus available + param_list['n_cpus'] = context.gear_dict['cpu_count'] # zoom zoom def build_command(context): """ command is a list of prepared commands - param_list is a dictionary of key:value pairs to be put into the command list - as such ("-k value" or "--key=value") + param_list is a dictionary of key:value pairs to be put into the command + list as such ("-k value" or "--key=value") """ log.debug('') @@ -110,12 +101,14 @@ def build_command(context): else: # check for argparse nargs='*' lists of multiple values so # append it like '--key val1 val2 ...' - if (isinstance(param_list[key], str) and len(param_list[key].split()) > 1): - # then it is a list of multiple things: e.g. "--modality T1w T2w" + if (isinstance(param_list[key], str) and + len(param_list[key].split()) > 1): + # then it is a list of multiple things: + # e.g. "--modality T1w T2w" command.append('--' + key) for item in param_list[key].split(): command.append(item) - else: # single value so append it like '--key=value' + else: # single value so append it like '--key=value' command.append('--' + key + '=' + str(param_list[key])) if key == 'verbose': # handle a 'count' argparse argument where manifest gives @@ -124,6 +117,3 @@ def build_command(context): command[-1] = '-' + param_list[key] return command - - -# vi:set autoindent ts=4 sw=4 expandtab : See Vim, :help 'modeline'