Help for GTROT

PURPOSE:
This program rotates VICAR image datasets that have a GeoTIFF label.  The
program can figure out what rotation the input has from the GeoTIFF label.
The rotation is defined as the ordering of pixel samples (the minor order)
and image lines (the major order) with respect to an East-North map system
(or an X-Y map system in GeoTIFF terms).  The eight possible rotations can
be represented by the following diagrams (here, pixel value represents the
order of data in the file): 


   369    123    741    987
0: 258 1: 456 2: 852 3: 654
   147    789    963    321

   963    789    147    321
4: 852 5: 456 6: 258 7: 654
   741    123    369    987

Note that rotation 1 is the VICAR standard rotation.  Rotation 0
is the USGS and DMA standard, for example, DTED data.

The user does not have to figure out how many 90 degree turns or
flips to apply to an image to get the VICAR standard anymore (for
the GeoTIFF case), the program only needs the value of the output
rotation in the parameter ROT.  The parameter defaults to one
which is the VICAR standard.

All 64 transformations are possible in this program (the old VICAR
program can only do some of the transformations, others require two
executions).  For information only, the transformations are shown
here:

	  no flip              flip

rotate 0  90 180 270      0  90 180 270

   0)  0   3   2   1      4   5   6   7
   1)  1   0   3   2      5   6   7   4
   2)  2   1   0   3      6   7   4   5
   3)  3   2   1   0      7   4   5   6
   4)  4   5   6   7      0   3   2   1
   5)  5   6   7   4      1   0   3   2
   6)  6   7   4   5      2   1   0   3
   7)  7   4   5   6      3   2   1   0

For algebra buffs, the set of 8 rotations is a non-Abelian group
generated by the flip and rotate 90 operations.  It is the smallest
non-Abelian group.

In addition, rotate updates the rotation value in the label.

EXECUTION:

Example

gtrot INP=A OUT=B  will rotate A to B so that B has VICAR standard rotation

OPERATION:

1.  The label is read and the rotation of the GeoTIFF label is computed.
2.  The desired rotation is read from the ROT parameter.
3.  The transformation is calculated by the program using the table above.
4.  The entire image is read.
5.  The image is written out in the rotated order.
6.  The GeoTIFF label is updated for the new rotation.

The program uses dynamic allocation of buffers in the C programming
language, so a twenty or thirty megabyte image can be rotated.  Larger
images can be rotated by the TCL procedure GTROTATE (ready early '00).

 TIMING: 

As fast as VICAR can read and write the lines.  

 ORIGINAL PROGRAMMER:    A. Zobrist          29 Oct 1999
 COGNIZANT PROGRAMMER:   Barbara McGuffie    29 Oct 1999
 
 REVISION HISTORY
  1999-10-29 AZ  Initial version
  2008-01-11 WLB Switched to USES_ANSI_C AND LIB_CARTO; misc cleanup  
  2016-01-08 WLB Migrated to mipl; replaced printf with zifmessage
  

PARAMETERS:


INP

STRING - Input image file

OUT

STRING - Output image file

ROT

desired rotation

See Examples:


Cognizant Programmer: