Re: Fiji: getResult("column", row); not working in Macro

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

Re: Fiji: getResult("column", row); not working in Macro

Rasband, Wayne (NIH/NIMH) [E]
On Jan 23, 2015, at 3:03 PM, fmerchant <[hidden email]> wrote:
>
> I have the following Macro in Fiji.
> It opens an image and runs the Colocalization Threshold macro successfully
> with measurements displayed in the Results window.
>
> However, when I try to read values from the results window, using
> getResult("column", row);
>
> I get the following error message:

The “Results” window created by the Colocalization Threshold plugin is not compatible with the getResult() macro function. You can work around this problem by saving the “Results” window and re-opening it as a normal results table. The following macro demonstrates how to do this.

-wayne

  run("Clown (14K)");
  run("Split Channels");
  run("Colocalization Threshold", "channel_1=[clown.jpg (red)] channel_2=[clown.jpg (green)] use=None channel=[Red : Green] include");
  path = getDirectory("temp")+"Results.csv";
  saveAs("results", path);
  run("Close");
  open(path);
  rtot = getResult("Rtotal", nResults-1);
  print("rtot="+rtot);


> Screen_Shot_2015-01-23_at_1.png
> <http://imagej.1557.x6.nabble.com/file/n5011323/Screen_Shot_2015-01-23_at_1.png>  
>
> Here is the results window that is generated by running the Colocalization
> Threshold macro.
> Screen_Shot_2015-01-23_at_1.png
> <http://imagej.1557.x6.nabble.com/file/n5011323/Screen_Shot_2015-01-23_at_1.png>  
>
> I have attached the macro below.
> Please can someone tell me how I can fix this error?
>
> Thanks
> Fatima
>
> Here is the macro
>
> //Open file to Analyze
> id = File.openDialog("Choose a RGB (all 3 channels merged file");
> open(id);
> Index=lastIndexOf(id, "/");
> fname_fix = substring (id, (Index+1));
> dir = substring (id, 0, (Index+1));
> Index_fix = lastIndexOf(fname_fix, ".");
> fname = substring (fname_fix, 0, (Index_fix));
>
> print(fname_fix);
>
> run("Split Channels");
> //close blue channel
> close();
> //saveAs("Tiff", dir+fname+"_Green.tif");
> //saveAs("Tiff", dir+fname+"_Red.tif");
>
> //Run Colocalization Threshold
>
> run("Colocalization Threshold", "channel_1=["+fname_fix+" (red)]
> channel_2=["+fname_fix+" (green)] use=None channel=[Red : Green] show use
> show include");
> selectWindow("Results");
> nRes = nResults;
> Rtot = getResult("Rtotal", nResults-1); //This line gives an error (image
> attached)
> print(Rtot);
> ch1_thresh = getResult("Ch1 thresh", nResults-1);
> ch2_thresh = getResult("Ch2 thresh", nResults-1);
> print(ch1_thresh);
> print(ch2_thresh);
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Fiji-getResult-column-row-not-working-in-Macro-tp5011323.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html


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