.\" Copyright (c) 1994 The Board of Trustees of The Leland Stanford .\" Junior University. All rights reserved. .\" .\" Permission to use, copy, modify and distribute this software and its .\" documentation for any purpose is hereby granted without fee, provided .\" that the above copyright notice and this permission notice appear in .\" all copies of this software and that you do not sell the software. .\" Commercial licensing is available by contacting the author. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, .\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY .\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. .\" .\" Author: .\" Phil Lacroute .\" Computer Systems Laboratory .\" Electrical Engineering Dept. .\" Stanford University .\" .\" $Date: 1994/12/31 19:49:53 $ .\" $Revision: 1.1 $ .\" .\" Macros .\" .FS -- function start .\" is return type of function .\" name and arguments follow on next line .de FS .PD 0v .PP \\$1 .HP 8 .. .\" .FA -- function arguments .\" one argument declaration follows on next line .de FA .IP " " 4 .. .\" .FE -- function end .\" end of function declaration .de FE .PD .. .\" .DS -- display start .de DS .IP " " 4 .. .\" .DE -- display done .de DE .LP .. .TH vpResample 3 "" VolPack .SH NAME vpResample, vpResample2D, vpResample3D \- resample an array .SH SYNOPSIS #include .sp .FS vpResult \fBvpResample(\fIvpc, num_dimens, src_dimens, dst_dimens, src_strides, dst_strides, element_type, src_array, dst_array\fB)\fR .FA vpContext *\fIvpc;\fR .FA int \fInum_dimens;\fR .FA int \fI*src_dimens, *dst_dimens;\fR .FA int \fI*src_strides, *dst_strides;\fR .FA int \fIelement_type;\fR .FA void \fI*src_array, *dst_array;\fR .FE .sp .FS vpResult \fBvpResample2D(\fIsrc_array, src_x, src_y, dst_array, dst_x, dst_y, element_type, filter_type\fB)\fR .FA void *\fIsrc_array;\fR .FA int \fIsrc_x, src_y;\fR .FA void *\fIdst_array;\fR .FA int \fIdst_x, dst_y;\fR .FA int \fIelement_type;\fR .FA int \fIfilter_type;\fR .FE .sp .FS vpResult \fBvpResample3D(\fIsrc_array, src_x, src_y, src_z, dst_array, dst_x, dst_y, dst_z, element_type, filter_type\fB)\fR .FA void *\fIsrc_array;\fR .FA int \fIsrc_x, src_y, src_z;\fR .FA void *\fIdst_array;\fR .FA int \fIdst_x, dst_y, dst_z;\fR .FA int \fIelement_type;\fR .FA int \fIfilter_type;\fR .FE .SH ARGUMENTS .IP \fIvpc\fR VolPack context from \fBvpCreateContext.\fR .IP \fInum_dimens\fR Number of dimensions in the input and output arrays. .IP \fIsrc_dimens\fR Array containing the dimensions of the input array. .IP \fIdst_dimens\fR Array containing the dimensions of the output array. .IP \fIsrc_strides\fR Array containing the strides for each dimension of the input array. .IP \fIdst_strides\fR Array containing the strides for each dimension of the output array. .IP \fIelement_type\fR Constant specifying the data type of the array elements (VP_UCHAR, VP_USHORT, VP_FLOAT). .IP \fIsrc_array\fR Input array containing input data. .IP \fIdst_array\fR Output array for result data. .IP "\fIsrc_x, src_y, src_z\fR" Dimensions of the input array. .IP "\fIdst_x, dst_y, dst_z\fR" Dimensions of the result array. .IP \fIfilter_type\fR Constant specifying one of the predefined filters (VP_BOX_FILTER, VP_LINEAR_FILTER, VP_GAUSSIAN_FILTER, VP_BSPLINE_FILTER, VP_MITCHELL_FILTER). .SH DESCRIPTION \fBvpResample\fR 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 \fBvpResample\fR 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. .PP The routines \fBvpResample2D\fR and \fBvpResample3D\fR provide a simpler (but less flexible) interface to \fBvpResample\fR. 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. .PP The remainder of this man page describe \fBvpResample\fR. The \fIvpc\fR argument is a VolPack context that contains a description of the resampling filter. Use \fBvpSetFilter\fR to define the filter. The volume data and rendering parameters currently stored in the context are not affected by calls to \fBvpResample\fR. .PP The remaining arguments to \fBvpResample\fR describe the size and layout of the input and output arrays. The two arrays must have the same number of dimensions, specified by \fInum_dimens.\fR The sizes of the dimensions are specified by \fIsrc_dimens\fR and \fIdst_dimens\fR which are 1D arrays with \fInum_dimens\fR elements in each array. \fIsrc_dimens[0]\fR is the size of the input dimension to be resampled. \fIdst_dimens[0]\fR is the size of the output dimension after resampling, so the scale factor is dst_dimens[0] / src_dimens[0]. The remaining elements of \fIsrc_dimens\fR 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). .PP The \fIsrc_strides\fR and \fIdst_stride\fR 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 \fIsrc_dimens\fR. .PP The \fIelement_type\fR argument specifies the data type of each element of the input and output data arrays. The supported types are: .IP VP_UCHAR Unsigned character (1 byte per element). .IP VP_USHORT Unsigned short (2 bytes per element). .IP VP_FLOAT Single-precision floating point (4 bytes per element). .PP Finally, the last two arguments to \fBvpResample\fR are pointers to the first elements of the input and output arrays. .SH ERRORS The normal return value is VP_OK. The following error return values are possible: .IP VPERROR_BAD_SIZE No filter weight table has been specified. .SH SEE ALSO VolPack(3), vpSetFilter(3)