changeset 1:54b8c8bceb32 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points2binaryimage/ commit 2994366afa0a1c537c0edf6c4578bda079494b2f
author imgteam
date Wed, 26 Jun 2024 08:35:48 +0000
parents c2dcc029a23b
children 380b628a2213
files __pycache__/points2binaryimage.cpython-36.pyc creators.xml points2binaryimage.py points2binaryimage.xml
diffstat 4 files changed, 59 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
Binary file __pycache__/points2binaryimage.cpython-36.pyc has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/creators.xml	Wed Jun 26 08:35:48 2024 +0000
@@ -0,0 +1,23 @@
+<macros>
+
+    <xml name="creators/bmcv">
+        <organization name="Biomedical Computer Vision Group, Heidelberg Universtiy" alternateName="BMCV" url="http://www.bioquant.uni-heidelberg.de/research/groups/biomedical_computer_vision.html" />
+        <yield />
+    </xml>
+
+    <xml name="creators/alliecreason">
+        <person givenName="Allison" familyName="Creason"/>
+        <yield/>
+    </xml>
+
+    <xml name="creators/bugraoezdemir">
+        <person givenName="Bugra" familyName="Oezdemir"/>
+        <yield/>
+    </xml>
+
+    <xml name="creators/thawn">
+        <person givenName="Till" familyName="Korten"/>
+        <yield/>
+    </xml>
+    
+</macros>
--- a/points2binaryimage.py	Sat Feb 09 14:21:50 2019 -0500
+++ b/points2binaryimage.py	Wed Jun 26 08:35:48 2024 +0000
@@ -1,11 +1,11 @@
 import argparse
-import sys
-import numpy as np
-import skimage.io
-import pandas as pd
 import os
 import warnings
 
+import numpy as np
+import pandas as pd
+import skimage.io
+
 
 def points2binaryimage(point_file, out_file, shape=[500, 500], has_header=False, invert_xy=False):
 
@@ -22,21 +22,22 @@
                 raise IndexError("Point {},{} is out of image with bounds {},{}.".format(int(a_row[0]), int(a_row[1]), shape[0], shape[1]))
 
             if invert_xy:
-                if img.shape[0]<=int(a_row[0]) or img.shape[1]<=int(a_row[1]):
+                if img.shape[0] <= int(a_row[0]) or img.shape[1] <= int(a_row[1]):
                     raise IndexError("Point {},{} is out of image with bounds {},{}.".format(int(a_row[0]), int(a_row[1]), shape[0], shape[1]))
                 else:
                     img[int(a_row[1]), int(a_row[0])] = 32767
             else:
-                if img.shape[0]<=int(a_row[1]) or img.shape[1]<=int(a_row[0]):
+                if img.shape[0] <= int(a_row[1]) or img.shape[1] <= int(a_row[0]):
                     raise IndexError("Point {},{} is out of image with bounds {},{}.".format(int(a_row[1]), int(a_row[0]), shape[0], shape[1]))
                 else:
                     img[int(a_row[0]), int(a_row[1])] = 32767
     else:
-        raise Exception("{} is empty or does not exist.".format(point_file)) # appropriate built-in error?
+        raise Exception("{} is empty or does not exist.".format(point_file))  # appropriate built-in error?
 
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
-        skimage.io.imsave(out_file, img, plugin='tifffile') # otherwise we get problems with the .dat extension
+        skimage.io.imsave(out_file, img, plugin='tifffile')  # otherwise we get problems with the .dat extension
+
 
 if __name__ == "__main__":
     parser = argparse.ArgumentParser()
@@ -49,5 +50,5 @@
 
     args = parser.parse_args()
 
-    #TOOL
+    # TOOL
     points2binaryimage(args.point_file.name, args.out_file, [args.shapey, args.shapex], has_header=args.has_header, invert_xy=args.invert_xy)
--- a/points2binaryimage.xml	Sat Feb 09 14:21:50 2019 -0500
+++ b/points2binaryimage.xml	Wed Jun 26 08:35:48 2024 +0000
@@ -1,13 +1,28 @@
-<tool id="ip_points_to_binaryimage" name="Points to Binary Image" version="0.1">
-    <description>Converts points to a binary image</description>
+<tool id="ip_points_to_binaryimage" name="Convert point coordinates to binary image" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.05">
+    <description></description>
+    <macros>
+        <import>creators.xml</import>
+        <token name="@TOOL_VERSION@">0.2</token>
+        <token name="@VERSION_SUFFIX@">3</token>
+    </macros>
+    <creator>
+        <expand macro="creators/bmcv" />
+    </creator>
+    <edam_operations>
+        <edam_operation>operation_3443</edam_operation>
+    </edam_operations>
+    <xrefs>
+        <xref type="bio.tools">galaxy_image_analysis</xref>
+    </xrefs>
     <requirements> 
-        <requirement type="package" version="0.14.2">scikit-image</requirement>
+        <requirement type="package" version="0.14.2">scikit-image</requirement> 
         <requirement type="package" version="1.15.4">numpy</requirement>
         <requirement type="package" version="0.23.4">pandas</requirement>
         <requirement type="package" version="2018.7">pytz</requirement><!--pandas seems to have additional requirements that are not automatically installed-->
-        <requirement type="package" version="2.4.1">dateutil</requirement>
+        <requirement type="package" version="2.5.2">python-dateutil</requirement>
+        <requirement type="package" version="0.15.1">tifffile</requirement>
     </requirements>
-    <command>
+    <command detect_errors="aggressive">
         <![CDATA[
         python '$__tool_directory__/points2binaryimage.py' '$input' '$output' $shapex $shapey $has_header $invert_xy
         ]]>
@@ -33,9 +48,13 @@
         </test>
     </tests>
     <help>
-    **What it does**
+
+        This tool converts a CSV list of points to a binary image by rasterizing the point coordinates.
 
-    Converts CSV point file to binary image.
+        The created image is a single-channel image with 16 bits per pixel (unsigned integer).
+        The points are rasterized with value 32767 (white).
+        Pixels not corresponding to any points in the CSV are assigned the value 0 (black).
+
     </help>
     <citations>
         <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>