X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 23 Jun 2006 04:49 PM by  anon
contours
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
23 Jun 2006 04:49 PM
    I would like to save all the points that are inside a specific contour. Is there a function in IDL to test if a point lies inside or outside a contour? Thanks

    Deleted User



    New Member


    Posts:
    New Member


    --
    23 Jun 2006 04:49 PM
    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

    Deleted User



    New Member


    Posts:
    New Member


    --
    23 Jun 2006 04:49 PM
    what about using 'where' procedure ix = where( 2D_array ge min_value and 2D_array lt max_value, count ) dim = size( 2D_array ) result = fltarr( dim[1], dim[2] ) if ( count gt 0 ) then begin result[ix] = 2D_array[ix] endif end
    You are not authorized to post a reply.