Christopher Snyder | 26 Jun 22:54 2015
Picon

automatically setting the scalar opacity for vol image data

Hi there,

I would truly truly be grateful if someone could help me with this. It has caused me much strife.

I would like to change the opacity scaling to some default piecewise function when I first run my code -- without messing with the GUI or the pop up window: volume.edit_traits()

I've tried many related ways, but for sanity I'll stick to a prototypical example:
#########
volume=mlab.pipeline.volume(mlab.pipeline.scalar_field(sIzi,sIxi,sIyi,I))
from tvtk.util.ctf import PiecewiseFunction
otf = PiecewiseFunction()
otf.add_point(0.0,0.0)
#otf.add_point(0.25,0.0)
otf.add_point(0.35,0.15)
otf.add_point(1.0,.25)

volume.volume_property.set_scalar_opacity(otf)

#########

This code seems to edit the opacity, but it acts as if I had typed in 0.0025 (or maybe 0.025?) and 0.0035 instead of 0.35. For clarity, I would like slope of the opacity function to change at the 25% and 35% percentiles.

Thanks,
Chris


------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
MayaVi-users mailing list
MayaVi-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users
Tom | 22 Jun 17:02 2015
Picon

Problem with mayavi 4.4.0 - mlab.figure.scene.save() and mlab.text3d()

Hallo,
I'm using mayavi 4.4.0, Windows 8, python 2.7 on my PC & my laptop.
However, there are 2 issues with mayavi
1. On my laptop, I can call mlab.figure.scene.save() to save screen 
shot. But the same code doesn't work on my PC (error).

2. On my PC, mlab.text3d() works well, but on my laptop, the code show 
nothing (but there is no error).

Could somebody help me?
Thanks
Tom

------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
Prabhu Ramachandran | 3 Jun 16:37 2015
Picon

[ANN] Mayavi-4.4.1 release

Hello,

Enthought is pleased to announce Mayavi-4.4.1.  Mayavi is a general purpose,
cross-platform Python package for 2-D and 3-D scientific data visualization.
Mayavi integrates seamlessly with numpy and provides a convenient Pythonic
wrapper for the VTK API.  It provides a high-level visualization API that sits
on top of the powerful VTK (http://www.vtk.org) library. It provides a
stand-alone UI to help visualize your data. Mayavi is easy to extend and embed
in your own dialogs and UIs.

For more information see here:

  http://docs.enthought.com/mayavi/mayavi/index.html

Mayavi-4.4.0 is available as part of the free Canopy
(https://store.enthought.com/downloads/) packages.  4.4.1 will be available soon.

This is a major public release as this is the first public version of Mayavi to
support VTK-6.x and also support VTK-5.x.  Mayavi-4.4.1 (and 4.4.0) should work
with all VTK 6.x releases as well as the latest development version. We did have
a 4.4.0 release but did not announce it widely. For more details on the
enhancements and fixes please see here:

http://docs.enthought.com/mayavi/mayavi/auto/changes.html#mayavi-4-4-1

and here:

http://docs.enthought.com/mayavi/mayavi/auto/changes.html#mayavi-4-4-0

This release is important as this will allow us to track major improvements that
are part of the VTK-6.x releases.

We are thankful to the following for their contributions towards this release:

Deepak Surti, Prabhu Ramachandran, Robert Kern, Mark Kness, Ioannis Tziakos,
Mark Dickinson, Paul Müller, Gael Varoquaux

cheers,
Mayavi Developers

------------------------------------------------------------------------------
_______________________________________________
MayaVi-users mailing list
MayaVi-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users
Stuart Mumford | 9 Feb 12:27 2015
Picon

Mayavi 4.4 with VTK 6 and Setting Inputs

Hello,

I have just upgraded to 4.4 using VTK 6, and some of my more detailed TVTK code has exploded. I have managed to fix some of it but I am so far unable to find a solution to this problem:

the input to this code is 'bfield' which is a mayavi.sources.array_source.ArraySource.

Old code:

#Make a streamline instance with the bfield

surf_field_lines = tvtk.StreamTracer()

surf_field_lines.input = bfield


surf_field_lines.source = surf_seeds

surf_field_lines.integrator = tvtk.RungeKutta4()

surf_field_lines.maximum_propagation = 1000

surf_field_lines.integration_direction = 'backward'

surf_field_lines.update()


which raises an 'input is read only error' and presumably will do the same on 'source' once it gets there.


I have tried a few different things, including `input_connection` which does this:
surf_field_lines.input_connection = bfield.outputs[0]
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-38-a2fc63178a31> in <module>() ----> 1 surf_field_lines.input_connection = bfield.outputs[0] /usr/lib/python2.7/site-packages/tvtk/tvtk_classes.zip/tvtk_classes/algorithm.pyc in _set_input_connection(self, obj) 191 def _set_input_connection(self, obj): 192 old_val = self._get_input_connection() --> 193 self._wrap_call(self._vtk_obj.SetInputConnection, deref_vtk(obj)) 194 self.trait_property_changed('input_connection', old_val, obj) 195 input_connection = traits.Property(_get_input_connection, /usr/lib/python2.7/site-packages/tvtk/tvtk_base.pyc in _wrap_call(self, vtk_method, *args) 521 self._in_set += 1 522 mtime = self._wrapped_mtime(vtk_obj) + 1 --> 523 ret = vtk_method(*args) 524 self._in_set -= 1 525 if self._wrapped_mtime(vtk_obj) > mtime: TypeError: SetInputConnection argument 1: method requires a vtkAlgorithmOutput, a vtkImageData was provided.

I also tried this:

import tvtk.common as tvtk_commontvtk_common.configure_input(surf_field_lines, bfield.outputs[0])
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-37-2ac55d369a09> in <module>() 1 import tvtk.common as tvtk_common ----> 2 tvtk_common.configure_input(surf_field_lines, bfield.outputs[0]) /usr/lib/python2.7/site-packages/tvtk/common.pyc in configure_input(inp, op) 83 inp.input_connection = op 84 elif op.is_a('vtkDataSet'): ---> 85 inp.set_input_data(op) 86 else: 87 raise ValueError('Unknown input type for object %s'%op) AttributeError: 'StreamTracer' object has no attribute 'set_input_data'
With a very similar error happening for tvtk_common.configure_connection.

So what is the correct idiom for connecting the input and source data on these objects?

Thanks
Stuart

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
MayaVi-users mailing list
MayaVi-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users
Sushilkumar | 3 Jan 05:02 2015
Picon

Mayavi query

Hello 

I am trying to use Mayavi to develop a magnetic dipole field in Cartesian coordinate system. 

However when I run the python script I get the following errors

Generic Warning: In /build/buildd/vtk-5.8.0/
Filtering/vtkPolyLine.cxx, line 199
Coincident points in polyline...can't compute normals

I am using the same python script as in the link below. The difference being the formula used for calculating the field components (Please let me know if you would like me to email you my python script). Could you suggest ways to overcome the above error? 

http://docs.enthought.com/mayavi/mayavi/auto/example_magnetic_field_lines.html#example-magnetic-field-lines

Thanks in advance and appreciate your help

--
SK2

"Claiming that something can move faster than light is a good conversation-stopper in physics. People edge away from you in cocktail parties; friends never return phone calls. You just don’t mess with Albert Einstein."

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
MayaVi-users mailing list
MayaVi-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users
Luke Zoltan Kelley | 4 Sep 04:10 2014
Picon

Misaligned streamlines overplotted on image planes

I'm trying to plot magnetic field lines (mlab.pipeline.streamline), in addition to two image planes of density (mlab.pipeline.image_plane_widget) in a cubic (512^3) grid.  In general this is working well, but occasionally the streamlines' bounding box is no longer aligned with that of the image planes; each time the streamlines' box becomes elongated along a single direction*.  The data is always in a 512^3 grid, but only some snapshots create this problem --- so it seems to be an issue with the autoscaling based on the shape of the streamlines.

Is there a way to manually set the aspect ratio of the streamlines?

Here is the script I'm using which acts on a scalar array 'scal' (512x512x512), and vector array 'vect' (512x512x512x3):



mlab.options.offscreen = True
fig    = mlab.figure(size=[1000,1000])
extent = [0,1,0,1,0,1]
shape  = np.shape(scal)
x,y,z  = np.mgrid[ 0:1.0:1j*shape[0] , 0:1.0:1j*shape[1] , 0:1.0:1j*shape[2] ]

# Draw vector field                                                                                                                                                             
u,v,w      = vect[...,0], vect[...,1], vect[...,2]
vect_field = mlab.pipeline.vector_field(x,y,z, u,v,w)
streams    = mlab.pipeline.streamline(vect_field, figure=fig, extent=extent, reset_zoom=False, seedtype='plane', seed_scale=2.0, colormap='Greens')

streams.stream_tracer.integration_direction = 'both'
mlab.outline()
seed = streams.seed.widget
seed.set( normal=[0.0,0.0,1.0] )
seed.set( center=[0.5,0.5,0.5] )
seed.set( resolution=SEED_RESOLUTION )
seed.enabled = False
                            
# Draw scalar field
scal       = np.log10(scal)
scal_field = mlab.pipeline.scalar_field(x,y,z, scal)
midz       = np.int(np.floor(shape[2]*0.5))
plane1 = mlab.pipeline.image_plane_widget(scal_field, figure=fig, plane_orientation='z_axes', slice_index=midz, opacity=0.1, transparent=True, extent=extent, reset_zoom=False )
plane2 = mlab.pipeline.image_plane_widget(scal_field, figure=fig, plane_orientation='x_axes', slice_index=0, opacity=0.1, extent=extent, reset_zoom=False )

mlab.colorbar()
mlab.view(35, 75, 3.0, focalpoint=[0.5,0.5,0.4])



Thanks!

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
MayaVi-users mailing list
MayaVi-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users
david | 26 May 15:48 2014
Picon

Problem of ScalarCutPlane module: how to fix the normal direction or hide the normal arrow

I am developing a program based on Mayavi and TraitsUI, which need a fixed 
normal direction ScalarCutPlane to display unstructured grid data.
Firstly, I am trying to catch  the ScalarPlanCut.implict_plane.nomral change 
event using HasTraits.on_trait_change method. However, it only catches the 
initial assignment to normal. The trait changing using mouse interaction does 
not invoke the bond method.
Then, I try to catch the changing event of 
ScalarPlanCut.implict_plane.nomral_to_x_axis. And python tell the attribute 
normal_to_x_axis can not be accessed. I looked into the source code of 
ImplicitPlane. I find that normal_to_x_aixs exsites.
So the first question is how to access "normal_to_x_axis" publicly. Another 
question is the comment in source code of ImplictPlane mentioned that there is 
"modified_event" can be caught if the state of normal is changed. but it don't 
tell explicitly what name it is. So the question is how to catch the 
"modified_event"
Any help will be appreciated.

------------------------------------------------------------------------------
The best possible search technologies are now affordable for all companies.
Download your FREE open source Enterprise Search Engine today!
Our experts will assist you in its installation for $59/mo, no commitment.
Test it for FREE on our Cloud platform anytime!
http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk
Daniel Pflugfelder | 16 May 17:37 2014
Picon
Picon

Clipping planes in Mayavi?

Hello,

I have a complex 3D scene in Mayavi. To get a better overview I would like
to clip away part of the scene. The closest thing to realise this I found
was the camera clipping range, such as:

fig=mlab.figure()
mlab.points3d([0],[0],[0])
fig.scene.camera.clipping_range=[2,2.9]
mlab.draw()

This works, but as soon as I move the scene the clipping is gone and the
full scene is there again. 
Does Mayavi offer the possibility for persistent clipping planes, ideally in
all three directions?

Any help is greatly appreciated!
Daniel

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
GeeKer Wang | 27 Apr 10:51 2014
Picon

How to use MultilineTextEditor or SourceCodeEditor?

I want to edit ProgrammableFilter source code in the PropertyEditor,
but I can't find a multiline text editor for Str.

There are MultilineTextEditor and SourceCodeEditor in the Mayavi
source code, but I don't know if anyone have used them.

Any idea? Thanks.

--

-- 
Martin

------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
Prabhu Ramachandran | 17 Apr 21:41 2014
Picon

Mayavi and VTK 6.x

Hi all,

Thanks to a lot of effort from Deepak Surti, we have a working version 
of Mayavi with VTK-6.x.

There were a few upstream bugs in VTK which have been fixed. The latest 
version of VTK master should work although VTK-6.1 + the following 
patches is well tested to work:

http://review.source.kitware.com/#/c/15095/1
http://review.source.kitware.com/#/c/15138/

One of these is not merged yet but should be merged soon. With these, 
all the TVTK and mayavi tests pass.  There are 2 of the integration 
tests that fail but everything else passes. All the examples have also 
been tested and seem to run fine. This is the first phase of the 
migration to the new pipeline and once this is merged, we will work on 
the next set of changes to move to the new pipeline.  Note, that VTK 
5.10.1 continues to work fine as before and will continue to do so. 
Travis-ci continues to build only with 5.x and not with 6.x.

Over the next few weeks, as time permits, we will try to make some more 
changes.  This mostly has to do with using the new pipeline better.  We 
will also refactor some of the changes to be a little cleaner.

Enjoy!

cheers,
Prabhu

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
Florian M. Wagner | 16 Apr 11:57 2014
Picon

Interactive Slicer for 3D unstructured grid

Dear all,

as a quick inspection of simulation results I would like to add a Python function that takes a VTK file (3D tetrahedral grid with cell data) and opens a mayavi window with an interactive slicer. Is that technically possible and could you point me in the right direction? For the time being my code only visualizes the gridpoints:

def showMesh3D(mesh, interactive=True):
    """
    Proof of concept for mayavi binding.
    """

    # should avoid opening of mayavi window when building documentation
    if not interactive:
        mlab.options.offscreen = True

    fig = mlab.figure(bgcolor=(1, 1, 1), size=(400, 400))

    # temporary VTK write & read, may be replaced with direct VTK object.
    tmp = "/tmp/3d_view_%s.vtk" % os.getpid()
    mesh.exportVTK(tmp)
    src = mlab.pipeline.open(tmp, figure=fig)
    os.remove(tmp)

    surf = mlab.pipeline.surface(src, figure=fig, opacity=0.5)
    edges = mlab.pipeline.extract_edges(surf, figure=fig)
    mlab.pipeline.surface(edges, color=(0, 0, 0), figure=fig)
    #mlab.pipeline.image_plane_widget(surf, colormap='gray',
                                     #plane_orientation='x_axes')

Thanks a lot,
Florian
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
MayaVi-users mailing list
MayaVi-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users

Gmane