Interest-oriented drawing tool for image analysis (in python)

In an attempt to move away from IDL and Matlab, I am exploring what tools I need to implement in python / scipy et al. One of the common features is the display of medical images and areas of interest (for example, defroi in IDL or, this is a version of GIU, xroi). In chaco and matplotlib there are examples of the LassoSelection tool that is approaching, but not quite suitable for my needs (I would like to click on the mouse, rather than drag the mouse).

Are there existing tools that can do this, or will I need to extend and customize existing classes? In any case, pointers in the right direction would be helpful.

+6
python matplotlib image-processing chaco
source share
4 answers

I think you could use PyQTGraph for this purpose, https://launchpad.net/pyqtgraph . I only used it sparingly since it has fewer inherent options than matplotlib, but it is pretty fast and it has built-in widgets for your choice of ROI. You will probably find that you are building custom nonetheless, string schemes that combine matplotlib with PyQTGraph can cause headaches if there are different formats, etc. This can lead to more bookkeeping, but it can solve your problem.

+2
source share

Matplotlib does not seem to be suitable for shooting for interactive data integration, which includes features such as drawing areas of interest. Although, of course, this applies to event processing, etc.

The best I could come up with so far is an impressive effort called guiqwt . It is based on PyQwt and, in addition, has a fairly large list of (fairly easily satisfied) dependencies. A quick look at their test examples of image visualization shows a convenient set of development tools. It was easy to install and run these examples. Time will tell how easy it is to integrate into my own work.

+6
source share

Matplotlib now has a beautiful widget called "LassoSelector", which simplifies drawing a free polygon.

Sample code here: http://matplotlib.org/examples/widgets/lasso_selector_demo.html

My minimalist version:

from pylab import * from matplotlib.widgets import LassoSelector fig, ax = plt.subplots() ax.imshow(np.random.randint(0,255,(255,255)), cmap='gray') def onselect(verts): print verts lasso = LassoSelector(ax, onselect) subplots_adjust(left=0.1, bottom=0.1) 
+2
source share

There is a nice tool here that does exactly what you want from jdoepfert on github . Performance was a bit slow on my machine, but if you comment on motion_notify_event , it works like a charm.

0
source share

All Articles