diff projective_transformation.py @ 4:37b079c98c38 draft

"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation/ commit ded1703bcd6e295b26201505edb58381991b265e"
author imgteam
date Mon, 28 Feb 2022 17:36:23 +0000
parents be9a815e2240
children 6a8ae8cd7167
line wrap: on
line diff
--- a/projective_transformation.py	Thu Jan 20 17:14:55 2022 +0000
+++ b/projective_transformation.py	Mon Feb 28 17:36:23 2022 +0000
@@ -47,7 +47,6 @@
 
 
 def transform(moving_fn, fixed_fn, warp_mat, output_fn):
-
     moving = skimage.io.imread(moving_fn)
     nDims = len(moving.shape)
     assert nDims in [2, 3, 4, 5, 6], 'this tool only supports up to 6 dimensions'
@@ -79,8 +78,8 @@
     warp_mat = np.array(warp_mat)
     assert warp_mat.shape[0] in [3], 'only 2D image transformaton is supported'
 
-    trans = ProjectiveTransform(matrix=warp_mat)
-    warped_coords = warp_coords_batch(trans, hw_fixed)
+    transI = ProjectiveTransform(matrix=np.linalg.inv(warp_mat))
+    warped_coords = warp_coords_batch(transI, hw_fixed)
 
     if isMulCh or isRGB:
         for i in range(nCh):