예제 #1
0
from numpy import array
try:
    engine = mayavi.engine
except NameError:
    from mayavi.api import Engine
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()
# -------------------------------------------

from mayavi.modules.iso_surface import IsoSurface

#vtk_file_reader2 = engine.open(u'/home/m/spammsand/spammsand/water_to_duals/z_15.vtk')
vtk_file_reader2 = engine.open(
    u'/home/matcha/Desktop/RESEARCH/spammsand_may_21_2015/spammsand/water_to_duals/z_14.vtk'
)

iso_surface2 = IsoSurface()
engine.add_module(iso_surface2, obj=None)
iso_surface2.actor.mapper.scalar_mode = 'use_field_data'

#iso_surface2.actor.property.specular_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.diffuse_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.ambient_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)

iso_surface2.actor.property.specular_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.diffuse_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.ambient_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.color = (1.0, 1.0, 1.0)
예제 #2
0
from numpy import array
try:
    engine = mayavi.engine
except NameError:
    from mayavi.api import Engine
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()
# -------------------------------------------

from mayavi.modules.iso_surface import IsoSurface

#vtk_file_reader2 = engine.open(u'/home/m/spammsand/spammsand/water_to_duals/z_15.vtk')

vtk_file_reader2 = engine.open(u'x_19.vtk')

iso_surface2 = IsoSurface()
engine.add_module(iso_surface2, obj=None)
iso_surface2.actor.mapper.scalar_mode = 'use_field_data'

#iso_surface2.actor.property.specular_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.diffuse_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.ambient_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)

iso_surface2.actor.property.specular_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.diffuse_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.ambient_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.color = (1.0, 1.0, 1.0)
예제 #3
0
# Recorded script from Mayavi2
from numpy import array
from mayavi import mlab
try:
    engine = mayavi.engine
except NameError:
    from mayavi.api import Engine
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()
# ------------------------------------------- 
vtk_file_reader = engine.open('/home/dori/develop/pySAM/vtk/_55_1.11595_1.70081e-05.vtk')
from mayavi.modules.surface import Surface
surface = Surface()
engine.add_filter(surface, vtk_file_reader)
mlab.savefig('scene.png')
예제 #4
0
# Recorded script from Mayavi2
from numpy import array
try:
    engine = mayavi.engine
except NameError:
    from mayavi.api import Engine
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()
# -------------------------------------------

from mayavi.modules.iso_surface import IsoSurface

vtk_file_reader2 = engine.open(
    u'/home/m/spammsand/spammsand/tube_5_duals/z_10.vtk')
##vtk_file_reader2 = engine.open(u'/home/matcha/Desktop/RESEARCH/spammsand_may_10_2015/spammsand/350_6311gss/z_12.vtk')
iso_surface2 = IsoSurface()
engine.add_module(iso_surface2, obj=None)
iso_surface2.actor.mapper.scalar_mode = 'use_field_data'

#iso_surface2.actor.property.specular_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.diffuse_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.ambient_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)

iso_surface2.actor.property.specular_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.diffuse_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.ambient_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.color = (1.0, 1.0, 1.0)
예제 #5
0
# Recorded script from Mayavi2

from numpy import array
from mayavi import mlab
try:
    engine = mayavi.engine
except NameError:
    from mayavi.api import Engine
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()
# ------------------------------------------- 
scene = engine.scenes[0]
vtk_file_reader = engine.open(u'out.vtk', scene)
from mayavi.modules.surface import Surface
surface = Surface()
engine.add_filter(surface, vtk_file_reader)
from mayavi.modules.iso_surface import IsoSurface
iso_surface1 = IsoSurface()
vtk_file_reader = engine.scenes[0].children[0]
engine.add_filter(iso_surface1, vtk_file_reader)
scene.scene.x_minus_view()
hand=mlab.gcf(engine)
mlab.figure(hand,bgcolor=(1,1,1))
surface.actor.property.opacity = 0.78
scene.scene.save(u'out.png')
예제 #6
0
# Recorded script from Mayavi2
from numpy import array
try:
    engine = mayavi.engine
except NameError:
    from mayavi.api import Engine
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()
# ------------------------------------------- 

from mayavi.modules.iso_surface import IsoSurface


