当前位置: 首页>>代码示例>>Python>>正文


Python vtk.vtkOutlineFilter函数代码示例

本文整理汇总了Python中vtk.vtkOutlineFilter函数的典型用法代码示例。如果您正苦于以下问题:Python vtkOutlineFilter函数的具体用法?Python vtkOutlineFilter怎么用?Python vtkOutlineFilter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了vtkOutlineFilter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_bbox

    def build_bbox(self, basis_vector):
        
        cell = numpy.array(basis_vector).astype(numpy.float32)
        Xmax,Ymax,Zmax =  numpy.array([cell[0,0], cell[1,1], cell[2,2]], dtype = numpy.float32)
        bbox_points = vtk.vtkPoints()
        
        self.cell_bounds_coords = numpy.array([-Xmax/2. , Xmax/2.,  -Ymax/2., Ymax/2.,  -Zmax/2., Zmax/2.])
        
        bbox_points.InsertNextPoint(-Xmax/2. , -Ymax/2., -Zmax/2.)
        bbox_points.InsertNextPoint(Xmax/2. , Ymax/2., Zmax/2.)
         
        BBox_poly = vtk.vtkPolyData()
        BBox_poly.SetPoints(bbox_points)
         
        outline = vtk.vtkOutlineFilter()
        if vtk.vtkVersion.GetVTKMajorVersion()<6:
            outline.SetInput(BBox_poly)
        else:
            outline.SetInputData(BBox_poly)

        outline_mapper = vtk.vtkPolyDataMapper()
        outline_mapper.SetInputConnection(outline.GetOutputPort())
        
        outline_actor = vtk.vtkActor()
        outline_actor.SetMapper(outline_mapper)
        outline_actor.GetProperty().SetColor(1,1,1)
        outline_actor.GetProperty().SetLineWidth(3)
        
        return outline_actor
开发者ID:mark-johnson-1966,项目名称:MDANSE,代码行数:29,代码来源:MolecularViewerPlugin.py

示例2: __init__

 def __init__(self,viewer, selection_color):
     self.viewer = viewer
     self.selection_color = selection_color
     outline = vtk.vtkOutlineFilter()
     if vtk.vtkVersion.GetVTKMajorVersion()<6:
         outline.SetInput(self.viewer._polydata)
     else:
         outline.SetInputData(self.viewer._polydata)
                 
     outlineMapper = vtk.vtkPolyDataMapper()
     outlineMapper.SetInputConnection(outline.GetOutputPort())
     self.box=vtk.vtkActor()
     self.box.SetMapper( outlineMapper )
     self.box.GetProperty().SetColor(1,1,1)
     self.box.PickableOff()
     
     self.SetProp3D(self.box)
     self.planes=vtk.vtkPlanes()
     self.SetInteractor(viewer.iren)
     if vtk.vtkVersion.GetVTKMajorVersion()<6:
         self.SetInput(self.viewer._polydata)
     else:
         self.SetInputData(self.viewer._polydata)
         
     self.SetPlaceFactor(1)
     self.PlaceWidget()
     self.InsideOutOn()
     self.SetRotationEnabled(0)
     self.GetPlanes(self.planes)
     self.AddObserver("EndInteractionEvent",self.on_select_atoms)
开发者ID:mark-johnson-1966,项目名称:MDANSE,代码行数:30,代码来源:MolecularViewerPlugin.py

示例3: SetInput

  def SetInput(self, input) :
    img = image(input)
    self.__input__ = img
    if img :
      # Update to try to avoid to exit if a c++ exception is throwed
      # sadely, it will not prevent the program to exit later...
      # a real fix would be to wrap c++ exception in vtk
      img.UpdateOutputInformation()
      img.Update()
      import itk
      self.__flipper__ = itk.FlipImageFilter[img].New(Input=img)
      axes = self.__flipper__.GetFlipAxes()
      axes.SetElement(1, True)
      self.__flipper__.SetFlipAxes(axes)
      self.__itkvtkConverter__ = itk.ImageToVTKImageFilter[img].New(self.__flipper__)
      self.__volumeMapper__.SetInput(self.__itkvtkConverter__.GetOutput())
      # needed to avoid warnings
      # self.__itkvtkConverter__.GetOutput() must be callable
      import vtk
      if not self.__outline__ :
	  self.__outline__ = vtk.vtkOutlineFilter()
	  self.__outline__.SetInput(self.__itkvtkConverter__.GetOutput())
	  self.__outlineMapper__ = vtk.vtkPolyDataMapper()
	  self.__outlineMapper__.SetInput(self.__outline__.GetOutput())
	  self.__outlineActor__ = vtk.vtkActor()
	  self.__outlineActor__.SetMapper(self.__outlineMapper__)
	  self.__ren__.AddActor(self.__outlineActor__)
      else :
	  self.__outline__.SetInput(self.__itkvtkConverter__.GetOutput())

    self.Render()
开发者ID:glehmann,项目名称:WrapITK-old,代码行数:31,代码来源:__init__.py

示例4: build_real_bbox

    def build_real_bbox(self, molecule):
        
        Xmin,Xmax,Ymin, Ymax, Zmin, Zmax = molecule.GetBounds()
        bbox_points = vtk.vtkPoints()
         
        bbox_points.InsertNextPoint(Xmin, Ymin, Zmin)
        bbox_points.InsertNextPoint(Xmax , Ymax, Zmax)
         
        BBox_poly = vtk.vtkPolyData()
        BBox_poly.SetPoints(bbox_points)
         
        outline = vtk.vtkOutlineFilter()
        if vtk.vtkVersion.GetVTKMajorVersion()<6:
            outline.SetInput(BBox_poly)
        else:
            outline.SetInputData(BBox_poly)

        outline_mapper = vtk.vtkPolyDataMapper()
        outline_mapper.SetInputConnection(outline.GetOutputPort())
        
        outline_actor = vtk.vtkActor()
        outline_actor.SetMapper(outline_mapper)
        outline_actor.GetProperty().SetColor(1,0,0)
        outline_actor.GetProperty().SetLineWidth(3)
        
        self._renderer.AddActor(outline_actor)
        self._iren.Render()
开发者ID:mark-johnson-1966,项目名称:MDANSE,代码行数:27,代码来源:MolecularViewerPlugin.py

示例5: add_outline

 def add_outline(self):
     outline = vtk.vtkOutlineFilter()
     outline.SetInputData(self.data.grid[self.current_timestep])
     outline_mapper = vtk.vtkDataSetMapper()
     outline_mapper.SetInputConnection(outline.GetOutputPort())
     self.outline_actor.SetMapper(outline_mapper)
     self.ren.AddActor(self.outline_actor)
开发者ID:capitalaslash,项目名称:radcal-gui,代码行数:7,代码来源:vtkgui.py

示例6: __init__

 def __init__(self, module_manager):
     SimpleVTKClassModuleBase.__init__(
         self, module_manager,
         vtk.vtkOutlineFilter(), 'Processing.',
         ('vtkDataSet',), ('vtkPolyData',),
         replaceDoc=True,
         inputFunctions=None, outputFunctions=None)
开发者ID:fvpolpeta,项目名称:devide,代码行数:7,代码来源:vtkOutlineFilter.py

示例7: setup_renderer

def setup_renderer(renderer, actors, bboxpolydata=None):
    ren = renderer
    for actor in actors:
        # assign actor to the renderer
        ren.AddActor(actor)
    ############################################
    # Create a vtkOutlineFilter to draw the bounding box of the data set.
    # Also create the associated mapper and actor.
    if bboxpolydata is not None:
        outline = vtk.vtkOutlineFilter()
        outline.SetInput(bboxpolydata.GetOutput())
        mapOutline = vtk.vtkPolyDataMapper()
        mapOutline.SetInputConnection(outline.GetOutputPort())
        outlineActor = vtk.vtkActor()
        outlineActor.SetMapper(mapOutline)
        outlineActor.GetProperty().SetColor(100, 100, 100)
        ren.AddViewProp(outlineActor)
        ren.AddActor(outlineActor)
    

    # Create a vtkLight, and set the light parameters.
    light = vtk.vtkLight()
    light.SetFocalPoint(0.21406, 1.5, 0)
    light.SetPosition(8.3761, 4.94858, 4.12505)
    ren.AddLight(light)
    return ren
