Skip to content

Commit 6b55a28

Browse files
committed
Merge branch 'master' into fix/correctly-handle-priors
2 parents 98a15bc + 986d7fd commit 6b55a28

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

sdcflows/workflows/fit/syn.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
from nipype.pipeline import engine as pe
2828
from nipype.interfaces import utility as niu
29-
from nipype.interfaces.base import Undefined
3029
from niworkflows.engine.workflows import LiterateWorkflow as Workflow
3130

3231
from ... import data

sdcflows/workflows/fit/tests/test_syn.py

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# https://www.nipreps.org/community/licensing/
2222
#
2323
"""Test fieldmap-less SDC-SyN."""
24+
2425
import json
2526
import pytest
2627
from nipype.pipeline import engine as pe
@@ -145,6 +146,30 @@ def test_syn_wf(tmpdir, datadir, workdir, outdir, sloppy_mode, sd_prior):
145146
wf.run(plugin="Linear")
146147

147148

149+
@pytest.mark.parametrize("laplacian_weight", [None, (0.5, 0.1), (0.8, -1.0)])
150+
@pytest.mark.parametrize("sloppy", [True, False])
151+
def test_syn_wf_inputs(sloppy, laplacian_weight):
152+
"""Test the input validation of the SDC-SyN workflow."""
153+
from sdcflows.workflows.fit.syn import MAX_LAPLACIAN_WEIGHT
154+
155+
laplacian_weight = (
156+
(0.1, 0.2)
157+
if laplacian_weight is None
158+
else (
159+
max(min(laplacian_weight[0], MAX_LAPLACIAN_WEIGHT), 0.0),
160+
max(min(laplacian_weight[1], MAX_LAPLACIAN_WEIGHT), 0.0),
161+
)
162+
)
163+
metric_weight = [
164+
[1.0 - laplacian_weight[0], laplacian_weight[0]],
165+
[1.0 - laplacian_weight[1], laplacian_weight[1]],
166+
]
167+
168+
wf = init_syn_sdc_wf(sloppy=sloppy, laplacian_weight=laplacian_weight)
169+
170+
assert wf.inputs.syn.metric_weight == metric_weight
171+
172+
148173
@pytest.mark.parametrize("ants_version", ["2.2.0", "2.1.0", None])
149174
def test_syn_wf_version(monkeypatch, ants_version):
150175
"""Ensure errors are triggered with ANTs < 2.2."""
@@ -188,12 +213,15 @@ def test_adjust_zooms(anat_res, epi_res, retval, tmpdir, datadir):
188213
assert _adjust_zooms("anat.nii.gz", "epi.nii.gz") == retval
189214

190215

191-
@pytest.mark.parametrize("in_dtype,out_dtype", [
192-
("float32", "int16"),
193-
("int16", "int16"),
194-
("uint8", "int16"),
195-
("float64", "int16"),
196-
])
216+
@pytest.mark.parametrize(
217+
"in_dtype,out_dtype",
218+
[
219+
("float32", "int16"),
220+
("int16", "int16"),
221+
("uint8", "int16"),
222+
("float64", "int16"),
223+
],
224+
)
197225
def test_ensure_dtype(in_dtype, out_dtype, tmpdir):
198226
"""Exercise the set dtype function node."""
199227
import numpy as np

0 commit comments

Comments
 (0)