diff --git a/sdcflows/conftest.py b/sdcflows/conftest.py index e8f2e709be..bfcc77ae86 100644 --- a/sdcflows/conftest.py +++ b/sdcflows/conftest.py @@ -72,6 +72,7 @@ def doctest_fixture(doctest_namespace, request): dsA_dir=data_dir / "dsA", dsB_dir=data_dir / "dsB", dsC_dir=data_dir / "dsC", + data_dir=data_dir, ) doctest_namespace.update((key, Path(val.root)) for key, val in layouts.items()) diff --git a/sdcflows/interfaces/bspline.py b/sdcflows/interfaces/bspline.py index f2b1dfaa14..4268a18ed5 100644 --- a/sdcflows/interfaces/bspline.py +++ b/sdcflows/interfaces/bspline.py @@ -309,12 +309,12 @@ class _ApplyCoeffsFieldInputSpec(BaseInterfaceInputSpec): fmap2data_xfm = InputMultiObject( File(exists=True), desc="the transform by which the target EPI can be resampled on the fieldmap's grid.", - xor="data2fmap_xfm", + xor=["data2fmap_xfm"], ) data2fmap_xfm = InputMultiObject( File(exists=True), desc="the transform by which the fieldmap can be resampled on the target EPI's grid.", - xor="fmap2data_xfm", + xor=["fmap2data_xfm"], ) in_xfms = traits.List( traits.List(traits.List(traits.Float)), @@ -380,6 +380,24 @@ class ApplyCoeffsField(SimpleInterface): With those coordinates known, interpolation is trivial. 4. Generate a spatial image with the new data. + Example + ------- + + >>> from sdcflows.interfaces.bspline import ApplyCoeffsField + >>> unwarp = ApplyCoeffsField(pe_dir='j', ro_time=0.03125) + >>> unwarp.inputs.in_data = str(data_dir / 'epi.nii.gz') + >>> unwarp.inputs.in_coeff = str(data_dir / 'topup-coeff.nii.gz') + >>> unwarp.inputs.data2fmap_xfm = str(data_dir / 'epi2fmap_xfm.txt') + >>> result = unwarp.run() # doctest: +SKIP + + Inverse transforms may be used instead: + + >>> unwarp = ApplyCoeffsField(pe_dir='j', ro_time=0.03125) + >>> unwarp.inputs.in_data = str(data_dir / 'epi.nii.gz') + >>> unwarp.inputs.in_coeff = str(data_dir / 'topup-coeff.nii.gz') + >>> unwarp.inputs.fmap2data_xfm = str(data_dir / 'fmap2epi_xfm.txt') + >>> result = unwarp.run() # doctest: +SKIP + """ input_spec = _ApplyCoeffsFieldInputSpec diff --git a/sdcflows/tests/data/epi2fmap_xfm.txt b/sdcflows/tests/data/epi2fmap_xfm.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/sdcflows/tests/data/fmap2epi_xfm.txt b/sdcflows/tests/data/fmap2epi_xfm.txt new file mode 100644 index 0000000000..e69de29bb2