**PURPOSE**- Performs arithmetic operations point for point on the input image to create a new output image. The operations are conditional on the original pixel value, position in image, and register value(s).

**USAGE**- .OPERATION: AR IF

- <OR>

AR IF [x],[y],[z][If register variables are present on the operation line then the current value of the column value (x), row value (y), and slice value (z) are placed in the respective variable. This allows the logical clauses to access info about current position in the image.)

.INPUT FILE: PIC001

[Enter the name of the input image.].OUTPUT FILE: PIC002

[Enter the name of the output image.]In the explanation which follows, 'P1' refers to the value of the current input pixel and 'P2' refers to the value of the current output pixel. Arithmetic expressions can contain constants, functions, input pixels, and registers. Valid logical comparison operators are: .LT., .LE., .EQ., .NE.,

.GE., AND .GT.

.IF (...) THEN P2=f(P1): IF (P1 .GT. 0.9) THEN P2=-1.0

[Enter 'IF' clause and associated formula to be used to compute P2 from the P1 in case the 'IF' clause is satisfied.

The 'IF' clause can contain a single arithmetic expression followed by a logical comparison to a second arithmetic expression. The 'if' clause must be surrounded by parenthesis. The 'THEN' delimiter is required.Examples of accepted responses:

IF (P1 .LT. 0.1) THEN P2=0.6

IF (P1 .NE. 0.0) THEN P2=[v1]

IF (P1 .EQ. [v4]) THEN P2=[v2]

IF (P1 .LT. RAN(0)) THEN P2=0.6

IF (P1 .LT. 0.1) THEN P2=RAN(0)

IF (P1/4 .LT. 0.1) THEN P2=6

IF ([var].LT. 5) THEN P2=6

IF (P1 .LT. SIN(P1)) THEN P2=6

IF (ABS(P1) .LT. P1) THEN P2=P1

.ELSE IF (...) THEN P2=f(P1): ELSE IF(P1 .LT. -.9) THEN P2=1.0

[Enter 'ELSE IF' clause and associated formula to be used to compute P2 from the P1 in case the 'IF' clause is not satisfied and the currrent 'ELSE IF' clause is satisfied.

The 'ELSE' clause can contain a single arithmetic expression followed by a logical comparison to a second arithmetic expression.

The 'ELSE IF' clause must be surrounded by parenthesis. The 'THEN' delimiter is required. The whole 'ELSE IF' line can be left blank if desired..ELSE FORMULA: P2=RAN(0)

[Enter associated formula to be used to compute P2 from the P1 in case the 'IF' and 'ELSE IF' clauses are not satisfied for this pixel. The whole 'ELSE' FORMULA can be left blank if desired.

**NOTES**

- See documentation for general
rules of
writing arithmetic expressions and functions in SPIDER.
- Since this operation is interpreting your expressions it is expected to be very SLOW.

**SUBROUTINES**- ARITHL, IFTORPN, POLISH, CALC, CHARINSIDE

**CALLER**- UTIL2

© Copyright Notice / Enquiries: spiderem.software@gmail.com