On Tue, Jul 12, 2011 at 12:53:32PM +0000, Juha Jäykkä wrote:
> > I don't know: you gave only a fairly non-specific description of your
> > problem. I would have to write an example to find out where things
> > exactly fail.

> I did attach a script.

Please accept my excuses. I try to answer to Mayavi question reasonnably
fast eventhough I am travelling and have a hard time keeping up with
mail. Sometimes I go too far in the speed/quality tradeoff.

> The failure occurs at the second 
> set_active_attribute(). It does not matter what you replace my Phi with, in 
> fact, you can use the following:

Thanks for the example. This requires more brain resources than I can
dedicate to it right now. I'll have a look at this later.

> > I would try representing data as a surface (PolyData, which you can
> > create using an mlab.mesh command) and applying to it a 2D contouring
> > operation (I do not know out of the top of my head what the name of the
> > corresponding VTK filter is, but I am pretty sure that it exists.

> That approach has the disadvantage of enforcing an image window. Is
> there a way of doing the mlab.mesh without the final surface? Use it to
> just construct the PolyDataNormals?

Sure. For every mlab function, you can build the corresponding pipeline
using mlab.pipeline function. Specifically, you can simply look at the
pipeline in the pipeline view UI and deduce the name of the mlab.pipeline
function calls for the names of the pipeline steps.

> Also, mesh is *very* slow, but it does work.

Interesting. I can see why this could be the case. You might be right
that a better strategy is to use the same data structure that you where
using: mlab.pipeline.scalar_field. Sorry for the confusion.

That said, I wonder whether the error that you are seeing is not related
to the computation of contours not working right on the flat scalar_field
(or ImageData in VTK speech).

Digging a bit in the Mayavi code, I have the feeling that the contour
filter should work just right on flat data. 

Out of the blue, I do not know what the problem is. However, I had a
quick look running your script and notice that np.abs(Phi) was always
zero. I fixed that (by having z equal to 1 rather than 0), and your
example works just fine.

I suspect that, in the case of the example that you sent, the error that
you are seeing is related to the fact that contour extraction returned no
contours, for a reason or another.

HTH,

Gaël

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
MayaVi-users mailing list
MayaVi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users

Reply via email to