예제 #1
0
def create_window():
    gridparam = make.gridparam(background="black", minor_enabled=(False, False),
                               major_style=(".", "gray", 1))
    win = ImageDialog(edit=False, toolbar=True,
                      wintitle="Region of interest (ROI) test",
                      options=dict(gridparam=gridparam))
    for toolklass in (RectangleTool, EllipseTool, FreeFormTool, PlaceAxesTool):
        win.add_tool(toolklass)
    return win
예제 #2
0
def create_window():
    gridparam = make.gridparam(background="black",
                               minor_enabled=(False, False),
                               major_style=(".", "gray", 1))
    win = ImageDialog(edit=False,
                      toolbar=True,
                      wintitle="Region of interest (ROI) test",
                      options=dict(gridparam=gridparam))
    for toolklass in (RectangleTool, EllipseTool, FreeFormTool, PlaceAxesTool):
        win.add_tool(toolklass)
    return win
예제 #3
0
def create_window():
    gridparam = make.gridparam(background="black",
                               minor_enabled=(False, False),
                               major_style=(".", "gray", 1))
    win = ImageDialog(edit=False, toolbar=True,
                      wintitle="All image and plot tools test",
                      options=dict(gridparam=gridparam))
    for toolklass in (RectangleTool, EllipseTool, SegmentTool,
                      MultiLineTool, FreeFormTool):
        win.add_tool(toolklass, handle_final_shape_cb=customize_shape)
    return win
예제 #4
0
def mandel():
    win = ImageDialog(edit=True, toolbar=True, wintitle="Mandelbrot",
                      options=dict(yreverse=False))
    mandel = MandelItem(-1.5, .5, -1., 1.)
    win.add_tool(FullScale, mandel)
    plot = win.get_plot()
    plot.set_aspect_ratio(lock=False)
    plot.add_item(mandel)
    plot.set_full_scale(mandel)
    win.show()
    win.exec_()
예제 #5
0
def create_window():
    gridparam = make.gridparam(background="black",
                               minor_enabled=(False, False),
                               major_style=(".", "gray", 1))
    win = ImageDialog(edit=False,
                      toolbar=True,
                      wintitle="All image and plot tools test",
                      options=dict(gridparam=gridparam))
    for toolklass in (RectangleTool, EllipseTool, SegmentTool, MultiLineTool,
                      FreeFormTool):
        win.add_tool(toolklass, handle_final_shape_cb=customize_shape)
    return win
예제 #6
0
def mandel():
    win = ImageDialog(edit=True,
                      toolbar=True,
                      wintitle="Mandelbrot",
                      options=dict(yreverse=False))
    mandel = MandelItem(-1.5, .5, -1., 1.)
    win.add_tool(FullScale, mandel)
    plot = win.get_plot()
    plot.set_aspect_ratio(lock=False)
    plot.add_item(mandel)
    plot.set_full_scale(mandel)
    win.show()
    win.exec_()
예제 #7
0
def create_window():
    win = ImageDialog(edit=False,
                      toolbar=True,
                      wintitle="All image and plot tools test")
    for toolklass in (LabelTool, HRangeTool, VCursorTool, HCursorTool,
                      XCursorTool, SegmentTool, RectangleTool,
                      ObliqueRectangleTool, CircleTool, EllipseTool,
                      MultiLineTool, FreeFormTool, PlaceAxesTool,
                      AnnotatedRectangleTool, AnnotatedObliqueRectangleTool,
                      AnnotatedCircleTool, AnnotatedEllipseTool,
                      AnnotatedSegmentTool, AnnotatedPointTool):
        win.add_tool(toolklass)
    return win
예제 #8
0
def get_segment(item):
    """Show image and return selected segment coordinates"""
    win = ImageDialog(_("Select a segment then press OK to accept"), edit=True)
    default = win.add_tool(SelectTool)
    win.set_default_tool(default)
    segtool = win.add_tool(AnnotatedSegmentTool, title="Test",
                           switch_to_default_tool=True)
    segtool.activate()
    plot = win.get_plot()
    plot.add_item(item)
    plot.set_active_item(item)
    win.show()
    if win.exec_():
        shape = segtool.get_last_final_shape()
        return shape.get_rect()
예제 #9
0
import os, os.path as osp, pickle

from plotpy.plot import ImageDialog
from plotpy.tools import ImageMaskTool
from plotpy.builder import make

SHOW = True  # Show test in GUI-based test launcher

FNAME = "image_masked.pickle"

if __name__ == "__main__":
    import plotpy
    _app = plotpy.qapplication()
    win = ImageDialog(toolbar=True, wintitle="Masked image item test")
    win.add_tool(ImageMaskTool)
    if os.access(FNAME, os.R_OK):
        print("Restoring mask...", end=' ')
        iofile = open(FNAME, "rb")
        image = pickle.load(iofile)
        iofile.close()
        print("OK")
    else:
        fname = osp.join(osp.abspath(osp.dirname(__file__)), "brain.png")
        image = make.maskedimage(filename=fname,
                                 colormap='gray',
                                 show_mask=True,
                                 xdata=[0, 20],
                                 ydata=[0, 25])
    win.get_plot().add_item(image)
    win.show()
예제 #10
0
import os, os.path as osp, pickle

from plotpy.plot import ImageDialog
from plotpy.tools import ImageMaskTool
from plotpy.builder import make

SHOW = True # Show test in GUI-based test launcher

FNAME = "image_masked.pickle"

if __name__ == "__main__":
    import plotpy
    _app = plotpy.qapplication()
    win = ImageDialog(toolbar=True, wintitle="Masked image item test")
    win.add_tool(ImageMaskTool)
    if os.access(FNAME, os.R_OK):
        print("Restoring mask...", end=' ')
        iofile = open(FNAME, "rb")
        image = pickle.load(iofile)
        iofile.close()
        print("OK")
    else:
        fname = osp.join(osp.abspath(osp.dirname(__file__)), "brain.png")
        image = make.maskedimage(filename=fname, colormap='gray',
                                 show_mask=True, xdata=[0, 20], ydata=[0, 25])
    win.get_plot().add_item(image)
    win.show()
    win.exec_()
    iofile = open(FNAME, "wb")
    pickle.dump(image, iofile)