Login  Register

NaN on Results window

Posted by Miguel Tapia R. on Nov 16, 2016; 7:58pm
URL: http://imagej.273.s1.nabble.com/NaN-on-Results-window-tp5017588.html

Hello everyone,

I would like to exchange "0" values I obtained from a 32-bit image to "NaN" in the Results window. I wrote the following macro:


newImage("Untitled", "8-bit black", 400, 400, 1);

run("32-bit");

nBins = 256;
histMin = 0;
histMax = 256;

        run("Clear Results");
        row=0;
   
getHistogram(values, counts, nBins, histMin, histMax);

        for (j=0; j<nBins; j++) {
      setResult("Bin", row, values[j]);
      setResult("Numbers", row, counts[j]);
      count = counts[j];
        if (count==0) count=NaN;
        updateResults();
        row++;

   name = getTitle;
   name = name + ".csv";

}

in the Results window, bin 0 has all the values (in this case 160000) and the rest of bins shows "0" and i would ask if it is possible to change 0 to NaN to be displayed.

Thanks in advance,


Miguel

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