Mercurial > repos > imgteam > coordinates_of_roi
comparison coordinates_of_roi.py @ 3:02a686fc1654 draft
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/coordinates_of_roi/ commit da043bdec956714abb0fa82f278931bbe1a6d41d
author | imgteam |
---|---|
date | Mon, 25 Mar 2019 11:15:39 -0400 |
parents | 24d9bd16c953 |
children | 00175f4a2bbb |
comparison
equal
deleted
inserted
replaced
2:24d9bd16c953 | 3:02a686fc1654 |
---|---|
12 y = [] | 12 y = [] |
13 img_height = data.shape[0] | 13 img_height = data.shape[0] |
14 img_width = data.shape[1] | 14 img_width = data.shape[1] |
15 for j in range(img_width): | 15 for j in range(img_width): |
16 for i in range(img_height): | 16 for i in range(img_height): |
17 if white_obj == False: | 17 if white_obj == False: |
18 if data[i,j] <= threshold: | 18 if data[i,j] <= threshold: |
19 x.append(i + offset[0]) | 19 x.append(i + offset[0]) |
20 y.append(j + offset[1]) | 20 y.append(j + offset[1]) |
21 elif data[i,j] >= threshold: | 21 elif data[i,j] >= threshold: |
22 x.append(i + offset[0]) | 22 x.append(i + offset[0]) |
29 | 29 |
30 if __name__=="__main__": | 30 if __name__=="__main__": |
31 parser = argparse.ArgumentParser(description = "Create a csv table with Coordinates of the ROI") | 31 parser = argparse.ArgumentParser(description = "Create a csv table with Coordinates of the ROI") |
32 parser.add_argument("im", help = "Paste path to out.png (output created by transformation)") | 32 parser.add_argument("im", help = "Paste path to out.png (output created by transformation)") |
33 parser.add_argument("pixel_table", help = "Paste path to file in which list with all pixles > threshold should be saved") | 33 parser.add_argument("pixel_table", help = "Paste path to file in which list with all pixles > threshold should be saved") |
34 parser.add_argument('offset_x', type=int, help='offset in x direction (width)', default=0) | |
35 parser.add_argument('offset_y', type=int, help='offset in y direction (height)', default=0) | |
36 parser.add_argument("--white_obj", dest = "white_obj", default=False, help = "If set objects in image are white otherwise black", action = "store_true") | 34 parser.add_argument("--white_obj", dest = "white_obj", default=False, help = "If set objects in image are white otherwise black", action = "store_true") |
37 parser.add_argument("--threshold", dest = "threshold", default = 0.5, help = "Enter desired threshold value", type = float) | 35 parser.add_argument("--threshold", dest = "threshold", default = 0.5, help = "Enter desired threshold value", type = float) |
38 | 36 |
39 args = parser.parse_args() | 37 args = parser.parse_args() |
40 # with warnings.catch_warnings(): | 38 # with warnings.catch_warnings(): |
41 # warnings.simplefilter("ignore") | 39 # warnings.simplefilter("ignore") |
42 get_pixel_values(args.im, args.pixel_table, args.white_obj, args.threshold, [args.offset_x, args.offset_y]) | 40 get_pixel_values(args.im, args.pixel_table, args.white_obj, args.threshold) |