BG subtraction from ROI

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

BG subtraction from ROI

ergefan
Hi,

This question might sound stupid but I have been trying to find the plugin in ImageJ called "BG subtraction from ROI" but it's not either in the latest ImageJ version or in the plugin download website.
Appreciate anyone who can help. Thanks!

Kai
Reply | Threaded
Open this post in threaded view
|

Re: BG subtraction from ROI

Christine Labno
Hi Kai,

I don't have that as a plugin, but I do have a macro called BG
Subtraction from ROI.  Perhaps this is what you're looking for?

--begin code--

// Michael Cammer  20030118
// macros for cleaning up time series data
//---------------------------------------------
// User selects a ROI in the background of a stack.
// This ROI is measured in each slice and the mean value of
each slice is subtracted
//  from the correct slice.  This corrects for variation in
background value over time.
//Added single slice function and ability to set Stdev c\valkue

macro "BG [F12]" {
currentTitle = getTitle();
currentID=getImageID();
run("Set Measurements...", "  mean standard redirect=None
decimal=0");
scaling=3;
//scaling=getNumber("Enter Scaling factor",3)
selectImage(currentID);
if (nSlices>1){
// setSlice(1);
         run("Plot Z-axis Profile");    run("Close");
          for (i=1; i<=nSlices; i++){
          bgmean=getResult("Mean",(i-1));
                bgStdev=getResult("StdDev",(nResults-1));
                bgTotal=bgmean+(scaling*bgStdev);
                selectImage(currentID);
                run("Set Slice...", "slice="+i);
                run("Select All");
                run("Subtract...", "slice value="+bgTotal);}
                }
if (nSlices==1)  {run("Measure");
                selectImage(currentID);
  bgmean=getResult("Mean",(nResults-1));
                bgStdev=getResult("StdDev",(nResults-1));
                bgTotal=bgmean+(scaling*bgStdev);
                run("Select All");
                run("Subtract...", "value="+bgTotal);
                run("Select None");
                }
selectWindow("Results");
run("Close");
//showMessage("StDev="+bgStDev+ " Mean BG = "+bgmean);
run("Set Measurements...", "  mean  redirect=None decimal=0");
run("Select None");
}

--end code--



---- Original message ----
>Date: Mon, 19 Apr 2010 04:04:18 -0400
>From: Kai Fan <[hidden email]>  
>Subject: BG subtraction from ROI  
>To: [hidden email]
>
>Hi,
>
>This question might sound stupid but I have been trying to
find the plugin in ImageJ called "BG subtraction from ROI" but
it's not either in the latest ImageJ version or in the plugin
download website.
>Appreciate anyone who can help. Thanks!
>
>Kai
Reply | Threaded
Open this post in threaded view
|

Re: BG subtraction from ROI

Javier Casas
Hi Kal,

I was using your macro for BG subtraction from ROI for quite a while but
suddenly it stop working, most likely because of updating to 1.51t version.
You you know how can I fix this error?

Error: No results found in line 19:
                bgmean = getResult ( "Mean" , ( i - 1 ) <)> ;

Thanks a lot in advance

Javier Casas



--
Sent from: http://imagej.1557.x6.nabble.com/

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