vtk_file_reader2 = engine.open(u'/home/m/spammsand/spammsand/water_6311gss_duals/z_15.vtk')
##vtk_file_reader2 = engine.open(u'/home/matcha/Desktop/RESEARCH/spammsand_may_10_2015/spammsand/350_6311gss/z_12.vtk')
iso_surface2 = IsoSurface()
engine.add_module(iso_surface2, obj=None)
iso_surface2.actor.mapper.scalar_mode = 'use_field_data'

#iso_surface2.actor.property.specular_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.diffuse_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.ambient_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)

iso_surface2.actor.property.specular_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.diffuse_color  = (1.0, 1.0, 1.0)
iso_surface2.actor.property.ambient_color  = (1.0, 1.0, 1.0)
iso_surface2.actor.property.color          = (1.0, 1.0, 1.0)
예제 #7
0
    def view(prefix, name):
        """
        construct a generic visualization of base mesh, refined mesh,
        and potential/field/pseudopotential data in mayavi2
        requires running within mayavi2 or ipython with threads or
        something like::

            from pyface.api import GUI
            GUI().start_event_loop()

        in your script to interact with it.

        this is from a simplified macro recorded in mayavi2
        """
        """
        wwc 11/23/2018
        In both python 2.7 and 3.5, this 3D visualization with mayavi 
        works in Linux, but it's not compatible with X11 remote forwarding. 
        Install mayavi through conda channel "menpo" in python 3.5 or just 
        see environment setup of "ele35" in README. However, I haven't 
        found a mayavi version for python 3.6.
        """

        import mayavi
        try:
            from mayavi.api import Engine
            engine = Engine()
            engine.start()
        except AttributeError: # NameError:
            engine = mayavi.engine

        if len(engine.scenes) == 0:
            engine.new_scene()

        scene = engine.scenes[0]

        base_mesh_name = "%s_mesh.vtk" % prefix
        if os.access(base_mesh_name, os.R_OK):
            base_mesh = engine.open(base_mesh_name)
            surface = Surface()
            engine.add_filter(surface, base_mesh)
            surface.actor.property.representation = 'wireframe'
            surface.actor.property.line_width = 1

        mesh_name = "%s_%s_mesh.vtk" % (prefix, name)
        if os.access(mesh_name, os.R_OK):
            mesh = engine.open(mesh_name)
            mesh.cell_scalars_name = 'charge'
            surface = Surface()
            engine.add_filter(surface, mesh)
            module_manager = mesh.children[0]
            module_manager.scalar_lut_manager.lut_mode = 'RdBu'
            module_manager.scalar_lut_manager.use_default_range = False
            r = np.fabs(module_manager.scalar_lut_manager.data_range).max()
            module_manager.scalar_lut_manager.data_range = [-r, r]
            surface.actor.property.backface_culling = True

        data_name = "%s_%s.vtk" % (prefix, name)
        if os.access(data_name, os.R_OK):
            data = engine.open(data_name)
            if "pseudo_potential" in data._point_scalars_list:
                data.point_scalars_name = "pseudo_potential"
            else:
                data.point_scalars_name = "potential"
            iso_surface = IsoSurface()
            engine.add_filter(iso_surface, data)
            module_manager = data.children[0]
            module_manager.scalar_lut_manager.lut_mode = 'Greys'
            iso_surface.contour.auto_contours = True
            iso_surface.contour.number_of_contours = 5
            try:
                iso_surface.contour.maximum_contour = 1e-2
            except:
                pass

        scene.scene.isometric_view()
        scene.scene.render()
예제 #8
0
from numpy import array
from mayavi.modules.axes import Axes
from mayavi.api import Engine
from mayavi.modules.streamline import Streamline
from mayavi.tools.show import show

try:
    engine = mayavi.engine
except NameError:
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()

scene = engine.scenes[0]
vtk_file_reader = engine.open(sys.argv[1])
axes = Axes()
engine.add_filter(axes, vtk_file_reader)
streamline = Streamline()
engine.add_filter(streamline, vtk_file_reader)
streamline.seed.widget.center = array([0.0, 12.0, 12.0])
streamline.seed.widget.center = array([0.0, 12.0, 12.0])
streamline.seed.widget.handle_direction = array([1.0, 0.0, 0.0])
streamline.seed.widget.enabled = False

