UNU-2OP(1)

πŸ“¦ version 1.11.0, in fedora 43, fedora 44

πŸ’– UNU-2OP πŸ’–

okay bestie, welcome to unu-2op, one of the unu girlies β€” she does a binary operation on two nrrds, or on a nrrd and a constant. that's the whole vibe. let's get into it πŸ’…


✨ SYNOPSIS ✨

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

🌸 DESCRIPTION 🌸

so like, it's a binary operation on two nrrds, OR on a nrrd and a constant. no cap. either the first or the second operand can be a float constant, but NOT both β€” pick a lane, babe, you can't have two constants, that's not giving anything.

use - for an operand to signify a nrrd that's gonna be read from stdin (a pipe) 🫢. but heads up β€” that - can probably only be used once (reliably). so don't be greedy with it, iykyk.

  • Uses nrrdArithIterBinaryOp or (with -w) nrrdArithIterBinaryOpSelect

πŸŽ€ OPTIONS πŸŽ€

  • operator β€” the binary operator, the moment, the main character. 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 the 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). so either you're a control freak (valid) or you're letting chaos decide (also valid).
  • -t <type>, --type <type> β€” type to convert all INPUT nrrds to, prior to doing the operation πŸ’–. super useful for doing, for instance, the difference between two unsigned char nrrds. this will ALSO determine the output type. by default (not using this option), the types of the input nrrds are left unchanged. so like, she's not gonna touch your types unless you ask.
  • -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: "-" πŸ“€
ngl the defaults here are doing a LOT of heavy lifting, so if you don't pass -o you're getting stdout, and if you don't pass -w the first non-constant arg is your shape queen. just know that.

πŸ¦‹ SEE ALSO πŸ¦‹

  • unu(1)
  • abs(1), atan2(1), fabs(1), fmod(1), pow(1)

and that's the tea πŸ“ β€” this page is from August 2021 and it's page UNU-2OP(1) of the manual, so go forth, do your little binary ops, and slay πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from