Skip to content

Commit 6088fe3

Browse files
committed
enh: avoid names collision in new interface
1 parent c107a30 commit 6088fe3

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

sdcflows/interfaces/bspline.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,13 @@ class TOPUPCoeffReorient(SimpleInterface):
359359

360360
def _run_interface(self, runtime):
361361
self._results["out_coeff"] = [
362-
str(_fix_topup_fieldcoeff(in_coeff, self.inputs.fmap_ref,))
362+
str(
363+
_fix_topup_fieldcoeff(
364+
in_coeff,
365+
self.inputs.fmap_ref,
366+
fname_presuffix(in_coeff, suffix="_fixed", newpath=runtime.cwd),
367+
)
368+
)
363369
for in_coeff in self.inputs.in_coeff
364370
]
365371
return runtime

sdcflows/interfaces/tests/test_bspline.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
import nibabel as nb
55
import pytest
66

7-
from ..bspline import bspline_grid, Coefficients2Warp, BSplineApprox, TOPUPCoeffReorient
7+
from ..bspline import (
8+
bspline_grid,
9+
Coefficients2Warp,
10+
BSplineApprox,
11+
TOPUPCoeffReorient,
12+
_fix_topup_fieldcoeff,
13+
)
814

915

1016
@pytest.mark.parametrize("testnum", range(100))
@@ -56,7 +62,6 @@ def test_bsplines(tmp_path, testnum):
5662

5763
def test_topup_coeffs(tmpdir, testdata_dir):
5864
"""Check the revision of TOPUP headers."""
59-
6065
tmpdir.chdir()
6166
result = TOPUPCoeffReorient(
6267
in_coeff=str(testdata_dir / "topup-coeff.nii.gz"),
@@ -75,3 +80,7 @@ def test_topup_coeffs(tmpdir, testdata_dir):
7580
TOPUPCoeffReorient(
7681
in_coeff="failing.nii.gz", fmap_ref=str(testdata_dir / "epi.nii.gz"),
7782
).run()
83+
84+
# Test automatic output file name generation, just for coverage
85+
with pytest.raises(ValueError):
86+
_fix_topup_fieldcoeff("failing.nii.gz", str(testdata_dir / "epi.nii.gz"))

0 commit comments

Comments
 (0)