def __init__(self, module_manager): SimpleVTKClassModuleBase.__init__( self, module_manager, vtk.vtkTableWriter(), 'Writing vtkTable.', ('vtkTable',), (), replaceDoc=True, inputFunctions=None, outputFunctions=None)
def __init__(self, module_manager): SimpleVTKClassModuleBase.__init__(self, module_manager, vtk.vtkTableWriter(), 'Writing vtkTable.', ('vtkTable', ), (), replaceDoc=True, inputFunctions=None, outputFunctions=None)
def SerializeVTKTable(table): tmp = tempfile.mktemp() writer = vtk.vtkTableWriter() writer.SetFileName(tmp) writer.SetFileTypeToBinary() writer.SetInputData(table) writer.Update() with open(tmp, 'r') as fp: data = fp.read() os.remove(tmp) data = base64.b64encode(data) return data
# 6. simplifying the input data to remove non-persistent pairs topologicalSimplification = ttkTopologicalSimplification() topologicalSimplification.SetInputConnection(0, reader.GetOutputPort()) topologicalSimplification.SetInputArrayToProcess(0, 0, 0, 0, "data") topologicalSimplification.SetInputConnection(1, persistentPairs.GetOutputPort()) topologicalSimplification.SetDebugLevel(3) # 7. computing the Morse-Smale complex morseSmaleComplex = ttkMorseSmaleComplex() morseSmaleComplex.SetInputConnection(topologicalSimplification.GetOutputPort()) morseSmaleComplex.SetInputArrayToProcess(0, 0, 0, 0, "data") morseSmaleComplex.SetDebugLevel(3) # 8. saving the output data curveWriter = vtkTableWriter() curveWriter.SetInputConnection(curve.GetOutputPort()) curveWriter.SetFileName("curve.vtk") curveWriter.Write() sepWriter = vtkXMLPolyDataWriter() sepWriter.SetInputConnection(morseSmaleComplex.GetOutputPort(1)) sepWriter.SetFileName("separatrices.vtp") sepWriter.Write() segWriter = vtkXMLUnstructuredGridWriter() segWriter.SetInputConnection(morseSmaleComplex.GetOutputPort(3)) segWriter.SetFileName("segmentation.vtu") segWriter.Write()
import vtk writer = vtk.vtkTableWriter() writer.WriteToOutputStringOn() writer.SetInputData(input) writer.Update() output = writer.GetOutputString()