1vpResample(3) Library Functions Manual vpResample(3)
2
3
4
6 vpResample, vpResample2D, vpResample3D - resample an array
7
9 #include <volpack.h>
10
11 vpResult
12 vpResample(vpc, num_dimens, src_dimens, dst_dimens, src_strides,
13 dst_strides, element_type, src_array, dst_array)
14 vpContext *vpc;
15 int num_dimens;
16 int *src_dimens, *dst_dimens;
17 int *src_strides, *dst_strides;
18 int element_type;
19 void *src_array, *dst_array;
20
21 vpResult
22 vpResample2D(src_array, src_x, src_y, dst_array, dst_x, dst_y, ele‐
23 ment_type, filter_type)
24 void *src_array;
25 int src_x, src_y;
26 void *dst_array;
27 int dst_x, dst_y;
28 int element_type;
29 int filter_type;
30
31 vpResult
32 vpResample3D(src_array, src_x, src_y, src_z, dst_array, dst_x, dst_y,
33 dst_z, element_type, filter_type)
34 void *src_array;
35 int src_x, src_y, src_z;
36 void *dst_array;
37 int dst_x, dst_y, dst_z;
38 int element_type;
39 int filter_type;
40
42 vpc VolPack context from vpCreateContext.
43
44 num_dimens
45 Number of dimensions in the input and output arrays.
46
47 src_dimens
48 Array containing the dimensions of the input array.
49
50 dst_dimens
51 Array containing the dimensions of the output array.
52
53 src_strides
54 Array containing the strides for each dimension of the input
55 array.
56
57 dst_strides
58 Array containing the strides for each dimension of the output
59 array.
60
61 element_type
62 Constant specifying the data type of the array elements
63 (VP_UCHAR, VP_USHORT, VP_FLOAT).
64
65 src_array
66 Input array containing input data.
67
68 dst_array
69 Output array for result data.
70
71 src_x, src_y, src_z
72 Dimensions of the input array.
73
74 dst_x, dst_y, dst_z
75 Dimensions of the result array.
76
77 filter_type
78 Constant specifying one of the predefined filters (VP_BOX_FIL‐
79 TER, VP_LINEAR_FILTER, VP_GAUSSIAN_FILTER, VP_BSPLINE_FILTER,
80 VP_MITCHELL_FILTER).
81
83 vpResample is used to resample an array to a new grid with a different
84 resolution. It can be used to scale up or decimate an array of volume
85 data, for instance. An arbitrary separable space-invariant resampling
86 filter can be specified via a lookup table containing filter weights.
87 The input array may have an arbitrary number of dimensions, but on each
88 call to vpResample only one dimension of the array is resampled. To
89 scale all dimensions call the routine once for each dimension. Trans‐
90 formations other than scales (e.g. rotations and shears) are not sup‐
91 ported by these routines.
92
93 The routines vpResample2D and vpResample3D provide a simpler (but less
94 flexible) interface to vpResample. They take as arguments an input
95 array with its dimensions, an output array with its dimensions, and a
96 constant specifying a filter. The input array is resampled once for
97 each dimension and then stored in the output array. These two routines
98 automatically create a filter weight table and arrays for temporary
99 results.
100
101 The remainder of this man page describe vpResample. The vpc argument
102 is a VolPack context that contains a description of the resampling fil‐
103 ter. Use vpSetFilter to define the filter. The volume data and ren‐
104 dering parameters currently stored in the context are not affected by
105 calls to vpResample.
106
107 The remaining arguments to vpResample describe the size and layout of
108 the input and output arrays. The two arrays must have the same number
109 of dimensions, specified by num_dimens. The sizes of the dimensions
110 are specified by src_dimens and dst_dimens which are 1D arrays with
111 num_dimens elements in each array. src_dimens[0] is the size of the
112 input dimension to be resampled. dst_dimens[0] is the size of the out‐
113 put dimension after resampling, so the scale factor is dst_dimens[0] /
114 src_dimens[0]. The remaining elements of src_dimens give the sizes of
115 the other input array dimensions in any order (although some orderings
116 result in faster execution due to lower memory overhead). The other
117 output array dimensions are ignored (although they should be the same
118 as the corresponding input array dimensions since only one dimensions
119 is resampled).
120
121 The src_strides and dst_stride arguments are 1D arrays that contain a
122 stride in bytes for each dimension of the input and output arrays,
123 stored in the same order as the dimensions sizes in src_dimens.
124
125 The element_type argument specifies the data type of each element of
126 the input and output data arrays. The supported types are:
127
128 VP_UCHAR
129 Unsigned character (1 byte per element).
130
131 VP_USHORT
132 Unsigned short (2 bytes per element).
133
134 VP_FLOAT
135 Single-precision floating point (4 bytes per element).
136
137 Finally, the last two arguments to vpResample are pointers to the first
138 elements of the input and output arrays.
139
141 The normal return value is VP_OK. The following error return values
142 are possible:
143
144 VPERROR_BAD_SIZE
145 No filter weight table has been specified.
146
148 VolPack(3), vpSetFilter(3)
149
150
151
152VolPack vpResample(3)