ROT

Channel and GCP rotation


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

Back to top

Description


Rotates rectangular image data in image channels between two image files or within one file. Optionally, a ground control point (GCP) segment may be rotated along with the image.
Back to top

Parameters


rot(fili, filo, dbic, dboc, dbgc, dbiw, angle, rcentre, resample, memsize)

Name Type Caption Length Value range
FILI * str Input file name 1 -    
FILO * str Output file name 1 -    
DBIC List[int] Input raster channels 0 -    
DBOC List[int] Output raster channels 0 -    
DBGC List[int] Input GCP segment 0 - 1  
DBIW List[int] Raster input window 0 - 4 Xoffset, Yoffset, Xsize, Ysize
ANGLE List[float] Rotation angle 0 - 1 0 - 360
Default: 90
RCENTRE List[float] center of rotation 0 - 2  
RESAMPLE str Resampling method 0 - 5 See Details
Default: NEAR
MEMSIZE List[int] Working memory size (MB) 0 - 1 1 - 2000
Default: 64

* Required parameter
Back to top

Parameter descriptions

FILI

Specifies the name of the PCIDSK file that contain data to be rotated.

FILO

Specifies the name of the PCIDSK file to receive the rotated image data.

The output file can be the same as the input file. If FILO specifies a file that does not exist, ROT automatically creates a file that will fit the rotated image. FILO must be an existing file when rotating GCPs.

DBIC

Optionally specifies the input channels to be rotated.

If this parameter is not specified, no input channels are rotated. Duplicate channels are NOT allowed.

If the output file does not exist, this parameter must be specified in ascending order.

DBOC

Optionally specifies output channels to receive the rotated images.

Duplicate channels are NOT allowed.

If the output file is the same as the input file and the rotation angle (ANGLE) is 180 degrees, the output channels (DBOC) can be the same as the input channels (DBIC).

If the output file is the same as the input file and the rotation angle (ANGLE) is NOT 180 degrees, the output channels (DBOC) cannot be the same as the input channels (DBIC).

If the specified output file does not exist, this parameter will be ignored and ROT will create the channels automatically.

DBGC

Optionally specifies the GCP segment to be rotated along with the input image.

If this parameter is specified, a new GCP segment will be created in the output file. If it is not specified, no GCP segments are rotated.

Only the image coordinates inside the GCP segment will be rotated.

DBIW

Optionally specifies a rectangular window (Xoffset, Yoffset, Xsize, Ysize) to be read from the input image. If this parameter is not specified, the entire image is processed by default.

Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.

ANGLE

Specifies the clockwise angle of rotation, in degrees.

RCENTRE

Optionally specifies the center of rotation, in pixel and line coordinates. If this parameter is not specified, it defaults to the center of the input image.

RESAMPLE

Specifies the resampling method to use to determine the ouput pixel values.

Supported values are:

MEMSIZE

Specifies the amount, in megabytes, of internal memory allocated to ROT.

The default is 64 MB; a typical amount of memory to allocate is approximately half of the system memory available per processing thread.

Back to top

Details

ROT rotates the specified rectangular image channels (DBIC) and optionally a GCP segment (DBGC) in the input file by a user-defined angle (ANGLE), or simply rotates a GCP segment from the input file to the output file. For image rotation, the result is saved in the specified output image channels (DBOC) in the output file. If the output file is not specified, it defaults to the input file. If the output file is specified but does not exist, ROT automatically creates an output file that fits the rotated image.

The rotation can be restricted within a specified window (DBIW), if desired. By default, the entire image is rotated.

This function requires a minimum of 64MB of internal memory.

You can specify the center of rotation (RCENTRE) in pixel and line coordinates. By default, the center of rotation is the center of the input image.

The RESAMPLE (Resampling Method) parameter specifies the resampling method used during rotation.

Note: If a GCP segment is to be rotated as well, the DBIW parameter should be defaulted to the entire image. Only the image coordinates in the GCP segment are rotated.

If the rotation angle is 180 degrees and the center of rotation (RCENTRE) is not specified, it will be treated as a special case and ROT will run much faster.

Back to top

Examples

Rotate channel 1 of the demo file "irvine.pix" by 45 degrees and save the result in channel 7.

from pci.rot import rot

fili	=	"irvine.pix"	# input file
filo	=	"irvine.pix"	# update the input file
dbic	=	[1]	# channels to rotate
dboc	=	[7]	# output channel
dbgc	=	[]	# no GCP segment
dbiw	=	[]	# process entire image
angle	=	[45]	# rotation angle
rcentre	=	[]	# use center of image
resample	=	"CUBIC"	# cubic convolution
memsize	=	[]	# use default 64MB

rot( fili, filo, dbic, dboc, dbgc, dbiw, angle, rcentre, resample, memsize )

The user has a 400x200 file "file1.pix" and wants to rotate channel 1 of the file by 90 degrees. The result is to be saved in channel 1 of a 200x400 file "file2.pix".

from pci.rot import rot

fili	=	"file1.pix"
filo	=	"file2.pix"
dbic	=	[1]	# channel to rotate
dboc	=	[1]	# output channel
dbgc	=	[]	# no GCP segment
dbiw	=	[]	# process entire image
angle	=	[90]	# rotation angle
rcentre	=	[]	# use center of image
resample	=	"CUBIC"	# cubic convolution
memsize	=	[]	# use default 64MB

rot( fili, filo, dbic, dboc, dbgc, dbiw, angle, rcentre, resample,memsize )
	

The user has a 400x200 file "file1.pix" and wants to rotate channels 1 and 2 of the file by 45 degrees. The result is to be saved in channels 1 and 2 of a file "file2.pix", which does not exist.

from pci.rot import rot

fili	=	"file1.pix"
filo	=	"file2.pix"	# file to be created automatically
dbic	=	[1,2]	# channels to rotate
dboc	=	[1,2]	# output channels
dbgc	=	[2]	# rotate GCP segment 2
dbiw	=	[]	# process entire image
angle	=	[45]	# rotation angle
rcentre	=	[]	# use center of image
resample	=	"CUBIC"	# cubic convolution
memsize	=	[]	# use default 64MB

rot( fili, filo, dbic, dboc, dbgc, dbiw, angle, rcentre, resample, memsize )
	

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