Skip to content

Commit 43cc7fb

Browse files
committed
FIX(reslice): fix bug when not using chunking
1 parent 179ac78 commit 43cc7fb

File tree

1 file changed

+8
-4
lines changed
  • nitorch/cli/registration/reslice

1 file changed

+8
-4
lines changed

nitorch/cli/registration/reslice/main.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,12 @@ def build_from_target(affine, shape, smart=False):
407407
# --------------------------------------------------------------
408408
# chunkwise processing
409409
# --------------------------------------------------------------
410-
chunk = py.make_list(options.chunk, 3)
411-
if resample and chunk and any(c < x for x, c in zip(file.shape, chunk)):
410+
need_chunk = bool(options.chunk)
411+
if need_chunk:
412+
chunk = py.make_list(options.chunk, 3)
413+
need_chunk = need_chunk and any(c < x for x, c in zip(file.shape, chunk))
414+
415+
if resample and need_chunk:
412416

413417
odat = utils.movedim(torch.empty(
414418
[*oshape, file.channels],
@@ -470,9 +474,9 @@ def build_from_target(affine, shape, smart=False):
470474
# --------------------------------------------------------------
471475
else:
472476
if is_label:
473-
dat = dat.data(**backend_int)
477+
dat = vol.data(**backend_int)
474478
else:
475-
dat = dat.fdata(rand=False, **backend)
479+
dat = vol.fdata(rand=False, **backend)
476480
dat = dat[..., channels]
477481
dat = dat.reshape([*file.shape, file.channels])
478482
dat = utils.movedim(dat, -1, 0)

0 commit comments

Comments
 (0)