vpResample(3) | Library Functions Manual | vpResample(3) |
vpResample, vpResample2D, vpResample3D - resample an array
#include <volpack.h>
vpResult
vpResample(vpc, num_dimens, src_dimens, dst_dimens, src_strides, dst_strides, element_type, src_array, dst_array)
vpResult
vpResample2D(src_array, src_x, src_y, dst_array, dst_x, dst_y, element_type, filter_type)
vpResult
vpResample3D(src_array, src_x, src_y, src_z, dst_array, dst_x, dst_y, dst_z, element_type, filter_type)
vpResample is used to resample an array to a new grid with a different resolution. It can be used to scale up or decimate an array of volume data, for instance. An arbitrary separable space-invariant resampling filter can be specified via a lookup table containing filter weights. The input array may have an arbitrary number of dimensions, but on each call to vpResample only one dimension of the array is resampled. To scale all dimensions call the routine once for each dimension. Transformations other than scales (e.g. rotations and shears) are not supported by these routines.
The routines vpResample2D and vpResample3D provide a simpler (but less flexible) interface to vpResample. They take as arguments an input array with its dimensions, an output array with its dimensions, and a constant specifying a filter. The input array is resampled once for each dimension and then stored in the output array. These two routines automatically create a filter weight table and arrays for temporary results.
The remainder of this man page describe vpResample. The vpc argument is a VolPack context that contains a description of the resampling filter. Use vpSetFilter to define the filter. The volume data and rendering parameters currently stored in the context are not affected by calls to vpResample.
The remaining arguments to vpResample describe the size and layout of the input and output arrays. The two arrays must have the same number of dimensions, specified by num_dimens. The sizes of the dimensions are specified by src_dimens and dst_dimens which are 1D arrays with num_dimens elements in each array. src_dimens[0] is the size of the input dimension to be resampled. dst_dimens[0] is the size of the output dimension after resampling, so the scale factor is dst_dimens[0] / src_dimens[0]. The remaining elements of src_dimens give the sizes of the other input array dimensions in any order (although some orderings result in faster execution due to lower memory overhead). The other output array dimensions are ignored (although they should be the same as the corresponding input array dimensions since only one dimensions is resampled).
The src_strides and dst_stride arguments are 1D arrays that contain a stride in bytes for each dimension of the input and output arrays, stored in the same order as the dimensions sizes in src_dimens.
The element_type argument specifies the data type of each element of the input and output data arrays. The supported types are:
Finally, the last two arguments to vpResample are pointers to the first elements of the input and output arrays.
The normal return value is VP_OK. The following error return values are possible:
VolPack |