Login  Register

Re: moving average in stack

Posted by Michael Cammer on Jul 11, 2007; 8:12pm
URL: http://imagej.273.s1.nabble.com/moving-average-in-stack-tp3698864p3698865.html

some modification of the two macros should do what you want.


//-----------------------------------------------
macro "paste with blend adjacent slices"{
   checkCurrentVersion();
   original = getImageID();
   selectImage(original);
   for (i=2;i<=nSlices;i++) {
     run("Set Slice...", "slice="+i);  run("Select All");  run("Copy");
     run("Set Slice...", "slice="+(i-1));  setPasteMode("Average");
run("Paste");
   }
   selectImage(original);
   run("Set Slice...", "slice="+nSlices); run("Delete Slice");
   run("Set Slice...", "slice="+1);  run("Delete Slice");
   run("Brightness/Contrast...");
}



//------------------------------------------------------------------
macro 'Projections of variable width'{
   checkCurrentVersion();
   original = getImageID();
   end = nSlices();
   zdepth = 4;
   projtype = "'Max Intensity'" ;    // or 'Average Intensity' or
some other type
   for (i=1;i<(end-zdepth);i++){
     stop = i + zdepth;
     run("Z Project...", "start="+i+" stop="+stop+" projection="+projtype);
     run("Select All");
     run("Copy");
     run("Close");
     selectImage(original);
     run("Set Slice...", "slice="+i);
     run("Paste");
   }








At 12:20 PM 07/11/07, you wrote:

>Hi,
>
>Does anyone know how to do moving average in the z direction of a
>stack? Now the moving average filter is for the x-y plane. I want to
>do a moving average for each pixle in the z direction. Can anyone
>tell me how to do that with ImageJ? Thanks.
>
>Da
>
>_________________________________________________________________
>Need a brain boost? Recharge with a stimulating game. Play
>now!  http://club.live.com/home.aspx?icid=club_hotmailtextlink1

____________________________________________________________________________
Michael Cammer   Analytical Imaging Facility   Albert Einstein Coll. of Med.
URL:  http://www.aecom.yu.edu/aif/