streamline1 = Streamline()
engine.add_filter(streamline1, vtk_file_reader)
streamline1.seed.widget = streamline1.seed.widget_list[2]
streamline1.seed.widget.center = array([30.0, 12.0, 12.0])
streamline1.seed.widget.enabled = False
streamline1.seed.widget.center = array([30.0, 12.0, 12.0])
예제 #9
0
# Recorded script from Mayavi2
from numpy import array
try:
    engine = mayavi.engine
except NameError:
    from mayavi.api import Engine
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()
# ------------------------------------------- 

from mayavi.modules.iso_surface import IsoSurface


vtk_file_reader2 = engine.open(u'/home/m/spammsand/spammsand/tube_5_duals/y_15.vtk')
##vtk_file_reader2 = engine.open(u'/home/matcha/Desktop/RESEARCH/spammsand_may_10_2015/spammsand/350_6311gss/z_12.vtk')
iso_surface2 = IsoSurface()
engine.add_module(iso_surface2, obj=None)
iso_surface2.actor.mapper.scalar_mode = 'use_field_data'

#iso_surface2.actor.property.specular_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.diffuse_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.ambient_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)

iso_surface2.actor.property.specular_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.diffuse_color  = (1.0, 1.0, 1.0)
iso_surface2.actor.property.ambient_color  = (1.0, 1.0, 1.0)
iso_surface2.actor.property.color          = (1.0, 1.0, 1.0)
def draw(vtk_files,
         coords_file,
         conn_list=None,
         brain_rgba=(0.5, 0.5, 0.5, 0.2),
         node_rgba=(0.30, 0.69, 1.0, 1.0),
         node_rad=2.5,
         conn_thr=[0.75, 1.0],
         conn_cmap='YlOrRd'):

    ### Setup the engine and scene
    my_engine = Engine()
    my_engine.start()

    # Create a new scene
    my_scene = my_engine.new_scene()

    # Set background
    my_scene.scene.background = (1.0, 1.0, 1.0)

    # Initialize the rendering
    my_scene.scene.disable_render = True

    # Import VTK file to pipeline
    for vtk_file in vtk_files:
        vtk_source = my_engine.open(vtk_file)

        # Render surface
        vtk_surface = Surface()
        my_engine.add_module(vtk_surface, obj=vtk_source)
        vtk_surface.actor.property.specular_color = brain_rgba[:3]
        vtk_surface.actor.property.diffuse_color = brain_rgba[:3]
        vtk_surface.actor.property.ambient_color = brain_rgba[:3]
        vtk_surface.actor.property.color = brain_rgba[:3]
        vtk_surface.actor.property.opacity = brain_rgba[3]

    # Reset camera
    my_scene.scene.disable_render = False
    my_scene.scene.reset_zoom()

    ### Sensor-Locations
    # Load Coordinates in MRI-space
    node_coords = np.loadtxt(coords_file, delimiter=',')
    n_node = node_coords.shape[0]
    n_conn = np.int(n_node * (n_node - 1) * 0.5)

    # Import coordinates into pipeline
    crd_source = mlab.pipeline.scalar_scatter(node_coords[:, 0],
                                              node_coords[:, 1],
                                              node_coords[:, 2])
    # Render Glyphs for node points
    crd_surface = mlab.pipeline.glyph(crd_source,
                                      scale_mode='none',
                                      scale_factor=node_rad,
                                      mode='sphere',
                                      colormap='cool',
                                      color=node_rgba[:3],
                                      opacity=node_rgba[3])

    ### Connection-Locations
    if conn_list is None:
        return
    assert len(conn_list) == n_conn

    # Generate all vectors
    e_start = np.zeros((n_conn, 3))
    e_vec = np.zeros((n_conn, 3))

    triu_ix, triu_iy = np.triu_indices(n_node, k=1)

    for ii, (ix, iy) in enumerate(zip(triu_ix, triu_iy)):
        e_start[ii, :] = node_coords[ix, :]
        e_vec[ii, :] = 1e-3 * (node_coords[iy, :] - node_coords[ix, :])

    # Import vectors (connections) into pipeline
    edg_source = mlab.pipeline.vector_scatter(e_start[:, 0], e_start[:, 1],
                                              e_start[:, 2], e_vec[:, 0],
                                              e_vec[:, 1], e_vec[:, 2])
    edg_source.mlab_source.dataset.point_data.scalars = conn_list

    edg_thresh = mlab.pipeline.threshold(
        edg_source,
        low=np.percentile(conn_list, 100 * conn_thr[0]),
        up=np.percentile(conn_list, 100 * conn_thr[1]))
    edg_thresh.auto_reset_lower = False
    edg_thresh.auto_reset_upper = False

    edg_surface = mlab.pipeline.vectors(edg_thresh,
                                        colormap=conn_cmap,
                                        line_width=3.0,
                                        scale_factor=1000,
                                        scale_mode='vector')

    edg_surface.glyph.glyph.clamping = False
    edg_surface.actor.property.opacity = 0.75
    edg_surface.module_manager.vector_lut_manager.reverse_lut = True

    edg_surface.glyph.glyph_source.glyph_source = (
        edg_surface.glyph.glyph_source.glyph_dict['glyph_source2d'])
    edg_surface.glyph.glyph_source.glyph_source.glyph_type = 'dash'
