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


Python vtk.vtkTextMapper函数代码示例

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


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

示例1: InitiateScreenText

 def InitiateScreenText(self):
   '''
   self.tpropScren = vtk.vtkTextProperty()
   size = self.GetSize()
   self.text_screen = vtk.vtkTextActor()
   self.text_screen.SetPosition(10, 10)
   self.text_screen.SetInput(' ') 
   
   self.tpropScren.SetFontSize(10)
   self.tpropScren.SetFontFamilyToArial()
   self.tpropScren.SetJustificationToLeft()
   #self.tprop.BoldOn()
   #self.tprop.ItalicOn()
   #self.tpropScren.ShadowOn()
   self.tpropScren.SetColor(0.9, 0.8, 0.8)
   self.text_screen.SetTextProperty(self.tpropScren)
   '''
   #self.scree_text_offset = 10
   self.textMapper = vtk.vtkTextMapper()
   tprop = self.textMapper.GetTextProperty()
   tprop.SetFontFamilyToArial()
   tprop.SetFontSize(10)
   #tprop.BoldOn()
   #tprop.ShadowOn()
   tprop.SetColor(0.5, 0.9, 0.5)
   self.textActor = vtk.vtkActor2D()
   self.textActor.VisibilityOff()
   self.textActor.SetMapper(self.textMapper)
   self.AddActor2D(self.textActor)                                 
开发者ID:rbulha,项目名称:scopevtk,代码行数:29,代码来源:vtkScopeView.py

示例2: addText

    def addText(self, text, x=0.03, y=0.97, size=12, orientation="left"):
        property = vtk.vtkTextProperty()
        property.SetFontSize(size)
        property.SetFontFamilyToArial()
        property.BoldOff()
        property.ItalicOff()
        # property.ShadowOn()
        if orientation == "left":
            property.SetJustificationToLeft()
        elif orientation == "right":
            property.SetJustificationToRight()
        elif orientation == "center":
            property.SetJustificationToCenter()

        property.SetVerticalJustificationToTop()
        property.SetColor(1, 1, 1)

        mapper = vtk.vtkTextMapper()
        mapper.SetTextProperty(property)
        mapper.SetInput(str(text))

        textActor = vtk.vtkActor2D()
        self.textActors.append(textActor)
        textActor.SetMapper(mapper)
        textActor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()
        textActor.GetPositionCoordinate().SetValue(x, y)
        textActor.VisibilityOn()

        self.render.AddActor(textActor)
        self.Render()
开发者ID:aevum,项目名称:moonstone,代码行数:30,代码来源:vtkimageview.py

示例3: __init__

    def __init__(self):
        self.layer = 99
        self.children = []
        property = vtk.vtkTextProperty()
        property.SetFontSize(const.TEXT_SIZE)
        property.SetFontFamilyToArial()
        property.BoldOff()
        property.ItalicOff()
        property.ShadowOn()
        property.SetJustificationToLeft()
        property.SetVerticalJustificationToTop()
        property.SetColor(const.TEXT_COLOUR)
        self.property = property

        mapper = vtk.vtkTextMapper()
        mapper.SetTextProperty(property)
        self.mapper = mapper

        actor = vtk.vtkActor2D()
        actor.SetMapper(mapper)
        actor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()
        actor.PickableOff()
        self.actor = actor

        self.SetPosition(const.TEXT_POS_LEFT_UP)
开发者ID:invesalius,项目名称:invesalius3,代码行数:25,代码来源:vtk_utils.py

示例4: __init__

 def __init__(self, id):
     # Create text mapper and 2d actor to display finger position.
     self.textMapper = vtk.vtkTextMapper()
     self.textMapper.SetInput(id)  
     self.tprop = self.textMapper.GetTextProperty()
     self.tprop.SetFontFamilyToArial()
     self.tprop.SetFontSize(30)
     self.tprop.BoldOn()
     self.tprop.ShadowOn()
     self.tprop.SetColor(1, 0, 0)
     self.textActor = vtk.vtkActor2D()
     self.textActor.VisibilityOff()
     self.textActor.SetMapper(self.textMapper)
开发者ID:hnieto,项目名称:python-vtk-tuio,代码行数:13,代码来源:MultiTouchTest.py

