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

Release Notes

  

ImageView
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,
1=ImageMode
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,
1=ImageModeOnly,
2=NormalMode,
3=Always

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.
Clipboard=1,Measure=2,Copy=4,CopyGraphic=8,Paste=16,Load=32,Save=64,SaveGraphic=128,Details=256,Reference=512,Info=1024,Help=2048
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

The Custom3DViewer class
Method Returns Description
deleteAll() bool clears all data in view
addpolygon(pnts,closed) bool adds a open or closed polygon, see below for dataformats (*)
addPoints(pnts) bool adds points, see below for dataformats (*)
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

* points may be given in various forms

  • tuples ((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)
The Custom3DViewer class
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

Example 1: Image Mode Changed System Eventhandler

def Handle_ImageView_ImageModeChanged(ImageMode):
#
# ImageMode = VT_BOOL
#
# This event is called when image mode changes
#
  iv=GetImageView()
  pc=iv.pageControl
  p=iv.getCustomPanel(pc.activePage)
  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
#
  iv=GetImageView()
  p=iv.getCustomPanel(Page)
  if Page=='All' and iv.mode==0:
    p.mode=0
  else:
    p.mode=1

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
  else:
    v=iv.getView(Image)         #set named image
    if v<>None:
      v.showOverlay=Visible

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

def Points():
  v=GetImageView().getImageViewer('3D')
  if v<>None:
    v.deleteAll()  #clears all previous data
    import arr,math
    m=arr.XYZfMat(71,71)
    for i in range(71):
      for j in range(71):
        l=i*71+j
        ii=i-35
        jj=j-35
        m[l]=ii/10.0,jj/10.0,7.0*math.exp((-ii*ii-jj*jj)/70.0)
    v.addPoints(m)
    
    #add a line from center
    v.lineColor='red'
    v.addPolygon(((0,0,0),(10,10,10)),0) #open polygon
    
    #add some points
    v.pointColor='blue'
    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') 

Scorpion Vision Software Version: 9.2.0.515 - Date: 20120502
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2012 Tordivel AS.