Re: Setting values to NaN with a macro

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Setting values to NaN with a macro

Miguel Tapia R.
Hi,

I've tested the following macro wrote by ctrueden:

newImage("Untitled", "8-bit black", 400, 400, 1);
run("32-bit");
makeRectangle(83, 88, 235, 228);
setForegroundColor(50, 50, 50);
run("Draw");
run("Macro...", "code=[if (v==0) v=NaN]");
print("(1, 1) = " + getPixel(1, 1));

on ImageJ 64-bit 1.51h and it show "0" again instead of "NaN", any suggestions? I need to be able to assign NaN values

Thanks in advance,

Miguel

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

Re: Setting values to NaN with a macro

Michael Schmid
Hi Miguel,

for me, the macro of Curtis works well
(ImageJ 1.51h; Java 1.6.0_65 [64-bit]; Mac OS X 10.6.8)

Note that the run("Macro...", ...) command, like almost all ImageJ
commands, is restricted to the current selection (= ROI, Region of
Interest).

So you get NaN inside the rectangle, but the values remain 0.0 outside
(there, the run("Macro...", ...) command has no effect)

Michael
________________________________________________________________
On 2016-11-15 02:23, Miguel Tapia R. wrote:

> Hi,
>
> I've tested the following macro wrote by ctrueden:
>
> newImage("Untitled", "8-bit black", 400, 400, 1);
> run("32-bit");
> makeRectangle(83, 88, 235, 228);
> setForegroundColor(50, 50, 50);
> run("Draw");
> run("Macro...", "code=[if (v==0) v=NaN]");
> print("(1, 1) = " + getPixel(1, 1));
>
> on ImageJ 64-bit 1.51h and it show "0" again instead of "NaN", any suggestions? I need to be able to assign NaN values
>
> Thanks in advance,
>
> Miguel

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

Re: Setting values to NaN with a macro

Herbie
In reply to this post by Miguel Tapia R.
Dear Miguel,

perhaps you try

print("(1, 1) = " + getPixel(200, 200));

instead of

print("(1, 1) = " + getPixel(1, 1));

HTH

Herbie

::::::::::::::::::::::::::::::::::::::::::::::
Am 15.11.16 um 02:23 schrieb Miguel Tapia R.:
> newImage("Untitled", "8-bit black", 400, 400, 1);
> run("32-bit");
> makeRectangle(83, 88, 235, 228);
> setForegroundColor(50, 50, 50);
> run("Draw");
> run("Macro...", "code=[if (v==0) v=NaN]");
> print("(1, 1) = " + getPixel(1, 1));

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

Re: Setting values to NaN with a macro

Miguel Tapia R.
In reply to this post by Miguel Tapia R.
Thanks a lot Michael and Herbie, you were right, i've tested now

newImage("Untitled", "8-bit black", 400, 400, 1);
run("32-bit");
makeRectangle(83, 88, 235, 228);
setForegroundColor(50, 50, 50);
run("Draw");
run("Macro...", "code=[if (v==0) v=NaN]");
print("(200, 200) = " + getPixel(200, 200));

and it works, i'll consider the ROI next time!,

Cheers


Miguel

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