Skip to content

Commit c2158aa

Browse files
authored
Merge pull request #344 from mgxd/mnt/debug-sloppy
MNT: Add `sloppy` argument to workflows, distinguish from `debug`
2 parents 0cd77e3 + 60f0266 commit c2158aa

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

smriprep/cli/run.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,8 @@ def build_workflow(opts, retval):
579579

580580
# Build main workflow
581581
retval["workflow"] = init_smriprep_wf(
582-
debug=opts.sloppy,
582+
sloppy=opts.sloppy,
583+
debug=False,
583584
fast_track=opts.fast_track,
584585
freesurfer=opts.run_reconall,
585586
fs_subjects_dir=opts.fs_subjects_dir,

smriprep/workflows/anatomical.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def init_anat_preproc_wf(
7676
spaces,
7777
cifti_output=False,
7878
debug=False,
79+
sloppy=False,
7980
existing_derivatives=None,
8081
name="anat_preproc_wf",
8182
skull_strip_fixed_seed=False,
@@ -142,6 +143,8 @@ def init_anat_preproc_wf(
142143
Object containing standard and nonstandard space specifications.
143144
debug : :obj:`bool`
144145
Enable debugging outputs
146+
sloppy: :obj:`bool`
147+
Quick, impercise operations. Used to decrease workflow duration.
145148
name : :obj:`str`, optional
146149
Workflow name (default: anat_preproc_wf)
147150
skull_strip_mode : :obj:`str`
@@ -393,12 +396,12 @@ def _check_img(img):
393396
template_spec=skull_strip_template.spec,
394397
atropos_use_random_seed=not skull_strip_fixed_seed,
395398
omp_nthreads=omp_nthreads,
396-
normalization_quality="precise" if not debug else "testing",
399+
normalization_quality="precise" if not sloppy else "testing",
397400
)
398401

399402
# 4. Spatial normalization
400403
anat_norm_wf = init_anat_norm_wf(
401-
debug=debug,
404+
sloppy=sloppy,
402405
omp_nthreads=omp_nthreads,
403406
templates=spaces.get_spaces(nonstandard=False, dim=(3,)),
404407
)

smriprep/workflows/base.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
def init_smriprep_wf(
4545
*,
46+
sloppy,
4647
debug,
4748
fast_track,
4849
freesurfer,
@@ -80,6 +81,7 @@ def init_smriprep_wf(
8081
from smriprep.workflows.base import init_smriprep_wf
8182
from niworkflows.utils.spaces import SpatialReferences, Reference
8283
wf = init_smriprep_wf(
84+
sloppy=False,
8385
debug=False,
8486
fast_track=False,
8587
freesurfer=True,
@@ -102,6 +104,8 @@ def init_smriprep_wf(
102104
103105
Parameters
104106
----------
107+
sloppy: :obj:`bool`
108+
Quick, impercise operations. Used to decrease workflow duration.
105109
debug : :obj:`bool`
106110
Enable debugging outputs
107111
fast_track : :obj:`bool`
@@ -164,6 +168,7 @@ def init_smriprep_wf(
164168

165169
for subject_id in subject_list:
166170
single_subject_wf = init_single_subject_wf(
171+
sloppy=sloppy,
167172
debug=debug,
168173
freesurfer=freesurfer,
169174
fast_track=fast_track,
@@ -199,6 +204,7 @@ def init_smriprep_wf(
199204

200205
def init_single_subject_wf(
201206
*,
207+
sloppy,
202208
debug,
203209
fast_track,
204210
freesurfer,
@@ -238,6 +244,7 @@ def init_single_subject_wf(
238244
from smriprep.workflows.base import init_single_subject_wf
239245
BIDSLayout = namedtuple('BIDSLayout', ['root'])
240246
wf = init_single_subject_wf(
247+
sloppy=False,
241248
debug=False,
242249
freesurfer=True,
243250
fast_track=False,
@@ -258,6 +265,8 @@ def init_single_subject_wf(
258265
259266
Parameters
260267
----------
268+
sloppy: :obj:`bool`
269+
Quick, impercise operations. Used to decrease workflow duration.
261270
debug : :obj:`bool`
262271
Enable debugging outputs
263272
fast_track : :obj:`bool`
@@ -400,6 +409,7 @@ def init_single_subject_wf(
400409
# Preprocessing of T1w (includes registration to MNI)
401410
anat_preproc_wf = init_anat_preproc_wf(
402411
bids_root=layout.root,
412+
sloppy=sloppy,
403413
debug=debug,
404414
existing_derivatives=deriv_cache,
405415
freesurfer=freesurfer,

smriprep/workflows/norm.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
def init_anat_norm_wf(
4040
*,
41-
debug,
41+
sloppy,
4242
omp_nthreads,
4343
templates,
4444
name="anat_norm_wf",
@@ -53,7 +53,7 @@ def init_anat_norm_wf(
5353
5454
from smriprep.workflows.norm import init_anat_norm_wf
5555
wf = init_anat_norm_wf(
56-
debug=False,
56+
sloppy=False,
5757
omp_nthreads=1,
5858
templates=['MNI152NLin2009cAsym', 'MNI152NLin6Asym'],
5959
)
@@ -70,7 +70,7 @@ def init_anat_norm_wf(
7070
7171
Parameters
7272
----------
73-
debug : :obj:`bool`
73+
sloppy : :obj:`bool`
7474
Apply sloppy arguments to speed up processing. Use with caution,
7575
registration processes will be very inaccurate.
7676
omp_nthreads : :obj:`int`
@@ -194,7 +194,7 @@ def init_anat_norm_wf(
194194
split_desc = pe.Node(TemplateDesc(), run_without_submitting=True, name="split_desc")
195195

196196
tf_select = pe.Node(
197-
TemplateFlowSelect(resolution=1 + debug),
197+
TemplateFlowSelect(resolution=1 + sloppy),
198198
name="tf_select",
199199
run_without_submitting=True,
200200
)
@@ -208,7 +208,7 @@ def init_anat_norm_wf(
208208
registration = pe.Node(
209209
SpatialNormalization(
210210
float=True,
211-
flavor=["precise", "testing"][debug],
211+
flavor=["precise", "testing"][sloppy],
212212
),
213213
name="registration",
214214
n_procs=omp_nthreads,

0 commit comments

Comments
 (0)