开发者ID:HerrMuellerluedenscheid,项目名称:seismerize,代码行数:26,代码来源:vtk_focmec.py

示例8: __init__

    def __init__(self, reader):
        self.reader = reader
        sg = self.src_glyph = vtk.vtkSphereSource()
        sg.SetRadius(0.5)
        sg.SetCenter(0.5, 0.0, 0.0)
        g = self.glyph = vtk.vtkTensorGlyph()        
        g.SetInputConnection(self.reader.GetOutputPort())
        g.SetSource(self.src_glyph.GetOutput())
        g.SetScaleFactor(0.25)
        
        # The normals are needed to generate the right colors and if
        # not used some of the glyphs are black.        
        self.normals = vtk.vtkPolyDataNormals()
        self.normals.SetInputConnection(g.GetOutputPort())
        self.map = vtk.vtkPolyDataMapper()
        self.map.SetInputConnection(self.normals.GetOutputPort())        
        self.act = vtk.vtkActor()
        self.act.SetMapper(self.map)

        # An outline.
        self.of = vtk.vtkOutlineFilter()
        self.of.SetInputConnection(self.reader.GetOutputPort())
        self.out_map = vtk.vtkPolyDataMapper()
        self.out_map.SetInputConnection(self.of.GetOutputPort())
        self.out_act = vtk.vtkActor()
        self.out_act.SetMapper(self.out_map)        
开发者ID:Armand0s,项目名称:homemade_vtk,代码行数:26,代码来源:TestTensorGlyph.py

示例9: __init__

	def __init__(self, parent, visualizer, **kws):
		"""
		Initialization
		"""     
		self.x, self.y, self.z = -1, -1, -1
		VisualizationModule.__init__(self, parent, visualizer, **kws)
		self.on = 0
		self.renew = 1
		self.mapper = vtk.vtkPolyDataMapper()
		self.eventDesc = "Rendering orthogonal slices"
		self.outline = vtk.vtkOutlineFilter()
		self.outlineMapper = vtk.vtkPolyDataMapper()
		self.outlineActor = vtk.vtkActor()
		self.outlineActor.SetMapper(self.outlineMapper)
		
		self.picker = vtk.vtkCellPicker()
		self.picker.SetTolerance(0.005)
		
		self.planeWidgetX = vtk.vtkImagePlaneWidget()
		self.planeWidgetX.DisplayTextOn()
		self.planeWidgetX.SetPicker(self.picker)
		self.planeWidgetX.SetKeyPressActivationValue("x")
		#self.planeWidgetX.UserControlledLookupTableOn()
		self.prop1 = self.planeWidgetX.GetPlaneProperty()
		#self.prop1.SetColor(1, 0, 0)
		self.planeWidgetX.SetResliceInterpolateToCubic()

		self.planeWidgetY = vtk.vtkImagePlaneWidget()
		self.planeWidgetY.DisplayTextOn()
		self.planeWidgetY.SetPicker(self.picker)
		self.planeWidgetY.SetKeyPressActivationValue("y")
		self.prop2 = self.planeWidgetY.GetPlaneProperty()
		self.planeWidgetY.SetResliceInterpolateToCubic()
		#self.planeWidgetY.UserControlledLookupTableOn()
		#self.prop2.SetColor(1, 1, 0)


		# for the z-slice, turn off texture interpolation:
		# interpolation is now nearest neighbour, to demonstrate
		# cross-hair cursor snapping to pixel centers
		self.planeWidgetZ = vtk.vtkImagePlaneWidget()
		self.planeWidgetZ.DisplayTextOn()
		self.planeWidgetZ.SetPicker(self.picker)
		self.planeWidgetZ.SetKeyPressActivationValue("z")
		self.prop3 = self.planeWidgetZ.GetPlaneProperty()
		#self.prop3.SetColor(1, 0, 1)
		#self.planeWidgetZ.UserControlledLookupTableOn()
		self.planeWidgetZ.SetResliceInterpolateToCubic()
		self.renderer = self.parent.getRenderer()
		self.renderer.AddActor(self.outlineActor)
		self.useOutline = 1
		
		iactor = self.wxrenwin.GetRenderWindow().GetInteractor()
		self.planeWidgetX.SetInteractor(iactor)
		self.planeWidgetY.SetInteractor(iactor)
		self.planeWidgetZ.SetInteractor(iactor)
		
		lib.messenger.connect(None, "zslice_changed", self.setZ)
		self.filterDesc = "View orthogonal slices"
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:59,代码来源:Orthogonal.py

示例10: outline

def outline(source):
    outline_filter = vtk.vtkOutlineFilter()
    outline_filter.SetInput(source.GetOutput())
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInput(outline_filter.GetOutput())
    actor = vtk.vtkActor()
    actor.SetMapper(mapper)
    return actor
开发者ID:151706061,项目名称:IRTK,代码行数:8,代码来源:vtkTools.py

示例11: __init__

    def __init__(self,reader):
		self.outline=vtk.vtkOutlineFilter()
		self.outline.SetInput(reader.get_data_set())
		self.outlinemapper=vtk.vtkPolyDataMapper()
		self.outlinemapper.SetInput(self.outline.GetOutput())
		self.actor=vtk.vtkActor()
		self.actor.SetMapper(self.outlinemapper)
		self.actor.GetProperty().SetColor(0,0,0)
开发者ID:bitcoinsoftware,项目名称:3D-Scientific-Visualization,代码行数:8,代码来源:Outline.py

示例12: visQuadFunc

def visQuadFunc():
    """ vtk sample scene with iso contours """

    # VTK supports implicit functions of the form f(x,y,z)=constant. These
    # functions can represent things spheres, cones, etc. Here we use a
    # general form for a quadric to create an elliptical data field.
    quadric = vtk.vtkQuadric()
    quadric.SetCoefficients(.5, 1, .2, 0, .1, 0, 0, .2, 0, 0)

    # vtkSampleFunction samples an implicit function over the x-y-z range
    # specified (here it defaults to -1,1 in the x,y,z directions).
    sample = vtk.vtkSampleFunction()
    sample.SetSampleDimensions(30, 30, 30)
    sample.SetImplicitFunction(quadric)

    # Create five surfaces F(x,y,z) = constant between range specified. The
    # GenerateValues() method creates n isocontour values between the range
    # specified.
    contours = vtk.vtkContourFilter()
    contours.SetInputConnection(sample.GetOutputPort())
    contours.GenerateValues(8, 0.0, 1.2)

    contMapper = vtk.vtkPolyDataMapper()
    contMapper.SetInputConnection(contours.GetOutputPort())
    contMapper.SetScalarRange(0.0, 1.2)

    contActor = vtk.vtkActor()
    contActor.SetMapper(contMapper)

    # We'll put a simple outline around the data.
    outline = vtk.vtkOutlineFilter()
    outline.SetInputConnection(sample.GetOutputPort())

    outlineMapper = vtk.vtkPolyDataMapper()
    outlineMapper.SetInputConnection(outline.GetOutputPort())

    outlineActor = vtk.vtkActor()
    outlineActor.SetMapper(outlineMapper)
    outlineActor.GetProperty().SetColor(1, 0.5, 0)

    # extract data from the volume
    extract = vtk.vtkExtractVOI()
    extract.SetInputConnection(sample.GetOutputPort())
    extract.SetVOI(0, 29, 0, 29, 15, 15)
    extract.SetSampleRate(1, 2, 3)

    contours2 = vtk.vtkContourFilter()
    contours2.SetInputConnection(extract.GetOutputPort())
    contours2.GenerateValues(8, 0.0, 1.2)

    contMapper2 = vtk.vtkPolyDataMapper()
    contMapper2.SetInputConnection(contours2.GetOutputPort())
    contMapper2.SetScalarRange(0.0, 1.2)

    contActor2 = vtk.vtkActor()
    contActor2.SetMapper(contMapper2)

    return contActor, contActor2, outlineActor, contours, contours2
开发者ID:alexlib,项目名称:PyDataNYC2015,代码行数:58,代码来源:scenes.py

示例13: __init__

    def __init__(self, parent):
        QVTKRenderWindowInteractor.__init__(self, parent)

        self.renderer = vtk.vtkRenderer()
        self.GetRenderWindow().AddRenderer(self.renderer)
        
        interactor = vtk.vtkInteractorStyleSwitch()
        self._Iren.SetInteractorStyle(interactor)
                
        self.surface = None

        # Remainng calls set up axes.
        tprop = vtk.vtkTextProperty()
        tprop.SetColor(1,1,1)

        # Create a faint outline to go with the axes.
        self.outline = vtk.vtkOutlineFilter()

        # Initially set up with a box as input.  This will be changed
        # to a plot once the user clicks something.
        self.box = vtk.vtkBox()
        self.box.SetBounds(0,10,0,10,0,10)
        sample = vtk.vtkSampleFunction()
        sample.SetImplicitFunction(self.box)
        sample.SetSampleDimensions(2,2,2)
        sample.SetModelBounds(0,10,0,10,0,5)
        sample.ComputeNormalsOff()

        self.outline.SetInputConnection(sample.GetOutputPort())
        mapOutline = vtk.vtkPolyDataMapper()
        mapOutline.SetInputConnection(self.outline.GetOutputPort())
        self.outlineActor = vtk.vtkActor()
        self.outlineActor.SetMapper(mapOutline)
        self.outlineActor.GetProperty().SetColor(1,1,1)
        self.outlineActor.GetProperty().SetOpacity(.25)
        self.renderer.AddActor(self.outlineActor)

        self.axes = vtk.vtkCubeAxesActor2D()
        self.axes.SetCamera(self.renderer.GetActiveCamera())
        self.axes.SetFlyModeToOuterEdges()

        self.axes.SetLabelFormat("%6.4g")
        self.axes.SetFontFactor(0.8)
        self.axes.SetAxisTitleTextProperty(tprop)
        self.axes.SetAxisLabelTextProperty(tprop)
        self.axes.SetXLabel("MPI Rank")
        self.axes.SetYLabel("Progress")
        self.axes.SetZLabel("Effort")
        self.axes.SetInput(sample.GetOutput())
        self.renderer.AddViewProp(self.axes)

        # Keep original camera around in case it gets changed
        self.originalCamera = self.renderer.GetActiveCamera()

        self.renderer.GetActiveCamera().Pitch(90)     # Want effort to be vertical
        self.renderer.GetActiveCamera().OrthogonalizeViewUp()
        self.renderer.ResetCamera()
        self.renderer.GetActiveCamera().Elevation(15)  # Be slightly above the data
开发者ID:cmcantalupo,项目名称:libra,代码行数:58,代码来源:vtkutils.py

示例14: create_outline

 def create_outline(self):
     outline = vtk.vtkOutlineFilter()
     outline.SetInputData(self.rdr.GetOutput())
     outline_mapper = vtk.vtkPolyDataMapper()
     outline_mapper.SetInputConnection(outline.GetOutputPort())
     self.outline_actor = vtk.vtkActor()
     self.outline_actor.SetMapper(outline_mapper)
     self.outline_actor.GetProperty().SetColor(1,1,1)
     self.outline = outline
     self.renderer.AddActor(self.outline_actor)
开发者ID:lauragarciabernal,项目名称:Superprob,代码行数:10,代码来源:border.py

示例15: prepareOutlineActor

    def prepareOutlineActor(self,_dim):
        outlineData = vtk.vtkImageData()
        outlineData.SetDimensions(_dim[0], _dim[1], 1)

        outline = vtk.vtkOutlineFilter()
        outline.SetInput(outlineData)
        outlineMapper = vtk.vtkPolyDataMapper()
        outlineMapper.SetInputConnection(outline.GetOutputPort())
    
        self.outlineActor.SetMapper(outlineMapper)
        self.outlineActor.GetProperty().SetColor(1, 1, 1)        
开发者ID:odellus,项目名称:CompuCell3D,代码行数:11,代码来源:MVCDrawView2D.py


注:本文中的vtk.vtkOutlineFilter函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。