Mercurial > repos > imgteam > points_association_nn
annotate points_association_nn.py @ 1:fd4293bee0dc draft
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit ef82d0882741042922349499cafa35d20d70ce70"
author | imgteam |
---|---|
date | Thu, 22 Jul 2021 22:30:31 +0000 |
parents | 04e692ee53a8 |
children | b30aa285ac0a |
rev | line source |
---|---|
0
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
1 """ |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
2 Copyright 2021 Biomedical Computer Vision Group, Heidelberg University. |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
3 Author: Qi Gao (qi.gao@bioquant.uni-heidelberg.de) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
4 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
5 Distributed under the MIT license. |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
6 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
7 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
8 """ |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
9 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
10 import argparse |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
11 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
12 import numpy as np |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
13 import openpyxl # noqa: F401 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
14 import pandas as pd |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
15 import skimage.util |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
16 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
17 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
18 def disk_mask(imsz, ir, ic, nbpx): |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
19 ys, xs = np.ogrid[-nbpx:nbpx + 1, -nbpx:nbpx + 1] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
20 se = xs ** 2 + ys ** 2 <= nbpx ** 2 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
21 mask = np.zeros(imsz, dtype=int) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
22 if ir - nbpx < 0 or ic - nbpx < 0 or ir + nbpx + 1 > imsz[0] or ic + nbpx + 1 > imsz[1]: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
23 mask = skimage.util.pad(mask, nbpx) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
24 mask[ir:ir + 2 * nbpx + 1, ic:ic + 2 * nbpx + 1] = se |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
25 mask = skimage.util.crop(mask, nbpx) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
26 else: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
27 mask[ir - nbpx:ir + nbpx + 1, ic - nbpx:ic + nbpx + 1] = se |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
28 return mask |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
29 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
30 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
31 def find_nn(cim, icy, icx, nim, nbpx): |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
32 mask = disk_mask(cim.shape, icy, icx, nbpx) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
33 iys_nim, ixs_nim = np.where(nim * mask) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
34 if iys_nim.size == 0: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
35 return np.NaN, np.NaN |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
36 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
37 d2 = (icy - iys_nim) ** 2 + (icx - ixs_nim) ** 2 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
38 I1 = np.argsort(d2) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
39 iy_nim = iys_nim[I1[0]] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
40 ix_nim = ixs_nim[I1[0]] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
41 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
42 mask = disk_mask(cim.shape, iy_nim, ix_nim, nbpx) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
43 iys_cim, ixs_cim = np.where(cim * mask) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
44 d2 = (iy_nim - iys_cim) ** 2 + (ix_nim - ixs_cim) ** 2 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
45 I2 = np.argsort(d2) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
46 if not iys_cim[I2[0]] == icy or not ixs_cim[I2[0]] == icx: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
47 return np.NaN, np.NaN |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
48 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
49 return iy_nim, ix_nim |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
50 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
51 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
52 def points_linking(fn_in, fn_out, nbpx=6, th=25, minlen=50): |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
53 data = pd.read_csv(fn_in, delimiter="\t") |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
54 all_data = np.array(data) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
55 assert all_data.shape[1] in [3, 4], 'unknow collum(s) in input data!' |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
56 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
57 coords = all_data[:, :3].astype('int64') |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
58 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
59 frame_1st = np.min(coords[:, 0]) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
60 frame_end = np.max(coords[:, 0]) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
61 assert set([i for i in range(frame_1st, frame_end + 1)]).issubset(set(coords[:, 0].tolist())), "spots missing at some time point!" |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
62 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
63 nSlices = frame_end |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
64 stack_h = np.max(coords[:, 2]) + nbpx |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
65 stack_w = np.max(coords[:, 1]) + nbpx |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
66 stack = np.zeros((stack_h, stack_w, nSlices), dtype='int8') |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
67 stack_r = np.zeros((stack_h, stack_w, nSlices), dtype='float64') |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
68 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
69 for i in range(all_data.shape[0]): |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
70 iyxz = tuple(coords[i, ::-1] - 1) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
71 stack[iyxz] = 1 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
72 stack_r[iyxz] = all_data[i, -1] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
73 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
74 tracks_all = np.array([], dtype=float).reshape(0, nSlices, 4) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
75 maxv = np.max(stack_r) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
76 br_max = maxv |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
77 idx_max = np.argmax(stack_r) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
78 while 1: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
79 iyxz = np.unravel_index(idx_max, stack.shape) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
80 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
81 spot_br = np.empty((nSlices, 1)) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
82 track = np.empty((nSlices, 3)) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
83 for i in range(nSlices): |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
84 spot_br[i] = np.NaN |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
85 track[i, :] = np.array((np.NaN, np.NaN, np.NaN)) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
86 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
87 spot_br[iyxz[2]] = maxv |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
88 track[iyxz[2], :] = np.array(iyxz[::-1]) + 1 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
89 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
90 # forward |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
91 icy = iyxz[0] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
92 icx = iyxz[1] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
93 for inz in range(iyxz[2] + 1, nSlices): |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
94 iny, inx = find_nn(stack[:, :, inz - 1], icy, icx, stack[:, :, inz], nbpx) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
95 if np.isnan(iny) and not inz == nSlices - 1: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
96 iny, inx = find_nn(stack[:, :, inz - 1], icy, icx, stack[:, :, inz + 1], nbpx) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
97 if np.isnan(iny): |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
98 break |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
99 else: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
100 iny = icy |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
101 inx = icx |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
102 stack[iny, inx, inz] = 1 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
103 stack_r[iny, inx, inz] = stack_r[iny, inx, inz - 1] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
104 elif np.isnan(iny) and inz == nSlices - 1: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
105 break |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
106 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
107 track[inz, :] = np.array((inz, inx, iny)) + 1 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
108 spot_br[inz] = stack_r[iny, inx, inz] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
109 icy = iny |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
110 icx = inx |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
111 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
112 # backward |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
113 icy = iyxz[0] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
114 icx = iyxz[1] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
115 for inz in range(iyxz[2] - 1, -1, -1): |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
116 iny, inx = find_nn(stack[:, :, inz + 1], icy, icx, stack[:, :, inz], nbpx) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
117 if np.isnan(iny) and not inz == 0: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
118 iny, inx = find_nn(stack[:, :, inz + 1], icy, icx, stack[:, :, inz - 1], nbpx) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
119 if np.isnan(iny): |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
120 break |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
121 else: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
122 iny = icy |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
123 inx = icx |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
124 stack[iny, inx, inz] = 1 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
125 stack_r[iny, inx, inz] = stack_r[iny, inx, inz + 1] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
126 elif np.isnan(iny) and inz == 0: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
127 break |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
128 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
129 track[inz, :] = np.array((inz, inx, iny)) + 1 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
130 spot_br[inz] = stack_r[iny, inx, inz] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
131 icy = iny |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
132 icx = inx |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
133 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
134 for iz in range(nSlices): |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
135 if not np.isnan(track[iz, 0]): |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
136 stack[track[iz, 2].astype(int) - 1, track[iz, 1].astype(int) - 1, iz] = 0 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
137 stack_r[track[iz, 2].astype(int) - 1, track[iz, 1].astype(int) - 1, iz] = 0 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
138 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
139 # discard short trajectories |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
140 if np.count_nonzero(~np.isnan(spot_br)) > minlen * (frame_end - frame_1st) / 100: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
141 tmp = np.concatenate((track, spot_br), axis=1) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
142 tracks_all = np.concatenate((tracks_all, tmp.reshape(1, -1, 4)), axis=0) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
143 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
144 maxv = np.max(stack_r) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
145 idx_max = np.argmax(stack_r) |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
146 if maxv < th * br_max / 100: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
147 break |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
148 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
149 with pd.ExcelWriter(fn_out, engine="openpyxl") as writer: |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
150 for i in range(tracks_all.shape[0]): |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
151 df = pd.DataFrame() |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
152 df['FRAME'] = tracks_all[i, :, 0] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
153 df['POS_X'] = tracks_all[i, :, 1] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
154 df['POS_Y'] = tracks_all[i, :, 2] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
155 df['INTENSITY'] = tracks_all[i, :, 3] |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
156 df.to_excel(writer, sheet_name='spot%s' % (i + 1), index=False, float_format='%.2f') |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
157 writer.save() |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
158 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
159 |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
160 if __name__ == "__main__": |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
161 parser = argparse.ArgumentParser(description="Association of points in consecutive frames using the nearest neighbor algorithm") |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
162 parser.add_argument("fn_in", help="Name of input file (tsv tabular)") |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
163 parser.add_argument("fn_out", help="Name of output file (xlsx)") |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
164 parser.add_argument("nbpx", type=int, help="Neighborhood size in pixel") |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
165 parser.add_argument("thres", type=float, help="Percentage of the global maximal intensity for thresholding some event") |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
166 parser.add_argument("minlen", type=float, help="Minimum length of tracks (percentage of senquence length)") |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
167 args = parser.parse_args() |
04e692ee53a8
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points_association_nn/ commit db4c2a87a21f32e5d12d11e68f32773bfc06fcfd"
imgteam
parents:
diff
changeset
|
168 points_linking(args.fn_in, args.fn_out, args.nbpx, args.thres, args.minlen) |