Re: Setting values to NaN with a macro
Posted by
james_minto on
Nov 06, 2015; 9:40am
URL: http://imagej.273.s1.nabble.com/Setting-values-to-NaN-with-a-macro-tp5014841p5014873.html
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?
The change in NaN behavior occurs between ImageJ version 1.50a and 1.50d (I haven't yet tried the intermediate versions to find out exactly where) and also with java versions 1.6, 1.7 and OpenJDK8.
If I create an 8-bit image with a block of 255 and a value of 1 everywhere else, then run the macro if(v==1)v=NaN, the 255 remains unchanged whilst the 1 is set to 0, not NaN.
Would anyone by able to test if they get the same behaviour with their setup?
Cheers
James