Skip to content

Commit 4eb5bc4

Browse files
authored
Merge pull request #280 from nipy/fix/do-not-resample-bsplines
FIX: Remove "densification" of B-Spline transforms in ``apply()``
2 parents 20e2c25 + cdcc9bb commit 4eb5bc4

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

nitransforms/resampling.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -259,22 +259,14 @@ def apply(
259259
targets = None
260260
ref_ndcoords = _ref.ndcoords
261261

262-
if hasattr(transform, "to_field") and callable(transform.to_field):
263-
targets = ImageGrid(spatialimage).index(
264-
_as_homogeneous(
265-
transform.to_field(reference=reference).map(ref_ndcoords),
266-
dim=_ref.ndim,
267-
)
268-
)
269-
else:
270-
# Targets' shape is (Nt, 3, Nv) with Nv = Num. voxels, Nt = Num. timepoints.
271-
targets = (
272-
ImageGrid(spatialimage).index(
273-
_as_homogeneous(transform.map(ref_ndcoords), dim=_ref.ndim)
274-
)
275-
if targets is None
276-
else targets
262+
# Targets' shape is (Nt, 3, Nv) with Nv = Num. voxels, Nt = Num. timepoints.
263+
targets = (
264+
ImageGrid(spatialimage).index(
265+
_as_homogeneous(transform.map(ref_ndcoords), dim=_ref.ndim)
277266
)
267+
if targets is None
268+
else targets
269+
)
278270

279271
if targets.ndim == 2:
280272
targets = targets.T[np.newaxis, ...]

0 commit comments

Comments
 (0)