Exemplo n.º 1
0
 def __init__(self, renderer):
     self.__renderer = renderer
     self.__reader = vtkPolyDataReader()
     self.__mapper = vtkPolyDataMapper()
     self.__actor = vtkActor()
     self.__property = vtkProperty()
     self.__geometry_filter = vtkGeometryFilter()
Exemplo n.º 2
0
def __skin_renderer(renderer):
        __reader = vtkVolume16Reader()
        __reader.SetDataDimensions(64, 64)
        __reader.SetImageRange(1, 93)
        __reader.SetDataByteOrderToLittleEndian()
        __reader.SetFilePrefix("objfiles/headsq/quarter")
        __reader.SetDataSpacing(3.2, 3.2, 1.5)

        __contourfilter = vtkContourFilter()
        __contourfilter.SetInputConnection(__reader.GetOutputPort())
        #__contourfilter.SetValue(0, 1150)
        __contourfilter.SetValue(1, 500)

        __mapper = vtkPolyDataMapper()
        __mapper.SetInputConnection(__contourfilter.GetOutputPort())
        __mapper.ScalarVisibilityOff()

        __prop = vtkProperty()
        __prop.SetDiffuseColor(1, 0.8, 0.4)
        __prop.SetDiffuse(1)
        __prop.SetOpacity(0.2)

        __actor = vtkActor()
        __actor.SetMapper(__mapper)
        __actor.SetProperty(__prop)

        renderer.AddActor(__actor)
Exemplo n.º 3
0
 def __init__(self, renderer):
     self.__renderer = renderer
     self.__reader = vtkStructuredGridReader()
     self.__mapper = vtkDataSetMapper()
     self.__lookup_table = vtkLookupTable()
     self.__property = vtkProperty()
     self.__actor = vtkActor()
Exemplo n.º 4
0
    def __init__(self, renderer):
        # Renderer variable is needed to add the actor
        self.__renderer = renderer

        self.__reader = vtkSLCReader()
        self.__extract_voi = vtkExtractVOI()

        self.__contour_filter = vtkContourFilter()
        self.__mapper = vtkPolyDataMapper()
        self.__property = vtkProperty()
        self.__actor = vtkActor()

        self.__outline_filter = vtkOutlineFilter()
        self.__outline_mapper = vtkPolyDataMapper()
        self.__outline_property = vtkProperty()
        self.__outline_actor = vtkActor()
Exemplo n.º 5
0
 def __init__(self, renderer):
     self.__renderer = renderer
     self.__mapper = vtkPolyDataMapper()
     self.__filter = vtkContourFilter()
     self.__reader = vtkStructuredGridReader()
     self.__actor = vtkActor()
     self.__property = vtkProperty()
Exemplo n.º 6
0
 def __init__(self, renderer):
     """"init setting up variables"""
     self.__renderer = renderer
     self.__gridReader = vtkUnstructuredGridReader()
     self.__mapper = vtkDataSetMapper()
     self.__property = vtkProperty()
     self.__actor = vtkActor()
Exemplo n.º 7
0
    def __init__(self, renderer):
        # Renderer variable is needed to add the actor
        self.__renderer = renderer

        self.__reader = vtkStructuredPointsReader()
        self.__property = vtkProperty()
        self.__geometry_filter = vtkGeometryFilter()
        self.__mapper = vtkPolyDataMapper()
        self.__actor = vtkActor()
Exemplo n.º 8
0
 def __init__(self, renderer):
     self.__renderer = renderer
     self.__reader = vtkStructuredGridReader()
     self.__mapper = vtkDataSetMapper()
     self.__lookup_table = vtkLookupTable()
     self.__property = vtkProperty()
     self.__actor = vtkActor()
     self.__points = vtkPointSource()
     self.__rungeKutta = vtkRungeKutta4()
     self.__streamer = vtkStreamTracer()
Exemplo n.º 9
0
def kneeinner(renderer, zoomlevel, opacity, color):
    reader = vtkSLCReader()
    extracter = vtkExtractVOI()

    contourfilter = vtkContourFilter()
    mapper = vtkPolyDataMapper()
    property = vtkProperty()
    actor = vtkActor()

    outline_filter = vtkOutlineFilter()
    outline_mapper = vtkPolyDataMapper()
    outline_property = vtkProperty()
    outline_actor = vtkActor()

    reader.SetFileName("objfiles/vw_knee.slc")
    reader.Update()

    # Extract volume of interest to subsample the data for faster rendering
    extracter.SetInputConnection(reader.GetOutputPort())
    extracter.SetSampleRate(3, 1, 1)

    # Set contour filter
    contourfilter.SetInputConnection(extracter.GetOutputPort())
    contourfilter.SetValue(0, zoomlevel)
    
    # Clipping 1
    clipper = vtkClipPolyData()
    clipper.SetGenerateClipScalars(0)
    sphere = vtkSphere()
    sphere.SetRadius(110)
    sphere.SetCenter((74.8305, 89.2905, 275))
    print(sphere.GetCenter())
    print(reader.GetOutput().GetCenter())
    clipper.SetInputConnection(contourfilter.GetOutputPort())
    clipper.SetClipFunction(sphere)
    clipper.Update()

    #clipping 2
    clipper2 = vtkClipPolyData()
    clipper2.SetGenerateClipScalars(0)
    sphere2 = vtkSphere()
    sphere2.SetRadius(100)
    sphere2.SetCenter((74.8305, 89.2905, -20))
    clipper2.SetInputConnection(clipper.GetOutputPort())
    clipper2.SetClipFunction(sphere2)
    clipper2.Update()

    mapper.SetInputConnection(clipper2.GetOutputPort())
    mapper.ScalarVisibilityOff()

    # Set property
    property.SetColor(color)
    property.SetOpacity(opacity)

    # Set actor
    actor.SetMapper(mapper)
    actor.SetProperty(property)

    # Set outline filter
    outline_filter.SetInputConnection(extracter.GetOutputPort())

    # Set outline mapper
    outline_mapper.SetInputConnection(outline_filter.GetOutputPort())

    # Set property
    outline_property.SetColor(0.2, 0.2, 0.2)

    # Set outline actor
    outline_actor.SetMapper(outline_mapper)
    outline_actor.SetProperty(outline_property)

    # Add actor to the window renderer
    renderer.AddActor(actor)
    renderer.AddActor(outline_actor)
Exemplo n.º 10
0
 def __init__(self, renderer):
     self.__renderer = renderer
     self.__mapper = vtkPolyDataMapper()
     self.__lookup_table = vtkLookupTable()
     self.__property = vtkProperty()
     self.__actor = vtkActor()