def main(): # Create the MayaVi engine and start it. e = Engine() # Starting the engine registers the engine with the registry and # notifies others that the engine is ready. e.start() # Do this if you need to see the MayaVi tree view UI. ev = EngineView(engine=e) ui = ev.edit_traits() # Create a new scene. scene = e.new_scene() # Now create a new scene just for kicks. scene1 = e.new_scene() # Now setup a normal MayaVi pipeline. src = VTKXMLFileReader() src.initialize(join(get_data_dir(abspath(__file__)), 'fire_ug.vtu')) e.add_source(src) e.add_module(Outline()) e.add_module(ScalarCutPlane()) e.add_module(Streamline()) return e, ui
def main(): # Create the MayaVi engine and start it. e = Engine() # Starting the engine registers the engine with the registry and # notifies others that the engine is ready. e.start() # Do this if you need to see the MayaVi tree view UI. ev = EngineView(engine=e) ui = ev.edit_traits() # Create a new scene. scene = e.new_scene() # Now create a new scene just for kicks. scene1 = e.new_scene() # Now setup a normal MayaVi pipeline. src = VTKXMLFileReader() src.initialize(join(get_data_dir(abspath(__file__)), 'fire_ug.vtu')) e.add_source(src) e.add_module(Outline()) e.add_module(ScalarCutPlane()) e.add_module(Streamline()) return e, ui
import os from mayavi.core.api import Engine from mayavi.sources.vtk_file_reader import VTKFileReader from mayavi.modules.surface import Surface vtkFile = 'flow.vtk' # Create the MayaVi engine and start it. engine = Engine() engine.start() scene = engine.new_scene() # Read in VTK file and add as source reader = VTKFileReader() reader.initialize(vtkFile) engine.add_source(reader) # Add Surface Module surface = Surface() engine.add_module(surface) # Move the camera scene.scene.camera.elevation(-70) # Save scene to image file scene.scene.save_png('image.png') # Create a GUI instance and start the event loop. # This stops the window from closing from enthought.pyface.api import GUI gui = GUI()
from mayavi.sources.vtk_file_reader import VTKFileReader from mayavi.modules.surface import Surface vtkFile_l = '/Users/richad/bin/lh.vtk' vtkFile_r = '/Users/richad/bin/rh.vtk' # Create the MayaVi engine and start it. engine = Engine() engine.start() #scene = engine.new_scene() # Read in VTK file and add as source surface1 = Surface() reader1 = VTKFileReader() reader1.initialize(vtkFile_l) engine.add_source(reader1) engine.add_filter(surface1, reader1) surface2 = Surface() reader2 = VTKFileReader() reader2.initialize(vtkFile_r) engine.add_source(reader2) engine.add_filter(surface2, reader2) #import networkx as nx import numpy as np #import pickle as pk #import matplotlib.pyplot as plt #import bct from mayavi import mlab figure = mlab.figure(1, bgcolor=(1.0, 1.0, 1.0))
from mayavi.core.api import Engine from mayavi.sources.vtk_file_reader import VTKFileReader from mayavi.modules.surface import Surface vtkFile_l = 'lh.vtk' vtkFile_r = 'rh.vtk' # Create the MayaVi engine and start it. engine = Engine() engine.start() scene = engine.new_scene() # Read in VTK file and add as source reader1 = VTKFileReader() reader1.initialize(vtkFile_l) engine.add_source(reader1) # Add Surface Module surface = Surface() engine.add_module(surface) # Move the camera scene.scene.camera.elevation(90) scene.scene.camera.azimuth(-180) # Save scene to image file scene.scene.save_png('image.png') # Create a GUI instance and start the event loop. # This stops the window from closing from pyface.api import GUI