Skip to content

Instantly share code, notes, and snippets.

@miura
Created July 21, 2015 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miura/be839c4dfb09b4cd395f to your computer and use it in GitHub Desktop.
Save miura/be839c4dfb09b4cd395f to your computer and use it in GitHub Desktop.
# subtract mean
from ij import IJ
from ij.process import ImageStatistics as IS
#import math
imp = IJ.getImage()
stack = imp.getStack()
#stat = IS()
for i in range(stack.getSize()):
ip = stack.getProcessor(i + 1)
stats = ip.getStatistics()
meanInt = stats.mean
ip.add(-1 * round(meanInt))
imp.updateAndDraw()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment