Output of stack->results script to txt file

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

Output of stack->results script to txt file

Jacob Keller
Dear List,

can anyone tell me what needs to be tweaked here to output this to a
txt file rather than the results window--not expert enough yet to
figure that out myself. Also, for big stacks, things are getting
really slow, and sometimes the RAM can't handle things and I get a
JAVA heap error message...

Jacob



>
> Here is JavaScript code that displays the contents of an image or stack in the Results window, with one image per column. To create a "Stack to Results" command, save it in the plugins folder, or subfolder, as "Stack_to_Results.js" and use the Help>Refresh Menus command.
>>
>>
>> -wayne
>>
>>    var imp = IJ.getImage();
>>    var stack = imp.getStack();
>>    var nImages = stack.getSize();
>>    var nPixels = stack.getWidth()*stack.getHeight();
>>    var rt = new ResultsTable();
>>    for (var z=0; z<nImages; z++) {
>>       IJ.showProgress(z, nImages-1);
>>       IJ.showStatus((z+1)+"/"+nImages);
>>       var ip = stack.getProcessor(z+1);
>>       for (var i=0; i<nPixels; i++) {
>>          if (z==0) rt.incrementCounter();
>>          rt.setValue("i"+(z+1), i, ip.getf(i));
>>       }
>>    }
>>    rt.show("Results");
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>
>
>
> --
> *******************************************
> Jacob Pearson Keller
> Northwestern University
> Medical Scientist Training Program
> email: [hidden email]
> *******************************************




--
*******************************************
Jacob Pearson Keller
Northwestern University
Medical Scientist Training Program
email: [hidden email]
*******************************************

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

Re: Output of stack->results script to txt file

Kota Miura
Hi Jacob,

For the first question, you could replace the line rt.show("Results"); to

rt.saveAs("/tmp/results.csv");

The argument (path to the results file) should be adjusted according to
your OS and needs.

cheers,
Kota


On Tue, Aug 14, 2012 at 7:13 PM, Jacob Keller <
[hidden email]> wrote:

> Dear List,
>
> can anyone tell me what needs to be tweaked here to output this to a
> txt file rather than the results window--not expert enough yet to
> figure that out myself. Also, for big stacks, things are getting
> really slow, and sometimes the RAM can't handle things and I get a
> JAVA heap error message...
>
> Jacob
>
>
>
> >
> > Here is JavaScript code that displays the contents of an image or stack
> in the Results window, with one image per column. To create a "Stack to
> Results" command, save it in the plugins folder, or subfolder, as
> "Stack_to_Results.js" and use the Help>Refresh Menus command.
> >>
> >>
> >> -wayne
> >>
> >>    var imp = IJ.getImage();
> >>    var stack = imp.getStack();
> >>    var nImages = stack.getSize();
> >>    var nPixels = stack.getWidth()*stack.getHeight();
> >>    var rt = new ResultsTable();
> >>    for (var z=0; z<nImages; z++) {
> >>       IJ.showProgress(z, nImages-1);
> >>       IJ.showStatus((z+1)+"/"+nImages);
> >>       var ip = stack.getProcessor(z+1);
> >>       for (var i=0; i<nPixels; i++) {
> >>          if (z==0) rt.incrementCounter();
> >>          rt.setValue("i"+(z+1), i, ip.getf(i));
> >>       }
> >>    }
> >>    rt.show("Results");
> >>
> >> --
> >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
> >
> >
> >
> > --
> > *******************************************
> > Jacob Pearson Keller
> > Northwestern University
> > Medical Scientist Training Program
> > email: [hidden email]
> > *******************************************
>
>
>
>
> --
> *******************************************
> Jacob Pearson Keller
> Northwestern University
> Medical Scientist Training Program
> email: [hidden email]
> *******************************************
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--

-------------------------------------------------------------*Dr. Kota Miura*

Scientist & IT Engineer
Centre for Molecular and Cellular Imaging,
European Molecular Biology Laboratory
Meyerhofstr. 1
69117 Heidelberg
GERMANY

Tel +49 6221 387 404

Mobile +49 160 95001177

Fax +49 6221 387 512

http://cmci.embl.de
-------------------------------------------------------------

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