コード例 #1
0
def build_items():
    x = np.linspace(-10, 10, 200)
    y = np.sin(np.sin(np.sin(x)))
    filename = osp.join(osp.dirname(__file__), "brain.png")
    items = [ 
              make.curve(x, y, color="b"),
              make.image(filename=filename),
              make.trimage(filename=filename),
              make.maskedimage(filename=filename, colormap='gray',
                               show_mask=True, xdata=[0, 40], ydata=[0, 50]),
              make.label("Relative position <b>outside</b>",
                         (x[0], y[0]), (-10, -10), "BR"),
              make.label("Relative position <i>inside</i>",
                         (x[0], y[0]), (10, 10), "TL"),
              make.label("Absolute position", "R", (0, 0), "R"),
              make.legend("TR"),
              make.rectangle(-3, -0.8, -0.5, -1., "rc1"),
              make.segment(-3, -0.8, -0.5, -1., "se1"),
              make.ellipse(-10, 0.0, 0, 0, "el1"),
              make.annotated_rectangle(0.5, 0.8, 3, 1., "rc1", "tutu"),
              make.annotated_segment(-1, -1, 1, 1., "rc1", "tutu"),
              Axes( (0, 0), (1, 0), (0, 1) ),
              PolygonShape(np.array([[150., 330.],
                                     [270., 520.],
                                     [470., 480.],
                                     [520., 360.],
                                     [460., 200.],
                                     [250., 240.]])),
              ]
    return items
コード例 #2
0
ファイル: loadsaveitems_pickle.py プロジェクト: gyenney/Tools
def build_items():
    x = np.linspace(-10, 10, 200)
    y = np.sin(np.sin(np.sin(x)))
    filename = osp.join(osp.dirname(__file__), "brain.png")
    items = [
        make.curve(x, y, color="b"),
        make.image(filename=filename),
        make.trimage(filename=filename),
        make.maskedimage(filename=filename,
                         colormap='gray',
                         show_mask=True,
                         xdata=[0, 40],
                         ydata=[0, 50]),
        make.label("Relative position <b>outside</b>", (x[0], y[0]),
                   (-10, -10), "BR"),
        make.label("Relative position <i>inside</i>", (x[0], y[0]), (10, 10),
                   "TL"),
        make.label("Absolute position", "R", (0, 0), "R"),
        make.legend("TR"),
        make.rectangle(-3, -0.8, -0.5, -1., "rc1"),
        make.segment(-3, -0.8, -0.5, -1., "se1"),
        make.ellipse(-10, 0.0, 0, 0, "el1"),
        make.annotated_rectangle(0.5, 0.8, 3, 1., "rc1", "tutu"),
        make.annotated_segment(-1, -1, 1, 1., "rc1", "tutu"),
        Axes((0, 0), (1, 0), (0, 1)),
        PolygonShape(
            np.array([[150., 330.], [270., 520.], [470., 480.], [520., 360.],
                      [460., 200.], [250., 240.]])),
    ]
    return items
コード例 #3
0
 def set_item(self, item):
     """Set associated item -- must be a TrImageItem object"""
     base.BaseTransformMixin.set_item(self, item)
     crect = make.annotated_rectangle(0, 0, 1, 1, _("Cropping rectangle"))
     self.crop_rect = crect
     crect.annotationparam.format = "%.1f cm"
     plot = self.get_plot()
     plot.add_item(crect)
     plot.set_active_item(crect)
     x0, y0, x1, y1 = self.item.get_crop_coordinates()
     crect.set_rect(x0, y0, x1, y1)
     plot.replot()
コード例 #4
0
ファイル: rotatecrop.py プロジェクト: HaMF/guiqwt
 def set_item(self, item):
     """Set associated item -- must be a TrImageItem object"""
     base.BaseTransformMixin.set_item(self, item)
     crect = make.annotated_rectangle(0, 0, 1, 1, _("Cropping rectangle"))
     self.crop_rect = crect
     crect.annotationparam.format = "%.1f cm"
     plot = self.get_plot()
     plot.add_item(crect)
     plot.set_active_item(crect)
     x0, y0, x1, y1 = self.item.get_crop_coordinates()
     crect.set_rect(x0, y0, x1, y1)
     plot.replot()