예제 #11
0
# Recorded script from Mayavi2
from numpy import array
try:
    engine = mayavi.engine
except NameError:
    from mayavi.api import Engine
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()
# -------------------------------------------

from mayavi.modules.iso_surface import IsoSurface

vtk_file_reader2 = engine.open(
    u'/home/m/spammsand/spammsand/water_6311gss_duals/y_15.vtk')
##vtk_file_reader2 = engine.open(u'/home/matcha/Desktop/RESEARCH/spammsand_may_10_2015/spammsand/350_6311gss/y_12.vtk')
iso_surface2 = IsoSurface()
engine.add_module(iso_surface2, obj=None)
iso_surface2.actor.mapper.scalar_mode = 'use_field_data'

#iso_surface2.actor.property.specular_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.diffuse_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.ambient_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)

iso_surface2.actor.property.specular_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.diffuse_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.ambient_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.color = (1.0, 1.0, 1.0)
예제 #12
0
from numpy import array
try:
    engine = mayavi.engine
except NameError:
    from mayavi.api import Engine
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()
# ------------------------------------------- 

from mayavi.modules.iso_surface import IsoSurface


#vtk_file_reader2 = engine.open(u'/home/m/spammsand/spammsand/water_to_duals/z_15.vtk')
vtk_file_reader2 = engine.open(u'/home/matcha/Desktop/RESEARCH/spammsand_may_21_2015/spammsand/water_to_duals/z_14.vtk')

iso_surface2 = IsoSurface()
engine.add_module(iso_surface2, obj=None)
iso_surface2.actor.mapper.scalar_mode = 'use_field_data'

#iso_surface2.actor.property.specular_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.diffuse_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.ambient_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)

iso_surface2.actor.property.specular_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.diffuse_color  = (1.0, 1.0, 1.0)
iso_surface2.actor.property.ambient_color  = (1.0, 1.0, 1.0)
iso_surface2.actor.property.color          = (1.0, 1.0, 1.0)
예제 #13
0
    def view(prefix, name):
        """
        construct a generic visualization of base mesh, refined mesh,
        and potential/field/pseudopotential data in mayavi2
        requires running within mayavi2 or ipython with threads or
        something like::

            from pyface.api import GUI
            GUI().start_event_loop()

        in your script to interact with it.

        this is from a simplified macro recorded in mayavi2
        """
        try:
            engine = mayavi.engine
        except NameError:
            from mayavi.api import Engine
            engine = Engine()
            engine.start()

        if len(engine.scenes) == 0:
            engine.new_scene()

        scene = engine.scenes[0]

        base_mesh_name = "%s_mesh.vtk" % prefix
        if os.access(base_mesh_name, os.R_OK):
            base_mesh = engine.open(base_mesh_name)
            surface = Surface()
            engine.add_filter(surface, base_mesh)
            surface.actor.property.representation = 'wireframe'
            surface.actor.property.line_width = 1

        mesh_name = "%s_%s_mesh.vtk" % (prefix, name)
        if os.access(mesh_name, os.R_OK):
            mesh = engine.open(mesh_name)
            mesh.cell_scalars_name = 'charge'
            surface = Surface()
            engine.add_filter(surface, mesh)
            module_manager = mesh.children[0]
            module_manager.scalar_lut_manager.lut_mode = 'RdBu'
            module_manager.scalar_lut_manager.use_default_range = False
            r = np.fabs(module_manager.scalar_lut_manager.data_range).max()
            module_manager.scalar_lut_manager.data_range = [-r, r]
            surface.actor.property.backface_culling = True

        data_name = "%s_%s.vtk" % (prefix, name)
        if os.access(data_name, os.R_OK):
            data = engine.open(data_name)
            if "pseudo_potential" in data._point_scalars_list:
                data.point_scalars_name = "pseudo_potential"
            else:
                data.point_scalars_name = "potential"
            iso_surface = IsoSurface()
            engine.add_filter(iso_surface, data)
            module_manager = data.children[0]
            module_manager.scalar_lut_manager.lut_mode = 'Greys'
            iso_surface.contour.auto_contours = True
            iso_surface.contour.number_of_contours = 5
            try:
                iso_surface.contour.maximum_contour = 1e-2
            except:
                pass

        scene.scene.isometric_view()
        scene.scene.render()
