If you are working with IDL Direct Graphics this takes a couple of steps. You start by implementing CONTOUR's 'PATH_...' keywords, e.g:
CONTOUR, mydata, PATH_INFO=pathInfo, PATH_XY=pathXY, $
/PATH_DATA_COORDS, CLOSED=0
You use the info from the variables returned by PATH_INFO and PATH_XY (note particularly 'pathInfo[].offset' and 'pathInfo[].n') to create IDL ROI objects). The object class used would be IDLanROI, and it might be initiated with code like:
contour2vertexIndices = [lindgen(pathinfo[2].n, 0] + pathInfo[2].offset
contour2vertices = pathXY[*, contour2vertexIndices]
oROI2 = obj_new('IDLanROI', contour2vertices)
Now you can use the 'IDLanROI' method 'ContainsPoints' to test whether a given point or set of points is inside your contour line:
if oROI2->ContainsPoints([10.2, 79.9]) then ...
That is how one might set up a test for given points. To simple capture all the points inside the contour that has been captured as an "ROI" object use IDLanROI's 'ComputeMask' method. For example:
myContour2mask = oROI2->ComputeMask(DIMENSIONS=contourWindowDims)
will return a 2D graphic that has set to zero all the points that are outside your contour boundary.
James Jones
|