documents:120206pyip_cooking:python_imagej_cookbook
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
documents:120206pyip_cooking:python_imagej_cookbook [2021/10/19 17:55] – added scijava scripting in a script kota | documents:120206pyip_cooking:python_imagej_cookbook [2021/11/17 07:14] – [Shell Command] new addition kota | ||
---|---|---|---|
Line 1364: | Line 1364: | ||
For more explanation about this processing, see [[http:// | For more explanation about this processing, see [[http:// | ||
+ | |||
+ | ==== Background Subtraction (Rolling Ball) ==== | ||
+ | |||
+ | Menu item [Process > Subtract Background] | ||
+ | |||
+ | <code python> | ||
+ | from ij import IJ | ||
+ | from ij.plugin.filter import BackgroundSubtracter | ||
+ | |||
+ | imp = IJ.getImage() | ||
+ | |||
+ | ip = imp.getProcessor() | ||
+ | radius = 50.0 | ||
+ | createBackground = False | ||
+ | lightBackground = False | ||
+ | useParaboloid = False | ||
+ | doPresmooth = False | ||
+ | correctCorners = False | ||
+ | |||
+ | bs = BackgroundSubtracter() | ||
+ | bs.rollingBallBackground(ip, | ||
+ | imp.updateAndDraw() | ||
+ | </ | ||
+ | |||
+ | If the image is in RGB, then use a different method (rollingBallBrightnessBackground). | ||
+ | |||
+ | For more explanation about this processing, see [[https:// | ||
==== ImageCalculator ==== | ==== ImageCalculator ==== | ||
Line 2330: | Line 2357: | ||
See explanation in [[http:// | See explanation in [[http:// | ||
+ | |||
+ | ==== Shell Command ==== | ||
+ | |||
+ | To run Shell command in OSX, here is an example. | ||
+ | |||
+ | <code python> | ||
+ | from java.lang import Runtime | ||
+ | from java.util import Scanner | ||
+ | |||
+ | def runShellCommand( cmd ): | ||
+ | proc = Runtime.getRuntime().exec(cmd) | ||
+ | istream = proc.getInputStream() | ||
+ | scan = Scanner(istream).useDelimiter(" | ||
+ | for ss in scan: | ||
+ | print ss | ||
+ | |||
+ | |||
+ | runShellCommand( " | ||
+ | runShellCommand( "ls -la" ) | ||
+ | </ | ||
===== JAVADOCS ===== | ===== JAVADOCS ===== |
documents/120206pyip_cooking/python_imagej_cookbook.txt · Last modified: 2022/10/16 07:12 by kota