Exemple #1
0
 def test_11_07_get_selection_bounds(self):
     display_svc = ij2.get_display_service(self.context)
     overlay_svc = ij2.get_overlay_service(self.context)
     i, j = np.mgrid[0:15, 0:1900:100]
     image = i+j
     ds = ij2.create_dataset(self.context, image, "Foo")
     display = display_svc.createDisplay("Foo", ds)
     mask = np.zeros(i.shape, bool)
     islice = slice(2,-3)
     jslice = slice(3,-4)
     mask[islice, jslice] = True
     overlay = ij2.create_overlay(self.context, mask)
     overlay_svc.addOverlays(display, J.make_list([overlay]))
     ij2.select_overlay(display.o, overlay)
     rect = overlay_svc.getSelectionBounds(display)
     self.assertEqual(J.get_field(rect, "x", "D"), 3)
     self.assertEqual(J.get_field(rect, "y", "D"), 2)
     self.assertEqual(J.get_field(rect, "width", "D"), 11)
     self.assertEqual(J.get_field(rect, "height", "D"), 9)
Exemple #2
0
 def test_09_02_set_field(self):
     o = J.make_instance("imagej/util/RealRect", "(DDDD)V", 1, 2, 3, 4)
     J.set_field(o, "x", "D", 5.5)
     self.assertEqual(J.get_field(o, "x", "D"), 5.5)
Exemple #3
0
 def test_09_02_set_field(self):
     o = J.make_instance("imagej/util/RealRect", "(DDDD)V", 1, 2, 3, 4)
     J.set_field(o, "x", "D", 5.5)
     self.assertEqual(J.get_field(o, "x", "D"), 5.5)