Re: Automatic Segmentation of a region [message #29578] |
Wed, 06 March 2002 19:54 |
idlfreak
Messages: 47 Registered: October 2001
|
Member |
|
|
hi,
sorry abt that question. I figured out the function of max_subscript
and there was some small problem in the logic and i fixed it. Sorry
abt this question.
cheers
Akhila
idlfreak@yahoo.com (Akhila) wrote in message news:<b1ad7b05.0203061408.5a5ae0ea@posting.google.com>...
> HI,
> Thanx for the help Martin Downing. But i'm not able to understand
> the function of max_subscript. When i'm plotting a histogram for the
> image i have, the max region is the outer black. But i don't want that
> and i want the second highest region.
> So i tried this command:
>
> Histo = Histogram(image, min = 0, binsize = 1)
> max_area = max(Histo(Where(Histo lt 150000)), max_label)
> imagefin = image eq max_label
> tv, imagefin
>
> There's no image. I ahve no idea why. But the max region i get now is
> the one that i want. Please help me with this and tell me what
> max_subscript does.
>
> Thank you in advance for ur help and time.
>
> Cheers,
> Akhila.
>
>
> hradilv.nospam@yahoo.com (Vince) wrote in message news:<3c84d7c2.602066575@news>...
>> On Mon, 4 Mar 2002 13:59:39 -0000, "Martin Downing"
>> <martin.downing@ntlworld.com> wrote:
>>
>>>
>>> "Akhila" <idlfreak@yahoo.com> wrote in message
>>> news:b1ad7b05.0203031342.226685ea@posting.google.com...
>>>> Hi,
>>>> I have a small problem in segmentation. I first threshold a image and
>>>> then i perform morphological operations on the binary image. Using
>>>> label_regions i've identified all the blobs. I used the where function
>>>> to get the regions in each blob. I have one huge blob and the rest are
>>>> small. I want to make all the pixels in the small blob as 0.
>>>> I tried the following:
>>>>
>>>> Method1:
>>>>
>>>> im = Origimage and morphimage
>>>> tv,image
>>>>
>>>
>>> I havent a clue how this would be what you want, try adding a comment to say
>>> what it should be doing
>>>
>>>> Method 2:
>>>>
>>>> for j = 1, noofblobs do begin
>>>> region = Where (morphimage eq j)
>>>> Area = n_elements(region)
>>>> if (Area le 80000) then begin
>>>> morphimage[region] = 0B
>>>> endif
>>>> endfor
>>>>
> refering also to:
>>>> ... I have one huge blob and the rest are
>>>> small. I want to make all the pixels in the small blob as 0.
>>>
>>> or to put it another way, you want everything but the large blob to be 0,
>>> and the large blob set to 1?
>>> this method is taken from working code
>>> ==============================
>>> ; threshold_image could be from an segmentation routine
>>> ;e.g.: threshold_image = image LT 100b
>>>
>>> label_im = label_region1(threshold_image)
>>>
>>> ; use histogram to count area of each labeled region (blob)
>>> area = histogram(label_im, min=0, binsize = 1))
>>>
>>> ; if you want just the blob of maximum area:
>>> max_area = max(area,max_label)
>>>
>>> ; now create a binary mask of the biggest blob
>>> big_blob = label_im eq max_label
>>>
>>> ; and display it
>>> tvscl, big_blob
>>
>> I suspect that using tvscl (instead of tv) is the crux of the
>> problem?
>>
>>> ======================
>>>
>>> hope this help you,
>>>
>>> cheers
>>>
>>> Martin
>>>
>>>
>>> ----------------------------------------
>>> Martin Downing,
>>> Clinical Research Physicist,
>>> Grampian Orthopaedic RSA Research Centre,
>>> Woodend Hospital, Aberdeen, AB15 6LS.
>>>
>>>
>>>
|
|
|
Re: Automatic Segmentation of a region [message #29579 is a reply to message #29578] |
Wed, 06 March 2002 14:08  |
idlfreak
Messages: 47 Registered: October 2001
|
Member |
|
|
HI,
Thanx for the help Martin Downing. But i'm not able to understand
the function of max_subscript. When i'm plotting a histogram for the
image i have, the max region is the outer black. But i don't want that
and i want the second highest region.
So i tried this command:
Histo = Histogram(image, min = 0, binsize = 1)
max_area = max(Histo(Where(Histo lt 150000)), max_label)
imagefin = image eq max_label
tv, imagefin
There's no image. I ahve no idea why. But the max region i get now is
the one that i want. Please help me with this and tell me what
max_subscript does.
Thank you in advance for ur help and time.
Cheers,
Akhila.
hradilv.nospam@yahoo.com (Vince) wrote in message news:<3c84d7c2.602066575@news>...
> On Mon, 4 Mar 2002 13:59:39 -0000, "Martin Downing"
> <martin.downing@ntlworld.com> wrote:
>
>>
>> "Akhila" <idlfreak@yahoo.com> wrote in message
>> news:b1ad7b05.0203031342.226685ea@posting.google.com...
>>> Hi,
>>> I have a small problem in segmentation. I first threshold a image and
>>> then i perform morphological operations on the binary image. Using
>>> label_regions i've identified all the blobs. I used the where function
>>> to get the regions in each blob. I have one huge blob and the rest are
>>> small. I want to make all the pixels in the small blob as 0.
>>> I tried the following:
>>>
>>> Method1:
>>>
>>> im = Origimage and morphimage
>>> tv,image
>>>
>>
>> I havent a clue how this would be what you want, try adding a comment to say
>> what it should be doing
>>
>>> Method 2:
>>>
>>> for j = 1, noofblobs do begin
>>> region = Where (morphimage eq j)
>>> Area = n_elements(region)
>>> if (Area le 80000) then begin
>>> morphimage[region] = 0B
>>> endif
>>> endfor
>>>
> refering also to:
>>> ... I have one huge blob and the rest are
>>> small. I want to make all the pixels in the small blob as 0.
>>
>> or to put it another way, you want everything but the large blob to be 0,
>> and the large blob set to 1?
>> this method is taken from working code
>> ==============================
>> ; threshold_image could be from an segmentation routine
>> ;e.g.: threshold_image = image LT 100b
>>
>> label_im = label_region1(threshold_image)
>>
>> ; use histogram to count area of each labeled region (blob)
>> area = histogram(label_im, min=0, binsize = 1))
>>
>> ; if you want just the blob of maximum area:
>> max_area = max(area,max_label)
>>
>> ; now create a binary mask of the biggest blob
>> big_blob = label_im eq max_label
>>
>> ; and display it
>> tvscl, big_blob
>
> I suspect that using tvscl (instead of tv) is the crux of the
> problem?
>
>> ======================
>>
>> hope this help you,
>>
>> cheers
>>
>> Martin
>>
>>
>> ----------------------------------------
>> Martin Downing,
>> Clinical Research Physicist,
>> Grampian Orthopaedic RSA Research Centre,
>> Woodend Hospital, Aberdeen, AB15 6LS.
>>
>>
>>
|
|
|
Re: Automatic Segmentation of a region [message #29615 is a reply to message #29579] |
Tue, 05 March 2002 06:36  |
hradilv.nospam
Messages: 19 Registered: November 2001
|
Junior Member |
|
|
On Mon, 4 Mar 2002 13:59:39 -0000, "Martin Downing"
<martin.downing@ntlworld.com> wrote:
>
> "Akhila" <idlfreak@yahoo.com> wrote in message
> news:b1ad7b05.0203031342.226685ea@posting.google.com...
>> Hi,
>> I have a small problem in segmentation. I first threshold a image and
>> then i perform morphological operations on the binary image. Using
>> label_regions i've identified all the blobs. I used the where function
>> to get the regions in each blob. I have one huge blob and the rest are
>> small. I want to make all the pixels in the small blob as 0.
>> I tried the following:
>>
>> Method1:
>>
>> im = Origimage and morphimage
>> tv,image
>>
>
> I havent a clue how this would be what you want, try adding a comment to say
> what it should be doing
>
>> Method 2:
>>
>> for j = 1, noofblobs do begin
>> region = Where (morphimage eq j)
>> Area = n_elements(region)
>> if (Area le 80000) then begin
>> morphimage[region] = 0B
>> endif
>> endfor
>>
> refering also to:
>> ... I have one huge blob and the rest are
>> small. I want to make all the pixels in the small blob as 0.
>
> or to put it another way, you want everything but the large blob to be 0,
> and the large blob set to 1?
> this method is taken from working code
> ==============================
> ; threshold_image could be from an segmentation routine
> ;e.g.: threshold_image = image LT 100b
>
> label_im = label_region1(threshold_image)
>
> ; use histogram to count area of each labeled region (blob)
> area = histogram(label_im, min=0, binsize = 1))
>
> ; if you want just the blob of maximum area:
> max_area = max(area,max_label)
>
> ; now create a binary mask of the biggest blob
> big_blob = label_im eq max_label
>
> ; and display it
> tvscl, big_blob
I suspect that using tvscl (instead of tv) is the crux of the
problem?
> ======================
>
> hope this help you,
>
> cheers
>
> Martin
>
>
> ----------------------------------------
> Martin Downing,
> Clinical Research Physicist,
> Grampian Orthopaedic RSA Research Centre,
> Woodend Hospital, Aberdeen, AB15 6LS.
>
>
>
|
|
|
Re: Automatic Segmentation of a region [message #29627 is a reply to message #29615] |
Mon, 04 March 2002 05:59  |
Martin Downing
Messages: 136 Registered: September 1998
|
Senior Member |
|
|
"Akhila" <idlfreak@yahoo.com> wrote in message
news:b1ad7b05.0203031342.226685ea@posting.google.com...
> Hi,
> I have a small problem in segmentation. I first threshold a image and
> then i perform morphological operations on the binary image. Using
> label_regions i've identified all the blobs. I used the where function
> to get the regions in each blob. I have one huge blob and the rest are
> small. I want to make all the pixels in the small blob as 0.
> I tried the following:
>
> Method1:
>
> im = Origimage and morphimage
> tv,image
>
I havent a clue how this would be what you want, try adding a comment to say
what it should be doing
> Method 2:
>
> for j = 1, noofblobs do begin
> region = Where (morphimage eq j)
> Area = n_elements(region)
> if (Area le 80000) then begin
> morphimage[region] = 0B
> endif
> endfor
>
refering also to:
> ... I have one huge blob and the rest are
> small. I want to make all the pixels in the small blob as 0.
or to put it another way, you want everything but the large blob to be 0,
and the large blob set to 1?
this method is taken from working code
==============================
; threshold_image could be from an segmentation routine
;e.g.: threshold_image = image LT 100b
label_im = label_region1(threshold_image)
; use histogram to count area of each labeled region (blob)
area = histogram(label_im, min=0, binsize = 1))
; if you want just the blob of maximum area:
max_area = max(area,max_label)
; now create a binary mask of the biggest blob
big_blob = label_im eq max_label
; and display it
tvscl, big_blob
======================
hope this help you,
cheers
Martin
----------------------------------------
Martin Downing,
Clinical Research Physicist,
Grampian Orthopaedic RSA Research Centre,
Woodend Hospital, Aberdeen, AB15 6LS.
|
|
|