HOME GUIDE OPERATIONS DOCS FAQ TECHNIQUES FORMATS INSTALL NEW TIPS WEB LINKS WADSWORTH

AR - Arithmetic operation

(9/27/07)

PURPOSE

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

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.]

.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.) +X22 + X23)
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 X21,X22   ; 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-X21) / (X22-X21)
    3. Can handle a whole stack now (Sept. 02). 4. We have reports of this operation giving incorrect results on Intel based MacIntosh computers (Sept. 07)

SUBROUTINES

ARITH, POLISH, CALC

CALLER

UTIL2

© Copyright Notice /       Enquiries: spider@wadsworth.org

BACK TO SPIDER BACK TO WADSWORTH