Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] AttributeError for _ApplyCoeffsFieldInputSpec #481

Merged
merged 2 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdcflows/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
22 changes: 20 additions & 2 deletions sdcflows/interfaces/bspline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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
Expand Down
Empty file.
Empty file.
Loading