# HG changeset patch # User imgteam # Date 1699913437 0 # Node ID f38f42d55813037e864ea15f62054a493b40edc6 # Parent cb1eaebdb4c4e513535f220790c404be0f72a9dc planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/binaryimage2points/ commit 2286a6c9da88596349ed9d967c51541409c0a7bf diff -r cb1eaebdb4c4 -r f38f42d55813 binaryimage2points.py --- a/binaryimage2points.py Sat Feb 09 14:31:13 2019 -0500 +++ b/binaryimage2points.py Mon Nov 13 22:10:37 2023 +0000 @@ -1,53 +1,49 @@ import argparse -import sys +import warnings + +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 -import warnings - def binaryimage2points(input_file): # ignore warnings that arise when importing a package that was compiled against an older version of numpy than installed; https://github.com/numpy/numpy/pull/432 - warnings.filterwarnings("ignore") + warnings.filterwarnings("ignore") + + img_in = skimage.io.imread(input_file, plugin='tifffile') - img_in = skimage.io.imread(input_file, plugin='tifffile') - - #make label image + # make label image label = skimage.measure.label(img_in) - - #amount of regions + + # amount of regions amount_label = np.max(label) - + # 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(label==i) + for i in range(1, amount_label + 1): + # get coordinates of region + coord = np.where(label == 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__": parser = argparse.ArgumentParser() parser.add_argument('input_file', help='input file') parser.add_argument('out_file', help='out file (TSV)') - - args = parser.parse_args() - input_file = args.input_file - out_file = args.out_file - - #TOOL + + args = parser.parse_args() + input_file = args.input_file + out_file = args.out_file + + # TOOL out_dataFrame = binaryimage2points(input_file) - - #Print to csv file + + # Print to csv file out_dataFrame.to_csv(out_file, index=False, header=False, sep="\t") diff -r cb1eaebdb4c4 -r f38f42d55813 binaryimage2points.xml --- a/binaryimage2points.xml Sat Feb 09 14:31:13 2019 -0500 +++ b/binaryimage2points.xml Mon Nov 13 22:10:37 2023 +0000 @@ -1,9 +1,16 @@ - - Converts Binary Image to Points + + + + operation_3443 + + + galaxy_image_analysis + numpy - scikit-image + scikit-image pandas + tifffile