Mercurial > repos > galaxyp > qupath_roi_splitter
annotate qupath_roi_splitter.py @ 6:6a8cf86fd3b7 draft default tip
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
author | galaxyp |
---|---|
date | Mon, 02 Sep 2024 19:07:23 +0000 |
parents | 17c54a716a5b |
children |
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 |
4
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
9 def collect_coords(input_coords, feature_index, coord_index=0): |
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
10 coords_with_index = [] |
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
11 for coord in input_coords: |
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
12 coords_with_index.append((coord[0], coord[1], feature_index, coord_index)) |
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
13 coord_index += 1 |
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
14 return coords_with_index |
0
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
15 |
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
16 |
6
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
17 def collect_roi_coords(input_roi): |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
18 coords = input_roi["geometry"]["coordinates"] |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
19 |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
20 def process_coords(coord_list): |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
21 if isinstance(coord_list[0], (int, float)): |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
22 return [coord_list] |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
23 elif all(isinstance(c, list) for c in coord_list): |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
24 return coord_list |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
25 else: |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
26 return [coord_list] |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
27 |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
28 if isinstance(coords[0][0], list): |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
29 return [process_coords(sub_coords) for sub_coords in coords] |
2
7bee859bbd11
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents:
1
diff
changeset
|
30 else: |
6
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
31 return [process_coords(coords)] |
2
7bee859bbd11
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents:
1
diff
changeset
|
32 |
7bee859bbd11
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents:
1
diff
changeset
|
33 |
0
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
34 def split_qupath_roi(in_roi): |
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
35 with open(in_roi) as file: |
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
36 qupath_roi = geojson.load(file) |
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
37 |
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
38 # HE dimensions |
4
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
39 dim_plt = [int(qupath_roi["dim"]["width"]), int(qupath_roi["dim"]["height"])] |
6
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
40 tma_name = qupath_roi["name"] |
0
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
41 |
6
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
42 if "featureNames" in qupath_roi: |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
43 cell_types = [ct.rsplit(" - ", 1)[-1] for ct in qupath_roi["featureNames"]] |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
44 else: |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
45 cell_types = ["all"] |
0
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
46 |
4
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
47 coords_by_cell_type = {ct: [] for ct in cell_types} |
6
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
48 if "all" not in coords_by_cell_type: |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
49 coords_by_cell_type["all"] = [] |
4
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
50 |
6
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
51 for roi in qupath_roi["features"]: |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
52 feature_coords = collect_roi_coords(roi) |
0
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
53 |
6
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
54 if args.all or "classification" not in roi["properties"]: |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
55 coords_by_cell_type["all"].append(feature_coords) |
4
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
56 elif "classification" in roi["properties"]: |
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
57 cell_type = roi["properties"]["classification"]["name"] |
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
58 if cell_type in cell_types: |
6
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
59 coords_by_cell_type[cell_type].append(feature_coords) |
0
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
60 |
6
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
61 for cell_type, coords_list in coords_by_cell_type.items(): |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
62 if coords_list: |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
63 img = np.ones((dim_plt[1], dim_plt[0], 3), dtype="uint8") * 255 |
4
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
64 |
6
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
65 all_coords = [] |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
66 for feature in coords_list: |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
67 for polygon in feature: |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
68 # Multiple sub_polygons in LMD data |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
69 for sub_poly in polygon if isinstance(polygon[0][0], list) else [polygon]: |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
70 pts = np.array(sub_poly, dtype=np.float32).reshape(-1, 2) |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
71 pts = pts.astype(np.int32) |
0
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
72 |
6
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
73 # Get filled pixel coordinates |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
74 if args.fill: |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
75 temp_img = np.ones((dim_plt[1], dim_plt[0]), dtype="uint8") * 255 |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
76 cv2.fillPoly(temp_img, [pts], color=0) |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
77 filled_coords = np.column_stack(np.where(temp_img == 0)) |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
78 all_coords.extend(filled_coords[:, [1, 0]]) # Swap columns to get (x, y) |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
79 cv2.fillPoly(img, [pts], color=0) |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
80 else: |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
81 cv2.polylines(img, [pts], isClosed=True, color=(0, 0, 0), thickness=1) |
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
82 all_coords.extend(pts) |
0
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
83 |
6
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
84 all_coords = np.array(all_coords) |
4
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
85 coords_df = pd.DataFrame(all_coords, columns=['x', 'y'], dtype=int) |
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
86 coords_df.to_csv("{}_{}.txt".format(tma_name, cell_type), sep='\t', index=False) |
0
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
87 |
4
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
88 # Generate image for visualization if --img is specified |
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
89 if args.img: |
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
90 cv2.imwrite("{}_{}.png".format(tma_name, cell_type), img) |
3
24ccdcfbabac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 00029e8a3ee400f69a6dbe9e556ec9c27c6979cb
galaxyp
parents:
2
diff
changeset
|
91 |
0
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
92 |
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
93 if __name__ == "__main__": |
4
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
94 parser = argparse.ArgumentParser(description="Split ROI coordinates of QuPath TMA annotation by cell type (classification)") |
0
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
95 parser.add_argument("--qupath_roi", default=False, help="Input QuPath annotation (GeoJSON file)") |
4
9f136ebf73ac
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 918ae25f84e7042ed36461219ff068633c1c2427
galaxyp
parents:
3
diff
changeset
|
96 parser.add_argument("--fill", action="store_true", required=False, help="Fill pixels in ROIs (order of coordinates will be lost)") |
6
6a8cf86fd3b7
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 80eecd9912892296aad3231be75fcee3cc6a6b02
galaxyp
parents:
5
diff
changeset
|
97 parser.add_argument('--version', action='version', version='%(prog)s 0.3.2') |
2
7bee859bbd11
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit 7391296e0c7c8d48b42a129d154b50b29fd41737
galaxyp
parents:
1
diff
changeset
|
98 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
|
99 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
|
100 args = parser.parse_args() |
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
101 |
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
102 if args.qupath_roi: |
b5e9cebb27e3
planemo upload for repository hhttps://github.com/npinter/ROIsplitter commit cdf3e9652b10c7a0b179202129a797e32fd95909
galaxyp
parents:
diff
changeset
|
103 split_qupath_roi(args.qupath_roi) |