User Tools

Site Tools


blogtng:2010-08-11:python_installation_notes_win32_xp

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
blogtng:2010-08-11:python_installation_notes_win32_xp [2010/08/11 15:35] kotablogtng:2010-08-11:python_installation_notes_win32_xp [2016/05/24 12:46] (current) – external edit 127.0.0.1
Line 173: Line 173:
 ---> this does work as well. Shows a new window with plot.  ---> this does work as well. Shows a new window with plot. 
  
-=== Testing Command line interface in Python ===+=== Testing Command line interface (console) in Python ===
  
 In the bottom console, select “Pydev console” from “Open Console” icon. This will start up interactive python interpreter.  In the bottom console, select “Pydev console” from “Open Console” icon. This will start up interactive python interpreter. 
  
-==== Further trials ====+==== Accessing ImageJ as Image Processing Library==== 
 + 
 +Jython interpreter must be used instead of Python interpreter for accessing Java. For this, pydev installed in eclipse do the job. This is quite useful but the drawback is that one cannot use numpy and scipy. Instead, one should use java numerical libraries as recommended by Albert Cardona.   
 +  * [[http://math.nist.gov/javanumerics/jama/|JaMa]] (Java Matrix Package) 
 +  * [[https://java3d.dev.java.net/|Java3D]]  
 +  * see also [[http://math.nist.gov/javanumerics/#libraries|a list of libraries]] 
 + 
 +  - Basic setting: In eclipse, [Window > Preference], collapse Pydev-Interpreter-Jython tee. If you see nothing listed in "Jython interpreter" field, then you need to set path to a jython interpreter. If you do not have one, you could download the latest from Jython project page (http://www.jython.org/). In my case, I pointed the reference to jython.jar within FIJI jar folder. Since FIJI has automatic updating function, this jar should be the latest one (Python2.5 comparable).   
 +  - Make a new pydev project by [File > New > Pydev project], Fill "Project name", choose project type as Jython, and Grammer version 2.5, choose jython (this name is what you gave when you set the library path in 1.) from Interpreter drop down menu. 
 +  - Right click the newly created project folder and [new > pydev module]. In the creation panel, choose whatever the project name (could also be blank), fill Name of the module ("testjy" in this example) and Finish. 
 +  - Right click the newly created project folder again, and select "prpoperties". Select Pydev-PYTHONPATH, select "external libraries" tab, and "Add zip/jar/egg" to set ij.jar as an external library.  
 +  - optional: to access lugins in ImageJ plugin folder, add that plugin class file or jar file in the library path as well.  
 + 
 +Double clicking test.py will open the file in the editor window. COpy and paste the following: 
 +<code> 
 +from ij import IJ 
 +import ij.process.ImageProcessor as IP 
 + 
 +blobs = IJ.openImage("http://rsb.info.nih.gov/ij/images/blobs.gif"
 +imp = blobs.createImagePlus() 
 +ip = blobs.getProcessor().duplicate() 
 +imp.setProcessor("blobs copy", ip) 
 +imp.show() 
 +ip.setThreshold(147, 147, IP.NO_LUT_UPDATE) 
 +IJ.run(imp, "Convert to Mask", ""
 +IJ.run(imp, "Watershed", ""
 +</code> 
 +save the file, right click the file in Pydeve Package view and select [Run as > Jython Run]. If segmented blob appears, then the setup is working.  
 + 
 +To dynamically access jython-ij, set external library path in [window > preferences] interpreter-Jyton pane. Adding ij.jar in the library path will enable you to access jython just like in IDLE by clicking open console icon and selecting pydev console.  
  
-Next Trials would be to use ImageJ from Eclipse-jython environment to see if it would be possible to interactively access IJ API. 
blogtng/2010-08-11/python_installation_notes_win32_xp.1281540906.txt.gz · Last modified: 2016/05/24 12:46 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki