DVcrop_rect


Synopsis

extract a subset of a rectilinear field


group DVcrop_rect {
Mesh_Rect+Node_Data+Iparam &in {
xform_nonotify;
nnodes+req;
};
int+Iparam min[in.ndim];
int+Iparam max[in.ndim];
Mesh_Rect+Node_Data+Oparam out{
&xform<weight=-1> => in.xform;
};
method+notify_val+notify_inst upd_crop = "crop_rect";
} ;

Description

DVcrop_rect reduces the size of a Mesh_Rect field by extracting the data within a specified range of its dimensions. The process is analogous to "cropping" a photographic image. Typical uses are to eliminate uninteresting portions of the data and to increase processing speed by reducing the amount of data.

Input

&in

A reference to an input that contains a Mesh_Rect and Node_Data.

min[in.ndim]
max[in.ndim]

Integers. These are references to 1D arrays that will hold the minimum and maximum X (Y, and Z) coordinates for the cropping operation. The arrays take their length from the ndim of the input Grid_Struct, i.e., a 1D mesh needs only 1 array element to specify X min and max coordinates, a 2D mesh needs 2 array elements for X and Y, etc.

Output

out

The output field contains a new Mesh_Rect. Its points array (extents) are modified to retain the mesh's position in space.

For example, the following 1D field has a points array (extents) from 0 to 49.


1 2 3 4
01234567890123456789012345678901234567890123456789

You crop the field using an I min of 30 and an I max of 49. The output field has coordinate indices from 0 to 19 and a points array from 30 to 49.


3 4
..............................01234567890123456789

The output field also contains a new Node_Data that has the data within the cropped region.

Files

v/dv.v
modules/crop.c

Example

Libraries.Main.Filters.crop

See also