예제 #14
0
# Recorded script from Mayavi2
from numpy import array
try:
    engine = mayavi.engine
except NameError:
    from mayavi.api import Engine
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()
# ------------------------------------------- 

from mayavi.modules.iso_surface import IsoSurface


vtk_file_reader2 = engine.open(u'/home/m/spammsand/spammsand/z_12.vtk')
##vtk_file_reader2 = engine.open(u'/home/matcha/Desktop/RESEARCH/spammsand_may_10_2015/spammsand/350_6311gss/z_12.vtk')
iso_surface2 = IsoSurface()
engine.add_module(iso_surface2, obj=None)
iso_surface2.actor.mapper.scalar_mode = 'use_field_data'

#iso_surface2.actor.property.specular_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.diffuse_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.ambient_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)

iso_surface2.actor.property.specular_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.diffuse_color  = (1.0, 1.0, 1.0)
iso_surface2.actor.property.ambient_color  = (1.0, 1.0, 1.0)
iso_surface2.actor.property.color          = (1.0, 1.0, 1.0)
예제 #15
0
try:
    engine = mayavi.engine
except NameError:
    from mayavi.api import Engine
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()
# ------------------------------------------- 

from mayavi.modules.iso_surface import IsoSurface


#vtk_file_reader2 = engine.open(u'/home/m/spammsand/spammsand/water_to_duals/z_15.vtk')

vtk_file_reader2 = engine.open(u'x_19.vtk')

iso_surface2 = IsoSurface()
engine.add_module(iso_surface2, obj=None)
iso_surface2.actor.mapper.scalar_mode = 'use_field_data'

#iso_surface2.actor.property.specular_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.diffuse_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.ambient_color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)
#iso_surface2.actor.property.color = (0.5019607843137255, 0.5019607843137255, 0.5019607843137255)

iso_surface2.actor.property.specular_color = (1.0, 1.0, 1.0)
iso_surface2.actor.property.diffuse_color  = (1.0, 1.0, 1.0)
iso_surface2.actor.property.ambient_color  = (1.0, 1.0, 1.0)
iso_surface2.actor.property.color          = (1.0, 1.0, 1.0)
예제 #16
0
from mayavi.api import Engine
from mayavi.modules.axes import Axes
from mayavi.modules.surface import Surface
from mayavi.modules.streamline import Streamline
from mayavi.tools.show import show

try:
    engine = mayavi.engine
except NameError:
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()

scene = engine.scenes[0]
vtk_file_reader = engine.open(sys.argv[1], scene)
vtk_file_reader1 = engine.open(sys.argv[2], scene)

surface = Surface()
engine.add_filter(surface, vtk_file_reader)
surface.contour.contours = [1.5]
surface.actor.mapper.progress = 1.0
surface.actor.mapper.scalar_range = array([ 0.,  3.])
surface.enable_contours = True
surface.actor.property.point_size = 0.0
surface.actor.property.opacity = 0.1602

streamline = Streamline()
streamline.seed.widget = streamline.seed.widget_list[2]
engine.add_filter(streamline, vtk_file_reader1)
streamline.stream_tracer.integration_direction = 'both'