Skip to content

Commit

Permalink
FIX(reslice): fix bug when not using chunking
Browse files Browse the repository at this point in the history
  • Loading branch information
balbasty committed Dec 18, 2024
1 parent 179ac78 commit 43cc7fb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions nitorch/cli/registration/reslice/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,12 @@ def build_from_target(affine, shape, smart=False):
# --------------------------------------------------------------
# chunkwise processing
# --------------------------------------------------------------
chunk = py.make_list(options.chunk, 3)
if resample and chunk and any(c < x for x, c in zip(file.shape, chunk)):
need_chunk = bool(options.chunk)
if need_chunk:
chunk = py.make_list(options.chunk, 3)
need_chunk = need_chunk and any(c < x for x, c in zip(file.shape, chunk))

if resample and need_chunk:

odat = utils.movedim(torch.empty(
[*oshape, file.channels],
Expand Down Expand Up @@ -470,9 +474,9 @@ def build_from_target(affine, shape, smart=False):
# --------------------------------------------------------------
else:
if is_label:
dat = dat.data(**backend_int)
dat = vol.data(**backend_int)
else:
dat = dat.fdata(rand=False, **backend)
dat = vol.fdata(rand=False, **backend)
dat = dat[..., channels]
dat = dat.reshape([*file.shape, file.channels])
dat = utils.movedim(dat, -1, 0)
Expand Down

0 comments on commit 43cc7fb

Please sign in to comment.