Up | Draw | Overlay | Tool | Toollist | Timer | SPB | Camera | CameraImage | Bitmap | Historylist - ImageBuffer | Clipboard | ScorpionGeometry | Statistics | Curve | States | Logging | Panels | Shared Memory | BarCode Reader | StdCtrls

Release Notes
 

  

 
Historylist - ImageBuffer
The ImageBuffer module is designed to provide access to the Scorpion History List. With the ImageBuffer class one can add measurement values to the state and comment of the list.

This module contains classes for accessing the historylist, the list of images for each inspection, and the individual images within the Imagelist.

The ImageBuffer class

Use the global python method GetImageBuffer() to retrieve an instance of the class to be able to work with the Scorpion HistoryList.

Attribute Access Type Description
name R string the internal name of the ImageBuffer
caption R/W string the Result
count R int number of images in buffer
currentIndex, index R/W int zero based index of current image
imageNo R int current image no
comment R/W string current comment
metadata R/W string current metadata
bufferSize R/W int max number of images before deleting oldest
memoryLimit R/W int low memory limit before deleting oldest from buffer

 

Method Returns Description
getImageNo(index) int returns imageNo with a zero based index - where 0 is newest image, count-1 is last and oldest
indexOf(imageNo) int zero based index of imageNo
getImages(imageNo) ImageList returns an instance of the ImageList class for the images given by imageNo
getState(imageNo) int returns state of given imageNo:
  • 0=None
  • 1=Empty
  • 2=OK
  • 3=Warning
  • 4=Error
  • 5=Unknown
getTime(imageNo) string time of images in format yyyymmdd_hhmmss
getComment(imageNo) string returns comment of given imageNo
setComment(imageNo,value) None sets comment of given imageNo
getName(imageNo,index) string returns sourcename of specified index of imageNo. In normal mode this is the name of the camera, in simulation mode this is the name of imagefile 
save() bool saves current image
saveAll() bool saves all images
clear() bool clears all history

The ImageList class

This class is returned from the method ImageBuffer.getImages(imageNo) or the function GetImages('',imageNo)

Attribute Access Type Description
count R int number of bitmaps in image
comment R/W string comment of image
metadata R/W string user defined metadata to image set
state R/W string state of image - see ImageBuffer.getState method
path R/W string path of default image folder

 

Method Returns Description
getImage(index) Image returns an instance of the Image class given by index. The index is zero based.
save(filename) bool save all images. If filename is given without path, images are saved at HistoryList's configured image folder.

The Image class

This class is returned from the method ImageList.getImage(index) or the function GetImage('',imageNo,index)

Attribute Access Type Description
name R string sourcename of image, normally the cameraname - returns the filename in simulation mode
width R int width of image in pixels
height R int height of image in pixels
handle R int The windows HBITMAP handle. Valid in the Scorpion process only.
pixelFormat R int
  • 0=Device
  • 1=1bit
  • 2=4bit
  • 3=8bit
  • 4=15bit
  • 5=16bit
  • 6=24bit
  • 7=32bit
  • 8=Custom

Method Returns Description
save(filename) bool save image at given filename

Example 1: Handle_HistoryList_New

def Handle_HistoryList_New(ImageNo,Comment):
#
# ImageNo = VT_INT
# Comment = VT_BSTR
#
# Return modified or unmodified comment
#
  ib=GetImageBuffer()
  print ImageNo, Comment, ib
  if ib<>None:
    imgs=ib.getImages(int(ImageNo))  #note the int(ImageNo) to convert to integer
    print 'imgs',imgs
    if imgs<>None:
      print 'cnt',imgs.count
      img=imgs.getImage(0)
      print 'img',img
      if img<>None:
        print 'name',img.name
        print 'width',img.width
        print 'height',img.height

  return Comment 

Example 2: Modifying the HistoryList Comment

def Handle_HistoryList_New(ImageNo,Comment):
#
# ImageNo = VT_INT
# Comment = VT_BSTR
#
# Return modified or unmodified comment
#
  print ' New image ',ImageNo
  str0 = '%.f ' % (counter) 
  SetValue('CurrentStr.Text',str0)
  return str0
def Handle_HistoryList_SelectionChange(ImageNo,Comment):
#
# ImageNo = VT_INT
# Comment = VT_BSTR
#
# Return modified or unmodified comment

  print ' history list selection change '
  commentList = Comment.split(' - ')
  SetValue('CurrentStr.Text',commentList[0])
  return commentList[0]
def Handle_HistoryList_Update(ImageNo,Comment):
#
# ImageNo = VT_INT
# Comment = VT_BSTR
#
# Return modified or unmodified comment
#
  running = GetValue('System.Running')
  str0 = '%.f - ' % (counter)
  if not running :
    str0 = GetValue('CurrentStr.Text') + ' - '
    return str0 + Comment
 

Scorpion Vision Version XII : Build 726 - Date: 20181012
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2018 Tordivel AS.