Login  Register

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

Posted by Herbie on Jun 09, 2020; 2:31pm
URL: http://imagej.273.s1.nabble.com/setting-0-value-pixel-to-NaN-or-ignoring-pixels-0-tp5023459p5023460.html

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