Posted by
Rasband, Wayne (NIH/NIMH) [E] on
Nov 06, 2015; 4:34pm
URL: http://imagej.273.s1.nabble.com/Setting-values-to-NaN-with-a-macro-tp5014841p5014880.html
>> On Nov 6, 2015, at 4:40 AM, james_minto <
[hidden email]> wrote:
>>
>> james_minto wrote
>>> In versions 1.44p and earlier, I could set zero values as NaN (not a
>>> number) with the following macro:
>>>
>>> if(v==0)v=NaN;
>>>
>>> In version 1.50d this does not work (no change to the image), but it also
>>> doesn't give an error message. This problem happens for all image types
>>> I've tested (8-bit, 32-bit, RGB) and in both Fiji and plain ImageJ.
>>>
>>> Has the syntax for defining NaN changed at some point between version
>>> 1.44p and 1.50d?
>>>
>>> Does any one know of an alternative method to set pixels than meet a
>>> certain criteria as NaN?
This regression is fixed in the latest ImageJ daily build (1.50e13). Here is a test macro that reproduces the problem.
newImage("Untitled", "32-bit black", 400, 400, 1);
run("Macro...", "code=[if (v==0) v=NaN]");
print("(0, 0) = " + getPixel(0, 0));
On ImageJ 1.50e13, it outputs
(0, 0) = NaN
On ImageJ 1.50d it outputs
(0, 0) = 0
-wayne
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html