Eidolon
|
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) |
![]() | |
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 | |
![]() | |
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) |
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().
def __init__ | ( | self, | |
mgr, | |||
camera, | |||
indicatorCol = color(1,1,1,0.25) , |
|||
parent = None |
|||
) |
|
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.
|
private |
Returns the transform from plane-relative coordinates to world coordinates.
|
private |
|
private |
|
private |
Updates the figures containing mesh slice data for each secondary mesh object.
|
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.
def addHandle | ( | self, | |
handle | |||
) |
Add the handle to the view and to self.handles.
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.
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.
def createMaterial | ( | self, | |
name, | |||
useLighting = False , |
|||
useVertexColor = True |
|||
) |
Helper method for creating a blank material which bypasses the UI.
def createTexture | ( | self, | |
name, | |||
width, | |||
height, | |||
format | |||
) |
Helper method for creating a texture which bypasses the UI.
def deselectHandles | ( | self | ) |
Deselect all handles.
def fillImage | ( | self, | |
img | |||
) |
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.
def getHandle | ( | self, | |
index | |||
) |
Return handle at position `index' in the list of handles.
def getImagePosition | ( | self, | |
x, | |||
y | |||
) |
def getImageStackMax | ( | self | ) |
Get the maximum stack index. This must be overridden to define the max value as something other than 0.
def getImageStackPosition | ( | self | ) |
Get the index in the image stack of the source object. This must be overridden to set the stack position.
def getImageXiPosition | ( | self | ) |
Get the xi value on the unit interval representing Z position within the stack the current view represents.
def getObjectNames | ( | self | ) |
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.
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).
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).
def getScreenPosition | ( | self, | |
pos | |||
) |
Returns the screen coordinate of the world vector `pos'.
def getSecondaryNames | ( | self | ) |
Get the names of secondary viewable objects. This must be overridden to return something other than [].
def getSelectedHandle | ( | self | ) |
Returns the selected handle, None otherwise.
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).
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.
def isStdPlaneName | ( | self, | |
name | |||
) |
Returns True if `name' is the name of a standard plane (ie. XY, YZ, XZ).
def mouseDrag | ( | self, | |
e, | |||
dx, | |||
dy | |||
) |
def mousePress | ( | self, | |
e | |||
) |
def mouseRelease | ( | self, | |
e | |||
) |
def parentClosed | ( | self, | |
e | |||
) |
def removeHandle | ( | self, | |
index | |||
) |
Remove the handle at position `index' in self.handles to the view.
def removeHandles | ( | self | ) |
Remove all handles from the view.
def retainObjFigures | ( | self, | |
names | |||
) |
Keep only the figures for those objects named in the iterable `names.
def selectHandleScreenCoord | ( | self, | |
x, | |||
y | |||
) |
Select a handle based on the screen coordinate (`x',`y'). Returns the handle is selected, None otherwise.
def setFigsVisible | ( | self, | |
name, | |||
vis | |||
) |
Set the visibility of the figures to `vis' for object named by `name'.
def setFigTransforms | ( | self | ) |
Set the transforms for all figures to fit them in the viewing area and translate/scale as inputed by user.
def setIndicatorVisible | ( | self, | |
visible | |||
) |
Set whether the 3D plane indicator is visible or not.
def setObjPlane | ( | self, | |
name, | |||
planetrans | |||
) |
Set the view plane for the object named by `name' in self.objFigMap, retaining the figure list.
def setPlaneIndicator | ( | self, | |
obj, | |||
planetrans | |||
) |
Set the plane indicator in the 3D view for object `obj' to be at transform `planetrans'.
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.
camera |
|
static |
handles |
indicatorCol |
indicatorMaterial |
indicatorPlane |
indicatorTrans |
indicatorVisible |
linewidth |
mgr |
objFigMap |
planeName |
planeShift |
sceneBB |
scroll |
slicewidth |
sourceName |
|
static |
viewplane |
zoom |