示例5: addPicker

 def addPicker(self):
     self.textMapper = vtk.vtkTextMapper()
     tprop = self.textMapper.GetTextProperty()
     tprop.SetFontFamilyToArial()
     tprop.SetFontSize(10)
     tprop.BoldOn()
     tprop.ShadowOn()
     tprop.SetColor(1, 0, 0)
     self.textActor.VisibilityOff()
     self.textActor.SetMapper(self.textMapper)
                 
     self.picker = vtk.vtkCellPicker()
                 
     def annotatePick(object, event):
         print("pick")
         if self.picker.GetCellId() < 0:
             self.textActor.VisibilityOff()
         else:
             selPt = self.picker.GetSelectionPoint()
             pickPos = self.picker.GetPickPosition()
             pickPosInt = (round(pickPos[0]), round(pickPos[1]),round(pickPos[2]))
             pickPosIntStr = str(pickPosInt)
             pickPosIntQStr = Qt.QString(pickPosIntStr)
         
         i = self.materialControl.currentIndex()
         j = self.controlTypeTab[i].currentIndex()
         if j == 0:
             if self.firstPlanePt[i].isChecked():
                 self.firstPlanePtValueRecord[i] = pickPos
                 self.firstPlanePtValue[i].setText(pickPosIntQStr)
             if self.secondPlanePt[i].isChecked():
                 self.secondPlanePtValueRecord[i] = pickPos
                 self.secondPlanePtValue[i].setText(pickPosIntQStr)
             if self.thirdPlanePt[i].isChecked():
                 self.thirdPlanePtValueRecord[i] = pickPos
                 self.thirdPlanePtValue[i].setText(pickPosIntQStr)
         else:
             if self.controlPt[i].isChecked():
                 self.controlPtValueRecord[i] = pickPos
                 self.controlPtValue[i].setText(pickPosIntQStr)
         pickValue = self.data_matrix_red[round(pickPos[2]),round(pickPos[1]),round(pickPos[0])]
         self.textMapper.SetInput("(%.3i, %.3i, %.3i)"%pickPosInt)
         print pickValue
         self.textActor.SetPosition(selPt[:2])
         self.textActor.VisibilityOn()
                 
     # Now at the end of the pick event call the above function.
     self.picker.AddObserver("EndPickEvent", annotatePick)
     self.iren.SetPicker(self.picker)
     # Add the actors to the renderer, set the background and size
     self.ren.AddActor2D(self.textActor)
开发者ID:JonathanWang1,项目名称:somethingMyOwn,代码行数:51,代码来源:gui.py

示例6: display_info

 def display_info(self, info):
     self.infotxt_mapper = vtk.vtkTextMapper()
     tprops = self.infotxt_mapper.GetTextProperty()
     tprops.SetFontSize(14)
     tprops.SetFontFamilyToTimes()
     tprops.SetColor(0, 0, 1)
     tprops.BoldOn()
     tprops.SetVerticalJustificationToTop()
     self.infotxt = "INFO : {}".format(info)
     self.infotxt_actor = vtk.vtkActor2D()
     self.infotxt_actor.VisibilityOn()
     self.infotxt_actor.SetMapper(self.infotxt_mapper)
     self.ren.AddActor(self.infotxt_actor)
     self.infotxt_mapper.SetInput(self.infotxt)
     winsize = self.ren_win.GetSize()
     self.infotxt_actor.SetPosition(10, winsize[1]-10)
     self.infotxt_actor.VisibilityOn()
开发者ID:blondegeek,项目名称:pymatgen,代码行数:17,代码来源:structure_vtk.py

示例7: display_warning

 def display_warning(self, warning):
     self.warningtxt_mapper = vtk.vtkTextMapper()
     tprops = self.warningtxt_mapper.GetTextProperty()
     tprops.SetFontSize(14)
     tprops.SetFontFamilyToTimes()
     tprops.SetColor(1, 0, 0)
     tprops.BoldOn()
     tprops.SetJustificationToRight()
     self.warningtxt = "WARNING : {}".format(warning)
     self.warningtxt_actor = vtk.vtkActor2D()
     self.warningtxt_actor.VisibilityOn()
     self.warningtxt_actor.SetMapper(self.warningtxt_mapper)
     self.ren.AddActor(self.warningtxt_actor)
     self.warningtxt_mapper.SetInput(self.warningtxt)
     winsize = self.ren_win.GetSize()
     self.warningtxt_actor.SetPosition(winsize[0]-10, 10)
     self.warningtxt_actor.VisibilityOn()
开发者ID:blondegeek,项目名称:pymatgen,代码行数:17,代码来源:structure_vtk.py

示例8: display_pick

    def display_pick(self, images, image_pos_pat, image_ori_pat, postS, LesionZslice):
        '''Display a z-slice and use picker to pick coordinates with a mouse right-click'''
        #subtract volumes based on indicated postS            
        # define image based on subtraction of postS -preS
        image = self.subImage(images, postS)    

        # Proceed to build reference frame for display objects based on DICOM coords   
        [transformed_image, transform_cube] = self.dicomTransform(image, image_pos_pat, image_ori_pat)
                
        # Calculate the center of the volume
        transformed_image.UpdateInformation() 
    
        # Set up ortogonal planes
        self.xImagePlaneWidget.SetInput( transformed_image )
        self.yImagePlaneWidget.SetInput( transformed_image )
        self.zImagePlaneWidget.SetInput( transformed_image )
        
        self.zImagePlaneWidget.SetSliceIndex( LesionZslice )
        self.xImagePlaneWidget.On()
        self.yImagePlaneWidget.On()
        self.zImagePlaneWidget.On()
        
        ############
        self.textMapper = vtk.vtkTextMapper()
        tprop = self.textMapper.GetTextProperty()
        tprop.SetFontFamilyToArial()
        tprop.SetFontSize(10)
        tprop.BoldOn()
        tprop.ShadowOn()
        tprop.SetColor(1, 0, 0)
           
        # initialize 
        self.seeds = vtk.vtkPoints()  
        self.textActor = vtk.vtkActor2D()
        self.textActor.VisibilityOff() 
        self.textActor.SetMapper(self.textMapper)

        # Initizalize
        self.iren1.SetPicker(self.picker)
        self.picker.AddObserver("EndPickEvent", self.annotatePick)
        self.renWin1.Render()
        self.renderer1.Render()
        self.iren1.Start()
                
        return self.seeds
开发者ID:xieyanfu,项目名称:extractFeatures,代码行数:45,代码来源:display.py

示例9: setTitle

    def setTitle(self):
        """Put a text at the top of the figure."""
        tprop = self.textProperty(fontsize = self.opt.title_fontsize)
        tprop.SetVerticalJustificationToTop()
        tprop.SetJustificationToCentered()
        mapper = vtk.vtkTextMapper()
        mapper.SetInput(self.opt.title)
        mapper.SetTextProperty(tprop)
        actor = vtk.vtkActor2D()
        actor.SetMapper(mapper)
        actor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()
        if self.opt.title_coord:
            actor.GetPositionCoordinate().SetValue(self.opt.title_coord[0],
                                                   self.opt.title_coord[1])
        else:
            actor.GetPositionCoordinate().SetValue(0.5, 0.99)

        return actor
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:18,代码来源:PlotVTK.py

示例10: display_rottra

	def display_rottra(self,mod):
		tm = vtk.vtkTextMapper()
		tp = tm.GetTextProperty()
		#tp.SetFontFamilyToArial()
		tp.SetFontSize(10)
		#tp.BoldOff()
		tp.ShadowOff()
		tp.SetColor(1, 1, 1)
		tp.SetOpacity(1)
		label = vtk.vtkActor2D()
		label.VisibilityOn()
		label.SetMapper(tm)
		v=[0,15]
		label.SetPosition(v)
		rottra = mod.rottra
		tm.SetInput("R:[%.3f,%.3f,%.3f]  T:[%.3f,%.3f,%.3f]"%(rottra[0],rottra[1],rottra[2],rottra[3],rottra[4],rottra[5]))
		self.renderer.AddActor2D(label)
		self.renwin.Render()
开发者ID:ggoret,项目名称:VEDA,代码行数:18,代码来源:mod.py

示例11: text

def text(text, font_size=10, position=(0, 0), color=(0, 0, 0), is_visible=True):
    """ Generate a 2d text actor.
    """
    mapper = vtk.vtkTextMapper()
    mapper.SetInput(text)
    properties = mapper.GetTextProperty()
    properties.SetFontFamilyToArial()
    properties.SetFontSize(font_size)
    properties.BoldOn()
    properties.ShadowOn()
    properties.SetColor(color)

    actor = vtk.vtkActor2D()
    actor.SetPosition(position)
    if not is_visible:
        actor.VisibilityOff()
    actor.SetMapper(mapper)

    return actor
开发者ID:dgoyard,项目名称:caps-clindmri,代码行数:19,代码来源:pvtk.py

示例12: __setupPicking

 def __setupPicking(self):
     # Create a text mapper and actor to display the results of picking.
     textMapper = vtk.vtkTextMapper()
     tprop = textMapper.GetTextProperty()
     tprop.SetFontFamilyToArial()
     tprop.SetFontSize(10)
     tprop.BoldOn()
     tprop.ShadowOn()
     tprop.SetColor(1, 0, 0)
     self.textActor = vtk.vtkActor2D()
     self.textActor.VisibilityOff()
     self.textActor.SetMapper(textMapper)
     
     # Create a cell picker.
     self.pick_opacity_init = 0.5
     self._picker = vtk.vtkVolumePicker()
     self._picker.SetTolerance(0.00005)
     self._picker.SetVolumeOpacityIsovalue(self.pick_opacity_init)
     self._picker.PickCroppingPlanesOff()
开发者ID:behollis,项目名称:DBSViewer,代码行数:19,代码来源:dbsMainWindow.py

示例13: redraw

    def redraw(self, reset_camera=False):
        """
        Redraw the render window.

        Args:
            reset_camera: Set to True to reset the camera to a
                pre-determined default for each structure.  Defaults to False.
        """
        self.ren.RemoveAllViewProps()
        self.picker = None
        self.add_picker_fixed()
        self.helptxt_mapper = vtk.vtkTextMapper()
        tprops = self.helptxt_mapper.GetTextProperty()
        tprops.SetFontSize(14)
        tprops.SetFontFamilyToTimes()
        tprops.SetColor(0, 0, 0)

        if self.structure is not None:
            self.set_structure(self.structure, reset_camera)

        self.ren_win.Render()
开发者ID:AtlasL,项目名称:pymatgen,代码行数:21,代码来源:structure_vtk.py

示例14: setText

 def setText(self, text):
     logging.debug("In TextWidget::setText()")
     self.text = text
     if self.scene:
         self.property.SetJustificationToLeft()
         self.property.SetVerticalJustificationToBottom()
         self.property.SetColor(self.fontColor)
 
         self.mapper = vtk.vtkTextMapper()
         self.mapper.SetTextProperty(self.property)
         self.mapper.SetInput(self.text)
         if self.textActor:
             self.scene.renderer.RemoveActor(self.textActor)
         self.textActor = vtk.vtkActor2D()
         self.textActor.SetMapper(self.mapper)
         self.textActor.PickableOff()
         self.textActor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()
         self.textActor.GetPositionCoordinate().SetValue(self.position[0], self.position[1])
         self.textActor.VisibilityOn()
         self.scene.renderer.AddActor(self.textActor)   
         self.autoResizeBox()
         self.scene.window.Render()
开发者ID:aevum,项目名称:moonstone,代码行数:22,代码来源:textwidget.py

示例15: set_open_text_on_off

	def set_open_text_on_off(self):
		if not self.islabelon:
			tm = vtk.vtkTextMapper()
			tp = tm.GetTextProperty()
			tp.SetFontFamilyToArial()
			tp.SetFontSize(20)
			tp.BoldOff()
			tp.ShadowOff()
			tp.SetColor(1, 1, 1)
			tp.SetOpacity(0.8)
			self.label = vtk.vtkActor2D()
			self.label.VisibilityOn()
			self.label.SetMapper(tm)
			v=[200,100]
			self.label.SetPosition(v)
			tm.SetInput("VEDA - Visual Environment for Docking Algorithms - Version (%s)\n \nDevelopped by Gael Goret and Jorge Navaza"%self.version)
			self.renderer.AddActor2D(self.label)
			self.renwin.Render()
			self.islabelon=1
		else :
			self.label.VisibilityOff()
			self.renderer.RemoveActor2D(self.label)
			self.renwin.Render()
			self.islabelon=0
开发者ID:ggoret,项目名称:VEDA,代码行数:24,代码来源:gfx.py


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