Mercurial > repos > imgteam > projective_transformation_points
annotate projective_transformation_points.py @ 4:aaac58d83043 draft
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
author | imgteam |
---|---|
date | Wed, 23 Dec 2020 23:56:29 +0000 |
parents | 0d2707c82d29 |
children | 3a686b6aa7fc |
rev | line source |
---|---|
0
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
1 from skimage.transform import ProjectiveTransform |
2
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
2 from scipy.ndimage import map_coordinates |
0
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
3 import numpy as np |
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
4 import pandas as pd |
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
5 import argparse |
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
6 |
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
7 |
2
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
8 def _stackcopy(a, b): |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
9 if a.ndim == 3: |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
10 a[:] = b[:, :, np.newaxis] |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
11 else: |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
12 a[:] = b |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
13 |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
14 |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
15 def warp_img_coords_batch(coord_map, shape, dtype=np.float64, batch_size=1000000): |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
16 rows, cols = shape[0], shape[1] |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
17 coords_shape = [len(shape), rows, cols] |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
18 if len(shape) == 3: |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
19 coords_shape.append(shape[2]) |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
20 coords = np.empty(coords_shape, dtype=dtype) |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
21 |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
22 tf_coords = np.indices((cols, rows), dtype=dtype).reshape(2, -1).T |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
23 |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
24 for i in range(0, (tf_coords.shape[0]//batch_size+1)): |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
25 tf_coords[batch_size*i:batch_size*(i+1)] = coord_map(tf_coords[batch_size*i:batch_size*(i+1)]) |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
26 tf_coords = tf_coords.T.reshape((-1, cols, rows)).swapaxes(1, 2) |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
27 |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
28 _stackcopy(coords[1, ...], tf_coords[0, ...]) |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
29 _stackcopy(coords[0, ...], tf_coords[1, ...]) |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
30 if len(shape) == 3: |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
31 coords[2, ...] = range(shape[2]) |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
32 |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
33 return coords |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
34 |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
35 |
0
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
36 def warp_coords_batch(coord_map, coords, dtype=np.float64, batch_size=1000000): |
1
f1744c5654b9
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 201f4231192bc368b14e72bb1314b9a97b8db8d0
imgteam
parents:
0
diff
changeset
|
37 tf_coords = coords.astype(np.float32)[:, ::-1] |
0
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
38 |
1
f1744c5654b9
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 201f4231192bc368b14e72bb1314b9a97b8db8d0
imgteam
parents:
0
diff
changeset
|
39 for i in range(0, (tf_coords.shape[0]//batch_size)+1): |
0
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
40 tf_coords[batch_size*i:batch_size*(i+1)] = coord_map(tf_coords[batch_size*i:batch_size*(i+1)]) |
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
41 |
2
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
42 return tf_coords[:, ::-1] |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
43 |
0
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
44 |
4
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
45 def transform(fn_roi_coords, fn_warp_matrix, fn_out): |
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
46 data = pd.read_csv(fn_roi_coords, delimiter="\t") |
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
47 all_data = np.array(data) |
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
48 |
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
49 nrows = all_data.shape[0] |
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
50 ncols = all_data.shape[1] |
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
51 roi_coords = all_data.take([0,1],axis=1).astype('int64') |
2
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
52 |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
53 tol = 10 |
4
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
54 moving = np.zeros(np.max(roi_coords,axis=0)+tol, dtype=np.uint32) |
2
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
55 idx_roi_coords = (roi_coords[:,0]-1) * moving.shape[1] + roi_coords[:,1] - 1 |
4
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
56 moving.flat[idx_roi_coords] = np.transpose(np.arange(nrows)+1) |
0
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
57 |
4
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
58 trans_matrix = np.array(pd.read_csv(fn_warp_matrix, delimiter="\t", header=None)) |
2
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
59 transP = ProjectiveTransform(matrix=trans_matrix) |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
60 roi_coords_warped_direct = warp_coords_batch(transP, roi_coords) |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
61 shape_fixed = np.round(np.max(roi_coords_warped_direct,axis=0)).astype(roi_coords.dtype)+tol |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
62 |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
63 transI = ProjectiveTransform(matrix=np.linalg.inv(trans_matrix)) |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
64 img_coords_warped = warp_img_coords_batch(transI, shape_fixed) |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
65 |
4
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
66 moving_warped = map_coordinates(moving, img_coords_warped, order=0, mode='constant', cval=0) |
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
67 idx_roi_coords_warped = np.where(moving_warped>0) |
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
68 roi_annots_warped = moving_warped.compress((moving_warped>0).flat) |
2
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
69 |
0
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
70 df = pd.DataFrame() |
4
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
71 col_names = data.columns.tolist() |
2
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
72 df['x'] = idx_roi_coords_warped[0] + 1 |
0d2707c82d29
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit f1298dca5a7f5be3acbb5e3d80c98b1cd6d2795b"
imgteam
parents:
1
diff
changeset
|
73 df['y'] = idx_roi_coords_warped[1] + 1 |
4
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
74 if ncols>2: |
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
75 for i in range(2,ncols): |
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
76 df[col_names[i]] = all_data[:,i].take(roi_annots_warped) |
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
77 df.to_csv(fn_out, index = False, sep="\t") |
0
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
78 |
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
79 |
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
80 if __name__ == "__main__": |
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
81 parser = argparse.ArgumentParser(description="Transform coordinates") |
4
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
82 parser.add_argument("coords", help="Paste path to .csv with coordinates (and labels) to transform (tab separated)") |
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
83 parser.add_argument("warp_matrix", help="Paste path to .csv that should be used for transformation (tab separated)") |
aaac58d83043
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 7391bb4256f49ec30cf38d9438f97e11ec25a115"
imgteam
parents:
2
diff
changeset
|
84 parser.add_argument("out", help="Paste path to file in which transformed coords (and labels) should be saved (tab separated)") |
0
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
85 args = parser.parse_args() |
ed8a71e13f7b
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit c3f4b766f03770f094fda6bda0a5882c0ebd4581
imgteam
parents:
diff
changeset
|
86 transform(args.coords, args.warp_matrix, args.out) |