Can i use CONTOUR to retrieve the subscripts within a closed contour? [message #93138] |
Sun, 01 May 2016 06:22  |
Beate
Messages: 1 Registered: May 2016
|
Junior Member |
|
|
Hi,
I use CONTOUR with the arguments path_info, path_xy, /path_data_coords and /closed to retrieve the subscripts of the closed contours.
Example:
contour, scl256img, levels=[80,130], path_info=info, path_xy=xy, /closed, /path_data_coords
npatch = n_elements(info) ; number of patches
for i = 0, (npatch-1) do begin ; loop over contours
s = [indgen(info(i).n), 0]
contourpath2D = xy[*, info(i).offset + s]
endfor
Q:
Can i use CONTOUR in a similar way to also retrieve the subscripts within the closed contours? Or is there another IDL procedure or function that can help me with this?
Thanks!
|
|
|
Re: Can i use CONTOUR to retrieve the subscripts within a closed contour? [message #93143 is a reply to message #93138] |
Mon, 02 May 2016 10:41  |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
On Sunday, May 1, 2016 at 8:22:04 AM UTC-5, Beate wrote:
> Hi,
> I use CONTOUR with the arguments path_info, path_xy, /path_data_coords and /closed to retrieve the subscripts of the closed contours.
>
> Example:
> contour, scl256img, levels=[80,130], path_info=info, path_xy=xy, /closed, /path_data_coords
> npatch = n_elements(info) ; number of patches
> for i = 0, (npatch-1) do begin ; loop over contours
> s = [indgen(info(i).n), 0]
> contourpath2D = xy[*, info(i).offset + s]
> endfor
>
> Q:
> Can i use CONTOUR in a similar way to also retrieve the subscripts within the closed contours? Or is there another IDL procedure or function that can help me with this?
>
> Thanks!
Rather than using CONTOUR, the easiest way is to just use a simple WHERE:
label_by_contour_level = VALUE_LOCATE([80, 130], scl256image)
above_130 = WHERE(label_by_contour_level eq 1)
between_80_and_130 = WHERE(label_by_contour_level eq 0)
below_80 = WHERE(label_by_contour_level eq -1)
-Jeremy.
|
|
|