DBReadLine and DBWriteLine

Demonstrates how to read and write a line of imagery data.

Remarks

The following example illustrates how to mirror the first channel of a database across the horizontal axis.

Code

  local integer tfid, y_offset, float ptr buf1, float ptr buf2
  local string temp_file

  temp_file =  "./my.pix"
  Delete temp_file noerror
  Call CopyFile( GetPCIHOME() + "/demo/irvine.pix", \
                 temp_file)

  tfid = DBOpen( temp_file, "w" )

  buf2 = EAlloc( float, DBPixels(tfid))
  buf1 = EAlloc( float, DBPixels(tfid))

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

  call DBClose( tfid )

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