Getting x and y positions from a mask [message #77087] |
Fri, 29 July 2011 03:32  |
S. Murray
Messages: 6 Registered: July 2010
|
Junior Member |
|
|
I am trying to obtain x and y coordinates of all the pixels within a
very specific mask that I have created (thresholded contour in an
image, but just one of the thresholded contours of the image, not all
of them). Firstly, I used the contour procedure (path_xy, path_info,
getting data coordinates...) and then used objects to get my mask from
this- something along the lines of here:
http://idlastro.gsfc.nasa.gov/idl_html_help/Programmatically _Defining_ROIs.html
I used 'mask_rule=2 'so I that I have a mask of all pixels falling on
or within a the regions boundary. I now have this mask array, which is
just a 2d byte array:
IDL> help,mask
MASK BYTE = Array[151, 151]
I want to find out what the x and y coordinates are of all pixels that
are '1's' in 'mask'. I wish to run a procedure on all pixels within
this contoured region but I cant figure out how to make an array of
the x and y coordinates. I know I could get the contour path pixels by
typing something like this from just the contour procedure:
line = [ LINDGEN( path_info[i].n ), 0 ]
path_coords=path_xy[*, path_info[i].offset + line]
But this does not include ALL pixels within the contoured region. I've
only ever come across the cursor procedure before which saves x and y
positions after clicking on the x display, however this won't exactly
be very useful for all 568 pixels in the mask!
Does anyone have any ideas? I don't know if its just because I'm not
proficient enough in IDL yet or if its because I've been working on
this for too long, but I have a feeling its a simple enough procedure
if I figure out what to use!
|
|
|