User Tools

Site Tools


documents:120206pyip_cooking:python_imagej_cookbook

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
documents:120206pyip_cooking:python_imagej_cookbook [2021/11/08 07:15] – added background subtraciton kotadocuments:120206pyip_cooking:python_imagej_cookbook [2021/11/17 07:14] – [Shell Command] new addition kota
Line 2357: Line 2357:
  
 See explanation in [[http://www.prasannatech.net/2008/09/implementing-java-interfaces-in-jython.html|here]].  See explanation in [[http://www.prasannatech.net/2008/09/implementing-java-interfaces-in-jython.html|here]]. 
 +
 +==== 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("\\n")
 + for ss in scan:
 + print ss
 +
 +
 +runShellCommand( "pwd" )
 +runShellCommand( "ls -la" )
 +</code>
  
 ===== JAVADOCS ===== ===== JAVADOCS =====
documents/120206pyip_cooking/python_imagej_cookbook.txt · Last modified: 2022/10/16 07:12 by kota

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki