Posted by
patrick coffey on
Mar 30, 2015; 7:20pm
URL: http://imagej.273.s1.nabble.com/saving-multiple-measurements-to-the-same-spreadsheet-or-text-file-tp5012045p5012258.html
Wayne et al. - thanks so much for your help. This solved the issue!
Patrick
-----Original Message-----
From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of
Rasband, Wayne (NIH/NIMH) [E]
Sent: Sunday, March 29, 2015 7:33 PM
To:
[hidden email]
Subject: Re: saving multiple measurements to the same spreadsheet or text
file
On Mar 29, 2015, at 12:25 PM, Patrick Coffey <
[hidden email]> wrote:
>
> Dear Jim,
> Thank you for your response. (I have spent countless hours on the
> resources that you mentioned). Unfortunately there is not a single
> example of saving data from columns of multiple measurements to a
> spreadsheet or txt file (one can build up a multi-column table one row
> at a time). Just to re-cap - I want to measure multiple profiles and save
them to the "same"
> file as columns. Saving the profiles to individual files is easy to do.
This example macro generates 10 profiles and saves them in a file as
columns.
-wayne
run("Blobs (25K)");
run("Clear Results");
setOption("ShowRowNumbers", false);
for (y=10; y<=200; y+=20) {
makeLine(30, y, 120, y);
profile = getProfile();
for (i=0; i<profile.length; i++) {
if (y==10)
setResult("X", i, i);
setResult("Y"+y, i, profile[i]);
}
}
updateResults;
saveAs("Results", "");
> So the output would look something like this
>
> Profile1 Profile2 Profile3
> 130 240 255
> 77 212 170
> And so on ....
>
> I believe the problem is that imagej does not support 2D arrays,
> hence it is impossible to build up a 2D array in nested loops in the
> typical fashion. My guess is that I will have to resort to a 1D array
> that has the same number of positions as the 2D array. Then I will
> have to literally build up the results table one line at a time where
> the intended columns are separated by "\t". Once the results table is
> built, I will be able to save that as a spreadsheet file.
>
> Please let me know if you have a workaround and thanks for the help.
> Patrick
>
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of
> Jim Passmore
> Sent: Thursday, March 19, 2015 6:20 AM
> To:
[hidden email]
> Subject: Re: saving multiple measurements to the same spreadsheet or
> text file
>
> Patrick,
> Based on your brief description, I think there may be what you need in
> the standard Results Table. For example, if you measure a series of
> lines, you can get a result table with the length and angle
> orientation (2 columns) of each line, one line per row in the table.
> It can easily be saved to a text file to import into a spreadsheet.
>
> There are probably multiple ways to use it that will accomplish what
> you need. First off, bookmark the "developer resources" page, as it
> will come in handy.
http://imagej.net/developer/index.html>
> Second, from that page there is a list of macro language functions at
>
http://imagej.net/developer/macro/functions.html> I would search through that page for commands that operate on the
> result table. In particular, the setResult and updateResults commands
might help.
> Use ctrl-F in the browser window and search for "result" to find a few
> more useful commands.
>
> Another option would be to save your measurements in an array, then
> use the Array.show command to display them in a result window, which
> again can be saved to a file. Array commands are on the same web page.
>
> Note that there are numerous examples linked to from the list of macro
> functions, and there are other resources on the developer page,
> including a couple of "manuals" on macro programming and many more
> examples. You may find better ideas there. Happy programming!
>
>
>
> On Wed, Mar 18, 2015 at 3:02 PM, Patrick Coffey
> <
[hidden email]>
> wrote:
>
>> Hi, I'm trying to determine if there is a straightforward way using a
>> macro with imageJ to save multiple measurements to a spreadsheet file
>> (or tab delimited txt file) in the form of a measurement for each column.
>> Currently I can save a single measurement at a time where the
>> relevant code is as follows
>>
>> ... looping through images (image1, image2, image3 ... and so on)
>> Plot.create("Profile", "X", "Value", profile); // Plot profile
>> Plot.show();
>> waitForUser("","review Plot");
>> saveAs("Measurements");
>>
>> I'd like the columns to be image1, image2, etc ...
>>
>> Any sample code is greatly appreciated. Many thanks, Patrick
>>
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>>
>
>
>
>
> *-- Jim Passmore*
> Research Associate
> Sealed Air Corporation
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html