Help for NEWMOS

 PURPOSE:

 NEWMOS is a VICAR application program which is able to mosaic up to
 thirty pictures.  If the frames have been map- projected using VICAR
 program MAP3, then NEWMOS can automatically determine the required
 size of the output image and the offsets of all the input images.

 EXECUTION:
   There are two ways to call newmos. The simplest mosaics or averages
   all of the inputs:

        NEWMOS  INP=(inputs...)  OUT=output  SIZE  PARAM

   The second mode includes an additional set of mask images:

        MASKMOS INP=(inputs...)  OUT=(outputs...)
        NEWMOS  INP=(inputs...,outputs...)  OUT=output  SIZE  PARAM

 OPERATION:

 NEWMOS calculates where each input picture is to be replaced in the 
 output frame from the offset parameters. The program takes each line
 of the output picture and determines which input frames have lines
 which map to this line in the output. The program scans along these
 input lines from left to the right and right to the left using the 
 edge detection parameters to find the left and right extents of
 valid picture data in each of the inputs. The data between these
 points whose DN are greater than THRESH, N1 are copied to the output.

 There are three methods of weighting the input images:

Default method:

 In reverse input data set order with an earlier input overlaying
 a subsequent input much as a person mosaicking prints by hand
 will put one print on top of another (with IN1 on top). 
 No weighting is performed.
 In this method ALL THE INPUT IMAGES ARE MOSAICKED which is NOT the case
 for the SMOOTH option.

Average method:  (AVER keyword)
 
 All the images which overlap are averaged to produce the output. 
 Weighting is performed based upon the WEIGHT keyword.
 DNout=sum(DNin*WEIGHTin)/sum(WEIGHTin).
 In this method ALL THE INPUT IMAGES ARE MOSAICKED which is NOT the case
 for the SMOOTH option.

Smooth method:  (SMOOTH keyword)

 Only THE FIRST HALF OF THE INPUT IMAGES ARE MOSAICKED. The second half 
 are masks which control the weighting for the first half. The masks
 can be generated automatically with the MASKMOS program. There is
 a 1:1 correspondence between images such that for M inputs image
 M/2+1 is the mask for image 1, image M/2+2 is the mask for image 2, etc.
 The output DN value is the sum of overlapping frames weighted by their
 mask values at that point including the WEIGHT keyword.
 DNout=sum(DNin*MASKin*WEIGHTin)/sum(MASKin*WEIGHTin).
 Note that the MAP3 labels must be present for the masks too.

In general:

 All data
 in an input picture which lies outside of the output frame are
 ignored.  If from the offset parameters and the size field any
 input has been determined to lie entirely outside the output 
 frame, a warning is printed and that frame is discarded. If
 no input data has been provided to cover a particular pixel
 in the output, the program will set that output pixel to DCLEVEL.

 NEWMOS can compute the output image size and the offsets of the input
 images automatically, if the inputs have been map-projected using
 MAP3.  This option is invoked by the keyword ADAPT.

 
 PROGRAM HISTORY:

 WRITTEN BY: Joel Mosher        March, 12 1976
 CONVERTED TO VAX BY:  Florance Moss   Feburary, 1 1984
 CONVERTED TO VICAR2 BY:  L.W.Kamp,    27 Oct. 1985
 COGNIZANT PROGRAMMER:  L. W. Kamp
 REVISIONS:
  18 AUG 03  ntt  Enabled 3D image capability.
  02 FEB 99  rrp/hbm Modified newmos to work with upto 80 input images.
                  The current solaris system only supports a maximum
                  of 64 input files so newmos was modified to close
                  unnecessary files or close file if a max of 45 have
                  been reached.
  04 Jun 98  rrp  Removed implicit variables from main44. Declared RLCP and
                  RSCP as real*8. Also changed loop parameter in OFFSET from
                  mp_max_keywd_length to mp_number_of_keywords. Prevented
                  the use of tlat vector in any test other then CHICK.
                  Updated the call to xvparm for weight to have maxcnt of
                  60 and not 1. Initialized all variables to avoid unexpected
                  program behavior.
  10 Jul 95  crs (CRI) made portable for UNIX
  1  mar 93  jjl  New smooth option.
  22 Feb 93  LWK  Fixed AVER (when no SMOOTH) bug
  20 Feb 93  LWK  Use TRANV vice CONVEV for Simple Cylindrical because of
                  RECTPATCH problem when ADD360 has been used
  11 Dec 92  LWK  Call CONVEV instead of TRANV in order to support PERSPECTIVE
  16 Oct 92  LWK  Enabled map codes 10-16 (but NO special code added to
                  handle these -- use at your own risk!);  revised SMOOTH
		  algorithm to ignore regions where >2 images overlap
  20 Nov 91  LWK  Removed NOMIN code from Simple Cylindrical (not needed as
                   TRANV does not truncate). Also added 1 to SAMP for Mercator.
  13 Nov 91  LWK  Used NOMIN to suppress call to TRANV, in order to allow 
                   range beyond (0,360) for Cylindrical
  ???        JRY  Added parameter SMOOTH
  07 Aug 89  GMY  Fix integer overflow when averaging pixels
  22 Feb 88  SP   COMPLETED CHANGE OF 87-12-8.  ADDED 1 TO SAMP FOR 
                      NORMAL CYLINDRICAL.
  22 Feb 88  SP   CORRECTED MAP LABEL INFO FOR OUTPUT FILE.
  22 Feb 88  SP   ADDED NOMIN KEYWORD TO ALLOW MORE THAN 360 DEGREES
                      OF LONGITUDE FOR CERTAIN PROJECTIONS.  
  11 Dec 87  SP   CORRECTED SUBR. OFFSET TO USE TRANV IF LAT AND LONG
                      IN MAP2 LABEL ARE VARIABLE.
  08 Dec 87  LWK  FIXED PROBLEM WITH HALFWORD DATA:  SINCE ALL WORK
                      IS DONE IN HALFWORD, REMOVE ALL REFERENCE TO BYTES!
  30 Oct 87  LWK  INITIALIZE 'WORK' ARRAY FOR SEARCV2, REMOVED TBUF STUFF
  11 Oct 87  LWK  FIXED BUGS READING IMAGE WITH LSTART<0, & IN ADAPT
  27 Mar 87  SP   FIXED PROBLEM WHERE INPUT IMAGES WERE ALL OFFSET 1 PIXEL
                      TO THE RIGHT OF CORRECT POSITION.
  15 Jan 87  LWK  FIXED BUG IN SUBR. ADAPT
  26 Mar 86  LWK  FIXED ISWTCH BUG IN SUBR.OFFSET
  27 Oct 85  LWK  CONVERTED PARAMETER PROCESSING TO VICAR2 
                      (REQUIRED BECAUSE NI>10)
  15 Oct 85  LWK  FINISHED VICAR2 CONVERSION (I/O ONLY) 
                      INCREASE # INPUT FILES TO 30
  26 Sep 85  HBD  CONVERTED I/O TO VICAR2
  24 Jan 84  FFM  CONVERT TO VAX
  Joel Mosher changes:
     10/8/75 FIX BUG IN WRITEING LABEL INTO PIX DATA
     10/16/75 PUT IN INCREMENT IN EDGE SEARCH
     10/30/75 FIX BUG IN BCDBIN(NOSAMP CONFUSED WOTH NOLINE)
     12/12/75 OS VERSION SET ALL VARIABLES TO ZERO
     1/26/76 FIX BUG IN INITIALIZING NSI
     1/26/76 PUT IN ERROR MESSAGE FOR NUMBER OF OFFSETS VS INPUTS
     6/2/76 FIX BUG IN ALLOCATION OF BUFFER SPACE
     1/29/78 PUT IN LABEL SEARCHING FOR OFFSETS
     1/30/78 LET SYSTEM ALLOCATE OUTPUT ALTERNATE BUFFER
     2/7/78 FIXED NIBBLE MISTAKE ,LNIB&RNIB REVERSED
     2/7/78 PUT IN THRESH TEST FOR OUTPUT BUFFER
     2/7/78 CHANGED THRESHOLDING
     2/19/78 PUT IN MAP2 LABEL UPDATE
     2/20/78 PUT IN PICTURE COMPATABILITY CHECKING
     3/26/78 PUT IN AVERAGING OPTION
     8/9/78 OVERLAID
     8/14/78 FIXED HALFWORD WRITE BUG
     12/31/78 PUT IN JUPITER RADIUS
     2/10/79 PUT IN CYLINDRICAL PROJECTION
     5/27/80 FIXED BUG IN OVERRIDE OF RADII
     12/28/80 USE 77 LABEL FORMAT TO GET NL AND NS
     12/29/80 CHANGE ALL CLOSES FROM 0 TO 1 TO BACKSPACE POSSIBLE
             TAPE INPUT DATA SETS
     4/19/81 PUT IN NORMAL CYLINDRICAL PROJECTION
     7/17/81 CHANGE RADII OF JUPITERS SATELLITES
     11/25/81 READ FORMAT PARAMTER IN SYSTEM LABEL AGAIN
     12/23/81 FIX ERROR IN HALF/BYTE SWITCH
     6/20/82 FIX WRAPAROUND PROBLEM IN ADAPT SUBROUTINE
     12/23/82 PUT IN FIX TO GIVE SCP LESS THAN 1 CIRCUMFERENCE
     2/20/83 FIX WRAPAROUND PROBLEM IN ADAPT AGAIN


PARAMETERS:


INP

input VICAR labelled files

OUT

output VICAR labelled file

SIZE

standard VICAR size field

SL

starting line of the SIZE field

SS

starting sample of the size field

SB

starting band of the size field

NL

number of lines of the size field

NS

number of samples of the size field.

NB

number of bands of the size field.

PIXL

locations of the common point in the input files

LCP

the line of the common point in OUT

SCP

the sample of the common point in OUT

THRESH

the lower DN used in finding the input's edge

LTHRESH

left threshold DN value

RTHRESH

right threshold DN value

ETHRESH

both the left and right thresholds

NSEQ

the number of consecutive elements >= THRE

LSEQ

the number of consecutive elements >= LTHR

RSEQ

the number of consecutive elements >= RTHR

ADAPT

Common points and output image size are computed automatically.

NOMIN

Used to prevent minimizing the output number of samples.

NIBB

the number of edge pixels to be nibbled

LNIB

the number of left edge pixels to be nibbled

RNIB

the number of right edge pixeles to be nibbled

DCLEV

the background DN value

INCR

sample increment to find an edge

FORMAT

output file data format

AVER

average the DN in the output overlapping area

MAP2

indicates all inputs have MAP2 labels.

RADIUS

specifies the radius of the target planet.

REQ

specifies the equatorial radius of the body.

RPOL

specifies the polar radius of the body.

TARGET

Target body. Valid: MOON,MCRY,IO,J1, EURO,J2,GANY,J3,CALL,J4.

SMOOTH

the overlapping area is weighted in its calculation

WEIGHT

Weight for each input. Defaults to 1.

See Examples:


Cognizant Programmer: