Ejemplo n.º 1
0
 def init():
     fsleyes.initialise()
     props.initGUI()
     colourmaps.init()
     initialised[0] = True
     fslgl.bootstrap(glver)
     wx.CallAfter(run)
Ejemplo n.º 2
0
    def __init__(self,
                 parent,
                 overlayList,
                 displayCtx,
                 title=None,
                 style=None):
        """Create an ``OrthoDialog``.

        :arg parent:      A :mod:`wx` parent object.

        :arg overlayList: An :class:`.OverlayList` instance.

        :arg displayCtx:  A :class:`.DisplayContext` instance.

        :arg title:       Dialog title.

        :arg style:       Dialog style - defaults to
                          ``wx.DEFAULT_DIALOG_STYLE``.
        """

        if style is None:
            style = wx.DEFAULT_DIALOG_STYLE

        wx.Dialog.__init__(self, parent, title=title, style=style)

        fslgl.getGLContext()
        fslgl.bootstrap()

        self.panel = OrthoPanel(self, overlayList, displayCtx, None)
        self.Layout()
Ejemplo n.º 3
0
    def ready():
        fslgl.bootstrap()

        overlayList = fsloverlay.OverlayList()
        displayCtx  = fsldc.DisplayContext(overlayList)

        frame = fslframe.FSLeyesFrame(
            parent, overlayList, displayCtx, **kwargs)

        if callback is not None:
            callback(overlayList, displayCtx, frame)
Ejemplo n.º 4
0
def main(args=None):
    """Entry point for ``render``.

    Creates and renders an OpenGL scene, and saves it to a file, according
    to the specified command line arguments (which default to
    ``sys.argv[1:]``).
    """

    if args is None:
        args = sys.argv[1:]

    # Initialise FSLeyes and implement hacks.
    # This must come first as, amongst other
    # things, it sets the fsleyes.assetDir.
    fsleyes.initialise()

    # Initialise colour maps module
    fslcm.init()

    # Create a GL context
    fslgl.getGLContext(offscreen=True, createApp=True)

    # Now that GL inititalisation is over,
    # make sure that the idle loop executes
    # all tasks synchronously, instead of
    # trying to schedule them on the wx
    # event loop. And make sure image textures
    # don't use separate threads for data
    # processing.
    with idle.idleLoop.synchronous(), \
         imagetexture.ImageTexture.enableThreading(False):

        # Parse arguments, and
        # configure logging/debugging
        namespace = parseArgs(args)
        fsleyes.configLogging(namespace.verbose, namespace.noisy)

        # Initialise the fsleyes.gl modules
        fslgl.bootstrap(namespace.glversion)

        # Create a description of the scene
        overlayList, displayCtx, sceneOpts = makeDisplayContext(namespace)

        import matplotlib.image as mplimg

        # Render that scene, and save it to file
        bitmap, bg = render(namespace, overlayList, displayCtx, sceneOpts)

        if namespace.crop is not None:
            bitmap = autocrop(bitmap, bg, namespace.crop)
        mplimg.imsave(namespace.outfile, bitmap)
Ejemplo n.º 5
0
    def ready():
        frame = None
        fslgl.bootstrap()

        overlayList = fsloverlay.OverlayList()
        displayCtx = fsldc.DisplayContext(overlayList)
        if make_fsleyesframe:
            frame = fslframe.FSLeyesFrame(parent, overlayList, displayCtx,
                                          **kwargs)

        if ownapp:
            app.SetOverlayListAndDisplayContext(overlayList, displayCtx)
            # Keep a ref to prevent the app from being GC'd
            if make_fsleyesframe:
                frame._embed_app = app

        called[0] = True
        ret[0] = (overlayList, displayCtx, frame)
Ejemplo n.º 6
0
    def __init__(self, parent, overlayList, displayCtx, title=None):
        """Create an ``OrthoFrame``.

        :arg parent:      A :mod:`wx` parent object.

        :arg overlayList: An :class:`.OverlayList` instance.

        :arg displayCtx:  A :class:`.DisplayContext` instance.

        :arg title:       Dialog title.
        """

        wx.Frame.__init__(self, parent, title=title)

        fslgl.getGLContext()
        fslgl.bootstrap()

        self.panel = OrthoPanel(self, overlayList, displayCtx, None)
        self.Layout()
Ejemplo n.º 7
0
def main(args=None):
    """Entry point for ``render``.

    Creates and renders an OpenGL scene, and saves it to a file, according
    to the specified command line arguments (which default to
    ``sys.argv[1:]``).
    """

    if args is None:
        args = sys.argv[1:]

    # Initialise FSLeyes and implement hacks.
    # This must come first as, amongst other
    # things, it sets the fsleyes.assetDir.
    fsleyes.initialise()

    # Initialise colour maps module
    fslcm.init()

    # Create a GL context
    fslgl.getGLContext(offscreen=True, createApp=True)

    # Parse arguments, and
    # configure logging/debugging
    namespace = parseArgs(args)
    fsleyes.configLogging(namespace.verbose, namespace.noisy)

    # Initialise the fsleyes.gl modules
    fslgl.bootstrap(namespace.glversion)

    # Create a description of the scene
    overlayList, displayCtx, sceneOpts = makeDisplayContext(namespace)

    import matplotlib.image as mplimg

    # Render that scene, and save it to file
    bitmap, bg = render(namespace, overlayList, displayCtx, sceneOpts)

    if namespace.crop is not None:
        bitmap = autocrop(bitmap, bg, namespace.crop)
    mplimg.imsave(namespace.outfile, bitmap)
Ejemplo n.º 8
0
def main(args=None):
    """Entry point for ``render``.

    Creates and renders an OpenGL scene, and saves it to a file, according
    to the specified command line arguments (which default to
    ``sys.argv[1:]``).
    """

    if args is None:
        args = sys.argv[1:]

    # Create a GL context
    fslgl.getGLContext(offscreen=True, createApp=True)

    # Initialise FSLeyes and implement hacks
    fsleyes.initialise()
    fsleyesmain.hacksAndWorkarounds()

    # Initialise colour maps module
    fslcm.init()

    # Parse arguments, and
    # configure logging/debugging
    namespace = parseArgs(args)
    fsleyes.configLogging(namespace)

    # Initialise the fsleyes.gl modules
    fslgl.bootstrap(namespace.glversion)

    # Create a description of the scene
    overlayList, displayCtx, sceneOpts = makeDisplayContext(namespace)

    import matplotlib.image as mplimg

    # Render that scene, and save it to file
    bitmap = render(namespace, overlayList, displayCtx, sceneOpts)
    mplimg.imsave(namespace.outfile, bitmap)
Ejemplo n.º 9
0
 def realCallback():
     fslgl.bootstrap(namespace.glversion)
     callback()