annotate qupath_roi_splitter.py @ 3:24ccdcfbabac draft

planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 00029e8a3ee400f69a6dbe9e556ec9c27c6979cb
author galaxyp
date Thu, 25 Apr 2024 15:13:22 +0000
parents 7bee859bbd11
children 9f136ebf73ac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
1 import argparse
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
2
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
3 import cv2
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
4 import geojson
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
5 import numpy as np
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
6 import pandas as pd
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
7
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
8
2
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
9 def draw_poly(input_df, input_img, col=(0, 0, 0), fill=False):
0
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
10 s = np.array(input_df)
2
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
11 if fill:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
12 output_img = cv2.fillPoly(input_img, pts=np.int32([s]), color=col)
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
13 else:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
14 output_img = cv2.polylines(input_img, np.int32([s]), True, color=col, thickness=1)
0
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
15 return output_img
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
16
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
17
2
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
18 def draw_roi(input_roi, input_img, fill):
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
19 if len(input_roi["geometry"]["coordinates"]) == 1:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
20 # Polygon w/o holes
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
21 input_img = draw_poly(input_roi["geometry"]["coordinates"][0], input_img, fill=fill)
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
22 else:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
23 first_roi = True
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
24 for sub_roi in input_roi["geometry"]["coordinates"]:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
25 # Polygon with holes
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
26 if not isinstance(sub_roi[0][0], list):
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
27 if first_roi:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
28 first_roi = False
3
24ccdcfbabac planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 00029e8a3ee400f69a6dbe9e556ec9c27c6979cb
galaxyp
parents: 2
diff changeset
29 col = (0, 0, 0)
2
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
30 else:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
31 # holes in ROI
3
24ccdcfbabac planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 00029e8a3ee400f69a6dbe9e556ec9c27c6979cb
galaxyp
parents: 2
diff changeset
32 col = (255, 255, 255) if not fill else (0, 0, 0)
24ccdcfbabac planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 00029e8a3ee400f69a6dbe9e556ec9c27c6979cb
galaxyp
parents: 2
diff changeset
33 input_img = draw_poly(sub_roi, input_img, col=col, fill=fill)
2
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
34 else:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
35 # MultiPolygon with holes
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
36 for sub_coord in sub_roi:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
37 if first_roi:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
38 first_roi = False
3
24ccdcfbabac planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 00029e8a3ee400f69a6dbe9e556ec9c27c6979cb
galaxyp
parents: 2
diff changeset
39 col = (0, 0, 0)
2
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
40 else:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
41 # holes in ROI
3
24ccdcfbabac planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 00029e8a3ee400f69a6dbe9e556ec9c27c6979cb
galaxyp
parents: 2
diff changeset
42 col = (255, 255, 255) if not fill else (0, 0, 0)
24ccdcfbabac planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 00029e8a3ee400f69a6dbe9e556ec9c27c6979cb
galaxyp
parents: 2
diff changeset
43 input_img = draw_poly(sub_coord, input_img, col=col, fill=fill)
2
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
44
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
45 return input_img
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
46
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
47
0
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
48 def split_qupath_roi(in_roi):
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
49 with open(in_roi) as file:
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
50 qupath_roi = geojson.load(file)
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
51
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
52 # HE dimensions
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
53 dim_plt = [qupath_roi["dim"]["width"], qupath_roi["dim"]["height"]]
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
54
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
55 tma_name = qupath_roi["name"]
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
56 cell_types = [ct.rsplit(" - ", 1)[-1] for ct in qupath_roi["featureNames"]]
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
57
1
064b53fd3131 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit e08a178a7c35c0673f6bfc163614a8fc730ffc6c
galaxyp
parents: 0
diff changeset
58 for cell_type in cell_types:
064b53fd3131 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit e08a178a7c35c0673f6bfc163614a8fc730ffc6c
galaxyp
parents: 0
diff changeset
59 # create numpy array with white background
064b53fd3131 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit e08a178a7c35c0673f6bfc163614a8fc730ffc6c
galaxyp
parents: 0
diff changeset
60 img = np.zeros((dim_plt[1], dim_plt[0], 3), dtype="uint8")
064b53fd3131 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit e08a178a7c35c0673f6bfc163614a8fc730ffc6c
galaxyp
parents: 0
diff changeset
61 img.fill(255)
0
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
62
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
63 for i, roi in enumerate(qupath_roi["features"]):
2
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
64 if not args.all:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
65 if "classification" not in roi["properties"]:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
66 continue
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
67 if roi["properties"]["classification"]["name"] == cell_type:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
68 img = draw_roi(roi, img, args.fill)
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
69 else:
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
70 img = draw_roi(roi, img, args.fill)
0
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
71
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
72 # get all black pixel
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
73 coords_arr = np.column_stack(np.where(img == (0, 0, 0)))
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
74
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
75 # remove duplicated rows
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
76 coords_arr_xy = coords_arr[coords_arr[:, 2] == 0]
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
77
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
78 # remove last column
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
79 coords_arr_xy = np.delete(coords_arr_xy, 2, axis=1)
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
80
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
81 # to pandas and rename columns to x and y
2
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
82 coords_df = pd.DataFrame(coords_arr_xy, columns=['y', 'x'])
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
83
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
84 # reorder columns
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
85 coords_df = coords_df[['x', 'y']]
0
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
86
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
87 # drop duplicates
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
88 coords_df = coords_df.drop_duplicates(
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
89 subset=['x', 'y'],
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
90 keep='last').reset_index(drop=True)
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
91
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
92 coords_df.to_csv("{}_{}.txt".format(tma_name, cell_type), sep='\t', index=False)
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
93
3
24ccdcfbabac planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 00029e8a3ee400f69a6dbe9e556ec9c27c6979cb
galaxyp
parents: 2
diff changeset
94 # img save
24ccdcfbabac planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 00029e8a3ee400f69a6dbe9e556ec9c27c6979cb
galaxyp
parents: 2
diff changeset
95 if args.img:
24ccdcfbabac planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 00029e8a3ee400f69a6dbe9e556ec9c27c6979cb
galaxyp
parents: 2
diff changeset
96 cv2.imwrite("{}_{}.png".format(tma_name, cell_type), img)
24ccdcfbabac planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 00029e8a3ee400f69a6dbe9e556ec9c27c6979cb
galaxyp
parents: 2
diff changeset
97
0
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
98
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
99 if __name__ == "__main__":
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
100 parser = argparse.ArgumentParser(description="Split ROI coordinates of QuPath TMA annotation by cell type (classfication)")
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
101 parser.add_argument("--qupath_roi", default=False, help="Input QuPath annotation (GeoJSON file)")
2
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
102 parser.add_argument("--fill", action="store_true", required=False, help="Fill pixels in ROIs")
0
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
103 parser.add_argument('--version', action='version', version='%(prog)s 0.1.0')
2
7bee859bbd11 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents: 1
diff changeset
104 parser.add_argument("--all", action="store_true", required=False, help="Extracts all ROIs")
3
24ccdcfbabac planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 00029e8a3ee400f69a6dbe9e556ec9c27c6979cb
galaxyp
parents: 2
diff changeset
105 parser.add_argument("--img", action="store_true", required=False, help="Generates image of ROIs")
0
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
106 args = parser.parse_args()
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
107
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
108 if args.qupath_roi:
b5e9cebb27e3 planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff changeset
109 split_qupath_roi(args.qupath_roi)