TPSINT

Thin Plate Spline interpolation


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Example :: Algorithm :: References :: Related

Back to top

Description


Generates a raster image by interpolating image values between specified pixel locations using a Radial Basis Interpolation Algorithm. This module implements the Thin Plate Spline scheme.
Back to top

Parameters


tpsint(fili, filo, dbvs, dboc, fldnme, pixres)

Name Type Caption Length Value range
FILI * str Input file name 1 -    
FILO str Output file name 0 -    
DBVS * List[int] Input vector segment 1 - 1  
DBOC List[int] Output raster channel 0 - 1  
FLDNME str Field name for elevation 0 - 64 Default: ATTRIBUTE
PIXRES List[float] Ouptut pixel resolution 0 - 2 0.0 -

* Required parameter
Back to top

Parameter descriptions

FILI

Specifies the name of the PCIDSK file that contains the vector segment in which the attribute value or the z-coordinate will be used as the basis for interpolation.

FILO

Specifies the name of the PCIDSK file to receive the generated raster channel. If this parameter is not specified, it is assumed to be the same as FILI. If the specified output file exists, its projection must be the same as that of the input file (FILI).

If FILO does not exist, a new PCIDSK file is created. By default, the projection information from FILI will be copied to the new output file.

DBVS

Specifies the vector segment in which the attribute value or the z-coordinate will be used as the basis for interpolation.

DBOC

Specifies the output channel to receive the interpolated image.

If the specified output file (FILO) already exists, DBOC must be specified.

FLDNME

Specifies the field name that contains the elevation values.

If this parameter is specified as ZCOORD, the actual z-coordinates of the vectors are used. Field names are not case-sensitive, and they do not need to be specified in complete form. If more than one match exists, the first name is used.

Supported values are:

The Field Name (FLDNME) parameter is required only for vector layers that contain 3-D points or contours. For 3-D lines and 3-D polygons the z-coordinates are automatically used. For 2-D layers, the elevation values are not specified.

The same name applies to all contour and 3-D point segments specified in the input vectors (DBVS) parameter. The segments that do not satisfy this requirement can be converted to the required format using ZVALTRNS.

If a field name other than ZCOORD is specified but is not found, this function attempts to use the z-coordinates of each vertex or point; this may, however, lead to unexpected results.

PIXRES

Specifies, in meters, the pixel resolution or size for the output file. By default, the pixel size is the same as the input file. The pixel size determines the number of pixels and lines in the output file. Decreasing the pixel size results in a larger output file and increased computation time.

Back to top

Details

TPSINT reads the gray-level values for an arbitrary number of pixel locations to generate a raster image based on the Thin Plate Spline method of interpolation between the specified gray levels.

The gray-level values are read from an input vector segment (DBVS).

This method is computationally expensive. The coefficients must be calculated by solving a system of equations. The number of equations is proportional to the size of the data set. After the coefficients are calculated, the interpolation is calculated. The complexity of this calculation is based on the number of data points related to each point to be interpolated. For example, for N data points on an MxM grid, approximately NxMxM calculations are required to calculate the interpolation.

This method is also memory demanding and a maximum limit of 4000 pixel locations has been set. This limit is further lowered depending on the amount of free memory available.

Back to top

Example

This example demonstrates the use of TPSINT in generating a raster layer from a vector layer.

from pci.tpsint import tpsint

fili	=	"irvine.pix"	# input file
filo	=	"oirvine.pix"	# output file
dbvs	=	[30]	# input vector segment
dboc	=	[1]	# output raster channel
fldnme	=	"ZCOORD"	# ZCOORD attribute
pixres	=	[30,30]	# output pixel resolution

tpsint( fili, filo, dbvs, dboc, fldnme, pixres )
Back to top

Algorithm

TPSINT implements the Thin Plate Spline radial basis function interpolation scheme. This interpolation scheme is defined by mathematical series (sum of terms).

In the Thin Plate Spline scheme, the interpolator is:

                                         N
                                         
      f(x, y) =  a + a x + a y  + 0.5 * SUM b  * sqr(R ) * log(R )
                  0   1     2                j        j         j
                                       j = 1

where:

     a , a , a , and b 
     0   1   2       j

are the coefficients defining the particular problem and

     R  
     j

is the distance between the point (X,Y) and the jth control point.

TPSINT determines the set of coefficients for the interpolator by solving a system of linear equations defined at a set of control points. The result is then substituted back into the interpolator and interpolation is computed at any point by summing the series. Further mathematical justifications on how these interpolators are derived and why they work can be found in the papers cited in References.

Back to top

References

"Theory And Applications Of The Multiquadric-Biharmonic Method", Vol. 19, No. 8/9 pp. 163-208, 1990

"Warping Digital Images Using Thin Plate Splines", in Pattern Recognition, Vol. 26, No. 2 pp. 375-376, 1993

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