Mercurial > repos > imgteam > superdsm
annotate run-superdsm.py @ 2:244f67290d28 draft
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/superdsm/ commit 2286a6c9da88596349ed9d967c51541409c0a7bf
author | imgteam |
---|---|
date | Mon, 13 Nov 2023 22:12:35 +0000 |
parents | 700ae37e5c69 |
children | 7fd8dba15bd3 |
rev | line source |
---|---|
0
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
1 """ |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
2 Copyright 2023 Leonid Kostrykin, Biomedical Computer Vision Group, Heidelberg University. |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
3 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
4 Distributed under the MIT license. |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
5 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
6 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
7 """ |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
8 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
9 import argparse |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
10 import imghdr |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
11 import os |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
12 import pathlib |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
13 import shutil |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
14 import tempfile |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
15 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
16 |
1
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
17 hyperparameters = [ |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
18 ('AF_scale', float), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
19 ('c2f_region_analysis/min_atom_radius', float), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
20 ('c2f_region_analysis_min_norm_energy_improvement', float), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
21 ('c2f_region_analysis_max_atom_norm_energy', float), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
22 ('c2f_region_analysis_max_cluster_marker_irregularity', float), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
23 ('dsm_alpha', float), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
24 ('dsm_AF_alpha', float), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
25 ('global_energy_minimization_betai', float), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
26 ('global_energy_minimization_AF_beta', float), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
27 ('postprocess_mask_max_distance', int), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
28 ('postprocess_mask_stdamp', float), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
29 ('postprocess_max_norm_energy', float), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
30 ('postprocess_min_contrast', float), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
31 ('postprocess_min_object_radius', float), |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
32 ] |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
33 |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
34 |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
35 def get_param_name(key): |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
36 return key.replace('/', '_') |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
37 |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
38 |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
39 def create_config(args): |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
40 cfg = superdsm.config.Config() |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
41 for key, _ in hyperparameters: |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
42 value = getattr(args, get_param_name(key)) |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
43 if value is not None: |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
44 cfg[key] = value |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
45 return cfg |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
46 |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
47 |
0
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
48 if __name__ == "__main__": |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
49 parser = argparse.ArgumentParser(description='Segmentation of cell nuclei in 2-D fluorescence microscopy images') |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
50 parser.add_argument('image', help='Path to the input image') |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
51 parser.add_argument('cfg', help='Path to the file containing the configuration') |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
52 parser.add_argument('masks', help='Path to the file containing the segmentation masks') |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
53 parser.add_argument('overlay', help='Path to the file containing the overlay of the segmentation results') |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
54 parser.add_argument('seg_border', type=int) |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
55 parser.add_argument('slots', type=int) |
1
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
56 for key, ptype in hyperparameters: |
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
57 parser.add_argument('--' + get_param_name(key), type=ptype, default=None) |
0
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
58 args = parser.parse_args() |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
59 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
60 if args.slots >= 2: |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
61 num_threads_per_process = 2 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
62 num_processes = args.slots // num_threads_per_process |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
63 else: |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
64 num_threads_per_process = 1 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
65 num_processes = 1 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
66 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
67 os.environ['MKL_NUM_THREADS'] = str(num_threads_per_process) |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
68 os.environ['OPENBLAS_NUM_THREADS'] = str(num_threads_per_process) |
2
244f67290d28
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/superdsm/ commit 2286a6c9da88596349ed9d967c51541409c0a7bf
imgteam
parents:
1
diff
changeset
|
69 |
244f67290d28
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/superdsm/ commit 2286a6c9da88596349ed9d967c51541409c0a7bf
imgteam
parents:
1
diff
changeset
|
70 import ray |
244f67290d28
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/superdsm/ commit 2286a6c9da88596349ed9d967c51541409c0a7bf
imgteam
parents:
1
diff
changeset
|
71 import superdsm.automation |
244f67290d28
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/superdsm/ commit 2286a6c9da88596349ed9d967c51541409c0a7bf
imgteam
parents:
1
diff
changeset
|
72 import superdsm.io |
244f67290d28
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/superdsm/ commit 2286a6c9da88596349ed9d967c51541409c0a7bf
imgteam
parents:
1
diff
changeset
|
73 import superdsm.render |
0
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
74 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
75 ray.init(num_cpus=num_processes, log_to_driver=True) |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
76 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
77 with tempfile.TemporaryDirectory() as tmpdirname: |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
78 tmpdir = pathlib.Path(tmpdirname) |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
79 img_ext = imghdr.what(args.image) |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
80 img_filepath = tmpdir / f'input.{img_ext}' |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
81 shutil.copy(str(args.image), img_filepath) |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
82 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
83 pipeline = superdsm.pipeline.create_default_pipeline() |
1
700ae37e5c69
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 7db4b765fa5a1f526cc94cd1f65d963d1e047b27
imgteam
parents:
0
diff
changeset
|
84 cfg = create_config(args) |
0
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
85 img = superdsm.io.imread(img_filepath) |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
86 data, cfg, _ = superdsm.automation.process_image(pipeline, cfg, img) |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
87 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
88 with open(args.cfg, 'w') as fp: |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
89 cfg.dump_json(fp) |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
90 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
91 overlay = superdsm.render.render_result_over_image(data, border_width=args.seg_border, normalize_img=False) |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
92 superdsm.io.imwrite(args.overlay, overlay) |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
93 |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
94 masks = superdsm.render.rasterize_labels(data) |
1b0fc671187f
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/superdsm/ commit 4d66ff6e8a2a842e44e8d0d7102dfb3ac78dca7e
imgteam
parents:
diff
changeset
|
95 superdsm.io.imwrite(args.masks, masks) |