コード例 #1
0
points1 = vtk.vtkPoints()
points1.InsertNextPoint(80, 50, 0)
points1.InsertNextPoint(100, 90, 0)
points1.InsertNextPoint(200, 50, 0)
points1.InsertNextPoint(230, 100, 0)
points1.InsertNextPoint(150, 170, 0)
points1.InsertNextPoint(110, 170, 0)
points1.InsertNextPoint(80, 50, 0)
points2 = vtk.vtkPoints()
points2.InsertNextPoint(80, 50, 0)
points2.InsertNextPoint(100, 90, 0)
points2.InsertNextPoint(200, 50, 0)
points2.InsertNextPoint(230, 100, 0)
points2.InsertNextPoint(150, 170, 0)
points2.InsertNextPoint(110, 170, 0)
roiStencil1 = vtk.vtkLassoStencilSource()
roiStencil1.SetShapeToPolygon()
roiStencil1.SetSlicePoints(0, points1)
roiStencil1.SetInformationInput(
    reader.GetOutput())  # Spacing, Origin, and WholeExtent

roiStencil2 = vtk.vtkLassoStencilSource()
roiStencil2.SetShapeToPolygon()
roiStencil2.SetPoints(points2)
roiStencil2.SetInformationInput(reader.GetOutput())

roiStencil3 = vtk.vtkLassoStencilSource()
roiStencil3.SetShapeToSpline()
roiStencil3.SetPoints(points1)
roiStencil3.SetInformationInput(reader.GetOutput())
roiStencil4 = vtk.vtkLassoStencilSource()
コード例 #2
0
points1 = vtk.vtkPoints()
points1.InsertNextPoint(80,50,0)
points1.InsertNextPoint(100,90,0)
points1.InsertNextPoint(200,50,0)
points1.InsertNextPoint(230,100,0)
points1.InsertNextPoint(150,170,0)
points1.InsertNextPoint(110,170,0)
points1.InsertNextPoint(80,50,0)
points2 = vtk.vtkPoints()
points2.InsertNextPoint(80,50,0)
points2.InsertNextPoint(100,90,0)
points2.InsertNextPoint(200,50,0)
points2.InsertNextPoint(230,100,0)
points2.InsertNextPoint(150,170,0)
points2.InsertNextPoint(110,170,0)
roiStencil1 = vtk.vtkLassoStencilSource()
roiStencil1.SetShapeToPolygon()
roiStencil1.SetSlicePoints(0,points1)
roiStencil1.SetInformationInput(reader.GetOutput())
roiStencil2 = vtk.vtkLassoStencilSource()
roiStencil2.SetShapeToPolygon()
roiStencil2.SetPoints(points2)
roiStencil2.SetInformationInput(reader.GetOutput())
roiStencil3 = vtk.vtkLassoStencilSource()
roiStencil3.SetShapeToSpline()
roiStencil3.SetPoints(points1)
roiStencil3.SetInformationInput(reader.GetOutput())
roiStencil4 = vtk.vtkLassoStencilSource()
roiStencil4.SetShapeToSpline()
roiStencil4.SetSlicePoints(0,points2)
roiStencil4.SetInformationInput(reader.GetOutput())
コード例 #3
0
reslice.GetOutput()

# Create a greyscale lookup table
table = vtk.vtkLookupTable()
table.SetRange(0, 100)  # image intensity range
table.SetValueRange(0.0, 1.0)  # from black to white
table.SetSaturationRange(0.0, 0.0)  # no color saturation
table.SetRampToLinear()
table.Build()

# Map the image through the lookup table
color = vtk.vtkImageMapToColors()
color.SetLookupTable(table)
color.SetInputConnection(reslice.GetOutputPort())

roiStencil = vtk.vtkLassoStencilSource()
roiStencil.SetShapeToPolygon()
roiStencil.SetPoints(testPoints)
roiStencil.SetInformationInput(reslice.GetOutput())
roiStencil.Update()

stencil = vtk.vtkImageStencil()
stencil.SetInputConnection(reslice.GetOutputPort())
stencil.SetBackgroundValue(0.0)
stencil.SetStencilConnection(roiStencil.GetOutputPort())
stencil.ReverseStencilOff()
stencil.Update()

# Create a greyscale lookup table
table1 = vtk.vtkLookupTable()
table1.SetRange(0, 200)  # image intensity range