Averaging Reducer

Author: Wayne Rasband (wsr at nih.gov)
History: 2002/05/16: First version
2003/06/25: Fixed inverted LUT related bug
2003/06/26: Fixed rounding error; works with float images
2007/06/16: Added macro for processing stacks
Limitations: Requires macro to work with stacks
Source: Averaging_Reducer.java
Installation: Copy Averaging_Reducer.class to the plugins folder and restart ImageJ.
Description: The plugin reduces the size of an image by averaging.

     reduce.gif

Here is a macro that uses this plugin to reduce the size of a stack:

  x=2; y=2;
  n = nSlices;
  id1 = getImageID;
  setBatchMode(true);
  run("Averaging Reducer", "x="+x+" y="+y);
  id2 = getImageID;
  for (i=2; i<=n; i++) {
      selectImage(id1);
      setSlice(i);
      run("Averaging Reducer", "x="+x+" y="+y);
      run("Copy");
      close;
      selectImage(id2);
      run("Add Slice");
      run("Paste");
  }
  setBatchMode(false);
  

|Plugins | Home |