Skip to content

Commit 1f44132

Browse files
committed
chore: Switch to fmt:skip in anat.ants
1 parent 1be5296 commit 1f44132

File tree

1 file changed

+15
-37
lines changed

1 file changed

+15
-37
lines changed

niworkflows/anat/ants.py

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ def init_brain_extraction_wf(
362362
# Apply mask
363363
apply_mask = pe.MapNode(ApplyMask(), iterfield=['in_file'], name='apply_mask')
364364

365-
# fmt: off
366365
wf.connect([
367366
(inputnode, trunc, [('in_files', 'op1')]),
368367
(inputnode, inu_n4_final, [('in_files', 'input_image')]),
@@ -386,8 +385,7 @@ def init_brain_extraction_wf(
386385
(inu_n4_final, outputnode, [('output_image', 'bias_corrected'),
387386
('bias_image', 'bias_image')]),
388387
(apply_mask, outputnode, [('out_file', 'out_file')]),
389-
])
390-
# fmt: on
388+
]) # fmt:skip
391389

392390
wm_tpm = get_template(in_template, label='WM', suffix='probseg', **common_spec) or None
393391
if wm_tpm:
@@ -403,26 +401,22 @@ def init_brain_extraction_wf(
403401
full_wm = pe.Node(niu.Function(function=_imsum), name='full_wm')
404402
full_wm.inputs.op1 = str(wm_tpm)
405403
full_wm.inputs.op2 = str(bstem_tpm)
406-
# fmt: off
407404
wf.connect([
408405
(full_wm, map_wmmask, [('out', 'input_image')])
409-
])
410-
# fmt: on
406+
]) # fmt:skip
411407
else:
412408
map_wmmask.inputs.input_image = str(wm_tpm)
413-
# fmt: off
414409
wf.disconnect([
415410
(map_brainmask, inu_n4_final, [('output_image', 'weight_image')]),
416-
])
411+
]) # fmt:skip
417412
wf.connect([
418413
(inputnode, map_wmmask, [(('in_files', _pop), 'reference_image')]),
419414
(norm, map_wmmask, [
420415
('reverse_transforms', 'transforms'),
421416
('reverse_invert_flags', 'invert_transform_flags'),
422417
]),
423418
(map_wmmask, inu_n4_final, [('output_image', 'weight_image')]),
424-
])
425-
# fmt: on
419+
]) # fmt:skip
426420

427421
if use_laplacian:
428422
lap_tmpl = pe.Node(
@@ -437,24 +431,20 @@ def init_brain_extraction_wf(
437431
mrg_tmpl = pe.Node(niu.Merge(2), name='mrg_tmpl')
438432
mrg_tmpl.inputs.in1 = tpl_target_path
439433
mrg_target = pe.Node(niu.Merge(2), name='mrg_target')
440-
# fmt: off
441434
wf.connect([
442435
(inu_n4, lap_target, [(('output_image', _pop), 'op1')]),
443436
(lap_tmpl, mrg_tmpl, [('output_image', 'in2')]),
444437
(inu_n4, mrg_target, [('output_image', 'in1')]),
445438
(lap_target, mrg_target, [('output_image', 'in2')]),
446439
(mrg_tmpl, norm, [('out', 'fixed_image')]),
447440
(mrg_target, norm, [('out', 'moving_image')]),
448-
])
449-
# fmt: on
441+
]) # fmt:skip
450442

451443
else:
452444
norm.inputs.fixed_image = tpl_target_path
453-
# fmt: off
454445
wf.connect([
455446
(inu_n4, norm, [(('output_image', _pop), 'moving_image')]),
456-
])
457-
# fmt: on
447+
]) # fmt:skip
458448

459449
if atropos_refine:
460450
atropos_model = atropos_model or list(ATROPOS_MODELS[bids_suffix].values())
@@ -467,13 +457,12 @@ def init_brain_extraction_wf(
467457
wm_prior=bool(wm_tpm),
468458
)
469459

470-
# fmt: off
471460
wf.disconnect([
472461
(thr_brainmask, outputnode, [('output_image', 'out_mask')]),
473462
(inu_n4_final, outputnode, [('output_image', 'bias_corrected'),
474463
('bias_image', 'bias_image')]),
475464
(apply_mask, outputnode, [('out_file', 'out_file')]),
476-
])
465+
]) # fmt:skip
477466
wf.connect([
478467
(inputnode, atropos_wf, [('in_files', 'inputnode.in_files')]),
479468
(inu_n4, atropos_wf, [('output_image', 'inputnode.in_corrected')]),
@@ -486,14 +475,11 @@ def init_brain_extraction_wf(
486475
('outputnode.out_segm', 'out_segm'),
487476
('outputnode.out_tpms', 'out_tpms'),
488477
]),
489-
])
490-
# fmt: on
478+
]) # fmt:skip
491479
if wm_tpm:
492-
# fmt: off
493480
wf.connect([
494481
(map_wmmask, atropos_wf, [('output_image', 'inputnode.wm_prior')]),
495-
])
496-
# fmt: on
482+
]) # fmt:skip
497483
return wf
498484

499485

@@ -762,7 +748,6 @@ def init_atropos_wf(
762748
# Apply mask
763749
apply_mask = pe.MapNode(ApplyMask(), iterfield=['in_file'], name='apply_mask')
764750

765-
# fmt: off
766751
wf.connect([
767752
(inputnode, dil_brainmask, [('in_mask', 'op1')]),
768753
(inputnode, copy_xform, [(('in_files', _pop), 'hdr_file')]),
@@ -824,8 +809,7 @@ def init_atropos_wf(
824809
('out_segm', 'out_segm'),
825810
('out_tpms', 'out_tpms'),
826811
]),
827-
])
828-
# fmt: on
812+
]) # fmt:skip
829813

830814
if wm_prior:
831815
from nipype.algorithms.metrics import FuzzyOverlap
@@ -844,10 +828,9 @@ def _argmax(in_dice):
844828

845829
apply_wm_prior = pe.Node(niu.Function(function=_improd), name='apply_wm_prior')
846830

847-
# fmt: off
848831
wf.disconnect([
849832
(copy_xform_wm, inu_n4_final, [('wm_map', 'weight_image')]),
850-
])
833+
]) # fmt:skip
851834
wf.connect([
852835
(inputnode, apply_wm_prior, [('in_mask', 'in_mask'),
853836
('wm_prior', 'op2')]),
@@ -858,8 +841,7 @@ def _argmax(in_dice):
858841
(overlap, sel_wm, [(('class_fdi', _argmax), 'index')]),
859842
(copy_xform_wm, apply_wm_prior, [('wm_map', 'op1')]),
860843
(apply_wm_prior, inu_n4_final, [('out', 'weight_image')]),
861-
])
862-
# fmt: on
844+
]) # fmt:skip
863845
return wf
864846

865847

@@ -989,16 +971,14 @@ def init_n4_only_wf(
989971
stacklevel=1,
990972
)
991973

992-
# fmt: off
993974
wf.connect([
994975
(inputnode, inu_n4_final, [('in_files', 'input_image')]),
995976
(inputnode, thr_brainmask, [(('in_files', _pop), 'in_file')]),
996977
(thr_brainmask, outputnode, [('out_mask', 'out_mask')]),
997978
(inu_n4_final, outputnode, [('output_image', 'out_file'),
998979
('output_image', 'bias_corrected'),
999980
('bias_image', 'bias_image')]),
1000-
])
1001-
# fmt: on
981+
]) # fmt:skip
1002982

1003983
# If atropos refine, do in4 twice
1004984
if atropos_refine:
@@ -1010,12 +990,11 @@ def init_n4_only_wf(
1010990
in_segmentation_model=atropos_model,
1011991
)
1012992

1013-
# fmt: off
1014993
wf.disconnect([
1015994
(inu_n4_final, outputnode, [('output_image', 'out_file'),
1016995
('output_image', 'bias_corrected'),
1017996
('bias_image', 'bias_image')]),
1018-
])
997+
]) # fmt:skip
1019998
wf.connect([
1020999
(inputnode, atropos_wf, [('in_files', 'inputnode.in_files')]),
10211000
(inu_n4_final, atropos_wf, [('output_image', 'inputnode.in_corrected')]),
@@ -1027,8 +1006,7 @@ def init_n4_only_wf(
10271006
('outputnode.out_segm', 'out_segm'),
10281007
('outputnode.out_tpms', 'out_tpms'),
10291008
]),
1030-
])
1031-
# fmt: on
1009+
]) # fmt:skip
10321010

10331011
return wf
10341012

0 commit comments

Comments
 (0)