|
Re: Grayscale AND Binary Image [message #29683 is a reply to message #29577] |
Mon, 11 March 2002 07:41  |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
"Alex Schuster" <alex@pet.mpin-koeln.mpg.de> wrote in message
news:3C8C87B9.AB9F06DC@pet.mpin-koeln.mpg.de...
> And the indices _are_ already there, they are in the index array. If you
> need them as coordinates, you can calculate them like this:
>
> x_coord = index mod x_dim
> y_coord = index / y_dim
That may be a typo. In this kind of calculation, you would usually have:
y_coord = index / x_dim
^
Cheers,
--
-Dick
Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
|
|
|
Re: Grayscale AND Binary Image [message #29686 is a reply to message #29577] |
Mon, 11 March 2002 02:32  |
Alex Schuster
Messages: 124 Registered: February 1997
|
Senior Member |
|
|
Akhila wrote:
>> For example, instead of
>>
>> new_img = original_img * mask_img
>>
>> you can do it that way:
>>
>> index = where( mask_img eq 1 )
>> new_img = 0 * original_img
>> new_img[index] = original_img[index]
>>
>> or:
>>
>> index = where( mask_img eq 0 )
>> new_img = original_img
>> new_img[index] = 0
>>
>> Alex
> yes. i want to get the indices of the pixels in the
> masked region and plot them in the original image.
>
> The idea you had suggested does the same thing as *
Correct, it was just indended as an example for where().
> i'm not sure if i can get the indices only (pixel
> location and not the value of the pixel) in a variable
> and then use those values to mask the original image
> and set the values of rest of the pixels to 0 in the
> original image.
>
> I hope i'm clear this time.
Sorry, I still don't understand. Why doesn't the code above already do
what you want?
And the indices _are_ already there, they are in the index array. If you
need them as coordinates, you can calculate them like this:
x_coord = index mod x_dim
y_coord = index / y_dim
Alex
--
Alex Schuster Wonko@planet-interkom.de
alex@pet.mpin-koeln.mpg.de
|
|
|
Re: Grayscale AND Binary Image [message #29704 is a reply to message #29577] |
Fri, 08 March 2002 12:45  |
idlfreak
Messages: 47 Registered: October 2001
|
Member |
|
|
yes. i want to get the indices of the pixels in the
masked region and plot them in the original image.
The idea you had suggested does the same thing as *
i'm not sure if i can get the indices only (pixel
location and not the value of the pixel) in a variable
and then use those values to mask the original image
and set the values of rest of the pixels to 0 in the
original image.
I hope i'm clear this time.
Thanx for ur time.
-Akhila.
Wonko@netcologne.de (Alex Schuster) wrote in message news:<8KOj1SOed8B@netcologne.de>...
> idlfreak@yahoo.com (Akhila) wrote:
>
>> I have the same size window for both the images. Is there any way
>> that i can get the region(pixel value) from the binary image and
>> obtain the same pixels in the original image. If that's possible
>> it'd be more ideal as that's the result i want.
>> Help me please !!!
>
> I'm not sure what you mean... do you want to get the indices of the
> pixels which are set to 1 in your mask image? Then have a look at the
> WHERE() function.
>
> For example, instead of
>
> new_img = original_img * mask_img
>
> you can do it that way:
>
> index = where( mask_img eq 1 )
> new_img = 0 * original_img
> new_img[index] = original_img[index]
>
> or:
>
> index = where( mask_img eq 0 )
> new_img = original_img
> new_img[index] = 0
>
>
> Alex
|
|
|
Re: Grayscale AND Binary Image [message #29715 is a reply to message #29577] |
Thu, 07 March 2002 14:23  |
Wonko[2]
Messages: 6 Registered: March 2002
|
Junior Member |
|
|
idlfreak@yahoo.com (Akhila) wrote:
> I have the same size window for both the images. Is there any way
> that i can get the region(pixel value) from the binary image and
> obtain the same pixels in the original image. If that's possible
> it'd be more ideal as that's the result i want.
> Help me please !!!
I'm not sure what you mean... do you want to get the indices of the
pixels which are set to 1 in your mask image? Then have a look at the
WHERE() function.
For example, instead of
new_img = original_img * mask_img
you can do it that way:
index = where( mask_img eq 1 )
new_img = 0 * original_img
new_img[index] = original_img[index]
or:
index = where( mask_img eq 0 )
new_img = original_img
new_img[index] = 0
Alex
--
Alex Schuster Wonko@netcologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de
|
|
|