Where can i find vtk documentation for python? - python

I am trying to use VTK from python. I tried to find and could not realy find anything on the web which can be used for documentation. I tried looking at the c++ documentation but the methods are very different.
Thanks a lot

You could see the python examples at VTK's wiki. There is another resource by going to the official nightly documentation and looking for a particular class; in the section examples for many (not all) classes you can find implementations in python (also in c++ and tcl). A third option is to go to the source folder of your last downloaded release of VTK; look for the folder "Examples", there you will also find different VTK implementations in python (besides C++ and tcl)

I recommend you use Mayavi and TVTK from Enthought, the API is much pythonic:
http://code.enthought.com/projects/mayavi/

On the VTK website you can find the VTK User's Guide. It is pretty thorough.

Related

how to control ImageJ from Python 3.4.2

I am trying to use Python 3.4.2 to control ImageJ
what I want to do is from python code , I want to sent orders to imageJ to analayse some images, detecting edges, contrast, noise etc
there is a similar question here
How to connect ImageJ to python?
but there is no answer, like "install this, and control the Find Edges button with this command"
I wonder how can I do that, can somebody help me
I have found this link, and this link, and they say that it is possible by using "import ij" but there is no ij library that I can use or install.
also ImageJ website states in "How can I call ImageJ from my software?" that "If your software is written in another language such as C or Python, there are many ways to integrate Java functionality. You must choose which one is best for your particular requirements." but there are no specifics
this Google webpage says that with "py4ij" I can control imagej with python "Py4IJ - Python for ImageJ - plugin and IDE that allows Python and Jython access to the ImageJ"
but I am not sure how to run it, Help
as an alternative to Imagej is Fiji but I am not sure if python can control it or I have to use Fiji, and Fiji tutorial
my last alternative is Using OpenCV for image processing but I actually need to use ImageJ or Fiji, so OpenCV is not a valid answer
thanks
EDIT
according to the first answer, it suggest to write a CellProfiler's RunImageJ module, but my question is should I have to install CellProfiler? from here, following the examples here and here and running the module
or should I follow the native Python idea from this link
in any case the first answer link talks about Jython, but I can not use Jython, the latest version of it is based on python2.7 and I am using 3.4, and there is no development for jython 3.x
help
Integration of Python with ImageJ was recently discussed on the new ImageJ forum; see the Python scripting thread.
While it focuses on calling native-code-wrapped Python modules such as NumPy from ImageJ, the reverse direction (calling ImageJ from Python) is also addressed by some of the solutions, particularly CellProfiler's RunImageJ module. As discussed there, a dedicated programmer could start there and champion a more general solution for the benefit of the community.
In general, this issue is discussed on the ImageJ wiki on the Python page, particularly the section on limitations.

Using OpenCV TLD from Python

According to the release docs for OpenCV 3.0.0, it includes an implementation of the Tracking-Detection-Learning algorithm. There's even some very basic docs for the C++ code.
I downloaded and compiled the 3.0.0-beta, including the Python wrapper, and it seems to have succeeded, and although I can run the Python samples, I can't find any way to access and TLD functionality through the Python wrapper. I can't even find references to it in the code.
Is it actually included in the 3.0.0 release, and if so, how do I access it?
From what I find so far there is no instruction, explicitly telling the user how to use TLD. But, you can access TLD tracking modules just by changing the parameter For instance: cv2.Tracker_create("TLD")
For a demo, you can try https://github.com/Itseez/opencv_contrib/blob/master/modules/tracking/samples/tracker.py and change the like cv2.Tracker_create("MIL") to cv2.Tracker_create("TLD")
Note: you must install opencv along with opencv_contrib to make this demo work.
Good Luck
the tld c++ code for opencv3.0 is in the opencv_contrib repo,
unfortunately, atm python or java wrapping is not ready yet.

Working OpenSceneGraph bindings for Python?

