Skip to content

Commit 09e9248

Browse files
committed
Patch for crash when applying 3D transform to 4D image
1 parent 4c69fb4 commit 09e9248

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nitransforms/resampling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async def _apply_serial(
108108
semaphore = asyncio.Semaphore(max_concurrent)
109109

110110
for t in range(n_resamplings):
111-
xfm_t = transform if n_resamplings == 1 else transform[t]
111+
xfm_t = transform if (n_resamplings == 1 or transform.ndim < 4) else transform[t]
112112

113113
if targets is None:
114114
targets = ImageGrid(spatialimage).index( # data should be an image
@@ -270,7 +270,7 @@ def apply(
270270
# Order F ensures individual volumes are contiguous in memory
271271
# Also matches NIfTI, making final save more efficient
272272
resampled = np.zeros(
273-
(len(ref_ndcoords), len(transform)), dtype=input_dtype, order="F"
273+
(len(ref_ndcoords), n_resamplings), dtype=input_dtype, order="F"
274274
)
275275

276276
resampled = asyncio.run(

0 commit comments

Comments
 (0)