Ok, I define the contour as following : src = mlab.pipeline.scalar_field(im) src.update_image_data = True contour = mlab.pipeline.contour(src, ) contour.filter.number_of_contours = int(im.max())
with im.max = 1041 labels Then : connect_ = tvtk.PolyDataConnectivityFilter(extraction_mode=6, color_regions=True) connect = mlab.pipeline.user_defined(contour, filter=connect_) surf = mlab.pipeline.surface(contour,colormap="gist_rainbow") If I use "extraction_mode=6", it display only one region. With "extraction_mode=5" it display : connect_.number_of_extracted_regions = 697, so I haven't all regions. And finally, when I try to use the picker, I can't update the color of the picked region. Eric On Nov 16, 2010, at 1:02 PM, Gael Varoquaux wrote: > On Tue, Nov 16, 2010 at 11:59:12AM +0100, moscardi wrote: >> Now I would like to do the same thing but with N regions and each region >> of different label. >> How can I do that ? Do I need to create a loop to extract every region ? > > Why don't you simply use the 'color_regions' setting on the > PolyDataConnectivityFilter, and show all regions. Then you get a scalar > field with a different value per connect component. If you don't specify > a color but a colormap to your suface, you'll get this scalar plotted as > colors by the color map. > > HTH, > > Gaƫl Eric MOSCARDI INRIA - Virtual Plants CIRAD, Avenue Agropolis 34398 Montpellier Cedex 5, France 04 67 61 58 00 (ask number 60 09) email : [email protected] ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev _______________________________________________ MayaVi-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mayavi-users
