Exemple #1
0
for file0 in os.listdir('.'):
    if fnmatch.fnmatch(file0, string):

        filename = file0
        print filename
        savename = filename

        scene = engine.new_scene()
        scene.scene.off_screen_rendering = True
        vtk_file_reader = engine.open(filename, scene)

        scene.scene.background = (1.0, 1.0, 1.0)

        from enthought.mayavi.filters.contour import Contour
        contour = Contour()
        engine.add_filter(contour, obj=None)
        from enthought.mayavi.filters.set_active_attribute import SetActiveAttribute
        set_active_attribute = SetActiveAttribute()
        engine.add_filter(set_active_attribute, obj=None)
        from enthought.mayavi.modules.surface import Surface
        surface = Surface()
        engine.add_module(surface, obj=None)

        ##Orientation axes
        orientation_axes = OrientationAxes()
        engine.add_module(orientation_axes, obj=None)
        orientation_axes.text_property.shadow_offset = array([1, -1])
        orientation_axes.text_property.font_family = 'times'
        orientation_axes.text_property.shadow_offset = array([1, -1])
        orientation_axes.text_property.font_size = 15
        orientation_axes.axes.axis_labels = False
for file0 in os.listdir('.'):
    if fnmatch.fnmatch(file0, '*AMP.rec'):
        filename = file0
        print filename
        savename = filename

        ##
        scene1 = engine.new_scene()
        scene1.scene.off_screen_rendering = True

        jesse_mat_lab_coord_source1 = engine.open(filename, scene1)

        ##
        from enthought.mayavi.modules.iso_surface import IsoSurface
        iso_surface1 = IsoSurface()
        engine.add_filter(iso_surface1, jesse_mat_lab_coord_source1)
        iso_surface1.contour.contours[0:1] = [0.5]

        ##Orientation axes
        orientation_axes = OrientationAxes()
        engine.add_module(orientation_axes, obj=None)
        orientation_axes.text_property.shadow_offset = array([1, -1])
        orientation_axes.text_property.font_family = 'times'
        orientation_axes.text_property.shadow_offset = array([1, -1])
        orientation_axes.text_property.font_size = 15
        orientation_axes.axes.axis_labels = False
        ##

        if os.path.isdir(dir + '/pics/') == False:
            os.mkdir(dir + '/pics/')
Exemple #3
0
for file0 in os.listdir('.'):
    if fnmatch.fnmatch(file0, '*AMP-interp.rec'):
        filename = file0
        print filename
        savename = filename

        ##
        scene1 = engine.new_scene()
        scene1.scene.off_screen_rendering = True

        jesse_mat_lab_coord_source1 = engine.open(filename, scene1)

        ##
        from enthought.mayavi.modules.iso_surface import IsoSurface
        iso_surface1 = IsoSurface()
        engine.add_filter(iso_surface1, jesse_mat_lab_coord_source1)
        iso_surface1.contour.contours[0:1] = [thresh]

        ##Orientation axes
        orientation_axes = OrientationAxes()
        engine.add_module(orientation_axes, obj=None)
        orientation_axes.text_property.shadow_offset = array([1, -1])
        orientation_axes.text_property.font_family = 'times'
        orientation_axes.text_property.shadow_offset = array([1, -1])
        orientation_axes.text_property.font_size = 15
        orientation_axes.axes.axis_labels = False
        ##

        if os.path.isdir(dir + '/pics-interp/') == False:
            os.mkdir(dir + '/pics-interp/')
# Recorded script from Mayavi2
from numpy import array
try:
    engine = mayavi.engine
except NameError:
    from enthought.mayavi.api import Engine
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()
# ------------------------------------------- 
scene = engine.scenes[0]
vtkxml_file_reader = engine.open(u'/Users/prabhu/work/MEDIA/m2/data/solution.vtp', scene)
from enthought.mayavi.modules.surface import Surface
surface = Surface()
engine.add_filter(surface, vtkxml_file_reader)
scene.scene.camera.position = [-5.0805380472988206, -22.772737120755238, 27.951999647518075]
scene.scene.camera.focal_point = [-0.30313491821289062, 0.0, 1.4027749300003052]
scene.scene.camera.view_angle = 30.0
scene.scene.camera.view_up = [-0.1142423672711194, 0.76412329986979977, 0.63487342369670707]
scene.scene.camera.clipping_range = [22.838642391722981, 51.077591804257452]
scene.scene.camera.compute_view_plane_normal()
scene.scene.render()
scene.scene.camera.position = [-26.79814746753679, -17.616423028517339, 16.698474306673273]
scene.scene.camera.focal_point = [-0.30313491821289062, 0.0, 1.4027749300003052]
scene.scene.camera.view_angle = 30.0
scene.scene.camera.view_up = [0.117668827287714, 0.54423876670086724, 0.83063723243342136]
scene.scene.camera.clipping_range = [16.95271984178639, 58.486755617116714]
scene.scene.camera.compute_view_plane_normal()
scene.scene.render()
surface.actor.property.edge_visibility = True
Exemple #5
0
from numpy import array
try:
    engine = mayavi.engine
except NameError:
    from enthought.mayavi.api import Engine
    engine = Engine()
    engine.start()
if len(engine.scenes) == 0:
    engine.new_scene()
# -------------------------------------------
scene = engine.scenes[0]
vtkxml_file_reader = engine.open(
    u'/Users/prabhu/work/MEDIA/m2/data/solution.vtp', scene)
