Skip to content

Commit d7f29f3

Browse files
committed
update ViewAnnotationsImageProcessor and ViewHighlightImageProcessor to use operable.transform_coordinates() in their visualizations
1 parent 8124947 commit d7f29f3

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎contrib/common/lib/cv/spot_analysis/image_processor/ViewAnnotationsImageProcessor.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@ def visualize_operable(
113113

114114
# initialize the figure
115115
self.figure.clear()
116-
self.figure.view.imshow(image)
116+
tc = lambda x, y: operable.transform_coordinates(p2.Pxy((x, y)))[1].astuple()
117+
(height, width), _ = it.dims_and_nchannels(image)
118+
img_xy, img_xy2 = tc(0, 0), tc(width, height)
119+
self.figure.view.draw_image(
120+
base_image.nparray, img_xy, (img_xy2[0] - img_xy[0], img_xy2[1] - img_xy[1]), invert_ylim=True
121+
)
117122

118123
# render
119124
include_label = len(to_render) > 1

‎contrib/common/lib/cv/spot_analysis/image_processor/ViewHighlightImageProcessor.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,12 @@ def visualize_operable(
115115

116116
# show the visualization
117117
self.figure.clear()
118-
self.figure.view.imshow(new_image)
118+
tc = lambda x, y: operable.transform_coordinates(p2.Pxy((x, y)))[1].astuple()
119+
(height, width), _ = it.dims_and_nchannels(new_image)
120+
img_xy, img_xy2 = tc(0, 0), tc(width, height)
121+
self.figure.view.draw_image(
122+
base_image.nparray, img_xy, (img_xy2[0] - img_xy[0], img_xy2[1] - img_xy[1]), invert_ylim=True
123+
)
119124
self.figure.view.show(block=False)
120125

121126
# build the return value

0 commit comments

Comments
 (0)