Mercurial > repos > imgteam > coordinates_of_roi
comparison coordinates_of_roi.py @ 1:ee045a6bbdef draft
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/coordinates_of_roi/ commit 4efef27bbe105490fc125e3586024ebb51fa929f
author | imgteam |
---|---|
date | Fri, 22 Feb 2019 17:11:28 -0500 |
parents | 0d30ffea8874 |
children | 24d9bd16c953 |
comparison
equal
deleted
inserted
replaced
0:0d30ffea8874 | 1:ee045a6bbdef |
---|---|
8 data = skimage.io.imread(im) | 8 data = skimage.io.imread(im) |
9 if len(data.shape) == 3 and data.shape[-1] > 1: | 9 if len(data.shape) == 3 and data.shape[-1] > 1: |
10 data = skimage.color.rgb2grey(data) | 10 data = skimage.color.rgb2grey(data) |
11 x = [] | 11 x = [] |
12 y = [] | 12 y = [] |
13 for i in range(data.shape[0]): | 13 img_height = data.shape[0] |
14 for j in range(data.shape[1]): | 14 img_width = data.shape[1] |
15 for j in range(img_width): | |
16 for i in range(img_height): | |
15 if white_obj == False: | 17 if white_obj == False: |
16 if data[i,j] <= threshold: | 18 if data[i,j] <= threshold: |
17 x.append(j + offset[0]) | 19 x.append(j + offset[0]) |
18 y.append(i + offset[1]) | 20 y.append(img_height-(i+1) + offset[1]) |
19 elif data[i,j] >= threshold: | 21 elif data[i,j] >= threshold: |
20 x.append(j + offset[0]) | 22 x.append(j + offset[0]) |
21 y.append(i + offset[1]) | 23 y.append(img_height-(i+1) + offset[1]) |
22 | 24 |
23 df = pd.DataFrame() | 25 df = pd.DataFrame() |
24 df['x'] = x | 26 df['x'] = x |
25 df['y'] = y | 27 df['y'] = y |
26 df.to_csv(pixel_table, sep="\t", index = False) | 28 df.to_csv(pixel_table, sep="\t", index = False) |