changeset 3:d09507d3fb0e draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/scale_image/ commit 6b687746bdb3d5d1fb11ecffd6dd1bf42dc2c38d
author imgteam
date Fri, 10 Nov 2023 14:23:33 +0000
parents f3c05a734dd1
children 3179853faae9
files scale_image.py scale_image.xml
diffstat 2 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/scale_image.py	Mon Jul 22 05:04:55 2019 -0400
+++ b/scale_image.py	Fri Nov 10 14:23:33 2023 +0000
@@ -1,13 +1,14 @@
 import argparse
 import sys
+
+import scipy.misc
 import skimage.io
 import skimage.transform
-import scipy.misc
 from PIL import Image
 
- 
+
 def scale_image(input_file, output_file, scale, order=1):
-    Image.MAX_IMAGE_PIXELS = 50000*50000
+    Image.MAX_IMAGE_PIXELS = 50000 * 50000
     img_in = skimage.io.imread(input_file)
     if order == 0:
         interp = 'nearest'
@@ -29,8 +30,8 @@
 if __name__ == "__main__":
     parser = argparse.ArgumentParser()
     parser.add_argument('input_file', type=argparse.FileType('r'), default=sys.stdin, help='input file')
-    parser.add_argument('out_file', type=argparse.FileType('w'), default=sys.stdin, help='out file (PNG)') 
-    parser.add_argument('scale', type=str, help='fraction scaling factor(float), percentage scaling factor(int), output size(tuple(height,width))') # integer option not implemented in galaxy wrapper
+    parser.add_argument('out_file', type=argparse.FileType('w'), default=sys.stdin, help='out file (PNG)')
+    parser.add_argument('scale', type=str, help='fraction scaling factor(float), percentage scaling factor(int), output size(tuple(height,width))')  # integer option not implemented in galaxy wrapper
     parser.add_argument('order', type=int, default=1, help='interpolation method')
     args = parser.parse_args()
 
--- a/scale_image.xml	Mon Jul 22 05:04:55 2019 -0400
+++ b/scale_image.xml	Fri Nov 10 14:23:33 2023 +0000
@@ -1,5 +1,12 @@
-<tool id="ip_scale_image" name="Scale Image" version="0.4"> 
-    <description>Scales image</description>
+<tool id="ip_scale_image" name="Scale image" version="0.4-2"> 
+    <description>with scikit-image</description>
+    <edam_operations>
+        <edam_operation>operation_3443</edam_operation>
+    </edam_operations>
+    <xrefs>
+        <xref type="bio.tools">scikit-image</xref>
+        <xref type="biii">scikit-image</xref>
+    </xrefs>
     <requirements>
         <requirement type="package" version="6.1.0">pillow</requirement>
         <requirement type="package" version="0.14.2">scikit-image</requirement>
@@ -46,9 +53,11 @@
     <tests>
         <test>
             <param name="input" value="sample1.png"/> <!--continue here-->
-            <param name="use_scale_option.use_scale" value="false"/>
-            <param name="use_scale_option.scale_x" value="200"/>
-            <param name="use_scale_option.scale_y" value="150"/>
+            <conditional name="use_scale_option">
+                <param name="use_scale" value="false"/>
+                <param name="scale_x" value="200"/>
+                <param name="scale_y" value="150"/>
+            </conditional>
             <param name="order" value="0"/>
             <output name="output" value="out2.png" ftype="png" compare="sim_size"/>
         </test>