sphere.Update()

composite = vtk.vtkMultiBlockDataSet()
composite.SetBlock(0,extractL.GetOutput())
composite.SetBlock(1,extractR.GetOutput())
composite.SetBlock(2,sphere.GetOutput())

# Scalar tree is used to clone for each of the composite pieces
stree = vtk.vtkSpanSpace()
stree.SetDataSet(extractL.GetOutput())
stree.ComputeResolutionOn()
stree.SetScalarRange(0.25,0.75)
stree.SetComputeScalarRange(computeScalarRange)

# Now contour the cells, using scalar tree
contour = vtk.vtkContour3DLinearGrid()
contour.SetInputData(composite)
contour.SetValue(0, 0.5)
contour.SetMergePoints(mergePoints)
contour.SetSequentialProcessing(serialProcessing)
contour.SetInterpolateAttributes(interpolateAttr);
contour.SetComputeNormals(computeNormals);
contour.UseScalarTreeOn()
contour.SetScalarTree(stree)

contMapper = vtk.vtkCompositePolyDataMapper()
contMapper.SetInputConnection(contour.GetOutputPort())
contMapper.ScalarVisibilityOff()

contActor = vtk.vtkActor()
contActor.SetMapper(contMapper)
Beispiel #2
0
sample.ComputeNormalsOn()
sample.Update()

#
# Extract voxel cells
extract = vtk.vtkExtractCells()
extract.SetInputConnection(sample.GetOutputPort())
extract.AddCellRange(0, sample.GetOutput().GetNumberOfCells())
extract.Update()

# Now contour the cells, using scalar tree or not
stree = vtk.vtkSpanSpace()
stree.SetDataSet(extract.GetOutput())
stree.SetNumberOfCellsPerBucket(1)

contour = vtk.vtkContour3DLinearGrid()
contour.SetInputConnection(extract.GetOutputPort())
contour.SetValue(0, 0.5)
contour.SetValue(1, 0.75)
contour.SetMergePoints(mergePoints)
contour.SetSequentialProcessing(serialProcessing)
contour.SetInterpolateAttributes(interpolateAttr)
contour.SetComputeNormals(computeNormals)
contour.UseScalarTreeOff()

contourST = vtk.vtkContour3DLinearGrid()
contourST.SetInputConnection(extract.GetOutputPort())
contourST.SetValue(0, 0.5)
contourST.SetValue(1, 0.75)
contourST.SetMergePoints(mergePoints)
contourST.SetSequentialProcessing(serialProcessing)
Beispiel #3
0
sample.ComputeNormalsOn()
sample.Update()

# Generate tetrahedral mesh. The side effect of the clip filter
# is to produce tetrahedra.
clip = vtk.vtkClipVolume()
clip.SetInputConnection(sample.GetOutputPort())
clip.SetValue(-10.0)
clip.GenerateClippedOutputOff()
clip.Update()

# Test that filter can handle the dataset and contour array
assert(vtk.vtkContour3DLinearGrid.CanFullyProcessDataObject(clip.GetOutput(), "scalars"))

# Now contour the cells
contour = vtk.vtkContour3DLinearGrid()
contour.SetInputConnection(clip.GetOutputPort())
contour.SetValue(0, 0.5)
contour.SetValue(1, 0.9)
contour.SetMergePoints(0)
contour.SetSequentialProcessing(serialProcessing)
contour.SetInterpolateAttributes(0);
contour.SetComputeNormals(0);

contMapper = vtk.vtkPolyDataMapper()
contMapper.SetInputConnection(contour.GetOutputPort())
contMapper.ScalarVisibilityOff()

contActor = vtk.vtkActor()
contActor.SetMapper(contMapper)
contActor.GetProperty().SetColor(.8,.4,.4)