Multi Plot Via Macro

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

Multi Plot Via Macro

danDino
I would like to use macro functionality to extract plot profile values from many ROI's for (several hundred) images within any given directory (running in Batch Mode). This works perfectly easily when using the "Multi Measure" command, but I can't find an appropriate solution for "Multi Plot".

Specifically I'm looking for the data not the plot profile images themselves - which is typically generated using the list button within the window "Profiles".

When running the macro I get the error dialog:

Area to Line " Composite selections cannot be converted to lines"

This post asks the same thing, and a Java solution using  the PlotWindow.getResultsTable() method is suggested. Is there a suitable method using IJ1 macros.

Any ideas for a quick fix.

Cheers
Dan


function action(input, output, filename) {
        open(input + filename);
        run("Duplicate...", " ");
        setOption("BlackBackground", false);
                run("Make Binary");
                run("Fill Holes");
                run("Create Selection");
                selectWindow(filename);
                run("Restore Selection");

                // choosing ROI Manager
                run("ROI Manager...");
                roiManager("Add");
                roiManager("Split");
                roiManager("Select", 0);
                roiManager("Delete");
               
                // basic measurements work here:
                //roiManager("multi-measure measure_all append");
                //saveAs("Results", output + filename + exten);
                //close();


                // aim: extract profile Multi Plots for each ROI for each image in the directory
               // ERROR generated here.....
                roiManager("Multi Plot");
                selectWindow("Profiles");
                saveAs("Results", output + filename + filename + exten);
       
        // this shows the Multi Plot window is being generated! It is then cropped and saved with the plot profiles on it
        // to the directory of choice...

        makeRectangle(10, 10, 300, 380);
        run("Crop");
        saveAs("Jpeg", output + filename);
        close();
}

exten = ".xls";
input = "/home/images/";
output = "/home/";


setBatchMode(true);
list = getFileList(input);
for (i = 0; i < list.length; i++)
        action(input, output, list[i]);
setBatchMode(false);
Reply | Threaded
Open this post in threaded view
|

Re: Multi Plot Via Macro

Rasband, Wayne (NIH/NIMH) [E]
On Jun 2, 2016, at 2:54 PM, danDino <[hidden email]> wrote:

>
> I would like to use macro functionality to extract plot profile values from
> many ROI's for (several hundred) images within any given directory (running
> in Batch Mode). This works perfectly easily when using the "Multi Measure"
> command, but I can't find an appropriate solution for "Multi Plot".
>
> Specifically I'm looking for the data not the plot profile images themselves
> - which is typically generated using the list button within the window
> "Profiles”.
>
> When running the macro I get the error dialog:
>
> Area to Line " Composite selections cannot be converted to lines"
>
> This  post <https://list.nih.gov/cgi-bin/wa.exe?A2=IMAGEJ;91a8fa74.1110>  
> asks the same thing, and a Java solution using  the
> PlotWindow.getResultsTable() method is suggested. Is there a suitable method
> using IJ1 macros.

You can use the Plot.showValues() macro function to extract plot profile values from a plot window. The following example adds 46 ROIs to the ROI Manager, runs "Multi Plot” to create a 46 curve plot and then uses Plot.showValues() to extract the plot values and display them in a 92 column Results table.

-wayne

  run("Blobs (25K)");
  setAutoThreshold("Default");
  roiManager("reset");
  run("Analyze Particles...", "exclude add");
  roiManager("Multi Plot");
  Plot.showValues();


> function action(input, output, filename) {
>        open(input + filename);
>        run("Duplicate...", " ");
>        setOption("BlackBackground", false);
> run("Make Binary");
> run("Fill Holes");
> run("Create Selection");
> selectWindow(filename);
> run("Restore Selection");
>
> // choosing ROI Manager
> run("ROI Manager...");
> roiManager("Add");
> roiManager("Split");
> roiManager("Select", 0);
> roiManager("Delete");
>
> // basic measurements work here:
> //roiManager("multi-measure measure_all append");
> //saveAs("Results", output + filename + exten);
> //close();
>
>
> // aim: extract profile Multi Plots for each ROI for each image in the
> directory
>               // ERROR generated here.....
> roiManager("Multi Plot");
> selectWindow("Profiles");
> saveAs("Results", output + filename + filename + exten);
>
>        // this shows the Multi Plot window is being generated! It is then
> cropped and saved with the plot profiles on it
>        // to the directory of choice...
>
>        makeRectangle(10, 10, 300, 380);
>        run("Crop");
>        saveAs("Jpeg", output + filename);
>        close();
> }
>
> exten = ".xls";
> input = "/home/images/";
> output = "/home/";
>
>
> setBatchMode(true);
> list = getFileList(input);
> for (i = 0; i < list.length; i++)
>        action(input, output, list[i]);
> setBatchMode(false);
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Multi-Plot-Via-Macro-tp5016583.html
> Sent from the ImageJ mailing list archive at Nabble.com.


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