How can I direct the Output of my Macro that performs Batch Measurement of Multiple Images into consecutive columns in the Results Table rather than one single column?
I put together the macro shown below that uses Batch Mode to measure the mean gray values for multiple regions of interest on a set of images. The ROIs are saved to each image as an overlay prior to running the Macro. The problem is that all the measurements end up sequentially in a single column in the Results Table. I would like the measurements for each image to appear in separate columns. For example, if I have ten images with five ROIs on each image, I would like the output to be ten columns, with 5 rows of data for each column. I am a beginner to Macro Programming, so any help would be greatly appreciated. It is not critical that the output goes to the Results Thank you for any help you are able to provide. //This Macro measures mean gray value as desired, but the outp I would like the data for each image to be in its own new column. The input for this Macro is a set of images with multiple ROIs saved to the Overlay for each image. macro "Batch Measure" { dir = getDirectory("Choose a Directory "); list = getFileList(dir); setBatchMode(true); for (i=0; i<list.length; i++) { path = dir+list[i]; open(path); run("Set Measurements...", "mean display redirect=None decimal=2"); run("To ROI Manager"); roiManager("Measure"); close(); } } -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Patrick,
One option is to use roiManager("Multi Measure"); Save your data and open your dataset in excel. Copy and Paste Special > Transpose. Best wishes Kees -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Patrick Krysan Sent: 20 April 2015 17:59 To: [hidden email] Subject: Macro Question: Measurements from Multiple Images into Consecutive Columns in Results Table rather than a Single Column? How can I direct the Output of my Macro that performs Batch Measurement of Multiple Images into consecutive columns in the Results Table rather than one single column? I put together the macro shown below that uses Batch Mode to measure the mean gray values for multiple regions of interest on a set of images. The ROIs are saved to each image as an overlay prior to running the Macro. The problem is that all the measurements end up sequentially in a single column in the Results Table. I would like the measurements for each image to appear in separate columns. For example, if I have ten images with five ROIs on each image, I would like the output to be ten columns, with 5 rows of data for each column. I am a beginner to Macro Programming, so any help would be greatly appreciated. It is not critical that the output goes to the Results Thank you for any help you are able to provide. //This Macro measures mean gray value as desired, but the outp I would like the data for each image to be in its own new column. The input for this Macro is a set of images with multiple ROIs saved to the Overlay for each image. macro "Batch Measure" { dir = getDirectory("Choose a Directory "); list = getFileList(dir); setBatchMode(true); for (i=0; i<list.length; i++) { path = dir+list[i]; open(path); run("Set Measurements...", "mean display redirect=None decimal=2"); run("To ROI Manager"); roiManager("Measure"); close(); } } -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Kees;
Thank you for that simple and effective suggestion - it works perfectly! It completely solved my problem. Cheers! Patrick > On Apr 21, 2015, at 9:59 AM, Straatman, Kees (Dr.) <[hidden email]> wrote: > > Dear Patrick, > > One option is to use roiManager("Multi Measure"); Save your data and open your dataset in excel. Copy and Paste Special > Transpose. > > Best wishes > > Kees > > -----Original Message----- > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Patrick Krysan > Sent: 20 April 2015 17:59 > To: [hidden email] > Subject: Macro Question: Measurements from Multiple Images into Consecutive Columns in Results Table rather than a Single Column? > > How can I direct the Output of my Macro that performs Batch Measurement of Multiple Images into consecutive columns in the Results Table rather than one single column? > > I put together the macro shown below that uses Batch Mode to measure the mean gray values for multiple regions of interest on a set of images. The ROIs are saved to each image as an overlay prior to running the Macro. The problem is that all the measurements end up sequentially in a single column in the Results Table. I would like the measurements for each image to appear in separate columns. For example, if I have ten images with five ROIs on each image, I would like the output to be ten columns, with 5 rows of data for each column. > > I am a beginner to Macro Programming, so any help would be greatly appreciated. It is not critical that the output goes to the Results > > Thank you for any help you are able to provide. > > > > //This Macro measures mean gray value as desired, but the outp I would like the data for each image to be in its own new column. The input for this Macro is a set of images with multiple ROIs saved to the Overlay for each image. > > macro "Batch Measure" { > dir = getDirectory("Choose a Directory "); > list = getFileList(dir); > setBatchMode(true); > for (i=0; i<list.length; i++) { > path = dir+list[i]; > open(path); > run("Set Measurements...", "mean display redirect=None decimal=2"); > run("To ROI Manager"); > roiManager("Measure"); > close(); > } > } > > -- > 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 |
Free forum by Nabble | Edit this page |