Skip to content

Commit cdfed73

Browse files
committed
update docs, add doctests
1 parent 6bc9e6b commit cdfed73

File tree

13 files changed

+416
-255
lines changed

13 files changed

+416
-255
lines changed

dmriprep/__about__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
__version__ = get_versions()['version']
66
del get_versions
77

8-
__packagename__ = "dmriprep"
9-
__credits__ = ("Contributors: please check the ``.zenodo.json`` file at the"
10-
"top-level folder of the repository")
11-
__url__ = "https://github.com/nipy/dmriprep"
8+
__packagename__ = 'dmriprep'
9+
__credits__ = ('Contributors: please check the ``.zenodo.json`` file at the'
10+
'top-level folder of the repository')
11+
__url__ = 'https://github.com/nipy/dmriprep'
1212

1313
DOWNLOAD_URL = (
14-
"https://github.com/nipy/dmriprep/{name}/archive/{ver}.tar.gz".format(
14+
'https://github.com/nipy/dmriprep/{name}/archive/{ver}.tar.gz'.format(
1515
name=__packagename__, ver=__version__
1616
)
1717
)

dmriprep/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313

1414
# Filter warnings that are visible whenever you import another package that
1515
# was compiled against an older numpy than is installed.
16-
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
17-
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
16+
warnings.filterwarnings('ignore', message='numpy.dtype size changed')
17+
warnings.filterwarnings('ignore', message='numpy.ufunc size changed')

dmriprep/cli.py

Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -13,114 +13,114 @@
1313

1414
# Filter warnings that are visible whenever you import another package that
1515
# was compiled against an older numpy than is installed.
16-
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
17-
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
16+
warnings.filterwarnings('ignore', message='numpy.dtype size changed')
17+
warnings.filterwarnings('ignore', message='numpy.ufunc size changed')
1818

1919
@click.command()
2020
# arguments as specified by BIDS-Apps
21-
@click.argument("bids_dir", type=click.Path(exists=True, file_okay=False))
21+
@click.argument('bids_dir', type=click.Path(exists=True, file_okay=False))
2222
@click.argument(
23-
"output_dir", type=click.Path(exists=True, file_okay=False, writable=True)
23+
'output_dir', type=click.Path(exists=True, file_okay=False, writable=True)
2424
)
2525
@click.argument(
26-
"analysis_level", default="participant", type=click.Choice(["participant", "group"])
26+
'analysis_level', default='participant', type=click.Choice(['participant', 'group'])
2727
)
2828
# optional arguments
2929
# options for filtering BIDS queries
3030
@click.option(
31-
"--skip_bids_validation",
32-
help="Assume the input dataset is BIDS compliant and skip the validation",
31+
'--skip_bids_validation',
32+
help='Assume the input dataset is BIDS compliant and skip the validation',
3333
is_flag=True
3434
)
3535
@click.option(
36-
"--participant_label",
36+
'--participant_label',
3737
default=None,
38-
help="The label(s) of the participant(s) that should be "
39-
"analyzed. The label corresponds to "
40-
"sub-<participant_label> from the BIDS spec (the 'sub-' "
41-
"prefix can be removed). If this parameter is not provided "
42-
"all subjects will be analyzed. Multiple participants "
43-
"can be specified with a space delimited list."
38+
help='The label(s) of the participant(s) that should be '
39+
'analyzed. The label corresponds to '
40+
'sub-<participant_label> from the BIDS spec (the "sub-" '
41+
'prefix can be removed). If this parameter is not provided '
42+
'all subjects will be analyzed. Multiple participants '
43+
'can be specified with a space delimited list.'
4444
)
4545
# options for prepping dwi scans
46-
# @click.option(
47-
# "--concat_shells",
48-
# default=None,
49-
# help="A space delimited list of acq-<label>",
50-
# )
5146
@click.option(
52-
"--b0_thresh",
47+
'--concat_dwis',
48+
default=None,
49+
help='A space delimited list of acq-<label>',
50+
)
51+
@click.option(
52+
'--b0_thresh',
5353
default=5,
5454
show_default=True,
55-
help="Threshold for b0 value",
55+
help='Threshold for b0 value',
5656
type=click.IntRange(min=0, max=10),
5757
)
5858
@click.option(
59-
"--output_resolution",
60-
help="The isotropic voxel size in mm the data will be resampled to before eddy.",
59+
'--output_resolution',
60+
help='The isotropic voxel size in mm the data will be resampled to before eddy.',
6161
type=float,
6262
multiple=True
6363
)
6464
# specific options for eddy
6565
@click.option(
66-
"--omp_nthreads",
66+
'--omp_nthreads',
6767
default=1,
6868
show_default=True,
69-
help="Maximum number of threads for eddy",
69+
help='Maximum number of threads for eddy',
7070
type=int,
7171
)
7272
@click.option(
73-
"--eddy_niter",
73+
'--eddy_niter',
7474
default=5,
7575
show_default=True,
76-
help="Fixed number of eddy iterations. See "
77-
"https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/eddy/UsersGuide"
78-
"#A--niter",
76+
help='Fixed number of eddy iterations. See '
77+
'https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/eddy/UsersGuide'
78+
'#A--niter',
7979
type=int,
8080
)
8181
@click.option(
82-
"--bet_dwi",
82+
'--bet_dwi',
8383
default=0.3,
8484
show_default=True,
85-
help="Fractional intensity threshold for BET on the DWI. "
86-
"A higher value will be more strict; it will cut off more "
87-
"around what it analyzes the brain to be.",
85+
help='Fractional intensity threshold for BET on the DWI. '
86+
'A higher value will be more strict; it will cut off more '
87+
'around what it analyzes the brain to be.',
8888
type=click.FloatRange(min=0, max=1),
8989
)
9090
@click.option(
91-
"--bet_mag",
91+
'--bet_mag',
9292
default=0.3,
9393
show_default=True,
94-
help="Fractional intensity threshold for BET on the magnitude. "
95-
"A higher value will be more strict; it will cut off more "
96-
"around what it analyzes the brain to be.",
94+
help='Fractional intensity threshold for BET on the magnitude. '
95+
'A higher value will be more strict; it will cut off more '
96+
'around what it analyzes the brain to be.',
9797
type=click.FloatRange(min=0, max=1),
9898
)
9999
@click.option(
100-
"--acqp_file",
100+
'--acqp_file',
101101
default=None,
102-
help="If you want to pass in an acqp file for topup/eddy instead of"
103-
"generating it from the json by default.",
102+
help='If you want to pass in an acqp file for topup/eddy instead of'
103+
'generating it from the json by default.',
104104
type=click.Path(exists=True, dir_okay=False),
105105
)
106106
# workflow configuration
107107
@click.option(
108-
"--ignore",
109-
"-i",
110-
help="Specify which node(s) to skip during the preprocessing of the dwi.",
111-
type=click.Choice(["denoise", "unring"]),
108+
'--ignore',
109+
'-i',
110+
help='Specify which node(s) to skip during the preprocessing of the dwi.',
111+
type=click.Choice(['denoise', 'unring', 'fieldmaps']),
112112
multiple=True,
113113
)
114114
@click.option(
115-
"--work_dir",
116-
"-w",
117-
help="working directory",
115+
'--work_dir',
116+
'-w',
117+
help='working directory',
118118
type=click.Path(exists=True, file_okay=False, writable=True),
119119
)
120120
@click.option(
121-
"--synb0_dir",
121+
'--synb0_dir',
122122
default=None,
123-
help="If you want to use Synb0-DISCO for preprocessing.",
123+
help='If you want to use Synb0-DISCO for preprocessing.',
124124
type=click.Path(exists=True, file_okay=False),
125125
)
126126
def main(
@@ -131,6 +131,7 @@ def main(
131131
skip_bids_validation,
132132
work_dir,
133133
ignore,
134+
concat_dwis,
134135
b0_thresh,
135136
output_resolution,
136137
bet_dwi,
@@ -152,10 +153,10 @@ def main(
152153
participant level analyses can be run independently (in parallel).
153154
"""
154155

155-
if analysis_level != "participant":
156+
if analysis_level != 'participant':
156157
raise NotImplementedError(
157-
"The only valid analysis level for dmriprep "
158-
"is participant at the moment."
158+
'The only valid analysis level for dmriprep '
159+
'is participant at the moment.'
159160
)
160161

161162
layout = BIDSLayout(bids_dir, validate=True)
@@ -169,7 +170,7 @@ def main(
169170
validate_input_dir(bids_dir, all_subjects, subject_list)
170171

171172
if not work_dir:
172-
work_dir = os.path.join(output_dir, "scratch")
173+
work_dir = os.path.join(output_dir, 'scratch')
173174

174175
if len(output_resolution) == 1:
175176
output_resolution = output_resolution * 3
@@ -180,6 +181,7 @@ def main(
180181
output_dir=output_dir,
181182
work_dir=work_dir,
182183
ignore=list(ignore),
184+
concat_dwis=list(concat_dwis),
183185
b0_thresh=b0_thresh,
184186
output_resolution=output_resolution,
185187
bet_dwi=bet_dwi,
@@ -188,13 +190,13 @@ def main(
188190
synb0_dir=synb0_dir
189191
)
190192
wf.write_graph()
191-
wf.config["execution"]["remove_unnecessary_outputs"] = False
192-
wf.config["execution"]["keep_inputs"] = True
193-
wf.config["execution"]["crashfile_format"] = "txt"
193+
wf.config['execution']['remove_unnecessary_outputs'] = False
194+
wf.config['execution']['keep_inputs'] = True
195+
wf.config['execution']['crashfile_format'] = 'txt'
194196
wf.run()
195197

196198
return 0
197199

198200

199-
if __name__ == "__main__":
201+
if __name__ == '__main__':
200202
sys.exit(main()) # pragma: no cover

dmriprep/data/boilerplate.bib

Lines changed: 23 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -123,66 +123,32 @@ @article{flirt
123123
pages = {143--156}
124124
}
125125

126-
@article{mcflirt,
127-
author = {Jenkinson, Mark and Bannister, Peter and Brady, Michael and Smith, Stephen},
128-
doi = {10.1006/nimg.2002.1132},
129-
issn = {1053-8119},
126+
@article{denoise1,
127+
title = {Denoising of diffusion MRI using random matrix theory},
128+
volume = {142},
129+
doi = {10.1016/j.neuroimage.2016.08.016},
130130
journal = {NeuroImage},
131-
number = 2,
132-
pages = {825-841},
133-
title = {Improved Optimization for the Robust and Accurate Linear Registration and Motion Correction of Brain Images},
134-
url = {http://www.sciencedirect.com/science/article/pii/S1053811902911328},
135-
volume = 17,
136-
year = 2002
131+
author = {Veraart, J.; Novikov, D.S.; Christiaens, D.; Ades-aron, B.; Sijbers, J. & Fieremans, E.},
132+
year = {2016},
133+
pages = {394-406}
137134
}
138135

139-
@article{bbr,
140-
author = {Greve, Douglas N and Fischl, Bruce},
141-
doi = {10.1016/j.neuroimage.2009.06.060},
142-
issn = {1095-9572},
143-
journal = {NeuroImage},
144-
number = 1,
145-
pages = {63-72},
146-
title = {Accurate and robust brain image alignment using boundary-based registration},
147-
volume = 48,
148-
year = 2009
136+
@article{denoise2,
137+
title = {Diffusion MRI noise mapping using random matrix theory},
138+
volume = {76},
139+
doi = {10.1002/mrm.26059},
140+
journal = {Magnetic Resonance in Medicine},
141+
author = {Veraart, J.; Fieremans, E. & Novikov, D.S.},
142+
year = {2016},
143+
pages = {1582-1593}
149144
}
150145

151-
@article{power_fd_dvars,
152-
author = {Power, Jonathan D. and Mitra, Anish and Laumann, Timothy O. and Snyder, Abraham Z. and Schlaggar, Bradley L. and Petersen, Steven E.},
153-
doi = {10.1016/j.neuroimage.2013.08.048},
154-
issn = {1053-8119},
155-
journal = {NeuroImage},
156-
number = {Supplement C},
157-
pages = {320-341},
158-
title = {Methods to detect, characterize, and remove motion artifact in resting state fMRI},
159-
url = {http://www.sciencedirect.com/science/article/pii/S1053811913009117},
160-
volume = 84,
161-
year = 2014
162-
}
163-
164-
@article{confounds_satterthwaite_2013,
165-
author = {Satterthwaite, Theodore D. and Elliott, Mark A. and Gerraty, Raphael T. and Ruparel, Kosha and Loughead, James and Calkins, Monica E. and Eickhoff, Simon B. and Hakonarson, Hakon and Gur, Ruben C. and Gur, Raquel E. and Wolf, Daniel H.},
166-
doi = {10.1016/j.neuroimage.2012.08.052},
167-
issn = {10538119},
168-
journal = {NeuroImage},
169-
number = 1,
170-
pages = {240--256},
171-
title = {{An improved framework for confound regression and filtering for control of motion artifact in the preprocessing of resting-state functional connectivity data}},
172-
url = {http://linkinghub.elsevier.com/retrieve/pii/S1053811912008609},
173-
volume = 64,
174-
year = 2013
175-
}
176-
177-
@article{hcppipelines,
178-
author = {Glasser, Matthew F. and Sotiropoulos, Stamatios N. and Wilson, J. Anthony and Coalson, Timothy S. and Fischl, Bruce and Andersson, Jesper L. and Xu, Junqian and Jbabdi, Saad and Webster, Matthew and Polimeni, Jonathan R. and Van Essen, David C. and Jenkinson, Mark},
179-
doi = {10.1016/j.neuroimage.2013.04.127},
180-
issn = {1053-8119},
181-
journal = {NeuroImage},
182-
pages = {105-124},
183-
series = {Mapping the Connectome},
184-
title = {The minimal preprocessing pipelines for the Human Connectome Project},
185-
url = {http://www.sciencedirect.com/science/article/pii/S1053811913005053},
186-
volume = 80,
187-
year = 2013
146+
@article{unring,
147+
title = {Gibbs-ringing artifact removal based on local subvoxel-shifts},
148+
volume = {76},
149+
doi = {10.1002/mrm.26054},
150+
journal = {Magnetic Resonance in Medicine},
151+
author = {Kellner, E; Dhital, B; Kiselev, V.G & Reisert, M.},
152+
year = {2016},
153+
pages = {1574–1581}
188154
}

0 commit comments

Comments
 (0)