Help for POLARECT

PURPOSE
     POLARECT is a VICAR applications program which performs 
     a  rectangular-to-polar  coordinate transformation  (or 
     inverse)  on  the input image with respect to  a  given 
     origin.   The  purpose of this program is to  geometri-
     cally transform an image to polar coordinates,  where R 
     and    are  the orthogonal axes rather than  x  and  y, 
     thereby allowing radial and circular characteristics in 
     the  image  to  be subjected to  existing  enhancement, 
     analysis  and transformation routines in a polar  coor-
     dinate sense.   After polar processing,  the  resultant 
     image may then be transformed back to rectangular coor-
     dinates. The program will operate on BYTE and HALF images,
     type is determined from the VICAR label.
TAE COMMAND LINE FORMAT

     polarect INP=A OUT=B SIZE=(SL,SS,NL,NS) PARAMS

          where

     INP and OUT       are the input and output data sets

     SIZE             is the standard VICAR size field.   SL 
                      and  SS refer to starting offsets with 
                      respect to the input image.  NL and NS 
                      refer  to the desired  output  picture 
                      size.

     PARAMS           is the VICAR parameter field.
OPERATION
  
     POLARECT  transforms the input image from the  standard 
     rectangular  coordinate  system to a  polar  coordinate 
     system  based on the orthogonal axes R and THETA. These 
     orthogonal axes are represented in the polar image by R 
     in the sample direction, and THETA in the direction  of 
     increasing  line  count as shown  in  Figure  1.   This 
     convention  was  used  in order to permit  the  use  an 
     angular  resolution as small as desired,  even though a 
     large  angular coverage may be desired,  the number  of 
     lines in the polar image becomes large. In general, the 
     radial  coverage  represented by the  sample  direction 
     remains relatively small,  thereby adhering to physical 
     record length constraints.
            FIGURE 1.  POLARECT PARAMETER CONVENTIONS
                                                          
               R=R1          R--->         R-R2           
              _________________________________           
         Th=A1|                               |           
              |                               |           
              |                               |      
          Th  |                               |      
           |  |                               |           
           |  |                               |           
           |  |                               |           
              |                               |      
              |                               |      
              |                               |           
              |                               |           
         Th=A2|_______________________________|           
                                              (nl,ns)
                    POLAR COORDINATE IMAGE                 
     The variables defined by the parameters RMIN (R1), RMAX 
     (R2), and RANGE (A1 and A2) are also shown in Figure 1.

     The  rectangular image coordinate system was  based  on 
     the  standard  convention of the +X and  +Y  directions 
     corresponding  to  increasing sample  and  line  counts 
     respectively. For this reason, the (Th=0)  direction is 
     defined  as the +X direction,  which is directed toward 
     the  right  side  of  the  rectangular   image.   These 
     conventions are shown in Figure 2. Also shown in Figure 
     2  are  pictorial  rtepresentations for  the  parameter 
     variables.

         FIGURE 2.  POLARECT PARAMETER CONVENTIONS   
                                                          
              (1,1)          X--->                        
              _________________________________           
              |                      Th=A1    |           
              |                       .       |           
              |                         .     |      
           Y  |                .          .   |      
           |  |             R=r1 .         .  |     o     
           |  |       ___._______._________._>| Th=0. 
           |  | (xcen,ycen)      .     R=r2.  |           
              |                .          .   |      
              |                         .     |      
              |                       .       |           
              |                      Th=A2    |           
              |_______________________________|           
                                              (nl,ns)
                RECTANGULAR COORDINATE IMAGE           
     Once  the  parameters have  been  determined,  POLARECT 
     performs  the  geometric  transformation  in  a  manner 
     similar to GEOMA,  i.e.,  every output pixel is  mapped 
     back  to its location in the input picture,  and either 
     four-point   bilinear  interpolation  or  the   nearest 
     neighbor method is used to determine the pixel DN.  The 
     mapping transformations are as follows:

     FORWARD MODE: For known R and THETA in the output image,

                     X (INPUT)  =  R cos(Theta) + XCEN
                     Y (INPUT)  =  R sin(Theta) + YCEN

     INVERSE MODE: For known X and Y in the output image,
                                      2          2
              R(INPUT) = sqrt((X-XCEN) + (Y-YCEN) )
              
                                -1
              THETA(OUTPUT)= tan  ((Y-YCEN)/(X-XCEN))

     Dynamic  allocation is used for the mapping  operation, 
     with  as  much of the input picture being  loaded  into 
     core as the partition allows.   For this reason,  it is 
     recommended that for optimum time utilization, the user 
     use POLARECT in the largest region possible when trans-
     forming larger pictures (NL&NX>1000).
     All  parameters in the INVERSE mode are expressible  in 
     terms of the forward mode parameters with the exception 
     of  the AUTO parameter which is NOT applicable  to  the 
     INVERSE  mode.   All  GENERAL parameters apply  to  the 
     INVERSE mode and unnecessary parameters are ignored.
