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 
Return to the default flat view Create a new topic Submit Reply
Re: label_region/histogram help [message #68547] Tue, 03 November 2009 14:54 Go to previous 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
[Message index]
 
Read Message
Read Message
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: Fri Oct 10 15:30:14 PDT 2025

Total time taken to generate the page: 0.80216 seconds