IHR

Read database image header


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Examples :: Related

Back to top

Description


IHR extracts data from a PCIDSK file header and georeferencing layer, and writes the data values to the output parameter(s).
Back to top

Parameters


ihr(file, imstat)

Name Type Caption Length Value range
FILE * str Input file name 1 -    
IMSTAT List[float] Image Statistics 0 - 15  

* Required parameter
Back to top

Parameter descriptions

FILE

Specifies the name of the PCIDSK image file from which header and georeferencing data are to be extracted.

IMSTAT

Header and georeferencing data extracted from the database file are saved in the IMSTAT output parameter for use by other algorithms. After IHR has completed running, IMSTAT contains the following values:
Back to top

Details

IHR reads header and georeferencing data from the specified input file (FILI), and saves the retrieved data to the IMSTAT parameter.

Back to top

Examples

Get database header and georeferencing data from the demo database file irvine.pix, and print the values.

from pci.ihr import ihr

file='irvine.pix'
imstat=[]

ihr( file, imstat )

print(imstat)
IMSTAT  - Image Statistics  >     512      512       10        9
                                    1        0        0       32
                                   30       30        1   428720
                              3734400   444080  3719040

The code shown below calculates the georeferenced location of the center of a specified database position (X,Y). Scaling factors (XSCALE,YSCALE) are calculated, given georeferenced locations of the upper-left and lower-right corners of the database, and the number of pixels and lines on the database.

from pci.ihr import ihr

def get_location(file_, x, y):
    imstat=[]
    ihr( file_, imstat )
    xscale=(imstat[13]-imstat[11]) / imstat[0]
    yscale=(imstat[13]-imstat[11]) / imstat[1]

    print('Georeferenced X position  = ' + imstat[11]+xscale*(x-0.5))
    print('Georeferenced Y position  = ' + imstat[12]+yscale*(y-0.5))
Note: When georeferencing units are UTM or METER, the pixel size (IMSTAT(9),IMSTAT(10)) equals the absolute value of the scaling factors (XSCALE,YSCALE).

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