Mercurial > repos > imgteam > overlay_moving_and_fixed_image
comparison overlay_moving_and_fixed_image.py @ 1:bc324ec66719 draft
"planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/overlay_moving_and_fixed_image/ commit 3d389fdec0db29cf6fbd783c0501455bf624fa90"
author | imgteam |
---|---|
date | Wed, 18 Dec 2019 05:02:39 -0500 |
parents | 165a9330fc90 |
children | b4fc6e09e576 |
comparison
equal
deleted
inserted
replaced
0:165a9330fc90 | 1:bc324ec66719 |
---|---|
27 for i in range(0, (tf_coords.shape[0]//batch_size+1)): | 27 for i in range(0, (tf_coords.shape[0]//batch_size+1)): |
28 tf_coords[batch_size*i:batch_size*(i+1)] = coord_map(tf_coords[batch_size*i:batch_size*(i+1)]) | 28 tf_coords[batch_size*i:batch_size*(i+1)] = coord_map(tf_coords[batch_size*i:batch_size*(i+1)]) |
29 tf_coords = tf_coords.T.reshape((-1, cols, rows)).swapaxes(1, 2) | 29 tf_coords = tf_coords.T.reshape((-1, cols, rows)).swapaxes(1, 2) |
30 | 30 |
31 _stackcopy(coords[1, ...], tf_coords[0, ...]) | 31 _stackcopy(coords[1, ...], tf_coords[0, ...]) |
32 _stackcopy(coords[0, ...], tf_coords[1, ...]) | 32 _stackcopy(coords[0, ...], tf_coords[1, ...]) |
33 if len(shape) == 3: | 33 if len(shape) == 3: |
34 coords[2, ...] = range(shape[2]) | 34 coords[2, ...] = range(shape[2]) |
35 | 35 |
36 return coords | 36 return coords |
37 | 37 |
45 def overlay(moving_image, fixed_image, factor, overlay_out_path): | 45 def overlay(moving_image, fixed_image, factor, overlay_out_path): |
46 moving_image = Image.fromarray(moving_image).convert("RGBA") | 46 moving_image = Image.fromarray(moving_image).convert("RGBA") |
47 fixed_image = Image.fromarray(fixed_image).convert("RGBA") | 47 fixed_image = Image.fromarray(fixed_image).convert("RGBA") |
48 overlay_out = Image.blend(moving_image, fixed_image, factor) | 48 overlay_out = Image.blend(moving_image, fixed_image, factor) |
49 overlay_out.save(overlay_out_path, "PNG") | 49 overlay_out.save(overlay_out_path, "PNG") |
50 | 50 |
51 | 51 |
52 if __name__=="__main__": | 52 if __name__=="__main__": |
53 parser = argparse.ArgumentParser(description = "Overlay two images") | 53 parser = argparse.ArgumentParser(description = "Overlay two images") |
54 parser.add_argument("fixed_image", help = "Path to fixed image") | 54 parser.add_argument("fixed_image", help = "Path to fixed image") |
55 parser.add_argument("moving_image", help = "Path to moving image") | 55 parser.add_argument("moving_image", help = "Path to moving image") |