LINTRN

Linear transformation of image channels


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

Back to top

Description


Applies a linear transformation (or its inverse) defined in a transformation parameters file to a set of image channels.
Back to top

Parameters


lintrn(fili, filo, fillt, trandir)

Name Type Caption Length Value range
FILI* str Input file name 1 -    
FILO* str Output file name 1 -    
FILLT* str Linear transformation parameters file 1 -    
TRANDIR str Transformation direction 0 - 3 FOR | INV
Default: FOR

* Required parameter
Back to top

Parameter descriptions

FILI

Specifies the name of the image file containing the channels to be linearly transformed.

FILO

Specifies the name of the image file to receive the linearly transformed channels.

FILLT

Specified the name of the MATLAB binary save/load format file that contains the parameters of the linear transformation.

The file contains the following parameters:

TRANDIR

Specifies the direction of the linear transformation.

Supported values are:
Back to top

Details

LINTRN applies a linear transformation, plus an optional 'shift' to a list of channels from the input image file, and writes the transformation results to the output image file as one or more channels. The list of channels and the transformation parameters are read from the specified linear transformations parameter file (FILLT).

Each pixel (X,Y) location coincides with an input vector to be transformed, where the first component of the vector is the image value in the first listed channel at that location, the second component of the vector is the image value in the second listed channel at that location, and so on. The vector produced by the transformation is written to the output image at the same pixel location from which the input vector was drawn.

Forward Transformation

The forward linear transformation results are written to 32-bit-per-pixel floating point channels in an output PCIDSK file. If the specified output file does not already exist, it is created.

If the forward transformation matrix has N columns, the input vectors must have N components, and the channel number vector (read from the linear transformation parameters file) will have N components. Each component of the channel number vector must be the number of a channel in the input data set. Component i of the channel number vector is the number of the channel from which component i of the input vectors is read.

If the linear transformation parameter file contains a 'shift' vector, that vector is subtracted from the input vectors before they are linearly transformed. This supports those transformations that require a mean vector to be subtracted from the input vectors before they are pre-multiplied by the transformation matrix.

If the forward transformation matrix has M rows, the output vectors will have M components. If the output PCIDSK file does not exist, one is created with M pixel-interleaved floating point (32R) channels and with the same X and Y dimensions as the input image. If the output file does exist, it must contain at least M channels (not necessarily floating point valued) with the same X and Y dimensions as the input data set. The transformed image data are written to the first M channels of the output file vector component index order.

Inverse Transformation

The input is read from channels in a PCIDSK file. The inverse linear transformation results are written to channels of an existing image file containing explicit-format (that is, not vector-quantized) image data.

If the inverse transformation matrix has N columns, the input vectors must have N components. The input vectors are read from the first N channels of the input image file.

If the inverse transformation matrix has M rows, the output vectors will have M components. The channel number vector (read from the linear transformation parameters file) has M components. Each component of the channel number vector must be the number of an channel existing in the output file. Component i of the output vectors will be written to the channel whose number is in component i of the channel number vector.

If the linear transformation parameters file contains a 'shift' vector, that vector is added to the output vectors before they are written to the output file.

Back to top

Examples

This example demonstrates noise-reduction for channels 108 to 112 of the file 'cuprad.pix'. The application of LINTRN is part of this process.

Compute the maximum/minimum autocorrelation factors (MAF) linear transformation for channels 108 to 112 of 'cuprad.pix':

from pci.mnflt import mnflt

fili	=	"cuprad.pix"
fillt	=	"cuprad_mnflt.mat"
dbic	=	list(range(108, 112 + 1))
wlenint	=	[]	# default to no wavelength interval restriction
valonly	=	''	# default to no band validity restriction
sampint	=	[]	# default to no subsampling
noissrc	=	"MAF"	# max/min autocorrelation factors
mafdel	=	[]	# delta=(1,1) by default

mnflt( fili, fillt, dbic, wlenint, valonly, sampint, noissrc, mafdel)

Generate the forward transformed bands.

The replacement channels are the noise-reduced version of the orginal channels 108 to 112.

from pci.lintrn import lintrn

fili	=	"cuprad.pix"
filo	=	"cuprad_for.pix"
fillt	=	"cuprad_mnflt.mat"
trandir	=	"for"

lintrn( fili, filo, fillt, trandir )

Apply a 5-by-5 averaging filter to the forward transformed channels that are dominated by noise (the first 4 out of the 5 channels).

from pci.fav import fav

file	=	"cuprad_for.pix"
dbic	=	[1]
dboc	=	[1]
flsz	=	[5,5]

fav( file, dbic, dboc, flsz )

file	=	"cuprad_for.pix"
dbic	=	[2]
dboc	=	[2]
flsz	=	[5,5]

fav( file, dbic, dboc, flsz )

file	=	"cuprad_for.pix"
dbic	=	[3]
dboc	=	[3]
flsz	=	[5,5]

fav( file, dbic, dboc, flsz )

file	=	"cuprad_for.pix"
dbic	=	[4]
dboc	=	[4]
flsz	=	[5,5]

fav( file, dbic, dboc, flsz )
				

Apply the inverse of the MNFLT transformation to the altered forward transformation results, and replace channels 108 to 112 in a copy of 'cuprad.pix' named 'cuprad_inv.pix' with the inverse transformation results.

from pci.lintrn import *

fili	=	"cuprad_for.pix"
filo	=	"cuprad_inv.pix"
fillt	=	"cuprad_mnflt.mat"
trandir	=	"inv"

lintrn( fili, filo, fillt, trandir )

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