Skip to content

Commit 76668fa

Browse files
committed
[FIX] reslice: properly take shoot sidecar into account
1 parent 81a5090 commit 76668fa

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

nitorch/cli/registration/reslice/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def exponentiate_transforms(transformations, **backend):
227227
prm = json.load(f)
228228
prm['voxel_size'] = spatial.voxel_size(trf.affine)
229229
trf.dat = spatial.shoot(trf.dat[None], displacement=True,
230-
return_inverse=trf.inv)
230+
return_inverse=trf.inv, **prm)
231231
if trf.inv:
232232
trf.dat = trf.dat[-1]
233233
else:

nitorch/cli/registration/reslice/parser.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
import os.path
2+
import json
13
from . import struct
24
from nitorch.core import cli
5+
from nitorch.core.pyutils import file_mod
36

47
help = r"""[nitorch] Reslice volumes
58
@@ -103,8 +106,15 @@ def parse_transform(args, options):
103106

104107
cli.check_next_isvalue(args, tag)
105108
opt.file, *args = args
106-
if isinstance(opt, struct.Velocity) and cli.next_isvalue(args):
107-
opt.json, *args = args
109+
if isinstance(opt, struct.Velocity):
110+
if cli.next_isvalue(args):
111+
opt.json, *args = args
112+
elif os.path.exists(file_mod(opt.file, ext='.json')):
113+
fname = file_mod(opt.file, ext='.json')
114+
with open(fname, "r") as f:
115+
sidecar = json.load(f)
116+
if 'bending' in sidecar:
117+
opt.json = fname
108118

109119
while cli.next_istag(args):
110120
tag, *args = args

0 commit comments

Comments
 (0)