% @(#)replacimag.hlq	19.1 (ESO-IPG) 02/25/03 14:03:40 
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1990 European Southern Observatory
%.IDENT      replacimag.hlq
%.AUTHOR     KB, IPG/ESO
%.KEYWORDS   MIDAS, help files, REPLACE/IMAGE
%.PURPOSE    On-line help file for the command: REPLACE/IMAGE
%.VERSION    1.0  30-JAN-1990 : Creation, KB
%----------------------------------------------------------------
\se
SECTION./IMAG
\es\co
REPLACE/IMAGE						06-JUN-2001  KB
\oc\su
REPLACE/IMAGE in out [test/]low,hi=express1[,express2]
	replace pixels according to intensity
\us\pu
Purpose:      
           For all pixels in a test frame with intensities in a given interval
           the values of the corresponding pixels of the input frame are
           replaced with the result of an algebraic expression.
\up\sy
Syntax:       
           REPLACE/IMAGE in out [test/]low,hi=express1[,express2]
\ys\pa
           in = primary input frame
\ap\pa
           out = output frame, if output frame equal to input frame or if
               set to `+', the replacements are done in the input frame
\ap\pa
           test = optional different test frame, if omitted (also no '/'),
               the primary input frame will be used as test frame
\ap\pa
           low,hi = lower + upper limit (as real numbers) of intensity interval
               in the test frame for replacements;
               low may be set to "<" to indicate neg. infinity
               hi may be set to ">" to indicate pos. infinity
\ap\pa
           express1 = algebraic expression to calculate the replacement value
               for all pixels in the interval [low,hi]
               a) real constant
               b) auxiliary input frame
               c) aux op constant, op = basic operation (+, -, * or /)
                  The blanks above are just for better readability, NO blanks
                  are possible in the actual expression (e.g. ima/12.3);
		  Negative constants have to be enclosed in parentheses.
                  Auxiliary frame must come first, constant last.
\ap\pa
           express2 = optional algebraic expression (same syntax as express1)
               to calculate the value for all pixels with intensities outside
               the interval [low,hi]
\ap\sa
See also:
           FILTER/IMAGE, COMPUTE/IMAGE, REPLACE/POLYGON
           @a replace.prg 
\as\no
Note:         
           All images involved must have same dimensions!
           Outside the interval [low,hi] the output frame will be equal
           to the input frame. unless a second expression is given.
           The total no. of pixels which have been replaced, i.e. found inside
           the interval [lo,hi], is also stored into keyword OUTPUTI(15).
 
           For more complicated expressions than the ones indicated above
           for the parameter `express1' or `express2', use the Midas command
           "@a replace" (Help for that is obtained via "HELP/APPLIC replace").
 
           OJO: This command does NOT update the min, max value of the result
                frame stored in descr. LHCUTS(3,4), instead the values from 
                the input frame are copied over.
\on\exs
Examples:
\ex
           REPLACE/IMAGE a c 2.001,2.02=2.1
             is equivalent to:
             if ((a(n).ge.2.001).and.(a(n).le.2.02)) then
                c(n) = 2.1
             else
                c(n) = a(n)
             endif
\xe\ex
           REPLACE/IMAGE a c 2.001,2.02=b   
             is equivalent to:
             if ((a(n).ge.2.001).and.(a(n).le.2.02)) then
                c(n) = b(n)
             else
                c(n) = a(n)
             endif
\xe\ex
           REPLACE/IMAGE a c 2.001,2.02=b,-9.9  
             is equivalent to:
             if ((a(n).ge.2.001).and.(a(n).le.2.02)) then
                c(n) = b(n)
             else
                c(n) = -9.9
             endif
\xe\ex
           REPLACE/IMAGE a c t/20.,22.=2.1     
             is equivalent to:
             if ((t(n).ge.20.).and.(t(n).le.22.)) then
                c(n) = 2.1
             else
                c(n) = a(n)
             endif
\xe\ex
           REPLACE/IMAGE a c t/2.001,2.02=b+4.4,d
             is equivalent to:
             if ((t(n).ge.2.001).and.(t(n).le.2.02)) then
                c(n) = b(n) + 4.4
             else
                c(n) = d(n)
             endif
\xe\ex
           REPLACE/IMAGE a c t/<,2.02=b+4.4 
             is equivalent to:
             if (t(n).le.2.02) then
                c(n) = b(n) + 4.4
             else
                c(n) = a(n)
             endif
\xe\ex
           REPLACE/IMAGE a + t/<,2.02=b+4.4 
             As above, but image `a.bdf' is modified itself.
\xe\ex
           REPLACE/IMAGE a &a <,0.0=a*(-1)
             Another way of getting the absolute value of `a.bdf'. 
\xe \sxe
