-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiisosurface.py
More file actions
26 lines (26 loc) · 922 Bytes
/
Copy pathmultiisosurface.py
File metadata and controls
26 lines (26 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from vtk import *
file_name=raw_input('File name?\n')
reader = vtkMetaImageReader()
renderer = vtkRenderer()
reader.SetFileName(file_name)
reader.Update()
isos = []
isoActors = []
isoMappers = []
num = int(raw_input('How many isosurfaces do you want?.\n'))
for i in range(0,num):
level = float(raw_input('Input the value where you want the isosurface.\n'))
isos.append(vtkImageMarchingCubes())
isos[i].SetValue(0,level)
isos[i].SetInputConnection(reader.GetOutputPort())
isoMappers.append(vtkPolyDataMapper())
isoMappers[i].SetInputConnection(isos[i].GetOutputPort())
isoActors.append(vtkActor())
isoActors[i].SetMapper(isoMappers[i])
renderer.AddActor(isoActors[i])
renderWindow=vtkRenderWindow()
renderWindow.AddRenderer(renderer)
renderWindowInteractor=vtkRenderWindowInteractor()
renderWindowInteractor.SetRenderWindow(renderWindow)
renderWindowInteractor.Initialize()
renderWindowInteractor.Start()