Skip to content

Patch for crash when applying 3D transform to 4D image #236

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

Merged
merged 1 commit into from
May 31, 2025
Merged
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
4 changes: 2 additions & 2 deletions nitransforms/resampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async def _apply_serial(
semaphore = asyncio.Semaphore(max_concurrent)

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

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

resampled = asyncio.run(
Expand Down