R/UNUImageProcessingFunctions.R
NrrdProject.Rd
Make projections along a nrrd axis, typically also rescaling
NrrdProject(infile, outfile, axis, measure = c("max", "min", "mean", "median", "mode", "variance", "skew", "intc", "slope", "error", "sd", "product", "sum", "L1", "L2", "Linf"), scale = "x0.3333 x0.333", kernel = "cheap", gamma = NA, cropmin = NULL, cropmax = NULL, suffix = NULL, CreateDirs = TRUE, Verbose = TRUE, Force = FALSE, UseLock = FALSE)
infile | Input/output files |
---|---|
outfile | Optional path to output file (constructed automatically when missing) |
axis | Number indicating 0-indexed axis or character "x", "y" or "z" |
measure | Character vector indicating summary function to apply to
values in each column. Choose from |
scale | How to scale each axis (see details) |
kernel | Type of smoothing kernel to use (see details) |
gamma | Exponent for the mapping of input to output values (see details) |
cropmin, cropmax | triples defining the lower and higher corners of bounding box |
suffix | A suffix added to the input file to construct an output filename |
CreateDirs | Whether to create implied output directories |
Verbose | Print status messages |
Force | Whether to overwrite an existing file |
UseLock | Whether to use file-based locking to enable simple parallelisation |
Logical indicating success
gamma: Just as in xv, the gamma value here is actually the
reciprocal of the exponent actually used to transform the values. Note also
that for cropmin,cropmax
the special value M can be used to indicate
the maximum index for that axis (i.e. n-1 when there are n samples).
scale: For each axis, information about how many samples in output:
"=": leave this axis completely untouched: no resampling whatsoever
"x<float>": 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 samples by <float>
"+=<uint>", "-=<uint>": add <uint> to or subtract <uint> from number input samples to get number output samples
"<uint>": exact number of output samples
"a": resample this axis to whatever number of samples preserves the aspect ratio of other resampled axes. Currently needs to be used on all but one of the resampled axes, if at all. (1 or more sampling specifications)
Kernel: The kernel to use for resampling. Kernels logically live in the input index space for upsampling, and in the output index space for downsampling. 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
"tent": linear interpolation
"cubic:B,C": 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 make c4h interpolate
"bspl3", "bspl5", "bspl7": cubic (same as cubic:1,0), quintic, and 7th order B-spline
"bspl3ai", "bspl5ai", "bspl7ai": discrete pre-filters to make bspl3, bspl5, bspl7 interpolate
"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"
Crop max, min:
<int> gives 0-based index
M, M+<int>, M-<int> give index relative to the last sample on the axis (M == #samples-1).
m+<int> give index relative to minimum axis (only relevant for max)
# NOT RUN { # NB cropping from 50th slice to 50 before final slice NrrdProject(infile,axis='z',cropmin='0 0 50',cropmax='0 0 M-50') # }