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

Home » Public Forums » archive » Re: label_region/histogram help
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
Re: label_region/histogram help [message #68547] Tue, 03 November 2009 14:54 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Dave wrote:

> I need some help on an image I'm working on.
>
> I've got many regions that I've distinguished via LABEL_REGION and
> looked at the population of the regions using HISTOGRAM.  Most of
> these regions have a population of less than 5 or so.  For these
> regions I have made the population zero by:
>
> im_pop = where(areas lt 5, numbers)
> if numbers lt 5 then area[im_pop]=0
>
> After I've got the populations of my regions where I want, for the
> most part, I need to get all the regions, including the 0 population
> regions, back into pixel space for display.  I cannot for the life of
> me figure this out.

Presumably you have your original image, let's call it image.
I assume it is Long Integers.

You have your Label_Region result, call it labelRegion.

So,to restore the regions from your orginal images, you would
do something like this:

s = Size(image, /Dimensions)
displayImage = LonArr(s[0]. s[1])
FOR j=1,Max(labelRegion)-1 DO BEGIN
thisRegion = Where(labelRegion EQ j, count)
IF count EQ 0 THEN Continue
displayImage[thisRegion] = image[thisRegion]
ENDFOR
TVImage, BytScl(displayImage)

This could be faster using the reverse indices to the Histogram
command, but *much* harder to explain. :-)

Cheers,

David
Re: label_region/histogram help [message #68660 is a reply to message #68547] Fri, 06 November 2009 09:03 Go to previous message
david.b.valdez is currently offline  david.b.valdez
Messages: 3
Registered: December 2008
Junior Member
On Nov 3, 3:54 pm, David Fanning <da...@dfanning.com> wrote:
> Dave wrote:
>> I need some help on an image I'm working on.
>
>> I've got many regions that I've distinguished via LABEL_REGION and
>> looked at the population of the regions using HISTOGRAM.  Most of
>> these regions have a population of less than 5 or so.  For these
>> regions I have made the population zero by:
>
>> im_pop = where(areas lt 5, numbers)
>> if numbers lt 5 then area[im_pop]=0
>
>> After I've got the populations of my regions where I want, for the
>> most part, I need to get all the regions, including the 0 population
>> regions, back into pixel space for display.  I cannot for the life of
>> me figure this out.
>
> Presumably you have your original image, let's call it image.
> I assume it is Long Integers.
>
> You have your Label_Region result, call it labelRegion.
>
> So,to restore the regions from your orginal images, you would
> do something like this:
>
>    s = Size(image, /Dimensions)
>    displayImage = LonArr(s[0]. s[1])
>    FOR j=1,Max(labelRegion)-1 DO BEGIN
>        thisRegion = Where(labelRegion EQ j, count)
>        IF count EQ 0 THEN Continue
>        displayImage[thisRegion] = image[thisRegion]
>    ENDFOR
>    TVImage, BytScl(displayImage)
>
> This could be faster using the reverse indices to the Histogram
> command, but *much* harder to explain. :-)
>
> Cheers,
>
> David

Thanks so much, that's exactly what i was looking for.

Dave
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Matrix Exponential
Next Topic: Re: IDL 7.0 under ubuntu 9.10

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

Current Time: Wed Oct 08 18:39:17 PDT 2025

Total time taken to generate the page: 0.00512 seconds