default empty values in Result Table

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

default empty values in Result Table

Emanuele Martini
Hi to all,
I am working on a jython plugin that permits to track (manually) the spindles elongation in a z-stack timelapse experiment.
So I could have situations where spindle 1 is tracked until frame 10 and spindle 2 is track in frames 1,2,5,7.
I would like to set up the resulttable with automatically NaN or empty values (and not 0 like it is) so I could obtain easyly something like that:
sp1 3.2 12.3 3.4 5.6 7.7 0.5 ...
sp2 3.7 14.4            4.6       ...

without zero...is it possible?
or I've to scan my result table for zero and replace with "" or NaN?
thank you,
Emanuele
Image Analyst @Ifom-IEO research campus -MI-
Reply | Threaded
Open this post in threaded view
|

Re: default empty values in Result Table

Michael Schmid
Hi Emanuele,

This is only slightly better than replacing '0' values at the end:
You could pre-fill the results table with NaNs and then overwrite the
values (assuming you add the values yourself, and it is not some plugin
that always adds values at the end).

Michael
_____________________________________________________________

On Mon, May 25, 2015 10:13, Emanuele Martini wrote:

> Hi to all,
> I am working on a jython plugin that permits to track (manually) the
> spindles elongation in a z-stack timelapse experiment.
> So I could have situations where spindle 1 is tracked until frame 10 and
> spindle 2 is track in frames 1,2,5,7.
> I would like to set up the resulttable with automatically NaN or empty
> values (and not 0 like it is) so I could obtain easyly something like
> that:
> sp1 3.2 12.3 3.4 5.6 7.7 0.5 ...
> sp2 3.7 14.4            4.6       ...
>
> without zero...is it possible?
> or I've to scan my result table for zero and replace with "" or NaN?
> thank you,
> Emanuele

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

Re: default empty values in Result Table

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Emanuele Martini
> On May 25, 2015, at 4:13 AM, Emanuele Martini <[hidden email]> wrote:
>
> Hi to all,
> I am working on a jython plugin that permits to track (manually) the
> spindles elongation in a z-stack timelapse experiment.
> So I could have situations where spindle 1 is tracked until frame 10 and
> spindle 2 is track in frames 1,2,5,7.
> I would like to set up the resulttable with automatically NaN or empty
> values (and not 0 like it is) so I could obtain easyly something like that:
> sp1 3.2 12.3 3.4 5.6 7.7 0.5 ...
> sp2 3.7 14.4            4.6       ...
>
> without zero...is it possible?

In the latest ImageJ daily build (1.49u6), enable “NaN empty cells” in Analyze>Set Measurements and empty cells in Results tables created by “Measure” and “Analyze Particles” will be set to NaN. When using a custom ResultTable, use the new ResultTable.setNaNEmptyCells() method to enable NaN empty cells. The following JavaScript example outputs a table with NaN empty cells.

-wayne

   rt = new ResultsTable();
   rt.setNaNEmptyCells(true);
   row = 0;
   for (n=0; n<=2*Math.PI; n += 0.1) {
      rt.setValue("n", row, n);
      if (row>2)
         rt.setValue("Sine(n)", row, Math.sin(n));
      if (row<3||row>6)
         rt.setValue("Cos(n)", row, Math.cos(n));
      row++;
   }
   rt.showRowNumbers(false);
   rt.show("Table with Empty Cells");


> View this message in context: http://imagej.1557.x6.nabble.com/default-empty-values-in-Result-Table-tp5012931.html
> Sent from the ImageJ mailing list archive at Nabble.com.



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

Re: default empty values in Result Table

Emanuele Martini
Thank you very much,
i will try !
have a nice day
Emanuele
Image Analyst @Ifom-IEO research campus -MI-
Reply | Threaded
Open this post in threaded view
|

Re: default empty values in Result Table

Sylvia Neumann
In reply to this post by Rasband, Wayne (NIH/NIMH) [E]
Hi Wayne,

I was trying your macro below, but it doesn't recognize the command "new ResultsTable" and probably also not the setNaNEmptyCells(true). I tried different spelling versions, but cannot get it to work. I can use the pre-fill option, but it would be really helpful to just set the empty values to NaN or if possible just leave the values empty. I want to use this to make a custom Results Table in a macro, not using the Analyze menu.

 rt = new ResultsTable();
   rt.setNaNEmptyCells(true);
   row = 0;
   for (n=0; n<=2*Math.PI; n += 0.1) {
      rt.setValue("n", row, n);
      if (row>2)
         rt.setValue("Sine(n)", row, Math.sin(n));
      if (row<3||row>6)
         rt.setValue("Cos(n)", row, Math.cos(n));
      row++;
   }
   rt.showRowNumbers(false);
   rt.show("Table with Empty Cells");

Is there a way to get this work?
Thanks, Sylvia  
Reply | Threaded
Open this post in threaded view
|

Re: default empty values in Result Table

Emanuele Martini
Dear Sylvia,
which programming language are you using?
Since this script is to be used in Java.
I think that you can try something like :
run("Set Measurements...", "nan redirect=None decimal=3");
that way I think that you set in macro NaN as empty value.
I don't know if in macro there is a more elegant way to do that.

Have a nice day,
Emanuele

Image Analyst @Ifom-IEO research campus -MI-
Reply | Threaded
Open this post in threaded view
|

Re: default empty values in Result Table

Herbie
In reply to this post by Sylvia Neumann
Good day Sylvia,

the _JavaScript_ in question works perfectly for me.

What do you mean by

"[...] it doesn't _recognize_ the command "new ResultsTable" and
probably also not the setNaNEmptyCells(true)."

Please be aware that the code is written in JavaScript not in the
ImageJ-macro language.

Best

Herbie

::::::::::::::::::::::::::::::::::::::::::::
Am 24.06.16 um 07:19 schrieb Sylvia Neumann:

> rt = new ResultsTable();
>     rt.setNaNEmptyCells(true);
>     row = 0;
>     for (n=0; n<=2*Math.PI; n += 0.1) {
>        rt.setValue("n", row, n);
>        if (row>2)
>           rt.setValue("Sine(n)", row, Math.sin(n));
>        if (row<3||row>6)
>           rt.setValue("Cos(n)", row, Math.cos(n));
>        row++;
>     }
>     rt.showRowNumbers(false);
>     rt.show("Table with Empty Cells");

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