UNU-QUANTIZE(1)

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

πŸ’– UNU-QUANTIZE πŸ’–

okay bestie, welcome to the unu-quantize page, part of the User Commands lineup in the unu manual. it's giving "shrink your numbers, keep your vibes". let's get into it 🫢


✨ NAME ✨

unu-quantize β€” quantize values to 8, 16, or 32 bits πŸ’…


🌸 SYNOPSIS 🌸

unu quantize -b,--bits <bits> [-min,--minimum <value>] [-max,--maximum
<value>] [-hb,--bins <bins>] [-blind8 <bool>] [-i,--input <nin>]
[-o,--output <nout>]

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, the whole point: quantize values to 8, 16, or 32 bits. that's the assignment and it ate πŸ”₯

your input values can be fixed point (think quantizing ushorts down to uchars, the classic glow-down) or floating point. either way, values get clamped to the min and max before they get quantized, so there's literally no risk of getting 255 where you expect 0 (with unsigned char output, for example). no cap, that would be so embarrassing πŸ™ˆ

the min and max can be specified explicitly (as a regular number), or in terms of percentiles β€” that's a number suffixed with %, and there is no space in between, bestie, keep them glued together.

heads up though: this does only linear quantization. that's the whole vibe, don't come looking for anything fancier πŸ’€

also go look at unu-convert(1), unu-2op(1) x, and unu-3op(1) clamp β€” the trio of related icons, iykyk.

  • Uses nrrdQuantize ✨

πŸŽ€ OPTIONS πŸŽ€

  • -b <bits> , --bits <bits> β€” the number of bits to quantize down to. this one decides the type of your output nrrd, so it's kinda the main character here πŸ‘‘
    • "8" β†’ unsigned char
    • "16" β†’ unsigned short
    • "32" β†’ unsigned int
  • -min <value> , --minimum <value> β€” the value to map to zero. give it as a regular number, or, if the number has a "%" suffix, this minimum is specified in terms of the percentage of samples in input that are lower. "0%" means the lowest input value gets used; "1%" means that the 1% of the lowest values are all mapped to zero. and by default (aka when you don't use this option at all), the lowest input value is used. (string); default: "nan" 🌸
  • -max <value> , --maximum <value> β€” the value to map to the highest unsigned integral value. same deal: give it explicitly as a regular number, or, if the number has a "%" suffix, this maximum is specified in terms of the percentage of samples in input that are higher. "0%" means the highest input value is used β€” which is also the default behavior (same as not using this option). (string); default: "nan" ✨
  • -hb <bins> , --bins <bins> β€” number of bins in the histogram of values, used for determining min or max by percentiles. and listen, this has to be large enough so that any errant very high or very low values don't compress the interesting part of the histogram to an inscrutably small number of bins. like, don't do that to yourself. (unsigned int); default: "5000" πŸ“
  • -blind8 <bins> β€” if you're not using "-min" or "-max", this is whether to know the range of 8-bit data blindly (uchar is always [0,255], signed char is [-128,127]). (bool); default: "true", "true" πŸ’…
  • -i <nin> , --input <nin> β€” input nrrd 🌈
  • -o <nout> , --output <nout> β€” output nrrd (string); default: "-" πŸ’œ

πŸ”₯ SEE ALSO πŸ”₯

unu(1), unu-unquantize(1), unu-convert(1), unu-2op(1) x, unu-3op(1) clamp


bestie reminder: -min and -max default to "nan", which is the whole "just use the actual lowest/highest input value" vibe. don't fight it πŸ’–

okay that's the page, you absolutely ate this one 🫢 and for the cute lil sign-off: this gorgeous piece of documentation is living its August 2021 era, from the UNU-QUANTIZE(1) manual, under User Commands. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from