I'm building a rendering engine in Python for fun. I need to load 3D scenes. Any standard modern format like DAE, 3DS, or MAX would work: I can convert my files easily between standard formats.
OpenSceneGraph seems to be the most comprehensive and well-maintained solution. It would be ideal to be able to use it in Python without much hassle. Are there working Python bindings for OSG that are easy to install, work on Mac OS X (I'm on 10.8), and are compatible with the latest versions of OSG?
I searched around and came across osgswig (http://code.google.com/p/osgswig/) and PyOSG (http://sourceforge.net/projects/pyosg/), but they don't seem to be actively maintained. I don't see any recent activity related to these packages, and it seems that people had trouble running osgswig on OSX. Ideally, I'd like to find something that "just works", without major compilation hassles. I'd like to just install a package and be able to import a module that will let me load COLLADA or 3DS files.
I also came across pycollada (https://github.com/pycollada/pycollada). It seems active, but fairly early-stage. Ideally, I'd like a reasonably comprehensive package that supports specular maps, normal maps, and other reasonably advanced features. Animation would be nice as well.
In summary, I need to load 3D scenes in Python. Bindings for OSG would probably be ideal, because OSG is so comprehensive. But I need something that works on OSX. I would also prefer something that can be installed reasonably easily. Does something like this exist?
Thanks!
Take a look at Open Asset Import Library (short name: Assimp). It is a portable Open Source library to import various well-known 3D model formats in a uniform manner. http://www.assimp.org/
You should loot at panda3D (http://www.panda3d.org/), it's a game engine with extensive python bindings. It has the features you want : http://www.panda3d.org/manual/index.php/Features
I used it for a few years and it was a solid tool.
I made my own fork of a mirror of a clone of the osgswig project for a similar purpose. I have it working with OpenSceneGraph version 3.2.1 on Windows and Mac; and it's likely I will eventually polish it for linux too. I'm already delivering one product to customers based on my version of osgswig, and I'm considering making others. Find my fork here:
https://github.com/cmbruns/osgswig
If others show enough interest, I might be coaxed into creating binary installers for my version of the osgswig module, to make installation easier.
If you just want the easiest OpenSceneGraph bindings for OSG 3.2.1, you can stop reading this answer here. Read on for more of my thoughts for the future.
Though I am maintaining a fork of osgswig (as stated above), I sort of hate SWIG, and I would prefer to use bindings based on Boost.Python, rather than on SWIG. For large, complex C++ APIs, like OpenSceneGraph, Boost.Python can be much more elegant than SWIG, both for the API consumer, and for the binding maintainer (me, and me). I found one project using Boost.Python to wrap OSG, at https://code.google.com/p/osgboostpython/, but the developer is lovingly wrapping each part of the interface by hand, and has thus only completed a tiny fraction of the large OpenSceneGraph API.
Taking that Boost.Python based project as inspiration, I created yet another OpenSceneGraph Python binding project, at https://github.com/JaneliaSciComp/osgpyplusplus. Eventually, I want to use this osgpyplusplus project for all my python osg needs. And I would appreciate help in making it ready. Right now, osgpyplusplus suffers from the following weaknesses, compared to osgswig:
osgpyplusplus is not yet used in any working product
The build environment is tricky to set up, requiring both Boost.Python and Pyplusplus
I haven't paid much attention to osgpyplusplus recently, so it might rust away if I continue to ignore it.
Though osgpyplusplus probably wraps most of the OpenSceneGraph API, there are probably some important missing pieces that won't be identified until someone tries to develop a significant project with it.
It would be a lot of work for me to create a binary module installer for osgpyplusplus at this point, so please don't ask me to.

Documentation for gnomekeyring Python lib

Is there a documentation for Python 'gnomekeyring' lib somewhere in the Web?
There is the reference for the C library which the Python package uses. Most function names are identical (except for the "gnome_keyring_" prefix). The Bending Gnome Keyring with Python blog series should give you a good start as well.
And as the keyring package was already mentioned: If I remember correctly, that package supports gnome-keyring as a backend, so you can look at its source code to find out how to use gnome-keyring.
Apparently not. But this one is documented, maybe that's an option?
http://pypi.python.org/pypi/keyring
If not, maybe you can figure out how to use gnomekeyring from reading the source of keyring. :)

What is the relationship between docutils and Sphinx?

There seems to be a plethora of documentation tools for Python. Another one that I've run across is epydoc. It seems like Sphinx is the de facto standard, because it's used to generate the official Python docs. Can someone please sort out the current state of Python's documentation tools for me?
epydoc and Sphinx are different types of tools.
They are the same in that they:
Both use ReST via docutils.
Both are very Pythonic in their focus
Both can generate HTML and PDF documentation
They are different in their focus.
Epydoc is focused on API (Developer) documentation. You get more results quicker with Epydoc. You point it at your source code and you get something. This is what I want from an API documentation tool.
Sphinx is focused on general (User) documentation. While Sphinx does pull a lot of information from your source code you need to put a little more into it. Sphinx can generate API documentation but, it's not as straight forward, and IMO doesn't do as good of a job as Epydoc. I know some will disagree because Sphinx is chosen for Python. BUT, it depends on how much work you want to put into it. I do love Sphinx for general documentation.
So it depends on how much work you want to put into it and what you are documenting.
I recently changed from Python2 to Python3 and found that there was no Epydoc package for Python3. So it seems with Python3 there is a clear focus on using Sphinx as API documentation.
It seems like Epydoc is, if not dead, at least pining for the fjords.
Sphynx with the sphinx-apidoc command and the autodoc extension looks to be the most popular option for API docs at this time.
Good examples are:
requests (src)
boto (src)
See: Should we use Epydoc, Sphinx or something else for documenting Python APIs? (SO5579198)
Sphinx encourages a more narrative style than tools in the javadoc mold, but maybe this is a good thing?

Categories