Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit 1c1bb4e

Browse files
committed
enh/wip: adding subject to dmriprep-data
1 parent d147bc8 commit 1c1bb4e

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

dmriprep/cli.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,26 @@ def main(participant_label, bids_dir, output_dir,
7878
@click.command()
7979
@click.argument('output_dir',
8080
)
81-
def data(output_dir):
82-
get_dataset(os.path.abspath(output_dir))
81+
@click.option('--subject', help="subject id to download (will choose 1 subject if not specified",
82+
default="sub-NDARBA507GCT")
83+
@click.option('--study', help="which study to download. Right now we only support the HBN dataset",
84+
default="HBN")
85+
def data(output_dir, study="HBN", subject="sub-NDARBA507GCT"):
86+
"""
87+
Download dwi raw data in BIDS format from public datasets
88+
89+
:param output_dir: A directory to write files to
90+
:param study: A study name, right now we only support 'HBN'
91+
:param subject: A subject from the study, starting with 'sub-'
92+
:return: None
93+
"""
94+
if not os.path.exists(output_dir):
95+
os.makedirs(output_dir)
96+
97+
if study.upper() != 'HBN':
98+
raise NotImplementedError('We only support data downloads from the HBN dataset right now.')
99+
100+
get_dataset(os.path.abspath(output_dir), source=study.upper(), subject_id=subject)
83101
print('done')
84102

85103

dmriprep/data.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@
2020
mod_logger = logging.getLogger(__name__)
2121

2222

23-
def get_dataset(output_dir, source='HBN'):
23+
def get_dataset(output_dir, source='HBN', subject_id='sub-NDARBA507GCT'):
2424
if source in ['HBN']:
25-
get_hbn_data(output_dir)
25+
get_hbn_data(output_dir, subject_id)
2626
else:
2727
raise ValueError('Invalid dataset source')
2828

2929

30-
def get_hbn_data(output_dir):
31-
subject_id = 'sub-NDARBA507GCT'
30+
def get_hbn_data(output_dir, subject_id):
3231
hbn_study = HBN(subjects=subject_id)
3332
subject = hbn_study.subjects[0]
3433
subject.download(directory=output_dir)

0 commit comments

Comments
 (0)