% @(#)align_mosa.hlq	19.1 (ESO-SDAG) 02/25/03 14:14:58
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c) 1995 European Southern Observatory
%.IDENT      align_mosa.hlq
%.AUTHOR     RHW, IPG/ESO
%.KEYWORDS   MIDAS, ccd package, ALIGN/MOSAIC
%.PURPOSE    On-line help file for the command: ALIGN/MOSAIC
%.VERSION    950719 RHW created
%---------------------------------------------------------------------
\se
SECTION./MOSAIC
\es\co
ALIGN/MOSAIC                                                    19-Jul-1995 RHW
\oc\su
ALIGN/MOSAIC in_frm in_tab out_frm method,data [nxrsub,nyrsub] [xref,yref] 
          [x_size,y_size]
	Align the elements of the mosaiced frame
\us\pu
Purpose:    
	Align the elements of the mosaiced frame
\up\sy
Syntax:     
        ALIGN/MOSAIC in_frm in_tab out_frm method,data [xref,yref] [xoff,yoff] 
                  [x_size,y_size]
\ys\pa
        in_frm=   The mosaiced frame to be aligned. This frame must have been 
                  produced by the CREATE/MOSAIC command and have an 
                  accompanying database table specified by parameter in_tab.
\ap\pa
        in_tab=   The database table from the CREATE/MOSAIC task.
\ap\pa 
        out_frm=  The aligned output frame produced by the command.
\ap\pa 
        method,data= Method to compute the matching intensities in the overlap
                  regions. Three inputs are possible:
                  a) S(hift),xshift,yshift. In this case the shift is assumed 
                     to be constant with respect to its neighbour in x (xshift)
                     and  in y (yshift).
                  b) C(oord),table. In this case, the table is assumed to 
                     contain the coordinates of objects in the input frame, 
                     one object per line in the following format: \\
                     1) the x and y coordinates of the object in the first 
                        subraster;\\
                     2) the x and y coordinates of the same object in the 
                        second subraster;
                     3) the x and y coordinates of the next object in the 
                        first subraster;
                        etc.\\
                  c) (R)eference,table. The table is assumed to contain the x 
                     and y shifts in columns 1 and 2 respectively for each 
                     input subraster relative to the reference subraster. The
                     most common use of this option is to make fine adjustments
                     by hand to the output of ALIGN/MOSAIC by editing the 
                     computed shifts slightly and rerunning the command with 
                     the new shifts.\
\ap\pa
        nxrsub,nyrsub= The column and row index of the reference subraster.
                 This will default to the central subraster.
\ap\pa
        xref,yref= The x and y offset of the destination in the output frame 
                 of the reference subraster. By default the reference 
                 subraster occupies the same position in the output frame that
                 it does in the input frame.
\ap\pa
        nocols,norows= The number of columns and lines in the output frame. The
                 defaults are the number of columns and lines in the input 
                 frame.
\ap\no
Note:
        The command CREATE/MOSAIC is controlled by the input parameters and an 
        additional number of CCD keywords: \\
        MO_TRIM  - the number of columns or rows to trim off each edge of 
                   each input subraster before inserting it in the output 
                   frame. The default is to trim one column or row at each 
                   edge.\\
        MO_INTER - The type of interpolant use to shift the subraster. 
                   Possible options area : nearest, linear, poly3, poly5, and 
                   spline3.\\
        MO_BLANK - to define the pixel intensity in undefined regions.\\
\\
        ALIGN/MOSAIC takes the mosaiced frame (in_frm), the database file 
        (in_tab) generated by CREATE/MOSAIC, and a list of coordinates 
        (method) and computes an output frame (out_frm) in which all the 
        individual subrasters are aligned. If method="coords", ALIGN/MOSAIC 
        accumulates the relative shifts between adjacent subrasters from the 
        table into a total shift for each subraster with respect to the 
        reference subraster.\\
\\
        Shifts which do not correspond to adjacent subrasters are ignored.
        For subrasters which have no direct shift information, ALIGN/MOSAIC
        makes a best guess at the x and y shift based on the shifts of nearby 
        subrasters which do have direct shift information.  If the x and y 
        shifts are sufficiently uniform over the whole input frame the user 
        may set the method parameter to "shifts" and supply values for the 
        xshift and yshift. Alternatively ,the shifts may be read from a table  
        file using the method="F,Table".\\
\\
        Coordinate tables may be generated interactively using the command
        SHIFT/MOSAIC command and using the display cursor.\\
\\
        The subrasters are inserted into the output frame using the 
        interpolation scheme defined by the CCD keyword MO_INTER, and aligned 
        with reference to the subraster defined by the parameter nxrsub and 
        nyrsub, using the shifts defined by the coordinates in a table or 
        defined by xshift and yshift parameters. Subrasters are inserted into 
        the output frame in the order they were placed in the original mosaic 
        with pixels in the most recently placed subrasters replacing those in 
        earlier placed ones in the overlap regions. Undefined pixels in the 
        output frame are given the value stored in the keyword MO_NUL.\\
\\
        The position of the reference subraster in the output frame may be 
        adjusted by setting the offset parameters xref and yref. The edges 
        of each subraster may be trimmed before insertion into the output 
        frame by setting the CCD keyword MO_TRIM.
\on\see
See also:   
        SET/CCD, SHOW/CCD, CREATE/MOSAIC, SHIFT/MOSAIC, MATCH/MOSAIC, 
        FIT/MOSAIC
\ees\exs
Examples:
\ex
	ALIGN/MOSAIC  mosin mosout mosdb coords,coordtab 6,5
        Align the mosin frame with respect to subraster 6, 5
\xe\ex
        SET/CCD MO_TRIM=2,2,2,2
 	ALIGN/MOSAIC  mosin mosout mosdb coords,coordtab 6,5 
        The same as above but trim 2 rows and columns off of each input image 
        before inserting into the output frame.
\xe \sxe



