changeset 2:b4fc6e09e576 draft default tip

"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/overlay_moving_and_fixed_image/ commit 0500f513ee291ae0f6fad32a0b4fad05cd59cb71"
author imgteam
date Sat, 26 Feb 2022 17:14:27 +0000
parents bc324ec66719
children
files overlay_moving_and_fixed_image.py overlay_moving_and_fixed_image.xml
diffstat 2 files changed, 19 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/overlay_moving_and_fixed_image.py	Wed Dec 18 05:02:39 2019 -0500
+++ b/overlay_moving_and_fixed_image.py	Sat Feb 26 17:14:27 2022 +0000
@@ -1,11 +1,12 @@
 import argparse
-from PIL import Image
-import skimage.io
-import skimage.color
-from skimage.transform import ProjectiveTransform
-from scipy.ndimage import map_coordinates
+
 import numpy as np
 import pandas as pd
+import skimage.color
+import skimage.io
+from PIL import Image
+from scipy.ndimage import map_coordinates
+from skimage.transform import ProjectiveTransform
 
 
 def _stackcopy(a, b):
@@ -24,12 +25,12 @@
 
     tf_coords = np.indices((cols, rows), dtype=dtype).reshape(2, -1).T
 
-    for i in range(0, (tf_coords.shape[0]//batch_size+1)):
-        tf_coords[batch_size*i:batch_size*(i+1)] = coord_map(tf_coords[batch_size*i:batch_size*(i+1)])
+    for i in range(0, (tf_coords.shape[0] // batch_size + 1)):
+        tf_coords[batch_size * i:batch_size * (i + 1)] = coord_map(tf_coords[batch_size * i:batch_size * (i + 1)])
     tf_coords = tf_coords.T.reshape((-1, cols, rows)).swapaxes(1, 2)
 
     _stackcopy(coords[1, ...], tf_coords[0, ...])
-    _stackcopy(coords[0, ...], tf_coords[1, ...]) 
+    _stackcopy(coords[0, ...], tf_coords[1, ...])
     if len(shape) == 3:
         coords[2, ...] = range(shape[2])
 
@@ -47,16 +48,16 @@
     fixed_image = Image.fromarray(fixed_image).convert("RGBA")
     overlay_out = Image.blend(moving_image, fixed_image, factor)
     overlay_out.save(overlay_out_path, "PNG")
- 
+
 
-if __name__=="__main__":
-    parser = argparse.ArgumentParser(description = "Overlay two images")
-    parser.add_argument("fixed_image", help = "Path to fixed image")
-    parser.add_argument("moving_image", help = "Path to moving image")
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser(description="Overlay two images")
+    parser.add_argument("fixed_image", help="Path to fixed image")
+    parser.add_argument("moving_image", help="Path to moving image")
     parser.add_argument("warp_matrix", help="Paste path to warp_matrix.csv that should be used for transformation")
     parser.add_argument("--inverse_transform", dest='inverse_transform', action='store_true', help="Set if inverse transform should be visualized")
-    parser.add_argument("--factor", dest = "factor", help = "Enter the factor by which images should be blended, 1.0 returns a copy of second image", type = float, default = 0.5)
-    parser.add_argument("overlay_out", help = "Overlay output path")
+    parser.add_argument("--factor", dest="factor", help="Enter the factor by which images should be blended, 1.0 returns a copy of second image", type=float, default=0.5)
+    parser.add_argument("overlay_out", help="Overlay output path")
     args = parser.parse_args()
 
     fixed_image = skimage.io.imread(args.fixed_image)
--- a/overlay_moving_and_fixed_image.xml	Wed Dec 18 05:02:39 2019 -0500
+++ b/overlay_moving_and_fixed_image.xml	Sat Feb 26 17:14:27 2022 +0000
@@ -1,4 +1,4 @@
-<tool id="ip_viz_overlay_moving_and_fixed_image" name="Overlay" version="0.0.2">
+<tool id="ip_viz_overlay_moving_and_fixed_image" name="Overlay" version="0.0.3" profile="20.05">
     <description>moving and fixed image</description>
     <requirements>
         <requirement type="package" version="0.14.2">scikit-image</requirement>
@@ -42,6 +42,8 @@
     **What it does**
 
     This tool performs an overlay of two images of which one was transformed to match the other.
+
+    Note: This tool is deprecated and may not be supported in future. Please use the tools "Projective Transformation" and "Overlay Images" instead.
     </help>
     <citations>
         <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>