Re: Transpose Table in Image J help
Posted by
Rasband, Wayne (NIH/NIMH) [E] on
Oct 05, 2015; 12:25am
URL: http://imagej.273.s1.nabble.com/Transpose-Table-in-Image-J-help-tp5014534p5014548.html
> On Oct 3, 2015, at 7:44 AM, Jacob Lewis <
[hidden email]> wrote:
>
> Hi Wayne,
>
> Sorry to bother you again. Would I apply the same logic as in the javascript you provided to take all the columns output by multi-measure (i.e. mean grey value) and merge them into one column? Or is that even more difficult/multi-step process? I know I would have to provide an additional column like molecule or trajectory to separate out each measurement. It appears I wasn’t very clear when I mentioned “transpose” in my last email, although that code was helpful. The plugin reads columns rather and rows, see screen shot for typical format. This is the format I need to get the data in after the multi-measure on all slices.
The following JavaScript, which replaces the "Multi Measure" command, measures each ROI in the ROI Manager on each of the images in the stack. All measurements for each parameter are in a single column. Enable “Stack position” in the Analyze>Set Measurements dialog to display the slice numbers in the Results table.
img = IJ.getImage();
IJ.run("Clear Results");
rm = RoiManager.getInstance();
rois = rm.getRoisAsArray();
slices = img.getStackSize();
for (slice=1; slice<=slices; slice++) {
img.setSlice(slice);
for (i=0; i<rois.length; i++) {
img.setRoi(rois[i]);
IJ.run(img, "Measure", "");
}
}
Here is a macro version:
run("Clear Results");
roiManager("Deselect");
roiManager("Remove Slice Info");
n = roiManager("count");
for (slice=1; slice<=nSlices; slice++) {
setSlice(slice);
for (i=0; i<n; i++) {
roiManager("select", i);
run("Measure");
}
}
-wayne
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html