AR - Arithmetic operation

(9/20/10)

PURPOSE

Performs arithmetic operations point for point on the input image to create an output image.   Example.

SEE ALSO

NEG [Negate - invert contrast of image]
AR SCA [Arithmetic scaling of image]

USAGE

.OPERATION: AR

.INPUT FILE: PIC001
[Enter name of the input image.]

.OUTPUT FILE: PIC002
[Enter name for the output image. Can not be same disk image as input.]

.FORMULA: P2=: P1+0.5
[Enter formula to be used to compute the output image (referred to by P2) from the input image (P1). Formula can be any valid math expression with many variable registers.

Examples of accepted formulae:
(P1-2.)/2.+SIN(P1+2)
(P1/512.)+0.
EXP(LOG((P1/512.)+0.)+[x]+[y])
4+ABS((P1-2.)/2.)
P1**3+P1+EXP((P1-2.)/2.)

NOTES

  1. See documentation for general rules of writing arithmetic expressions and functions in SPIDER.

  2. Order of application of operators follows that in Fortran (e.g. multiplication/division are performed before addition/subtraction). Use ()'s to control the order where necessary.

  3. Two operators must not follow each other in the formula e.g. P2=p1*-1.0 is not allowed.

  4. To rescale an image's range to 0 - 255 using 'AR':
     
             FI [min],[max]   ; File info. operation            
             oldfilename      ; Input file                      
             8,7              ; Min and max location in header  
             AR               ; Arithmetic operation            
             oldfilename      ; Input file                      
             newfile          ; Output file                     
             255 * (P1-[min]) / ([max]-[min])                     
    

  5. Can handle a whole stack now (Sept. 02).

  6. We have reports of this operation giving incorrect results on Intel based MacIntosh computers (Sept. 07) We think this is fixed now.

SUBROUTINES

ARITH, POLISH, CALC

CALLER

UTIL2

© Copyright Notice /       Enquiries: spider@wadsworth.org