Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Arguments as specified by BIDS-Apps
# required, positional arguments
# IMPORTANT: they must go directly with the parser object
parser.add_argument('bids_dir', action='store', type=Path,
help='the root folder of a BIDS valid dataset (sub-XXXXX folders should '
'be found at the top level in this folder).')
parser.add_argument('output_dir', action='store', type=Path,
help='the output path for the outcomes of preprocessing and visual '
'reports')
parser.add_argument('analysis_level', choices=['participant'],
help='processing stage to be run, only "participant" in the case of '
'sMRIPrep (see BIDS-Apps specification).')
# optional arguments
parser.add_argument('--version', action='version', version='smriprep v{}'.format(__version__))
g_bids = parser.add_argument_group('Options for filtering BIDS queries')
g_bids.add_argument('--participant-label', '--participant_label', action='store', nargs='+',
help='a space delimited list of participant identifiers or a single '
'identifier (the sub- prefix can be removed)')
g_bids.add_argument(
'--bids-filter-file', action='store', type=Path, metavar='PATH',
help='a JSON file describing custom BIDS input filters using pybids '
'{:{:
retval['run_uuid'] = run_uuid
retval['workflow'] = None
# Called with reports only
if opts.reports_only:
from niworkflows.reports import generate_reports
logger.log(25, 'Running --reports-only on participants %s', ', '.join(subject_list))
if opts.run_uuid is not None:
run_uuid = opts.run_uuid
retval['return_code'] = generate_reports(subject_list, str(output_dir), run_uuid,
packagename="smriprep")
return retval
logger.log(25, INIT_MSG(
version=__version__,
bids_dir=bids_dir,
subject_list=subject_list,
uuid=run_uuid,
spaces=opts.output_spaces)
)
# Build main workflow
retval['workflow'] = init_smriprep_wf(
debug=opts.sloppy,
fast_track=opts.fast_track,
freesurfer=opts.run_reconall,
fs_subjects_dir=opts.fs_subjects_dir,
hires=opts.hires,
layout=layout,
longitudinal=opts.longitudinal,
low_mem=opts.low_mem,
"""
import os
from pathlib import Path
import json
from ..__about__ import __version__, __url__, DOWNLOAD_URL
bids_dir = Path(bids_dir)
deriv_dir = Path(deriv_dir)
desc = {
'Name': 'sMRIPrep - Structural MRI PREProcessing workflow',
'BIDSVersion': '1.1.1',
'PipelineDescription': {
'Name': 'sMRIPrep',
'Version': __version__,
'CodeURL': DOWNLOAD_URL,
},
'CodeURL': __url__,
'HowToAcknowledge':
'Please cite our paper (https://doi.org/10.1101/306951), and '
'include the generated citation boilerplate within the Methods '
'section of the text.',
}
# Keys that can only be set by environment
if 'SMRIPREP_DOCKER_TAG' in os.environ:
desc['DockerHubContainerTag'] = os.environ['SMRIPREP_DOCKER_TAG']
if 'SMRIPREP_SINGULARITY_URL' in os.environ:
singularity_url = os.environ['SMRIPREP_SINGULARITY_URL']
desc['SingularityContainerURL'] = singularity_url
else:
subject_data = collect_data(layout, subject_id, bids_filters=bids_filters)[0]
if not subject_data['t1w']:
raise Exception("No T1w images found for participant {}. "
"All workflows require T1w images.".format(subject_id))
workflow = Workflow(name=name)
workflow.__desc__ = """
Results included in this manuscript come from preprocessing
performed using *sMRIPprep* {smriprep_ver}
(@fmriprep1; @fmriprep2; RRID:SCR_016216),
which is based on *Nipype* {nipype_ver}
(@nipype1; @nipype2; RRID:SCR_002502).
""".format(smriprep_ver=__version__, nipype_ver=nipype_ver)
workflow.__postdesc__ = """
For more details of the pipeline, see [the section corresponding
to workflows in *sMRIPrep*'s documentation]\
(https://smriprep.readthedocs.io/en/latest/workflows.html \
"sMRIPrep's documentation").
### References
"""
deriv_cache = None
if fast_track:
from ..utils.bids import collect_derivatives
std_spaces = spaces.get_spaces(nonstandard=False, dim=(3,))