ProgressCounter

Demonstrates how to update the progress counter in a loop.

Remarks

The following example mirrors the first channel of a database across the horizontal axis, and illustrate how to make use of ProgressCounter() calls.

Note the type of progress reporting performed depends on the value of the parameter MONITOR at the time EASI was invoked. If MONITOR="ON" a textual progress counter is printed to the terminal, if MONITOR="NET" the progress is sent over the network, otherwise if MONITOR="OFF" no progress reporting is performed.

Code

  local integer tfid, y_offset
  local float ptr buf1, float ptr buf2
  local integer stp, integer ysize
  local float fraction 
  local string temp_file

  try
    temp_file = "./my.pix"
    delete temp_file noerror
    call CopyFile( GetPCIHOME() + "/demo/irvine.pix", \
                 temp_file)

    tfid = DBOpen(temp_file, "r+")
    buf2 = EAlloc( float, DBPixels(tfid))
    buf1 = EAlloc( float, DBPixels(tfid))

    ysize = DBLines(tfid)
    for y_offset = 0 to ysize/2 - 1
        call DBReadLine( tfid, 1, y_offset, 0, DBPixels(tfid), buf1 )
        call DBReadLine( tfid, 1, ysize-y_offset-1, \
                         0, DBPixels(tfid), buf2 )
        call DBWriteLine( tfid, 1, ysize-y_offset-1, \
                          0, DBPixels(tfid), buf1 )
        call DBWriteLine( tfid, 1, y_offset, 0, DBPixels(tfid), buf2 )

        fraction = y_offset * 2
        fraction = fraction / ysize
        stp = ProgressCounter(fraction, "Inverting image")
    endfor

    stp = ProgressCounter( 2.0, "Done" )
    call DBClose( tfid )
  onerror
   print "Error: "+ GetLastErrorMessage()
  endonerror

Output

Sample output:

(EASI      0%) - Inverting image
(EASI      1%) - Inverting image
(EASI      2%) - Inverting image
(EASI      3%) - Inverting image
(EASI      4%) - Inverting image
(EASI      5%) - Inverting image
(EASI      6%) - Inverting image

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.