setting 0 value pixel to NaN or ignoring pixels=0

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

setting 0 value pixel to NaN or ignoring pixels=0

O_W_H
Hi I currently have an image which have a condition whereby pixels on the
outer rows or columns are set to 0, following which the adjacent pixel are
also set to 0.

I now need to remove these zero pixel from my analysis e.g. so that when i
run my min function it does not include the zero and also when i apply a 9
point filter the 0 values in these rows/columns should not be taken into
consideration.

I am very new to imageJ and can't seem to find the best way to do this. I
changed the threshold which sorted the minimum value reported but it is
still affecting my filter.






--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: setting 0 value pixel to NaN or ignoring pixels=0

Herbie
Good day,

I can't perfectly follow what the situation is that you try to describe
but excluding value-defined areas of an image from further analyse is
rather easy if the image is achromatic (gray-levels only).

1. Change the image type to 32bit

2. Apply the following macro function:
"
*changeValues(v1, v2, v3)*
Changes pixels in the image or selection that have a value in the range
v1-v2 to v3. For example, changeValues(0,5,5) changes all pixels less
than 5 to 5, and changeValues(0x0000ff,0x0000ff,0xff0000) changes all
blue pixels in an RGB image to red. In ImageJ 1.52d or later, use
changeValues(NaN,NaN,value) to replaces NaN values.
"

If you want to exclude all pixels that are of value zero, use:

        changeValues( 0, 0, NaN );

Paste the above macro line to an empty macro window (Plugins >> New >>
Macro) and run it.


HTH

Herbie

:::::::::::::::::::::::::::::::::::
Am 09.06.20 um 16:04 schrieb O_W_H:

> Hi I currently have an image which have a condition whereby pixels on the
> outer rows or columns are set to 0, following which the adjacent pixel are
> also set to 0.
>
> I now need to remove these zero pixel from my analysis e.g. so that when i
> run my min function it does not include the zero and also when i apply a 9
> point filter the 0 values in these rows/columns should not be taken into
> consideration.
>
> I am very new to imageJ and can't seem to find the best way to do this. I
> changed the threshold which sorted the minimum value reported but it is
> still affecting my filter.
>
>
>
>
>
>
> --
> Sent from: http://imagej.1557.x6.nabble.com/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: setting 0 value pixel to NaN or ignoring pixels=0

Fred Damen
In reply to this post by O_W_H
Greetings,

Process>Math>Macro...
if(x==255&&v=0)v=NaN

In most, but not all, Process ignores NaN.  Above will set zeros in column
255 (last column in 256x256 image) to NaN. I do not know how to address
two columns at once, although other macro functionality can be used in the
statement.
If this is not enough then
Plugin>New>Macro

Enjoy,

Fred

On Tue, June 9, 2020 9:04 am, O_W_H wrote:

> Hi I currently have an image which have a condition whereby pixels on the
> outer rows or columns are set to 0, following which the adjacent pixel are
> also set to 0.
>
> I now need to remove these zero pixel from my analysis e.g. so that when i
> run my min function it does not include the zero and also when i apply a 9
> point filter the 0 values in these rows/columns should not be taken into
> consideration.
>
> I am very new to imageJ and can't seem to find the best way to do this. I
> changed the threshold which sorted the minimum value reported but it is
> still affecting my filter.
>
>
>
>
>
>
> --
> Sent from: http://imagej.1557.x6.nabble.com/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html