view @ 0:cb1eaebdb4c4 draft default tip

planemo upload for repository commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
author imgteam
date Sat, 09 Feb 2019 14:31:13 -0500
line wrap: on
line source

import argparse
import sys
import pandas as pd
from skimage.measure import label
from 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;

    img_in =, plugin='tifffile') 
    #make label image
    label = skimage.measure.label(img_in)
    #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)
        # be carefull with x,y coordinates

    #make data frame of detections
    out_dataFrame = pd.DataFrame(center_mass)


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
    out_dataFrame = binaryimage2points(input_file)
    #Print to csv file
    out_dataFrame.to_csv(out_file, index=False, header=False, sep="\t")