Mercurial > repos > imgteam > projective_transformation_points
comparison projective_transformation_points.py @ 1:f1744c5654b9 draft
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/projective_transformation_points/ commit 201f4231192bc368b14e72bb1314b9a97b8db8d0
| author | imgteam |
|---|---|
| date | Wed, 27 Mar 2019 14:54:32 -0400 |
| parents | ed8a71e13f7b |
| children | 0d2707c82d29 |
comparison
equal
deleted
inserted
replaced
| 0:ed8a71e13f7b | 1:f1744c5654b9 |
|---|---|
| 3 import pandas as pd | 3 import pandas as pd |
| 4 import argparse | 4 import argparse |
| 5 | 5 |
| 6 | 6 |
| 7 def warp_coords_batch(coord_map, coords, dtype=np.float64, batch_size=1000000): | 7 def warp_coords_batch(coord_map, coords, dtype=np.float64, batch_size=1000000): |
| 8 tf_coords = coords.astype(np.float32) | 8 tf_coords = coords.astype(np.float32)[:, ::-1] |
| 9 | 9 |
| 10 for i in range(0, (tf_coords.shape[0]//batch_size+1)): | 10 for i in range(0, (tf_coords.shape[0]//batch_size)+1): |
| 11 tf_coords[batch_size*i:batch_size*(i+1)] = coord_map(tf_coords[batch_size*i:batch_size*(i+1)]) | 11 tf_coords[batch_size*i:batch_size*(i+1)] = coord_map(tf_coords[batch_size*i:batch_size*(i+1)]) |
| 12 | 12 |
| 13 return np.unique(np.round(tf_coords).astype(coords.dtype),axis=0) | 13 return np.unique(np.round(tf_coords).astype(coords.dtype),axis=0)[:, ::-1] |
| 14 | 14 |
| 15 | 15 |
| 16 def transform(coords, warp_matrix, out): | 16 def transform(coords, warp_matrix, out): |
| 17 indices = np.array(pd.read_csv(coords, delimiter="\t")) | 17 indices = np.array(pd.read_csv(coords, delimiter="\t")) |
| 18 a_matrix = np.array(pd.read_csv(warp_matrix, delimiter="\t", header=None)) | 18 a_matrix = np.array(pd.read_csv(warp_matrix, delimiter="\t", header=None)) |
