Eidolon
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
BaseCamera2DWidget Class Reference
Inheritance diagram for BaseCamera2DWidget:
Inheritance graph
Collaboration diagram for BaseCamera2DWidget:
Collaboration graph

Public Member Functions

def __init__ (self, mgr, camera, indicatorCol=color(1, 1, 1, 0.25), parent=None)
 
def getImageStackPosition (self)
 
def getImageStackMax (self)
 
def getSecondaryNames (self)
 
def getObjectNames (self)
 
def getImageXiPosition (self)
 
def mousePress (self, e)
 
def mouseDrag (self, e, dx, dy)
 
def mouseRelease (self, e)
 
def parentClosed (self, e)
 
def fillImage (self, img)
 
def isStdPlaneName (self, name)
 
def calculateViewPlane (self, reptrans, planename=None, imgxi=0)
 
def createFigure (self, name, ftype=FT_TRILIST, is2DOnly=True)
 
def createMaterial (self, name, useLighting=False, useVertexColor=True)
 
def createTexture (self, name, width, height, format)
 
def addHandle (self, handle)
 
def removeHandle (self, index)
 
def removeHandles (self)
 
def getHandle (self, index)
 
def getSelectedHandle (self)
 
def selectHandleScreenCoord (self, x, y)
 
def deselectHandles (self)
 
def handleSelected (self, handle)
 
def getObjFigures (self, name, numfigs=1, ftype=FT_TRILIST)
 
def retainObjFigures (self, names)
 
def setObjPlane (self, name, planetrans)
 
def setFigsVisible (self, name, vis)
 
def setPlaneIndicator (self, obj, planetrans)
 
def setIndicatorVisible (self, visible)
 
def getBBTransform (self)
 
def getWorldPosition (self, x, y, isAbsolute=True)
 
def getScreenPosition (self, pos)
 
def getOrthoPosition (self, pos)
 
def getScreenOrthoPosition (self, x, y, isAbsolute=True)
 
def getImagePosition (self, x, y)
 
def setFigTransforms (self)
 
def updateView (self)
 
- Public Member Functions inherited from Base2DWidget
def __init__ (self, parent=None)
 
def modifyDrawWidget (self, drawWidget)
 
def updateView (self)
 
def fillImage (self, img)
 
def mousePress (self, e)
 
def mouseRelease (self, e)
 
def mouseDrag (self, e, dx, dy)
 
def mouseWheelMove (self, e)
 
def mouseDoubleClick (self, e)
 
def keyPress (self, e)
 
def keyRelease (self, e)
 
def parentClosed (self, e)
 
def getDrawDims (self)
 
def getBoxFitScale (self, w, h)
 

Public Attributes

 mgr
 
 camera
 
 sourceName
 
 planeName
 
 scroll
 
 zoom
 
 viewplane
 
 objFigMap
 
 handles
 
 slicewidth
 
 linewidth
 
 planeShift
 
 sceneBB
 
 indicatorCol
 
 indicatorMaterial
 
 indicatorTrans
 
 indicatorPlane
 
 indicatorVisible
 
- Public Attributes inherited from Base2DWidget
 imgFormat
 
 img
 
 prevX
 
 prevY
 

Static Public Attributes

tuple defaultQuad
 
tuple standardPlanes = ('XY','XZ','YZ')
 

Private Member Functions

def _repaintDelay (self)
 
def _repaint3DDelay (self)
 
def _planeToWorldTransform (self)
 
def _imagePlaneMesh (self, rep, planetrans, stackpos, centerInView=False)
 
def _updatePlaneFig (self, fig, rep, planetrans, stackpos=0)
 
def _updateMeshPlanecutFigs (self, repfigspairs, planetrans)
 

Detailed Description

This is the base class for all 2D drawing widgets using a camera from the renderer. It handles the update cycle of
the camera rendering to a stream which is then fed into the image object for the widget. It provides createFigure()
which will create Figure objects only visible to the internal camera. This class has no UI components and relies on
inheriting subtypes calling modifyDrawWidget() to perform the correct association between the widget to draw into
and the fillImage() method which updates the camera and copies its data over.

The UI notion of this widget is to view a single primary image representation object in 2D, which can be dragged and
zoomed. An image stack value allows scrolling in the through-plane direction if supported, this represents moving in
the through-plane direction of an image volume or between planes of an image stack. Secondary images and meshes can 
be rendered over top of this image, these are sliced at the plane in 3D space which 2D view is currently "viewing".

The following methods return default values and must be overridden in a subtype for this class to function:
getImageStackPosition(), getImageStackMax(), getSecondaryNames().

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  mgr,
  camera,
  indicatorCol = color(1,1,1,0.25),
  parent = None 
)

