diff --git a/fsl/fsleyes/gl/globject.py b/fsl/fsleyes/gl/globject.py index 2b17f6eae9407761be70eba8f57fd96d1cb37558..c31ce0d7e20c2a0cce511f7f117e2c057a856e0f 100644 --- a/fsl/fsleyes/gl/globject.py +++ b/fsl/fsleyes/gl/globject.py @@ -237,8 +237,8 @@ class GLObject(object): def draw(self, zpos, xform=None): - """This method should draw a view of this ``GLObject`` at the - given Z location, which specifies the position along the screen + """This method should draw a view of this ``GLObject`` - a 2D slice + at the given Z location, which specifies the position along the screen depth axis. If the ``xform`` parameter is provided, it should be applied to the @@ -287,15 +287,26 @@ class GLSimpleObject(GLObject): """ def __init__(self): + """Create a ``GLSimpleObject``. """ GLObject.__init__(self) - def destroy( self): pass - def preDraw( self): pass - def postDraw(self): pass + def destroy( self): + """Overrides :meth:`GLObject.destroy`. Does nothing. """ + pass + + + def preDraw(self): + """Overrides :meth:`GLObject.preDraw`. Does nothing. """ + pass + + + def postDraw(self): + """Overrides :meth:`GLObject.postDraw`. Does nothing. """ + pass class GLImageObject(GLObject): - """The ``GLImageObject` class is the superclass for all GL representations + """The ``GLImageObject` class is the base class for all GL representations of :class:`.Image` instances. """ @@ -305,9 +316,12 @@ class GLImageObject(GLObject): This constructor adds the following attributes to this instance: =============== ======================================================= - ``image`` A reference to the image. - ``display`` A reference to the display. - ``displayOpts`` A reference to the image type-specific display options. + ``image`` A reference to the :class:`.Image` being displayed. + ``display`` A reference to the :class:`.Display` instance + associated with the ``image``. + ``displayOpts`` A reference to the :class:`.DisplayOpts` instance, + containing overlay type-specific display options. This + is assumed to be a sub-class of :class:`.ImageOpts`. =============== ======================================================= :arg image: The :class:`.Image` instance @@ -384,8 +398,10 @@ class GLImageObject(GLObject): through the given ``zpos``, with the optional ``xform`` applied to the coordinates. - This method is called by the :mod:`.gl14.glvolume_funcs` and - :mod:`.gl21.glvolume_funcs` modules. + This is a convenience method for generating vertices which can be used + to render a slice through a 3D texture. It is used by the + :mod:`.gl14.glvolume_funcs` and :mod:`.gl21.glvolume_funcs` (and other) + modules. A tuple of three values is returned, containing: diff --git a/fsl/fsleyes/gl/osmesacolourbarcanvas.py b/fsl/fsleyes/gl/osmesacolourbarcanvas.py index 1c7e1daff4fe49dcd4070e332916d97be39a2ae7..62dfa4c03e2231de2dd17f6ba1e104eca8f189e3 100644 --- a/fsl/fsleyes/gl/osmesacolourbarcanvas.py +++ b/fsl/fsleyes/gl/osmesacolourbarcanvas.py @@ -1,33 +1,28 @@ #!/usr/bin/env python # -# osmesacolourbarcanvas.py - A ColourBarCanvas which uses OSMesa for -# off-screen rendering. +# osmesacolourbarcanvas.py - The OSMesaColourBarCanvas. # # Author: Paul McCarthy <pauldmccarthy@gmail.com> # - -"""Provides the :class:`OSMesaColourBarCanvas` for off-screen -rendering of colour bars. +"""This module provides the :class:`OSMesaColourBarCanvas`, which is a +:class:`.ColourBarCanvas` for use with OSMesa (off-screen OpenGL rendering). """ -import logging -log = logging.getLogger(__name__) - import fsl.fsleyes.gl as fslgl import colourbarcanvas as cbarcanvas - + class OSMesaColourBarCanvas(cbarcanvas.ColourBarCanvas, fslgl.OSMesaCanvasTarget): - """A :class:`.SliceCanvas` which uses OSMesa for static off-screen OpenGL - rendering. - """ + """The ``OSMesaColourBarCanvas`` is a :class:`.ColourBarCanvas` which uses + OSMesa for static off-screen OpenGL rendering. + """ + - def __init__(self, - width=0, - height=0): - """Create a colour bar canvas for off-screen rendering. + def __init__(self, width=0, height=0): + """Create a ``OSColourBarCanvas``. + :arg width: Canvas width in pixels :arg height: Canvas height in pixels @@ -35,5 +30,3 @@ class OSMesaColourBarCanvas(cbarcanvas.ColourBarCanvas, fslgl.OSMesaCanvasTarget .__init__(self, width, height) cbarcanvas.ColourBarCanvas.__init__(self) - -ColourBarCanvas = OSMesaColourBarCanvas diff --git a/fsl/fsleyes/gl/osmesalightboxcanvas.py b/fsl/fsleyes/gl/osmesalightboxcanvas.py index cd1c5519a011757797e70243804e4b131eb0a6af..a749e26f578f65ab206d6c9453c4a25613675137 100644 --- a/fsl/fsleyes/gl/osmesalightboxcanvas.py +++ b/fsl/fsleyes/gl/osmesalightboxcanvas.py @@ -1,26 +1,22 @@ #!/usr/bin/env python # -# osmesalightboxcanvas.py - A LightBoxCanvas which uses OSMesa for off-screen -# OpenGL rendering. +# osmesalightboxcanvas.py - The OSMesaLightBoxCanvas. # # Author: Paul McCarthy <pauldmccarthy@gmail.com> # -"""Provides the :class:`OSMesaLightBoxCanvas` which supports off-screen -rendering. +"""This module provides the :class:`OSMesaLightBoxCanvas`, which is a +:class:`.LightBoxCanvas` for use with OSMesa (off-screen OpenGL rendering). """ -import logging -log = logging.getLogger(__name__) - import fsl.fsleyes.gl as fslgl import lightboxcanvas - + class OSMesaLightBoxCanvas(lightboxcanvas.LightBoxCanvas, fslgl.OSMesaCanvasTarget): - """A :class:`.LightBoxCanvas` which uses OSMesa for static off-screen Open - GL rendering. + """The ``OSMesaLightBoxCanvas`` is a :class:`.LightBoxCanvas` which uses + OSMesa for static off-screen Open GL rendering. """ def __init__(self, @@ -29,12 +25,14 @@ class OSMesaLightBoxCanvas(lightboxcanvas.LightBoxCanvas, zax=0, width=0, height=0): - """See the :class:`.LightBoxCanvas` constructor for details on the other - parameters. - + """Create an ``OSMesaLightBoxCanvas``. + :arg width: Canvas width in pixels :arg height: Canvas height in pixels + + See :meth:`.LightBoxCanvas.__init__` for details on the other + arguments. """ fslgl.OSMesaCanvasTarget .__init__(self, width, height) diff --git a/fsl/fsleyes/gl/osmesaslicecanvas.py b/fsl/fsleyes/gl/osmesaslicecanvas.py index 1fc242719736e44b52f47e94ab4f9edf97d4644b..4b905dd28ae6eb156b689798ad5613ba2425e09d 100644 --- a/fsl/fsleyes/gl/osmesaslicecanvas.py +++ b/fsl/fsleyes/gl/osmesaslicecanvas.py @@ -1,26 +1,21 @@ #!/usr/bin/env python # -# osmesaslicecanvas.py - A SliceCanvas which uses OSMesa for off-screen OpenGL -# rendering. +# osmesaslicecanvas.py - The OSMesaSliceCanvas. # # Author: Paul McCarthy <pauldmccarthy@gmail.com> # -"""Provides the :class:`OSMesaSliceCanvas` which supports off-screen -rendering. +"""This module provides the :class:`OSMesaSliceCanvas`, which is a +:class:`.SliceCanvas` for use with OSMesa (off-screen OpenGL rendering). """ -import logging -log = logging.getLogger(__name__) - import fsl.fsleyes.gl as fslgl import slicecanvas as sc - -class OSMesaSliceCanvas(sc.SliceCanvas, - fslgl.OSMesaCanvasTarget): - """A :class:`.SliceCanvas` which uses OSMesa for static off-screen OpenGL - rendering. + +class OSMesaSliceCanvas(sc.SliceCanvas, fslgl.OSMesaCanvasTarget): + """The ``OSMesaSliceCanvas`` is a :class:`.SliceCanvas` which uses OSMesa + for static off-screen OpenGL rendering. """ def __init__(self, @@ -29,12 +24,13 @@ class OSMesaSliceCanvas(sc.SliceCanvas, zax=0, width=0, height=0): - """See the :class:`.SliceCanvas` constructor for details on the other - parameters. - + """Create an ``OSMesaSliceCanvas``. + :arg width: Canvas width in pixels :arg height: Canvas height in pixels + + See :meth:`.SliceCanvas.__init__` for details on the other arguments. """ fslgl.OSMesaCanvasTarget.__init__(self, width, height) diff --git a/fsl/fsleyes/gl/slicecanvas.py b/fsl/fsleyes/gl/slicecanvas.py index d63e3a0d9ad16885cd3789cce5dd23e03fc8c790..bce0de051333226a43742ac0b7db6aa78e7e308a 100644 --- a/fsl/fsleyes/gl/slicecanvas.py +++ b/fsl/fsleyes/gl/slicecanvas.py @@ -696,6 +696,9 @@ class SliceCanvas(props.HasProperties): any of the parameters are not provided, the :attr:`.DisplayContext.bounds` are used. + .. note:: This method is used internally, and also by the + :class:`.WXGLSliceCanvas` class. + :arg xmin: Minimum x (horizontal) value to be in the display bounds. :arg xmax: Maximum x value to be in the display bounds. :arg ymin: Minimum y (vertical) value to be in the display bounds. diff --git a/fsl/fsleyes/gl/wxglcolourbarcanvas.py b/fsl/fsleyes/gl/wxglcolourbarcanvas.py index 4155a3d73bed8c4f7954c3487bad0ae845659fc4..633e563b2942d9ad35000959884ca830422cc9ce 100644 --- a/fsl/fsleyes/gl/wxglcolourbarcanvas.py +++ b/fsl/fsleyes/gl/wxglcolourbarcanvas.py @@ -1,17 +1,13 @@ #!/usr/bin/env python # -# wxglcolourbarcanvas.py - Provides the WXGLColourBarCanvas, for displaying -# a colour bar on a wx.glcanvas.GLCanvas canvas. +# wxglcolourbarcanvas.py - The WXGLColourBarCanvas class. # # Author: Paul McCarthy <pauldmccarthy@gmail.com> # -"""This module provides the :class:`WXGLColourBarCanvas`, for displaying a -:class:`.ColourBarCanvas` on a :class:`wx.glcanvas.GLCanvas`. +"""This module provides the :class:`WXGLColourBarCanvas` class, which is a +:class:`.ColourBarCanvas` for use in a :mod:`wx` application. """ -import logging -log = logging.getLogger(__name__) - import wx import wx.glcanvas as wxgl @@ -23,9 +19,14 @@ import fsl.fsleyes.gl.colourbarcanvas as cbarcanvas class WXGLColourBarCanvas(cbarcanvas.ColourBarCanvas, fslgl.WXGLCanvasTarget, wxgl.GLCanvas): - """A :class:`.ColourBarCanvas` which is also a - :class:`wx.glcanvas.GLCanvas`, for on screen rendering of colour bars. - """ + """The ``WXGLColourBarCanvas`` is a :class:`.ColourBarCanvas`, a + :class:`wx.glcanvas.GLCanvas` and a :class:`.WXGLCanvasTarget`. If you + want to use a :class:`.ColourBarCanvas` in your :mod:`wx` application, then + you should use a ``WXGLColourBarCanvas``. + + .. note:: The ``WXGLColourBarCanvas`` assumes the existence of the + :meth:`.ColourBarCanvas._genColourBarTexture` method. + """ def __init__(self, parent): wxgl.GLCanvas .__init__(self, parent) @@ -38,5 +39,3 @@ class WXGLColourBarCanvas(cbarcanvas.ColourBarCanvas, ev.Skip() self.Bind(wx.EVT_SIZE, onsize) - -ColourBarCanvas = WXGLColourBarCanvas diff --git a/fsl/fsleyes/gl/wxgllightboxcanvas.py b/fsl/fsleyes/gl/wxgllightboxcanvas.py index 0fd9ac4dc5457d32e85ebeb636b6bd9e652f3969..57f4b7659274207302044538c53929395d70d790 100644 --- a/fsl/fsleyes/gl/wxgllightboxcanvas.py +++ b/fsl/fsleyes/gl/wxgllightboxcanvas.py @@ -1,11 +1,14 @@ #!/usr/bin/env python # -# wxgllightboxcanvas.py - A wx.glcanvas.GLCanvas LightBoxCanvas. +# wxgllightboxcanvas.py - THe WXGLLightBoxCanvas class. # # Author: Paul McCarthy <pauldmccarthy@gmail.com> # -"""This module provides the :class:`WXGLLightBoxCanvas`, which is both a -:class:`.LightBoxCanvas`, and a :class:`wx.glcanvas.GLCanvas`. +"""This module provides the :class:`WXGLSliceCanvas` class, which is a +:class:`.SliceCanvas` for use in a :mod:`wx` application. +""" +"""This module provides the :class:`WXGLLightBoxCanvas`, which is a +:class:`.LightBoxCanvas` for use in a :mod:`wx` application. """ @@ -19,16 +22,20 @@ import fsl.fsleyes.gl as fslgl class WXGLLightBoxCanvas(lightboxcanvas.LightBoxCanvas, wxgl.GLCanvas, fslgl.WXGLCanvasTarget): - """A :class:`wx.glcanvas.GLCanvas` and a :class:`.SliceCanvas`, for - on-screen interactive 2D slice rendering from a collection of 3D - overlays. - """ + """The ``WXGLLightBoxCanvas`` is a :class:`.LightBoxCanvas`, a + :class:`wx.glcanvas.GLCanvas` and a :class:`.WXGLCanvasTarget`. If you + want to use a :class:`.LightBoxCanvas` in your :mod:`wx` application, + then you should use a ``WXGLLightBoxCanvas``. + + .. note:: The ``WXGLLightBoxCanvas`` assumes the existence of the + :meth:`.LightBoxCanvas._updateDisplayBounds` method. + """ + def __init__(self, parent, overlayList, displayCtx, zax=0): - """Configures a few event handlers for cleaning up property - listeners when the canvas is destroyed, and for redrawing on - paint/resize events. - """ + """Create a ``WXGLLightBoxCanvas``. See + :meth:`.LightBoxCanvas.__init__` for details on the arguments. + """ wxgl.GLCanvas .__init__(self, parent) lightboxcanvas.LightBoxCanvas.__init__(self, @@ -43,6 +50,3 @@ class WXGLLightBoxCanvas(lightboxcanvas.LightBoxCanvas, self._updateDisplayBounds() ev.Skip() self.Bind(wx.EVT_SIZE, onResize) - -# A convenient alias -LightBoxCanvas = WXGLLightBoxCanvas diff --git a/fsl/fsleyes/gl/wxglslicecanvas.py b/fsl/fsleyes/gl/wxglslicecanvas.py index a0fdbe16b14c312598b7ee04842978304eb0714f..6f789e77f5760b0f3c8f0069d8776e9031d47416 100644 --- a/fsl/fsleyes/gl/wxglslicecanvas.py +++ b/fsl/fsleyes/gl/wxglslicecanvas.py @@ -1,16 +1,11 @@ #!/usr/bin/env python # -# wxglslicecanvas.py - A SliceCanvas which is rendered using a -# wx.glcanvas.GLCanvas panel. +# wxglslicecanvas.py - The WXGLSliceCanvas class. # # Author: Paul McCarthy <pauldmccarthy@gmail.com> # -"""The :class:`WXGLSliceCanvas` class is both a :class:`.SliceCanvas` and a -:class:`wx.glcanvas.GLCanvas` panel. - -It is the main class used for on-screen orthographic rendering of 3D image -data (although most of the functionality is provided by the -:class:`.SliceCanvas` class). +"""This module provides the :class:`WXGLSliceCanvas` class, which is a +:class:`.SliceCanvas` for use in a :mod:`wx` application. """ @@ -24,15 +19,18 @@ import fsl.fsleyes.gl as fslgl class WXGLSliceCanvas(slicecanvas.SliceCanvas, wxgl.GLCanvas, fslgl.WXGLCanvasTarget): - """A :class:`wx.glcanvas.GLCanvas` and a :class:`.SliceCanvas`, for - on-screen interactive 2D slice rendering from a collection of 3D - overlays. + """The ``WXGLSliceCanvas`` is a :class:`.SliceCanvas`, a + :class:`wx.glcanvas.GLCanvas` and a :class:`.WXGLCanvasTarget`. If you + want to use a :class:`.SliceCanvas` in your :mod:`wx` application, then + you should use a ``WXGLSliceCanvas``. + + .. note:: The ``WXGLSliceCanvas`` assumes the existence of the + :meth:`.SliceCanvas._updateDisplayBounds` method. """ def __init__(self, parent, overlayList, displayCtx, zax=0): - """Configures a few event handlers for cleaning up property - listeners when the canvas is destroyed, and for redrawing on - paint/resize events. + """Create a ``WXGLSliceCanvas``. See :meth:`.SliceCanvas.__init__` for + details on the arguments. """ wxgl.GLCanvas .__init__(self, parent) diff --git a/fsl/fsleyes/views/colourbarpanel.py b/fsl/fsleyes/views/colourbarpanel.py index 88b88d17f03010b276a063ccb099ace423d9ce8e..bec6a6d2e0cc5d583b7be9c07b23e939d8268825 100644 --- a/fsl/fsleyes/views/colourbarpanel.py +++ b/fsl/fsleyes/views/colourbarpanel.py @@ -28,11 +28,11 @@ class ColourBarPanel(fslpanel.FSLEyesPanel): """ - orientation = cbarcanvas.ColourBarCanvas.orientation + orientation = cbarcanvas.WXGLColourBarCanvas.orientation """Draw the colour bar horizontally or vertically. """ - labelSide = cbarcanvas.ColourBarCanvas.labelSide + labelSide = cbarcanvas.WXGLColourBarCanvas.labelSide """Draw colour bar labels on the top/left/right/bottom.""" @@ -44,7 +44,7 @@ class ColourBarPanel(fslpanel.FSLEyesPanel): fslpanel.FSLEyesPanel.__init__(self, parent, overlayList, displayCtx) - self._cbPanel = cbarcanvas.ColourBarCanvas(self) + self._cbPanel = cbarcanvas.WXGLColourBarCanvas(self) self._sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(self._sizer) diff --git a/fsl/fsleyes/views/lightboxpanel.py b/fsl/fsleyes/views/lightboxpanel.py index 1211870b23883694d96312afe26e6c821813795e..0d3de04f3e24cb7b70e36179650bff1d5b8d9e2e 100644 --- a/fsl/fsleyes/views/lightboxpanel.py +++ b/fsl/fsleyes/views/lightboxpanel.py @@ -89,7 +89,7 @@ class LightBoxPanel(canvaspanel.CanvasPanel): self.getCanvasPanel(), style=wx.SB_VERTICAL) - self.__lbCanvas = lightboxcanvas.LightBoxCanvas( + self.__lbCanvas = lightboxcanvas.WXGLLightBoxCanvas( self.getCanvasPanel(), overlayList, displayCtx)