extract
Contents: Description, Arguments, Usage, Examples Supported Under Version: >1.69 Current Davinci Version: 2.27 64-bit Safe: Yes
Description Extracts portions of a VAL orthogonal to a given mask
Arguments and Return Values Arguments: A data array and a mask array Return Value: A data array extracted from input
Usage Syntax: extract(object = VAL, mask = VAL [, axis = STRING]) 'object' - data to extract from 'mask' - non-zero location specifies data to extract 'axis' - indicates how to arrange extracted pieces This routine will extract portions of the object orthogonal to the mask and coresponding to the points where the mask is set. This function is intended to speed the extraction of higher dimensional data from lower dimensional masks. For example, the commands: obj = create (10,10,10); mask = create(10,10,1, format=BYTE, start=0, step=0); mask[1,1] = mask[2,2] = mask[3,3] = 1; data = extract (obj, mask, axis="x"); would extract and return 'data' as a 3x1x10 VAR. The extract() function locates each non-zero bit in 'mask', and grabs the portion of 'obj' that is specified by that mask bit. Visualize the 10x10x1 'mask' as a 2D plane and the 10x10x10 'obj' as a 3D cube. Any point in the 2D 'mask' plane then uniquely specifies a 1x1x10 line in the 'obj' cube. The extract() function extracts each of these 1x1x10 objects and stacks them together. The pieces can be stacked together along either the x or y axes. Since the function has no assumptions about what the user wants, the user must specify the axis that pieces should be added along. To get a 1x3x10 VAR in 'data', the user could have specified axis="y" instead. When the mask can be described as a 1D line and the object as a 3D cube, each mask bit specifies a 2D plane. The planes can be stacked together in only one way, so the user does not have to specify an axis in that case. The VAL/mask combinations are listed below, with example sizes in the last three columns. The N used in the outputs is the number of mask bits set.
Examples dv> # load PDS qube to select spectra from dv> qube = load_pds(filename).qube.data; dv> # user wants to view the spectra under every 20th pixel in the x/y plane dv> mask = create(dim(qube)[1],dim(qube)[2],1, format=BYTE); dv> mask[] = 0; dv> mask[1::20,1::20] = 1; dv> # extract the selections and shape them into Nx1xZ VAR, where N is the dv> # num. of mask bits set and Z is the num. of bands in the qube. dv> spectra = extract (qube,mask,axis="x"); dv> # plot the selections dv> xplot (spectra, axis=z); |
DavinciWiki Mini-Nav Bar Contents
Contact Developers
All other topics
Recent Core Changes Modified On: 07-06-2009 |