fsleyes.gl.scene3dcanvas¶
This module provides the Scene3DCanvas class, which is used by
FSLeyes for its 3D view.
-
class
fsleyes.gl.scene3dcanvas.Scene3DCanvas(overlayList, displayCtx)[source]¶ Bases:
object-
__init__(overlayList, displayCtx)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
property
destroyed¶
-
property
opts¶ Returns a reference to the
Scene3DCanvasOptsinstance.
-
property
resetLightPos¶ By default, the
lightPosis updated whenever theDisplayContext.boundschange. This flag can be used to disable this behaviour.
-
property
viewMatrix¶ Returns the view matrix for the current scene - this is an affine matrix which encodes the current
Scene3DCanvasOpts.offset,Scene3DCanvasOpts.zoom,Scene3DCanvasOpts.rotationand camera settings.See
__genViewMatrix().
-
property
viewScale¶ Returns an affine matrix which encodes the current
Scene3DCanvasOpts.zoomsetting.
-
property
viewOffset¶ Returns an affine matrix which encodes the current
Scene3DCanvasOpts.offsetsetting.
-
property
viewRotation¶ Returns an affine matrix which encodes the current
Scene3DCanvasOpts.rotationsetting.
-
property
viewCamera¶ Returns an affine matrix which encodes the current camera. transformation. The initial camera orientation in the view shown by a
Scene3DCanvasis located on the positive Y axis, is oriented towards the positive Z axis, and is pointing towards the centre of theDisplayContext.displayBounds.
-
property
projectionMatrix¶ Returns the projection matrix. This is an affine matrix which converts from normalised device coordinates (NDCs, coordinates between -1 and +1) into viewport coordinates. The initial viewport for a
Scene3DCanvasis configured by theroutines.ortho()function.See
__setViewport().
-
property
invViewProjectionMatrix¶ Returns the inverse of the model-view-projection matrix, the equivalent of:
invert(projectionMatrix * viewMatrix)
-
property
viewport¶ Returns a list of three
(min, max)tuples which specify the viewport limits of the currently displayed scene.
-
canvasToWorld(xpos, ypos, near=True)[source]¶ Transform the given x/y canvas coordinates into the display coordinate system. The calculated coordinates will be located on the near clipping plane.
- Parameters
near – If
True(the default), the returned coordinate will be located on the near clipping plane. Otherwise, the coordinate will be located on the far clipping plane.
-
getGLObject(overlay)[source]¶ Returns the
GLObjectassociated with the given overlay, orNoneif there is not one.
-
getGLObjects()[source]¶ Returns two lists:
A list of overlays to be drawn
A list of corresponding
GLObjectinstances
The lists are in the order that they should be drawn.
This method also creates
GLObjectinstances for any overlays in theOverlayListthat do not have one.
-
_Scene3DCanvas__deregisterOverlay(overlay)¶
-
_Scene3DCanvas__displayBoundsChanged(*a)¶ Called when the
DisplayContext.boundschange. Resets theScene3DCanvasOpts.lightPosproperty.
-
_Scene3DCanvas__drawBoundingBox()¶
-
_Scene3DCanvas__drawCursor()¶ Draws three lines at the current
DisplayContext.location.
-
_Scene3DCanvas__drawLegend()¶ Draws a legend in the bottom left corner of the screen, showing anatomical orientation.
-
_Scene3DCanvas__drawLight()¶
-
_Scene3DCanvas__genGLObject(overlay)¶
-
_Scene3DCanvas__genViewMatrix(w, h)¶ Generate and return a transformation matrix to be used as the model-view matrix. This includes applying the current
zoom,rotationandoffsetsettings, and configuring the camera. This method is called by__setViewport().- Parameters
w – Canvas width in pixels
h – Canvas height in pixels
-
_Scene3DCanvas__highDpiChanged(*a)¶ Called when the
Scene3DCanvasOpts.highDpiproperty changes. Calls theGLCanvasTarget.EnableHighDPI()method.
-
_Scene3DCanvas__overlayListChanged(*a)¶ Called when the
OverlayListchanges. Destroys/createsGLObjectinstances as necessary.
-
_Scene3DCanvas__overlayTypeChanged(value, valid, display, name)¶
-
_Scene3DCanvas__registerOverlay(overlay)¶
-
_Scene3DCanvas__setViewport()¶ Called by
_draw(). Configures the viewport and calculates the model-view trasformation matrix.- Returns
Trueif the viewport was successfully configured,Falseotherwise.
-
__dict__= mappingproxy({'__module__': 'fsleyes.gl.scene3dcanvas', '__init__': <function Scene3DCanvas.__init__>, 'destroy': <function Scene3DCanvas.destroy>, 'destroyed': <property object>, 'opts': <property object>, 'resetLightPos': <property object>, 'defaultLightPos': <function Scene3DCanvas.defaultLightPos>, 'viewMatrix': <property object>, 'viewScale': <property object>, 'viewOffset': <property object>, 'viewRotation': <property object>, 'viewCamera': <property object>, 'projectionMatrix': <property object>, 'invViewProjectionMatrix': <property object>, 'viewport': <property object>, 'canvasToWorld': <function Scene3DCanvas.canvasToWorld>, 'getGLObject': <function Scene3DCanvas.getGLObject>, 'getGLObjects': <function Scene3DCanvas.getGLObjects>, '_initGL': <function Scene3DCanvas._initGL>, '_Scene3DCanvas__overlayListChanged': <function Scene3DCanvas.__overlayListChanged>, '_Scene3DCanvas__highDpiChanged': <function Scene3DCanvas.__highDpiChanged>, '_Scene3DCanvas__displayBoundsChanged': <function Scene3DCanvas.__displayBoundsChanged>, '_Scene3DCanvas__registerOverlay': <function Scene3DCanvas.__registerOverlay>, '_Scene3DCanvas__deregisterOverlay': <function Scene3DCanvas.__deregisterOverlay>, '_Scene3DCanvas__genGLObject': <function Scene3DCanvas.__genGLObject>, '_Scene3DCanvas__overlayTypeChanged': <function Scene3DCanvas.__overlayTypeChanged>, '_Scene3DCanvas__genViewMatrix': <function Scene3DCanvas.__genViewMatrix>, '_Scene3DCanvas__setViewport': <function Scene3DCanvas.__setViewport>, '_draw': <function Scene3DCanvas._draw>, '_Scene3DCanvas__drawCursor': <function Scene3DCanvas.__drawCursor>, '_Scene3DCanvas__drawLegend': <function Scene3DCanvas.__drawLegend>, '_Scene3DCanvas__drawLight': <function Scene3DCanvas.__drawLight>, '_Scene3DCanvas__drawBoundingBox': <function Scene3DCanvas.__drawBoundingBox>, '__dict__': <attribute '__dict__' of 'Scene3DCanvas' objects>, '__weakref__': <attribute '__weakref__' of 'Scene3DCanvas' objects>, '__doc__': None})¶
-
__module__= 'fsleyes.gl.scene3dcanvas'¶
-
__weakref__¶ list of weak references to the object (if defined)
-