Commit 015e2026 authored by Sean Fitzgibbon's avatar Sean Fitzgibbon
Browse files

Added inverse support to apply_xfm

parent 233b0513
......@@ -909,18 +909,19 @@ def register_slide_to_slide(moving, moving_res, fixed, fixed_res, out, config):
run(config)
def apply_slide_xfm(moving, moving_res, fixed, fixed_res, moving_reg, fixed_reg, out, rlevel=5, inverse=False):
def apply_slide_xfm(moving, moving_res, fixed, fixed_res, moving_reg, fixed_reg, out, rlevel=0, inverse=False):
moving_reg = tirl.load(moving_reg)
fixed_reg = tirl.load(fixed_reg)
# get transformation chain from registration
chain = fixed_reg.domain.chain
chain += moving_reg.domain.chain.inverse()
print(inverse)
if inverse:
raise NotImplementedError('Inverse not yet implemented')
else:
chain = fixed_reg.domain.chain
chain += moving_reg.domain.chain.inverse()
chain = chain.inverse()
# update input/output resolution in transformation chain
......@@ -951,6 +952,6 @@ def apply_slide_xfm(moving, moving_res, fixed, fixed_res, moving_reg, fixed_reg,
import glymur
glymur.Jp2k(out, data=np.round(moving_value_reshaped).astype(moving_native.dtype))
# import imageio
# imageio.imsave('test_moving.png', np.round(moving_value_reshaped).astype(moving_native.dtype))
# imageio.imsave('test_fixed.png', fixed_native.data)
\ No newline at end of file
import imageio
imageio.imsave('test_moving.png', np.round(moving_value_reshaped).astype(moving_native.dtype))
imageio.imsave('test_fixed.png', fixed_native.data)
\ No newline at end of file
......@@ -82,6 +82,8 @@ def add_applyxfm_cli(subparsers):
parser.add_argument("out", metavar="<dir>",
help="Name for resampled output image", type=str)
parser.add_argument('--inverse', dest='inverse', action='store_true')
parser.set_defaults(method='applyxfm')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment