changeset 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 f5744f0e5a81
files projective_transformation.py projective_transformation.xml test-data/tmat.tsv
diffstat 3 files changed, 5 insertions(+), 6 deletions(-) [+]
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):
--- a/projective_transformation.xml	Thu Jan 20 17:14:55 2022 +0000
+++ b/projective_transformation.xml	Mon Feb 28 17:36:23 2022 +0000
@@ -1,4 +1,4 @@
-<tool id="ip_projective_transformation" name="Projective Transformation" version="0.1.1" profile="20.05"> 
+<tool id="ip_projective_transformation" name="Projective Transformation" version="0.1.2" profile="20.05"> 
     <description>of 2D images</description>
     <requirements>
         <requirement type="package" version="0.18.1">scikit-image</requirement>
--- a/test-data/tmat.tsv	Thu Jan 20 17:14:55 2022 +0000
+++ b/test-data/tmat.tsv	Mon Feb 28 17:36:23 2022 +0000
@@ -1,3 +1,3 @@
-0.9406756518941536	-0.2954926628589712	45.11224440565029
-0.3009254584199789	0.949530052611427	-32.079361599470666
+0.9473192798662091	0.2999824649666423	-31.90319646127108
+-0.28701210871295463	0.9448018442119746	43.47552520776674
 0.0	0.0	1.0