RESTRICTIONS

     There  are  no  restrictions on image  size  or  record 
     lengths,  however,  the  user is advised of  the  rapid 
     execution  time  increase as input and output  pictures 
     sizes increase.

TIMING

     POLARECT execution time (on IBM) is approximately:

     a) 16 minutes for 1350 line by 1250 sample input image,

     b) 2 minutes for a 400 line by 400 sample input image,

     c) 1 minute for a 325 line by 325 sample input image.
EXAMPLES
A.   This  example represents the simplest form of  POLARECT 
     usage.   The  user  specifies the origin of  the  polar 
     coordinate system,  and allows the program to calculate 
     scaling  factors for the polar  coordinate  image.  The 
     output  picture size is defaulted to that of the input, 
     so that 1250 lines = 360 ,  and 1250 samples = RMAX  of 
     input   picture   (881.25   in   this   case).    After 
     transforming   to   polar   coordinates,    the   VICAR 
     applications  programs  FILTERAA and PIXH are  applied, 
     and  the  resulting image is transformed  back  to  the 
     rectangular coordinate format. See Figure 3A.

          COPY IN A SIZE=(1,1,1250,1250)
          polarect INP=A OUT=B 'AUTO XCEN=625. YCEN=625.
          FILTER B C FILTWTS
          PISH INP=(C,B) OUT=A PIXHPAR
          polarect A B 'INVERSE
     Note  that defaulting picture size may cause a loss  of 
     detail  because  there is usually insufficient  angular 
     resolution in the defaulted number of lines. This tends 
     to  cause a wiggling of straight lines at large  radius 
     when  inversely transformed.  For this  reason,  it  is 
     recommended  that the user make the number of lines  of 
     the polar coordinate image at least 3 times the maximum 
     radius RMAX.

B.   This  example  represents  the most  complex  usage  of 
     parameters necessary for POLARECT.  The user desires an 
     annular ring with center at (X,Y) = (-1000,500),  width 
     500 pixels,  and minimum radius of 1250. (Corresponding 
     to the circle passing through pixel (X,Y) = (250.,500.) 
     to  be transformed to polar coordinates with an angular 
     resolution of 0.01 degree per line (output).
          COPY TAPE A SIZE=(1,1,1000,1000)
          polarect A B NL=300 NS=500 XCEN=-1000. YCEN=500.                     RANGE=(-15.,+15.) RMIN=1250. RMAX=1750.                     RESO=(0.01) RSCALE=1.0
          polarect B A NL=1000 'INVERSE

     Written by:  W. D. Benton, 23 August 1977
     Cognizant Programmer:  B. Gokhman
     Revision:  C.R. Schenk 1-July-1994

PARAMETERS:


INP

Input image

OUT

Output image

SIZE

Size field

INVERSE

Polar to rectangular

BACK

Background DN for output.

NOINTERP

No bilinear interpolation

XCEN

X-coord. for origin of polar sys

YCEN

Y-coord. for origin of polar sys

RANGE

Angular limits of the sector

RMIN

Min radius of the sector

RMAX

Max radius of the sector

RESO

Angular resolution

RSCALE

Radial scaling factor

NOLABEL

Label info not used for default par

AUTO

Fits input sector to output size

See Examples:


Cognizant Programmer: