UNU-RESAMPLE(1)
π unu-resample β the glow-up page π
okay so bestie, welcome to unu-resample, one of the little helper commands that live under the big unu umbrella (that's the User Commands section of the manual, manual page UNU-RESAMPLE(1) if you're being formal about it). She does filtering and {up,down}sampling with a separable kernel and she is so good at it. π¦
β¨ NAME β¨
unu-resample β filtering and {up,down}sampling with a separable kernel πΈ
π SYNOPSIS π
unu resample [-old] -s,--size <sz0 ...> [-off,--offset [<off0 ...>]]
[-min,--minimum [<min0 ...>]] [-max,--maximum [<max0 ...>]] [-k,--kernel
<kern ...>] [-nrn] [-ne,--nonexistent <behavior>] [-b,--boundary
<behavior>] [-v,--value <value>] [-t,--type <type>] [-cheap]
[-c,--center <center>] [-co,--center-override] [-verbose <v>]
[-i,--input <nin>] [-o,--output <nout>]
π DESCRIPTION π
Filtering and {up,down}sampling with a separable kernel, periodt. π
She makes the NrrdResampleContext functions way easier to reach, by just assuming some things for you β including the big one: that the same kernel is used for resampling every axis that's getting resampled. One kernel, all the axes, no drama.
The only option you literally cannot skip is -s, because that's the one that says which axes to resample and how many output samples to make. The resampling kernel -k defaults to an interpolating cubic, but girl, there are so many other choices. By default, resampling an axis resamples the full extent of its samples, but you can offset that range with -off, or crop and/or pad with -min and -max. And she respects the difference between cell- and node-centered data β but if you know better, you can over-ride known centering with -co. π
- Uses the many
nrrdResample*functions operating on anrrdResampleContextπ«Ά
π OPTIONS π
-oldβ instead of using the newnrrdResampleContextimplementation, use the oldnrrdSpatialResampleimplementation. throwback era, ngl. π-s <sz0 ...>,--size <sz0 ...>β for each axis, info about how many samples are in the output. the possibilities, bestie:- β
=β: leave this axis completely untouched β no resampling whatsoever. not me touching it, not me thinking about it. - β
xfloatβ: multiply the number of input samples by float, and round to the nearest integer, to get the number of output samples. use βx1β to resample the axis but leave the number of samples unchanged. - β
/floatβ: divide number of input samples by float. - β
+=uintβ, β-=uintβ: add uint to or subtract uint from the number of input samples to get the number of output samples. - β
uintβ: exact number of output samples. no math, just vibes. β - β
aβ: resample this axis to whatever number of samples preserves the aspect ratio of the other resampled axes. currently needs to be used on all but one of the resampled axes, if at all. (iykyk)
- β
(1 or more sampling specifications) β¨
-off [<off0 ...>],--offset [<off0 ...>]β for each axis, an offset or shift to the position (in index space) of the lower end of the sampling domain. Either-offcan be used, or-minand-maxtogether, or none of these (so that, by default, the full domain of the axis is resampled). (0 or more doubles); default: ββ π-min [<min0 ...>],--minimum [<min0 ...>]β for each axis, the lower end (in index space) of the domain of the resampling. Either-offcan be used, or-minand-maxtogether, or none of these (so that, by default, the full domain of the axis is resampled). (0 or more doubles); default: ββ π-max [<max0 ...>],--maximum [<max0 ...>]β for each axis, the upper end (in index space) of the domain of the resampling. Either-offcan be used, or-maxand-maxtogether, or none of these (so that, by default, the full domain of the axis is resampled). (0 or more doubles); default: ββ π-k <kern>,--kernel <kern>β the kernel to use for resampling. Kernels logically live in the input index space for upsampling, and in the output index space for downsampling. the possibilities include:- β
boxβ: nearest neighbor interpolation on upsampling, and uniform averaging on downsampling. - β
cheapβ: nearest neighbor interpolation for upsampling, and non-blurring sub-sampling (pick subset of input samples) on downsampling. budget queen but make it work. π - β
tentβ: linear interpolation. - β
cubic:B,Cβ: the Mitchell/Netravali BC-family of cubics:- β
cubic:1,0β: B-spline; maximal blurring. - β
cubic:0,0.5β: Catmull-Rom; good interpolating kernel. π
- β
- β
c4hβ: 6-sample-support, C^4 continuous, accurate. - β
c4haiβ: discrete pre-filter to makec4hinterpolate. - β
bspl3β, βbspl5β, βbspl7β: cubic (same ascubic:1,0), quintic, and 7th order B-spline. - β
bspl3aiβ, βbspl5aiβ, βbspl7aiβ: discrete pre-filters to makebspl3,bspl5,bspl7interpolate. - β
hann:Rβ: Hann (cosine bell) windowed sinc, radius R. - β
black:Rβ: Blackman windowed sinc, radius R. - β
gauss:S,Cβ: Gaussian blurring, with standard deviation S and cut-off at C standard deviations. - β
dgauss:S,Cβ: Lindeberg's discrete Gaussian.
- β
default: βcubic:0,0.5β πΈ
-nrnβ do NOT do per-pass kernel weight renormalization. Doing the renormalization is not a performance hit (hence it's enabled by default), and the renormalization is sometimes needed to avoid βgratingβ on non-integral down-sampling. Disabling the renormalization is needed for correct results with artificially narrow kernels. so likeβ¦ turn it off on purpose, on purpose. π-ne <behavior>,--nonexistent <behavior>β when resampling floating-point values, how to handle non-existent values within kernel support:- β
noopβ: do nothing; let them pollute result. π - β
renormβ: ignore them and renormalize weights of existent values. - β
wghtβ: ignore them and simply use weights of existent values.
- β
default: βnoopβ
-b <behavior>,--boundary <behavior>β how to handle samples beyond the input bounds:- β
padβ: use some specified value. - β
bleedβ: extend border values outward. - β
mirrorβ: repeated reflections. - β
wrapβ: wrap-around to other side.
- β
default: βnoopβ π¦
-v <value>,--value <value>β for βpadβ boundary behavior, pad with this value (double); default: β0.0β-t <type>,--type <type>β type to save output as. By default (not using this option), the output type is the same as the input type; default: βdefaultβ-cheapβ [DEPRECATED: the β-k cheapβ option is the new (and more reliable) way to access this functionality. β-cheapβ is only here for legacy use in combination with β-oldβ.] π
bestie, this one is deprecated, fr fr. use -k cheap instead.
When downsampling (reducing number of samples), don't try to do correct filtering by scaling kernel to match new (stretched) index space; keep it in old index space. When used in conjunction with β-k boxβ, this can implement subsampling which chooses every Nth value.
-c <center>,--center <center>β (not available with β-oldβ) default centering of axes when input nrrd axes don't have a known centering: βcellβ or βnodeβ; default: βcellβ-co,--center-overrideβ (not available with β-oldβ) centering info specified via β-cβ should over-ride known centering, rather than simply be used when centering is unknown. main character energy, she decides. π-verbose <v>β (not available with β-oldβ) verbosity level (int); default: β0β-i <nin>,--input <nin>β input nrrd; default: β-β-o <nout>,--output <nout>β output nrrd (string); default: β-β
π SEE ALSO π
unu(1) β go say hi to the whole family π«Ά
mwah, that's the whole page bestie. this one's from <b>May 2021</b> and it lives in the unu corner of the manual (that's UNU-RESAMPLE(1)), so if you ever forget it, it's right there waiting for you. go resample something gorgeous. πβ¨ππ¦πΈπ
π¦ where this page comes from
- fedora 43: teem 1.11.0-83.fc43 Β· LGPL-2.1-or-later WITH LicenseRef-Fedora-Temporary-Simple-Library-exception
- fedora 43: teem 1.11.0-86.fc43 Β· LGPL-2.1-or-later WITH Simple-Library-Usage-exception
- fedora 44: teem 1.11.0-87.fc44 Β· LGPL-2.1-or-later WITH Simple-Library-Usage-exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms