Login  Register

question why getResult("Label",i) returns NaN instead of string

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

question why getResult("Label",i) returns NaN instead of string

Cammer, Michael-3
51 posts
Would somebody please help regarding whether this is a bug or I am coding this macro incorrectly?

When I try to use getResult("Label", i), the result is NaN.

For instance,

labels = newArray(nResults);
for (i=0; i<nResults; i++) {
labels[i] = getResult("Label", i);
redmeans[i] = getResult("Mean", i);
}  // end get red intensitites

correctly puts the red intensities in an array but the labels array is all NaN.  I also tried a = getResult("Label", i) and a is assigned NaN.

Example Results table data:

Label Area Mean
1 C2-_test_90_IFN_01-1:0001-0007 0.83 15.69
2 C2-_test_90_IFN_01-1:0002-0011 2.19 11.90
3 C2-_test_90_IFN_01-1:0003-0010 0.71 13.19
4 C2-_test_90_IFN_01-1:0004-0020 1.28 11.65

I can get the ROI names from the ROI Manager instead, but curious why this does not work.


Thank you!


Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory

NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY  10016

[hidden email]<mailto:[hidden email]>  http://nyulmc.org/micros  http://microscopynotes.com/

Voice direct only, no text or messages:  1-914-309-3270 and 1-646-501-0567


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

Re: question why getResult("Label",i) returns NaN instead of string

Wayne Rasband-2
427 posts
> On May 10, 2020, at 10:49 PM, Cammer, Michael <[hidden email]> wrote:
>
> Would somebody please help regarding whether this is a bug or I am coding this macro incorrectly?
>
> When I try to use getResult("Label", i), the result is NaN.

You have to use getResultString("Label",i) to get strings from the Label column.

-wayne

> For instance,
>
> labels = newArray(nResults);
> for (i=0; i<nResults; i++) {
> labels[i] = getResult("Label", i);
> redmeans[i] = getResult("Mean", i);
> }  // end get red intensitites
>
> correctly puts the red intensities in an array but the labels array is all NaN.  I also tried a = getResult("Label", i) and a is assigned NaN.
>
> Example Results table data:
>
> Label Area Mean
> 1 C2-_test_90_IFN_01-1:0001-0007 0.83 15.69
> 2 C2-_test_90_IFN_01-1:0002-0011 2.19 11.90
> 3 C2-_test_90_IFN_01-1:0003-0010 0.71 13.19
> 4 C2-_test_90_IFN_01-1:0004-0020 1.28 11.65
>
> I can get the ROI names from the ROI Manager instead, but curious why this does not work.
>
>
> Thank you!

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