Member Function Documentation

◆ _imagePlaneMesh()

def _imagePlaneMesh (   self,
  rep,
  planetrans,
  stackpos,
  centerInView = False 
)
private
Returns the (nodes,indices,xis) mesh for the isoplane mesh defining the slice of of image representation `rep' 
at stack position `stackpos' or plane position `planetrans'. The nodes are in screen ortho coordinate space, 
adjusted to be within the viewing bound box if `centerInView' is True. 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _planeToWorldTransform()

def _planeToWorldTransform (   self)
private
Returns the transform from plane-relative coordinates to world coordinates.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _repaint3DDelay()

def _repaint3DDelay (   self)
private
Here is the caller graph for this function:

◆ _repaintDelay()

def _repaintDelay (   self)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _updateMeshPlanecutFigs()

def _updateMeshPlanecutFigs (   self,
  repfigspairs,
  planetrans 
)
private
Updates the figures containing mesh slice data for each secondary mesh object.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _updatePlaneFig()

def _updatePlaneFig (   self,
  fig,
  rep,
  planetrans,
  stackpos = 0 
)
private
Updates `fig' to contain mesh data for isoplane cut through `rep' at plane `planetrans' if `rep' is a volume,
otherwise at image stack position `stackpos'. Returns the bound box of the mesh.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addHandle()

def addHandle (   self,
  handle 
)
Add the handle to the view and to self.handles.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateViewPlane()

def calculateViewPlane (   self,
  reptrans,
  planename = None,
  imgxi = 0 
)
Return the transform object representing the plane in space named by `planename' or by `reptrans' alone if
this isn't provided. If `planename' names a representation object then its transform is used to define the
plane, specifically if its a ImageSceneObjectRepr then getDefinedTransform() is called to get this transform.
If `planename' is one of the standard plane names (XY, YZ, or XZ) then the transform is defined to represent
this plane at image xi value `imgxi' in the direction normal to the plane (ie. this is Z axis xi value for
plane XY). The `reptrans' transform represents the transformation from xi space to world of the object the
plane bisects, thus if the object is a volume this is the transformation from texture coordinates to world
coordinates. This used to transform the standard plane definitions to world coordinates, and to define the
resulting transform if `planename' names neither a representation object nor a standard plane. The return
value is a transform in world space with a (1,1,1) scale component.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createFigure()

def createFigure (   self,
  name,
  ftype = FT_TRILIST,
  is2DOnly = True 
)
Helper method for creating a figure with name `name' and type `ftype'. If `is2DOnly' is True then the returned
figure is visible to this widget's camera only, otherwise it's default behaviour is unchanged.
Here is the call graph for this function:

◆ createMaterial()

def createMaterial (   self,
  name,
  useLighting = False,
  useVertexColor = True 
)
Helper method for creating a blank material which bypasses the UI.
Here is the caller graph for this function:

◆ createTexture()

def createTexture (   self,
  name,
  width,
  height,
  format 
)
Helper method for creating a texture which bypasses the UI.
Here is the caller graph for this function:

◆ deselectHandles()

def deselectHandles (   self)
Deselect all handles.
Here is the caller graph for this function:

◆ fillImage()

