Is there any way in a macro to get the information in a text window? For example, I have a text window that has rows and columns just like the Results Table, and I would like to sum the data in one of the columns of the text window just as I would by using
for (i = 0; i < nResults; i++) { sum += getResult(“Area”, i); } for the Results Table. Can this be done for a text window? Chris Coulon gaiag.net -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Chris,
As I understand it you can only use those functions on the table named "Results" so you need to rename your table to "Results" first then you can use the results table functions. Cheers, Matt > On 11 May 2014, at 00:46, christopher of the family hunt coulon <[hidden email]> wrote: > > Is there any way in a macro to get the information in a text window? For example, I have a text window that has rows and columns just like the Results Table, and I would like to sum the data in one of the columns of the text window just as I would by using > > for (i = 0; i < nResults; i++) { > sum += getResult(“Area”, i); > } > > for the Results Table. Can this be done for a text window? > > Chris Coulon > gaiag.net > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On 11 May 2014, at 00:46, christopher of the family hunt coulon
<[hidden email]> wrote: > Is there any way in a macro to get the information in a text window? For > example, I have a text window that has rows and columns just like the > Results Table, and I would like to sum the data in one of the columns of > the text window just as I would by using Not with the same code. The Result windows is an array of cells. The Text window is not. Renaming won't work. Perhaps you could save and reload the Text window data and parse its contents into variables, (lines of text as rows, then parse the column within each row). In any case not with the code you posted. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Chris,
On Sun, May 11, 2014 at 11:10 AM, Gabriel Landini <[hidden email]>wrote: > On 11 May 2014, at 00:46, christopher of the family hunt coulon > <[hidden email]> wrote: > > Is there any way in a macro to get the information in a text window? For > > example, I have a text window that has rows and columns just like the > > Results Table, and I would like to sum the data in one of the columns of > > the text window just as I would by using > > Not with the same code. The Result windows is an array of cells. > The Text window is not. Renaming won't work. > > Perhaps you could save and reload the Text window data and parse its > contents > into variables, (lines of text as rows, then parse the column within each > row). In any case not with the code you posted. > > Cheers > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > More details of Gabriel's suggestion is written in my macro textbook https://github.com/cmci/ij_textbook2/blob/master/CMCImacrocourse.pdf?raw=true See explanations starting from p96. cheers, Kota -- -------------------------------------------------------------*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 |
In reply to this post by Gabriel Landini
Please send an example file.
_________________________________________ Michael Cammer, Assistant Research Scientist Skirball Institute of Biomolecular Medicine Lab: (212) 263-3208 Cell: (914) 309-3270 ________________________________________ From: ImageJ Interest Group [[hidden email]] on behalf of Gabriel Landini [[hidden email]] Sent: Sunday, May 11, 2014 5:10 AM To: [hidden email] Subject: Re: getting data from a text window On 11 May 2014, at 00:46, christopher of the family hunt coulon <[hidden email]> wrote: > Is there any way in a macro to get the information in a text window? For > example, I have a text window that has rows and columns just like the > Results Table, and I would like to sum the data in one of the columns of > the text window just as I would by using Not with the same code. The Result windows is an array of cells. The Text window is not. Renaming won't work. Perhaps you could save and reload the Text window data and parse its contents into variables, (lines of text as rows, then parse the column within each row). In any case not with the code you posted. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html ------------------------------------------------------------ This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. ================================= -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Thanks Michael and Gabriel. I have been using a work around by saving the text window as Results and then re-opening it:
saveAs("Results", resultsDir + name); open(resultsDir + name); and then just using the getResult(“Column”, row) function. I guess that is the easiest way after all. Chris On May 11, 2014, at 6:53 AM, Cammer, Michael <[hidden email]> wrote: > Please send an example file. > > _________________________________________ > Michael Cammer, Assistant Research Scientist > Skirball Institute of Biomolecular Medicine > Lab: (212) 263-3208 Cell: (914) 309-3270 > > ________________________________________ > From: ImageJ Interest Group [[hidden email]] on behalf of Gabriel Landini [[hidden email]] > Sent: Sunday, May 11, 2014 5:10 AM > To: [hidden email] > Subject: Re: getting data from a text window > > On 11 May 2014, at 00:46, christopher of the family hunt coulon > <[hidden email]> wrote: >> Is there any way in a macro to get the information in a text window? For >> example, I have a text window that has rows and columns just like the >> Results Table, and I would like to sum the data in one of the columns of >> the text window just as I would by using > > Not with the same code. The Result windows is an array of cells. > The Text window is not. Renaming won't work. > > Perhaps you could save and reload the Text window data and parse its contents > into variables, (lines of text as rows, then parse the column within each > row). In any case not with the code you posted. > > Cheers > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > ------------------------------------------------------------ > This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. > ================================= > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |