Up | CentralPluginPage | CustomPage | DataInput | ImageView | Indicatorpanel | Resultpanel | Release Notes

Release Notes


The ImageView module gives access to the image view

The ImageView class
  • GetImageView()
Attribute Access Type Description
pageControl R PageControl the internal pagecontrol  in multi image configurations
mode R int 0=Normal,
count R int no of images

Method Returns Description
getCustomPanel(name) CustomPanel returns the named custom panel (derived from the Panel class)
getImageViewer(name) CustomViewer returns the named viewer for an image, 2D or 3D viewer (see below)
get(index) OverlayImageView returns OverlayImageView by index (0 indexed)
getView(name) OverlayImageView returns OverlayImageView by name
showImages(visible) bool shows or hides all single images in multi image configurations
showOverlays(visible) bool shows or hides overlay graphics

The CustomPanel class
Attribute Access Type Description
mode R/W int 0=Disabled,

The OverlayImageView class
Attribute Access Type Description
name R string name of image
handle R int return HWND for the image(bitmap) window as integer
reference R/W string name of reference
showOverlays R/W bool flag for overlay graphics visibility
menuOptions R/W int binary representation of items available in popup menu.
zoomRect R/W tuple zoomRect is a tuple of (x1,y1),(x2,y2) where the first point is the upper left corner, the second the lower right point. All values in pixel coordinates
zoomCenter R/W tuple zoomRect center as tuple (x,y), x and y in pixel coordinates
zoomSize R/W typle zoomRect size as tuple (dx,dy), dx and dy in pixel coordinates
zoomLock W bool locks zoom at current zoomlevel, ie. the user is not able tu unzoom belove current level. The user may zoom up and down to current level
image R Bitmap returns the current image class

Method Returns Description
zoomAt(center,size) bool zoom at center with given size, senter and size in pixel coordinates
unzoom() bool unzoom all
copy(graphics=False) bool copies shown image to clipboard, with or without graphic overlays. If graphics is False, the size of the copied image will be due to the numbers of image pixels shown in x and y direction. If graphics is True, the image size will be due to the numbers of screen pixels the image occupies on screen.

Note! when copying with graphics, the whole view area of the image has to be visible, no overlapping windows.
save(filename, graphics=False) bool saves shown image to given filename, see the copy command for parameters

The Custom3DViewer class

The Custom3DViewer class is the 3D viewer in the ImageView.

Attribute Access Type Description
centerX R/W float 3D view center x position
centerY R/W float 3D view center y position
centerZ R/W float 3D view center z position
focalLength R/W float 3D view focal length
radius R/W float 3D view readies
alpha R/W float 3D view alpha
beta R/W float 3D view beta
lineColor R/W string default polygon line color
pointColor R/W string default point color
textColor R/W string default text color
sphereColor R/W string default sphere color
planeColor R/W string default plane color
boxColor R/W string default box color

Method Returns Description
addPoints(pnts,col=pointColor) bool adds points, see below for dataformats (*)
addpolygon(pnts,closed=1,tag='',col=lineColor) bool adds a open or closed polygon, see below for dataformats (*)
addLine(line,tag="",col=lineColor,vis=1 bool adds a line ((p.x,p.y,p.z),(v.x,v.y,v.z)), Scorpion standard 3D line definition
addText(pnt,txt,tag='',col=textColor,vis=1) GLSceneObject add text at given position, returns 3D overlayitem
addSphere(pos,tag='',col=sphereColor,vis=1) GLSceneObject add a sphere at given position, returns 3D overlayitem
addPlane(pos,size,tag='',col=planeColor,vis=1) GLSceneObject add a plane at given position, returns 3D overlayitem
addBox(pos,size,tag='',col=boxColor,vis=1) GLSceneObject add a box at given position, returns 3D overlayitem
addAxis(pos,size,rot=(0,0,0),tag='',vis=1) GLSceneObject add an referencesystem axis object
clear(name) bool clear all overlays for named object
delete(name) bool delete named object
deleteAll() bool deletes all data

* points may be given in various forms

  • tuples and lists, like ((x0,y0,z0),(x1,y1,z1),...,(xn,yn,zn)). Note that single points must be a valid tuple ((x,y,z),)
  • strings on the same form as tuple
  • arrlib object, created by arr.pyd Python extension dll (supported arr datatypes : XYZfVec, XYZfMatr)
  • pos = (x,y,z)
  • size = (dx,dy,dz)
The GLSceneObject class

The GLSceneObject is the 3D version of 2D OverlayItem class
Attribute Access Type Description
position R/W tuple (x,y,z) object position
rotation R/W tuple (rx,ry,rz) object rotation in degrees
direction R/W tuple (dx,dy,dz) object direction, each value of -1, 0 or 1
color R/W string object color

Example 1: Image Mode Changed System Eventhandler

def Handle_ImageView_ImageModeChanged(ImageMode):
# ImageMode = VT_BOOL
# This event is called when image mode changes
  p.visible=ImageMode                         #uses the derived visible property, overriding the mode property

Example 2: Page Changed System Eventhandler

def Handle_ImageView_PageChanged(Page):
# Page = VT_BSTR
# This event is called after active page changes
  if Page=='All' and iv.mode==0:

Example 3: Access Control Changed System Eventhandler

def Handle_System_AccessControlChanged(Settings,Service):
  # Settings = VT_BOOL
  # Service = VT_BOOL
  GetImageView().showImages(Service)  #shows all images when entering servicemode, hides all when leaving servidemode

Example 4: Toggle overlay graphic visibility

def ShowOverlays(Image,Visible):
  iv=GetImageView()             #get the image container
  if Image=='':
    iv.showOverlays(Visible)    #set all images
    v=iv.getView(Image)         #set named image
    if v<>None:

Example 5: Add 3D data to an 3D Image

def Points():
  if v<>None:
    v.deleteAll()  #clears all previous data
    import arr,math
    for i in range(71):
      for j in range(71):
    #add a line from center
    v.addPolygon(((0,0,0),(10,10,10)),0) #open polygon    
    #add some points
    v.addPoints(((0,0,10),(0,0,15))) #adds 2 points
    v.addPoints(((0,0,20),))         #adds 1 point, note the trailing comma

Example 6: Access an Image's CustomPanel

GetImageView().getCustomPanel('Image')  #shows all images when entering servicemode, hides all when leaving servidemode
# alternative method
# pc=GetPageControl('ImageView.pc')
# ts=pc.getPage('Image')
# cp=ts.getControl('CustomPanel')

Example 7: Draw axis labels

def DrawAxisLabels():
  """draw labels on 3D axis X,Y,Z, text direction due to 'Home'"""
  for i in range(-25,26,5):
    if i:

Scorpion Vision Version XII : Build 657 - Date: 20170719
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.