comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Another "How to efficiently do this in IDL" question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Another "How to efficiently do this in IDL" question [message #78105] Fri, 21 October 2011 15:15 Go to next message
Robin Wilson is currently offline  Robin Wilson
Messages: 40
Registered: August 2010
Member
Hi all,

I've got a 2D integer array. For every cell in the array I want to do
the following:

1. Get the points that lie on a horizontal profile 7 cells long, with
the current cell as the central cell.

2. Find out if there are two (or more) points on both sides of the
central point that have a lower value than the central point. If so,
then mark this point in a separate array.

I can think of loads of ways to do this using very inefficient for loops
and lots of horrible code, but are there any particularly nice ways to
do this in IDL.

It looks to me like I'd have to loop over every cell in the array - it's
not something I could do all at once - but I'm willing to be corrected.

The other main question is that if I've got an array of points like the
following:

1 3 3 5 6 2 1
*

What is an efficient way to check that there are at least two points on
each side of the central point (marked with a star) that have a lower
value than it. My original thought was to loop through the cells, but I
suspect some fancy histogram command could do something to help with this...

Any advice would be most appreciated.

Cheers,

Robin
------------------
Robin Wilson
A PhD student studying complexity in remote sensing
www.rtwilson.com/academic
Re: Another "How to efficiently do this in IDL" question [message #78304 is a reply to message #78105] Thu, 03 November 2011 14:56 Go to previous message
JDS is currently offline  JDS
Messages: 94
Registered: March 2009
Member
On Friday, October 21, 2011 6:15:09 PM UTC-4, robintw wrote:
>
> The other main question is that if I've got an array of points like the
> following:
>
> 1 3 3 5 6 2 1
> *
>
> What is an efficient way to check that there are at least two points on
> each side of the central point (marked with a star) that have a lower
> value than it. My original thought was to loop through the cells, but I
> suspect some fancy histogram command could do something to help with this...
>

You can find all the "5 point peaks" relatively efficiently:

wh=where(d gt ((m=median(d,3))) and smooth((d eq m)*(n-2),n-2) eq n-3)

n=5 in your case.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Pixel modification after classification
Next Topic: Re: UTM Map Projection Produces Incorrect Results

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:38:19 PDT 2025

Total time taken to generate the page: 0.00627 seconds