changeset 2:3b7460735223 draft default tip

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/labelimage2points/ commit 2286a6c9da88596349ed9d967c51541409c0a7bf
author imgteam
date Mon, 13 Nov 2023 22:11:16 +0000
parents 07525a7d9ea0
children
files labelimage2points.py labelimage2points.xml
diffstat 2 files changed, 26 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/labelimage2points.py	Mon Jul 22 05:03:12 2019 -0400
+++ b/labelimage2points.py	Mon Nov 13 22:11:16 2023 +0000
@@ -1,33 +1,29 @@
 import argparse
-import sys
+
+import numpy as np
 import pandas as pd
 import skimage.io
-from skimage.measure import label
-from skimage.data import checkerboard
-import numpy as np
 
- 
 
 def labelimage2points(input_file):
-    img_in = skimage.io.imread(input_file) 
-        
-    #amount of regions
+    img_in = skimage.io.imread(input_file)
+
+    # amount of regions
     amount_label = np.max(img_in)
-    
+
     # iterate over all regions in order to calc center of mass
     center_mass = []
-    for i in range(1,amount_label+1):    
-        #get coordinates of region
-        coord = np.where(img_in==i)
+    for i in range(1, amount_label + 1):
+        # get coordinates of region
+        coord = np.where(img_in == i)
         # be carefull with x,y coordinates
-        center_mass.append([np.mean(coord[1]),np.mean(coord[0])])
+        center_mass.append([np.mean(coord[1]), np.mean(coord[0])])
 
-    #make data frame of detections
+    # make data frame of detections
     out_dataFrame = pd.DataFrame(center_mass)
 
-
-    #return
-    return(out_dataFrame)
+    # return
+    return out_dataFrame
 
 
 if __name__ == "__main__":
@@ -35,12 +31,12 @@
     parser.add_argument('input_file', help='input file')
     parser.add_argument('out_file', help='out file (CSV)')
 
-    args        = parser.parse_args()
-    input_file  = args.input_file
-    out_file    = args.out_file
+    args = parser.parse_args()
+    input_file = args.input_file
+    out_file = args.out_file
 
-    #TOOL
+    # TOOL
     out_dataFrame = labelimage2points(input_file)
 
-    #Print to csv file
+    # Print to csv file
     out_dataFrame.to_csv(out_file, index=False, header=False, sep="\t")
--- a/labelimage2points.xml	Mon Jul 22 05:03:12 2019 -0400
+++ b/labelimage2points.xml	Mon Nov 13 22:11:16 2023 +0000
@@ -1,5 +1,11 @@
-<tool id="ip_labelimage_to_points" name="Label to Points" version="0.2"> 
-    <description>Converts label image to points</description>
+<tool id="ip_labelimage_to_points" name="Convert label map to points (center of masses)" version="0.2-2"> 
+    <description></description>
+    <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.21.0">pandas</requirement>