Commit 8c599e4c authored by Sean Fitzgibbon's avatar Sean Fitzgibbon
Browse files

Added support for other file formats to APPLYXFM

parent f7da6821
......@@ -175,6 +175,7 @@ def _load_image(p):
timg = _load_jpg2k(p.file, p.resolution, p.resolution_level, p.dtype)
# add mask
if 'mask' in p.keys():
tirl.scripts.mnd.image.set_mask(timg, scope=globals(), **p.mask)
# Export
......@@ -1273,8 +1274,7 @@ def apply_slide_xfm(
fixed_reg,
out,
rlevel=0,
inverse=False,
):
inverse=False):
moving_reg = tirl.load(moving_reg)
fixed_reg = tirl.load(fixed_reg)
......@@ -1297,8 +1297,30 @@ def apply_slide_xfm(
# load native resolution images
moving_native = _load_jpg2k(moving, moving_res, rlevel)
fixed_native = _load_jpg2k(fixed, fixed_res, rlevel)
moving_native = _load_image(AttrMap(
{
'file': moving,
'resolution': moving_res,
'resolution_level': rlevel,
'dtype': 'uint8',
'export': False,
'snapshot': 'moving_native.png',
}
))
fixed_native = _load_image(AttrMap(
{
'file': fixed,
'resolution': fixed_res,
'resolution_level': rlevel,
'dtype': 'uint8',
'export': False,
'snapshot': 'fixed_native.png',
}
))
# moving_native = _load_jpg2k(moving, moving_res, rlevel)
# fixed_native = _load_jpg2k(fixed, fixed_res, rlevel)
# fixed pixel coordinates in native res
......@@ -1316,9 +1338,15 @@ def apply_slide_xfm(
)
# TODO: additional ouput types (beyond jp2) should be supported
import glymur
ext = op.splitext(out)[-1]
if ext == '.jp2':
import glymur
glymur.Jp2k(out, data=np.round(moving_value_reshaped).astype(moving_native.dtype))
else:
import skimage.io
skimage.io.imsave(out, 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))
......
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