from enthought.mayavi.modules.surface import Surface
surface = Surface()
engine.add_filter(surface, vtkxml_file_reader)
scene.scene.camera.position = [
    -7.8710042803035831, -23.270734468965951, 26.848457084803901
]
scene.scene.camera.focal_point = [
    -0.30313491821289062, 0.0, 1.4027749300003052
]
scene.scene.camera.view_angle = 30.0
scene.scene.camera.view_up = [
    -0.18791276028283388, 0.75198808427818908, 0.63182490899497246
]
scene.scene.camera.clipping_range = [21.722908882245918, 52.482070417945934]
scene.scene.camera.compute_view_plane_normal()
scene.scene.render()
scene.scene.camera.position = [
    -29.36388986802725, -16.258291095191616, 13.125528963969458
        orientation_axes.text_property.shadow_offset = array([1, -1])
        orientation_axes.text_property.font_family = 'times'
        orientation_axes.text_property.shadow_offset = array([1, -1])
        orientation_axes.text_property.font_size = 15
        orientation_axes.axes.axis_labels = False
        ##

        if os.path.isdir(dir + '/pics/') == False:
            os.mkdir(dir + '/pics/')

        filename = dir + '/pics/T-Iso-'

        ##
        from enthought.mayavi.modules.iso_surface import IsoSurface
        iso_surface = IsoSurface()
        engine.add_filter(iso_surface, vtk_file_reader)
        iso_surface.actor.property.opacity = 0.29999999999999999
        iso_surface.contour.auto_contours = True
        iso_surface.contour.number_of_contours = 3
        iso_surface.contour.minimum_contour = thresh - .1
        iso_surface.contour.maximum_contour = thresh + .1
        module_manager = engine.scenes[1].children[0].children[0]
        module_manager.scalar_lut_manager.scalar_bar_representation.minimum_size = array(
            [1, 1])
        module_manager.scalar_lut_manager.scalar_bar_representation.position2 = array(
            [0.17, 0.8])
        module_manager.scalar_lut_manager.scalar_bar_representation.position = array(
            [0.82, 0.1])
        module_manager.scalar_lut_manager.scalar_bar_representation.maximum_size = array(
            [100000, 100000])
        module_manager.scalar_lut_manager.scalar_bar.height = 0.80000000000000004
Exemple #7
0
'''
Created on Apr 28, 2009

@author: jakub
'''
import numpy as np
a = np.random.random((4, 4))
from enthought.mayavi.api import Engine
e = Engine()
e.start()
s = e.new_scene()
from enthought.mayavi.sources.api import ArraySource
src = ArraySource(scalar_data=a)
e.add_source(src)
from enthought.mayavi.filters.api import WarpScalar, PolyDataNormals
warp = WarpScalar()
e.add_filter(warp, obj=src)
normals = PolyDataNormals()
e.add_filter(normals, obj=warp)
from enthought.mayavi.modules.api import Surface
surf = Surface()
e.add_module(surf, obj=normals)
Exemple #8
0
src1 = ArraySource(transpose_input_array=True)
src1.name = u'Daten'
src1.scalar_data = plotdata
mayavi.add_source(src1)

# ------------------------------------------- 
#array_source = engine.scenes[0].children[0]
#engine.add_filter(<enthought.mayavi.modules.iso_surface.IsoSurface object at 0xa1a8059c>, array_source)
# ------------------------------------------- 
#from enthought.mayavi.tools.show import show
#show()

iso_surface = IsoSurface()
array_source = engine.scenes[0].children[0]
engine.add_filter(iso_surface, array_source)

iso_surface = engine.scenes[0].children[0].children[0].children[0]
iso_surface.actor.property.specular_color = (0.0, 0.0, 0.0)
iso_surface.actor.property.diffuse_color = (0.0, 0.0, 0.0)
iso_surface.actor.property.ambient_color = (0.0, 0.0, 0.0)
iso_surface.actor.property.color = (0.0, 0.0, 0.0)

# m_grid = Grid() 
# array_source = engine.scenes[0].children[0]
# engine.add_filter(m_grid, array_source)

# grid_plane = engine.scenes[0].children[0].children[0].children[1]
# grid_plane.actor.property.representation = 'points'

# m_labels = Labels() 
Exemple #9
0
for file0 in os.listdir('.'):
    if fnmatch.fnmatch(file0, string):

        filename = file0
        print filename
        savename = filename

        if os.path.isdir(dir + '/movie_pics/') == False:
            os.mkdir(dir + '/movie_pics/')

        filename = dir + '/movie_pics/'
        this_dir = filename

        from enthought.mayavi.modules.iso_surface import IsoSurface
        iso_surface = IsoSurface()
        engine.add_filter(iso_surface, obj=None)
        iso_surface.contour.contours[0:1] = [thresh]
        scene = engine.scenes[0]
        scene.scene.render()
        scene.scene.x_plus_view()
        scene.scene.camera.zoom(mag)
        #scene.scene.render()
        ## change the color bar range
        module_manager = engine.scenes[0].children[0].children[0]
        module_manager.scalar_lut_manager.show_scalar_bar = True
        module_manager.scalar_lut_manager.show_legend = True
        module_manager.scalar_lut_manager.scalar_bar.position2 = array(
            [0.17, 0.8])
        module_manager.scalar_lut_manager.scalar_bar.position = array(
            [0.82, 0.1])
        module_manager.scalar_lut_manager.scalar_bar.number_of_labels = 3