def fillImage (   self,
  img 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBBTransform()

def getBBTransform (   self)
Returns the boundbox transform which adjusts the figures to fit inside the selected viewing area based on the 
scene bound box, scroll, and zoom parameters.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHandle()

def getHandle (   self,
  index 
)
Return handle at position `index' in the list of handles.

◆ getImagePosition()

def getImagePosition (   self,
  x,
  y 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getImageStackMax()

def getImageStackMax (   self)
Get the maximum stack index. This must be overridden to define the max value as something other than 0.
Here is the caller graph for this function:

◆ getImageStackPosition()

def getImageStackPosition (   self)
Get the index in the image stack of the source object. This must be overridden to set the stack position.
Here is the caller graph for this function:

◆ getImageXiPosition()

def getImageXiPosition (   self)
Get the xi value on the unit interval representing Z position within the stack the current view represents.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getObjectNames()

def getObjectNames (   self)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getObjFigures()

def getObjFigures (   self,
  name,
  numfigs = 1,
  ftype = FT_TRILIST 
)
Get the Figure objects for the object `name', or create `numfigs' objects of type `ftype' if none found.
Here is the caller graph for this function:

◆ getOrthoPosition()

def getOrthoPosition (   self,
  pos 
)
Returns the orthographic camera coordinate of the world vector `pos'. In orthographic coordinates, the screen
center is (0,0) and bottom-right is (1,1).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getScreenOrthoPosition()

def getScreenOrthoPosition (   self,
  x,
  y,
  isAbsolute = True 
)
Returns the screen orthographic coordinate from the screen coordinate (x,y).If `isAbsolute', (x,y) is an absolute 
coordinate, otherwise it is a screen proportionate coordinate (ie. (0,0) is top-left corner, (1,1) is bottom-right).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getScreenPosition()

def getScreenPosition (   self,
  pos 
)
Returns the screen coordinate of the world vector `pos'.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSecondaryNames()

def getSecondaryNames (   self)
Get the names of secondary viewable objects. This must be overridden to return something other than [].
Here is the caller graph for this function:

◆ getSelectedHandle()

def getSelectedHandle (   self)
Returns the selected handle, None otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getWorldPosition()

def getWorldPosition (   self,
  x,
  y,
  isAbsolute = True 
)
Returns the world position of the screen coordinate (x,y). If `isAbsolute', (x,y) is an absolute pixel coordinate,
otherwise it is a screen proportionate coordinate (ie. (0,0) is top-left corner of screen and (1,1) is bottom-right).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSelected()

def handleSelected (   self,
  handle 
)
Called when the given handle object is selected by mouse click. If this is not overridden, handles are never
activated but the view will otherwise function correctly. This method should be overridden to make a selected
handle active.
Here is the caller graph for this function:

◆ isStdPlaneName()

def isStdPlaneName (   self,
  name 
)
Returns True if `name' is the name of a standard plane (ie. XY, YZ, XZ).
Here is the caller graph for this function:

◆ mouseDrag()

def mouseDrag (   self,
  e,
  dx,
  dy 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mousePress()

def mousePress (   self,
  e 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mouseRelease()

def mouseRelease (   self,
  e 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parentClosed()

def parentClosed (   self,
  e 
)
Here is the call graph for this function:

◆ removeHandle()

def removeHandle (   self,
  index 
)
Remove the handle at position `index' in self.handles to the view.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeHandles()

def removeHandles (   self)
Remove all handles from the view.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retainObjFigures()

def retainObjFigures (   self,
  names 
)
Keep only the figures for those objects named in the iterable `names.
Here is the caller graph for this function:

◆ selectHandleScreenCoord()

def selectHandleScreenCoord (   self,
  x,
  y 
)
Select a handle based on the screen coordinate (`x',`y'). Returns the handle is selected, None otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFigsVisible()

def setFigsVisible (   self,
  name,
  vis 
)
Set the visibility of the figures to `vis' for object named by `name'.
Here is the caller graph for this function:

◆ setFigTransforms()

def setFigTransforms (   self)
Set the transforms for all figures to fit them in the viewing area and translate/scale as inputed by user.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setIndicatorVisible()

def setIndicatorVisible (   self,
  visible 
)
Set whether the 3D plane indicator is visible or not.
Here is the call graph for this function:

◆ setObjPlane()

def setObjPlane (   self,
  name,
  planetrans 
)
Set the view plane for the object named by `name' in self.objFigMap, retaining the figure list.
Here is the caller graph for this function:

◆ setPlaneIndicator()

def setPlaneIndicator (   self,
  obj,
  planetrans 
)
Set the plane indicator in the 3D view for object `obj' to be at transform `planetrans'.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateView()

def updateView (   self)
Update the visible data for the current view's position. This will update the quad for the main image, secondary
images, and refill the isoline meshes for the secondary meshes. The plane in world space the 2D view currently
shows will be set to self.viewplane. Handles will also be updated as necessary, and all figures will be transformed
to fit into the current viewing position. If this method is overridden, the override should call this one to
perform these operations after updating subtype-specific state, ie. as the last statement in the method.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ camera

camera

◆ defaultQuad

tuple defaultQuad
static
Initial value:
= (
(vec3(-0.5,0.5), vec3(0.5,0.5), vec3(-0.5,-0.5), vec3(0.5,-0.5)), # vertices
((0, 2, 1), (1, 2, 3)), # triangle indices
(vec3(0,0), vec3(1,0), vec3(0,1), vec3(1,1)) # xi values
)

◆ handles

handles

◆ indicatorCol

indicatorCol

◆ indicatorMaterial

indicatorMaterial

◆ indicatorPlane

indicatorPlane

◆ indicatorTrans

indicatorTrans

◆ indicatorVisible

indicatorVisible

◆ linewidth

linewidth

◆ mgr

mgr

◆ objFigMap

objFigMap

◆ planeName

planeName

◆ planeShift

planeShift

◆ sceneBB

sceneBB

◆ scroll

scroll

◆ slicewidth

slicewidth

◆ sourceName

sourceName

◆ standardPlanes

tuple standardPlanes = ('XY','XZ','YZ')
static

◆ viewplane

viewplane

◆ zoom

zoom

The documentation for this class was generated from the following file: