Skip to content

[WIP][FIX] Bug ApplyInverseTransform #3326

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

Closed
wants to merge 5 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ def test_ApplyInverseDeformation_inputs():
xor=["deformation"],
),
in_files=dict(
field="fnames",
field="out{1}.pull.fnames",
mandatory=True,
),
interpolation=dict(
field="interp",
field="out{1}.pull.interp",
),
matlab_cmd=dict(),
mfile=dict(
Expand Down
14 changes: 10 additions & 4 deletions nipype/interfaces/spm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,13 @@ class ApplyInverseDeformationInput(SPMCommandInputSpec):
in_files = InputMultiPath(
File(exists=True),
mandatory=True,
field="fnames",
field="out{1}.pull.fnames",
desc="Files on which deformation is applied",
)
target = File(
exists=True, field="comp{1}.inv.space", desc="File defining target space"
)

deformation = File(
exists=True,
field="comp{1}.inv.comp{1}.sn2def.matname",
Expand All @@ -281,7 +282,10 @@ class ApplyInverseDeformationInput(SPMCommandInputSpec):
xor=["deformation"],
)
interpolation = traits.Range(
low=0, high=7, field="interp", desc="degree of b-spline used for interpolation"
low=0,
high=7,
field="out{1}.pull.interp",
desc="degree of b-spline used for interpolation",
)

bounding_box = traits.List(
Expand Down Expand Up @@ -328,9 +332,11 @@ class ApplyInverseDeformation(SPMCommand):
def _format_arg(self, opt, spec, val):
"""Convert input to appropriate format for spm"""
if opt == "in_files":
return scans_for_fnames(ensure_list(val))
return np.array([simplify_list(val)], dtype=object)
# return scans_for_fnames(ensure_list(val))
if opt == "target":
return scans_for_fname(ensure_list(val))
return np.array([simplify_list(val)], dtype=object)
# return scans_for_fname(ensure_list(val))
if opt == "deformation":
return np.array([simplify_list(val)], dtype=object)
if opt == "deformation_field":
Expand Down