Your company here — click to reach over 10,000 unique daily visitors

# unu-2op - Man Page

binary operation on two nrrds, or on a nrrd and a constant

## Synopsis

`unu 2op <operator> <in1> <in2> [-s,--seed <seed>] [-t,--type <type>] [-w,--which <arg>] [-o,--output <nout>]`

## Description

Binary operation on two nrrds, or on a nrrd and a constant. Either the first or second operand can be a float constant, but not both. Use “-” for an operand to signify a nrrd to be read from stdin (a pipe). Note, however, that “-” can probably only be used once (reliably).

• Uses nrrdArithIterBinaryOp or (with -w) nrrdArithIterBinaryOpSelect

## Options

operator

Binary operator. Possibilities include:

• +”, “-” “x” “/”: add, subtract, multiply, divide
• ^”: exponentiation (pow(3))
• spow”: signed exponentiation: sgn(x)pow(abs(x),p)
• fpow”: like spow but with curves flipped
• %”: integer modulo
• fmod”: same as fmod(3) in C
• atan2”: same as atan2(3) in C
• min” “max”: minimum, maximum
• lt” “lte” “gt” “gte”: same as C's <, <=, >, <=
• eq” “neq”: same as C's == and !=
• comp”: -1, 0, or 1 if 1st value is less than, equal to, or greater than 2nd value
• if”: if 1st value is non-zero, use it, else use 2nd value
• exists”: if 1st value exists, use it, else use 2nd value
• nrand”: scale unit-stdv Gaussian noise by 2nd value and add to first value
• rrand”: sample Rician distribution with 1st value for “true” mean, and 2nd value for sigma
in1

First input. Can be a single value or a nrrd.

in2

Second input. Can be a single value or a nrrd.

-s <seed> , --seed <seed>

seed value for RNG for nrand, so that you can get repeatable results between runs, or, by not using this option, the RNG seeding will be based on the current time (string)

-t <type> , --type <type>

type to convert all INPUT nrrds to, prior to doing operation, useful for doing, for instance, the difference between two unsigned char nrrds. This will also determine output type. By default (not using this option), the types of the input nrrds are left unchanged.

-w <arg> , --which <arg>

Which argument (0 or 1) should be used to determine the shape of the output nrrd. By default (not using this option), the first non-constant argument is used. (int); default: “-1

-o <nout> , --output <nout>

output nrrd (string); default: “-