本文整理汇总了Python中vtk.vtkScalarBarActor函数的典型用法代码示例。如果您正苦于以下问题:Python vtkScalarBarActor函数的具体用法?Python vtkScalarBarActor怎么用?Python vtkScalarBarActor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkScalarBarActor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: build_vtk_renderer
def build_vtk_renderer(self):
# offscreen rendering
if (vtk.vtkVersion().GetVTKMajorVersion() == 5.0):
graphics_factory = vtk.vtkGraphicsFactory()
graphics_factory.SetOffScreenOnlyMode( 1);
graphics_factory.SetUseMesaClasses( 1 );
imaging_factory = vtk.vtkImagingFactory()
imaging_factory.SetUseMesaClasses( 1 );
self.renderer = vtk.vtkRenderer()
self.renderer.SetBackground(1, 1, 1)
self.render_window = vtk.vtkRenderWindow()
# offscreen rendering
self.render_window.SetOffScreenRendering(1)
self.render_window.AddRenderer(self.renderer)
# create a renderwindowinteractor
#if self.interact:
#self.iren = vtk.vtkRenderWindowInteractor()
#self.iren.SetRenderWindow(self.render_window)
# scalar bar
self.scalarbar = vtk.vtkScalarBarActor()
# To avoid uninitialized warning in VTK 6
self.scalarbar.SetTitle("")
# black text since background is white for printing
self.scalarbar.GetLabelTextProperty().SetColor(0, 0, 0)
self.scalarbar.GetTitleTextProperty().SetColor(0, 0, 0)
开发者ID:SlicerDMRI,项目名称:whitematteranalysis,代码行数:29,代码来源:render.py
示例2: add_widgets
def add_widgets(self):
# axes
axes = vtk.vtkAxesActor()
self.marker_widget = vtk.vtkOrientationMarkerWidget()
self.marker_widget.SetInteractor(self.iren)
self.marker_widget.SetOrientationMarker(axes)
self.marker_widget.SetViewport(0.0, 0.0, 0.25, 0.25)
# scalar bar
self.scalarbar_actor = vtk.vtkScalarBarActor()
self.scalarbar_actor.SetLookupTable(self.lut)
self.scalarbar_widget = vtk.vtkScalarBarWidget()
self.scalarbar_widget.SetInteractor(self.iren)
self.scalarbar_widget.SetScalarBarActor(self.scalarbar_actor)
# contour slider
self.slider_rep = vtk.vtkSliderRepresentation2D()
self.slider_rep.SetTitleText("contour")
self.slider_rep.GetPoint1Coordinate().SetCoordinateSystemToNormalizedViewport()
self.slider_rep.GetPoint1Coordinate().SetValue(0.65, 0.1)
self.slider_rep.GetPoint2Coordinate().SetCoordinateSystemToNormalizedViewport()
self.slider_rep.GetPoint2Coordinate().SetValue(0.95, 0.1)
self.slider_widget = vtk.vtkSliderWidget()
self.slider_widget.SetInteractor(self.iren)
self.slider_widget.SetRepresentation(self.slider_rep)
self.slider_widget.SetAnimationModeToAnimate()
self.slider_widget.AddObserver(vtk.vtkCommand.InteractionEvent,
self.update_contour);
开发者ID:capitalaslash,项目名称:radcal-gui,代码行数:29,代码来源:vtkgui.py
示例3: __init__
def __init__(self, _drawModel):
self.legendActor = vtk.vtkScalarBarActor()
self.legendActor.SetNumberOfLabels(8)
(self.minCon, self.maxCon) = (0, 0)
self.plane = 'XY'
self.planePos = 0
self.ren = None
dM = ref(_drawModel)
self.drawModel = dM()
self.currentDrawingFunction = None
self.currentActors = {} # dictionary of current actors
self.drawingFcnName = "" # holds a string describing name of the drawing fcn . Used to determine if current actors need to be removed before next drawing
self.drawingFcnHasChanged = True
self.fieldTypes = None
self.currentDrawingParameters = DrawingParameters()
# self.currentFieldType = ("Cell_Field", FIELD_TYPES[0])
self.currentFieldType = ("Cell_Field", 'CellField')
self.__initDist = 0 # initial camera distance - used in zoom functions
self.min_max_text_actor = vtk.vtkTextActor()
# CUSTOM ACTORS
self.customActors = {} # {visName: CustomActorsStorage() }
self.currentCustomVisName = '' # stores name of the current custom visualization
self.currentVisName = '' # stores name of the current visualization
self.cameraSettingsDict = {} # {fieldName:CameraSettings()}
开发者ID:CompuCell3D,项目名称:CompuCell3D,代码行数:27,代码来源:MVCDrawViewBase.py
示例4: creaColorScaleBar
def creaColorScaleBar(self,orientation='H'):
'''Creates the scalar bar that indicates to the viewer the correspondence
between color values and data values
:param orientation: 'H' for horizontal bar, 'V' for vertical bar (defaults to 'H')
'''
self.scalarBar= vtk.vtkScalarBarActor()
pos= self.scalarBar.GetPositionCoordinate()
pos.SetCoordinateSystemToNormalizedViewport()
if orientation=='H':
pos.SetValue(0.1,0.1)
self.scalarBar.SetOrientationToHorizontal()
self.scalarBar.SetWidth(0.8)
self.scalarBar.SetHeight(0.06)
else:
pos.SetValue(0.85,0.25)
self.scalarBar.SetOrientationToVertical()
self.scalarBar.SetWidth(0.1)
self.scalarBar.SetHeight(0.7)
self.scalarBar.SetLookupTable(self.lookUpTable)
self.scalarBar.Modified()
#self.scalarBar.SetLabelFormat("%.2f")
labelTextProperty= self.scalarBar.GetLabelTextProperty()
labelTextProperty.ItalicOff()
return self.scalarBar
开发者ID:lcpt,项目名称:xc,代码行数:27,代码来源:vtk_lut_field.py
示例5: createActor
def createActor( self, **args ):
if self.colorBarActor == None:
pos = args.get( 'pos', [ 0.9, 0.2 ] )
title = args.get( 'title', '' )
self.colorBarActor = vtk.vtkScalarBarActor()
# self.colorBarActor.SetMaximumWidthInPixels( 50 )
self.colorBarActor.SetNumberOfLabels(9)
labelFormat = vtk.vtkTextProperty()
labelFormat.SetFontSize( 160 )
labelFormat.SetColor( VTK_FOREGROUND_COLOR[0], VTK_FOREGROUND_COLOR[1], VTK_FOREGROUND_COLOR[2] )
titleFormat = vtk.vtkTextProperty()
titleFormat.SetFontSize( 160 )
titleFormat.SetColor( VTK_FOREGROUND_COLOR[0], VTK_FOREGROUND_COLOR[1], VTK_FOREGROUND_COLOR[2] )
# titleFormat.SetVerticalJustificationToTop ()
# titleFormat.BoldOn()
self.colorBarActor.SetPosition( pos[0], pos[1] )
self.colorBarActor.SetLabelTextProperty( labelFormat )
self.colorBarActor.SetTitleTextProperty( titleFormat )
self.colorBarActor.SetTitle( title )
self.colorBarActor.SetLookupTable( self.getDisplayLookupTable() )
self.colorBarActor.SetVisibility(0)
self.colorBarActor.SetMaximumWidthInPixels(75)
else:
self.colorBarActor.SetLookupTable( self.getDisplayLookupTable() )
self.colorBarActor.Modified()
return self.colorBarActor
开发者ID:ThomasMaxwell,项目名称:HyperwallDataBrowse,代码行数:26,代码来源:ColormapManager.py
示例6: Execute
def Execute(self):
if not self.Centerlines:
self.PrintError('Error: No input centerlines.')
return
if not self.vmtkRenderer:
self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
self.vmtkRenderer.Initialize()
self.OwnRenderer = 1
self.vmtkRenderer.RegisterScript(self)
if self.CellDataArrayName:
cellCenters = vtk.vtkCellCenters()
cellCenters.SetInput(self.Centerlines)
cellCenters.Update()
cellCenters.GetOutput().GetPointData().SetActiveScalars(self.CellDataArrayName)
labelsMapper = vtk.vtkLabeledDataMapper();
labelsMapper.SetInput(cellCenters.GetOutput())
labelsMapper.SetLabelModeToLabelScalars()
labelsActor = vtk.vtkActor2D()
labelsActor.SetMapper(labelsMapper)
self.vmtkRenderer.Renderer.AddActor(labelsActor)
centerlineMapper = vtk.vtkPolyDataMapper()
centerlineMapper.SetInput(self.Centerlines)
if self.CellDataArrayName and not self.PointDataArrayName:
centerlineMapper.ScalarVisibilityOn()
centerlineMapper.SetScalarModeToUseCellData()
self.Centerlines.GetCellData().SetActiveScalars(self.CellDataArrayName)
centerlineMapper.SetScalarRange(self.Centerlines.GetCellData().GetScalars().GetRange(0))
elif self.PointDataArrayName:
centerlineMapper.ScalarVisibilityOn()
centerlineMapper.SetScalarModeToUsePointData()
self.Centerlines.GetPointData().SetActiveScalars(self.PointDataArrayName)
centerlineMapper.SetScalarRange(self.Centerlines.GetPointData().GetScalars().GetRange(0))
else:
centerlineMapper.ScalarVisibilityOff()
centerlineActor = vtk.vtkActor()
centerlineActor.SetMapper(centerlineMapper)
self.vmtkRenderer.Renderer.AddActor(centerlineActor)
scalarBarActor = None
if self.Legend and centerlineActor and self.PointDataArrayName:
scalarBarActor = vtk.vtkScalarBarActor()
scalarBarActor.SetLookupTable(centerlineActor.GetMapper().GetLookupTable())
scalarBarActor.GetLabelTextProperty().ItalicOff()
scalarBarActor.GetLabelTextProperty().BoldOff()
scalarBarActor.GetLabelTextProperty().ShadowOff()
scalarBarActor.SetLabelFormat('%.2f')
scalarBarActor.SetTitle(self.PointDataArrayName)
self.vmtkRenderer.Renderer.AddActor(scalarBarActor)
if self.Display:
self.vmtkRenderer.Render()
if self.OwnRenderer:
self.vmtkRenderer.Deallocate()
开发者ID:SaraZanchi,项目名称:vmtk,代码行数:59,代码来源:vmtkcenterlineviewer.py
示例7: __init__
def __init__(self):
'''
Constructor
'''
self.__OrientationMatrix = vtk.vtkMatrix4x4()
self.__CornerAnnotation = vtk.vtkCornerAnnotation()
self.__TextProperty = vtk.vtkTextProperty()
self.__LookupTable = vtk.vtkLookupTable()
self.__ScalarBarActor = vtk.vtkScalarBarActor()
self.__Prop3DCollection = vtk.vtkProp3DCollection()
self.__DataSetCollection = vtk.vtkDataSetCollection()
self.__OrientationTransform = vtk.vtkMatrixToLinearTransform()
self.__OrientationMatrix.Identity()
self.__CornerAnnotation.SetNonlinearFontScaleFactor(0.30)
self.__CornerAnnotation.SetText(0, "Jolly - (c) summit 2009 ref vtkINRIA3D")
self.__CornerAnnotation.SetMaximumFontSize(46)
self.__ScalarBarActor.SetLabelTextProperty(self.__TextProperty)
self.__ScalarBarActor.GetLabelTextProperty().BoldOff()
self.__ScalarBarActor.GetLabelTextProperty().ItalicOff()
self.__ScalarBarActor.SetNumberOfLabels(3)
self.__ScalarBarActor.SetWidth(0.1)
self.__ScalarBarActor.SetHeight(0.5)
self.__ScalarBarActor.SetPosition(0.9, 0.3)
self.__LookupTable.SetTableRange(0, 1)
self.__LookupTable.SetSaturationRange(0, 0)
self.__LookupTable.SetHueRange(0, 0)
self.__LookupTable.SetValueRange(0, 1)
self.__LookupTable.Build()
self.__ShowAnnotations = True
self.__ShowScalarBar = True
self.__OrientationTransform.SetInput(self.__OrientationMatrix)
self.__WindowLevel = self.GetWindowLevel()
self.__WindowLevel.SetLookupTable( self.__LookupTable )
self.__ScalarBarActor.SetLookupTable(self.__LookupTable)
self.__Renderer = self.GetRenderer()
self.__Renderer.AddViewProp(self.__CornerAnnotation)
self.__Renderer.AddViewProp(self.__ScalarBarActor)
self.__ImageActor = self.GetImageActor()
self.__RenderWindow = self.GetRenderWindow ()
self.__InteractorStyle = self.GetInteractorStyle()
self.__Interactor = None
self.__CornerAnnotation.SetWindowLevel(self.__WindowLevel)
self.__CornerAnnotation.SetImageActor(self.__ImageActor)
self.__CornerAnnotation.ShowSliceAndImageOn()
# Sometime we would want to set the default window/level value instead
# of the ImageData's ScalarRange
self.__RefWindow = None
self.__RefLevel = None
开发者ID:jackyko1991,项目名称:vtkpythonext,代码行数:59,代码来源:vtkPythonViewImage.py
示例8: __init__
def __init__(self,delta,wing):
self.arrowColor = vtk.vtkColorTransferFunction()
self.update_look_up_table()
self.print_counter=0
self.ren = vtk.vtkRenderer()
self.geo_reader = vtk.vtkUnstructuredGridReader()
self.geo_reader.SetFileName(wing)
self.vec_reader = vtk.vtkStructuredPointsReader()
self.vec_reader.SetFileName(delta)
""" This is for drawing the wing,"""
geo_Mapper=vtk.vtkDataSetMapper()
geo_Mapper.SetInputConnection(self.geo_reader.GetOutputPort())
geo_actor = vtk.vtkActor()
geo_actor.SetMapper(geo_Mapper)
self.ren.AddActor(geo_actor)
"""End of adding the wing """
self.ren.AddActor(self.create_stream_line(25,150,0,0.5))
#Add renderer to renderwindow and render
self.renWin = vtk.vtkRenderWindow()
self.renWin.AddRenderer(self.ren)
self.renWin.SetSize(1920, 1080)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(self.renWin)
iren.AddObserver('RightButtonPressEvent', self.capture_image, 1.0)
# Scalar Bar actor
scalar_bar = vtk.vtkScalarBarActor()
scalar_bar.SetOrientationToHorizontal()
scalar_bar.SetLookupTable(self.arrowColor)
scalar_bar.SetTitle("Color map")
scalar_bar.SetLabelFormat("%5.2f")
scalar_bar.SetMaximumHeightInPixels(300)
scalar_bar.SetMaximumWidthInPixels(60)
# Scalar Bar Widget
scalar_bar_widget = vtk.vtkScalarBarWidget()
scalar_bar_widget.SetInteractor(iren)
scalar_bar_widget.SetScalarBarActor(scalar_bar)
scalar_bar_widget.On()
self.ren.SetBackground(0,0,0)
self.renWin.Render()
iren.Start()
开发者ID:svelezsaffon,项目名称:vector_field_visualization_vtk,代码行数:59,代码来源:streamsurfaces.py
示例9: __init__
def __init__(self, _drawModel , graphicsFrameWidget, parent=None):
self.legendActor = vtk.vtkScalarBarActor()
self.legendActor.SetNumberOfLabels(8)
(self.minCon, self.maxCon) = (0, 0)
# print MODULENAME,"graphicsFrameWidget=",graphicsFrameWidget
# print MODULENAME,"parent=",parent
self.plane = 'XY'
self.planePos = 0
# # # self.drawModel = _drawModel
self.parentWidget = parent
# print MODULENAME,' __init__: parentWidget=',self.parentWidget
# from weakref import ref
# self.graphicsFrameWidget = ref(graphicsFrameWidget)
# gfw=self.graphicsFrameWidget()
# self.qvtkWidget = self.graphicsFrameWidget.qvtkWidget
from weakref import ref
dM = ref(_drawModel)
self.drawModel=dM()
gfw=ref(graphicsFrameWidget)
self.graphicsFrameWidget = gfw()
# qvtk=ref(self.graphicsFrameWidget.qvtkWidget)
# self.qvtkWidget = qvtk()
self.qvtkWidget = ref(self.graphicsFrameWidget.qvtkWidget)
# # # self.graphicsFrameWidget = graphicsFrameWidget
# # # self.qvtkWidget = self.graphicsFrameWidget.qvtkWidget
self.currentDrawingFunction = None
self.currentActors = {} # dictionary of current actors
self.drawingFcnName = "" # holds a string describing name of the drawing fcn . Used to determine if current actors need to be removed before next drawing
self.drawingFcnHasChanged = True
self.fieldTypes = None
self.currentDrawingParameters = DrawingParameters()
self.currentFieldType = ("Cell_Field", FIELD_TYPES[0])
self.__initDist = 0 # initial camera distance - used in zoom functions
#CUSTOM ACTORS
self.customActors = {} #{visName: CustomActorsStorage() }
self.currentCustomVisName = '' #stores name of the current custom visualization
self.currentVisName = '' #stores name of the current visualization
self.cameraSettingsDict = {} # {fieldName:CameraSettings()}
开发者ID:CompuCell3D,项目名称:CompuCell3D,代码行数:59,代码来源:MVCDrawViewBase.py
示例10: _addScalarBar
def _addScalarBar(self, val):
if len(val.shape) > 1:
val = norm(val, axis=1)
self._setupColorFunction(val.min(), val.max())
self._scalarBar = vtk.vtkScalarBarActor()
self._scalarBar.SetLookupTable(self._colorTransferFunction)
self._scalarBar.SetTitle("Velocities (m/s)")
self._ren.AddActor2D(self._scalarBar)
开发者ID:Andrew-AbiMansour,项目名称:PyDEM,代码行数:10,代码来源:visualize.py
示例11: PlotQualFace
def PlotQualFace(mesh, qual, rng, scbar=False):
""" Plot score """
# Add score to mesh
vtkfloat = VN.numpy_to_vtk(np.ascontiguousarray(qual), deep=True)
vtkfloat.SetName('Score')
mesh.GetCellData().AddArray(vtkfloat)
mesh.GetCellData().SetActiveScalars('Score')
mapper = vtk.vtkDataSetMapper()
if vtk.vtkVersion().GetVTKMajorVersion() >5:
mapper.SetInputData(mesh)
else:
mapper.SetInput(mesh)
mapper.SetScalarRange(rng[0], rng[1])
mapper.SetScalarModeToUseCellData()
# Create Actor
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().SetRepresentationToSurface()
actor.GetProperty().EdgeVisibilityOn()
actor.GetProperty().SetColor(1, 1, 1)
actor.GetProperty().LightingOff()
# Add FEM Actor to renderer window
ren = vtk.vtkRenderer()
ren.SetBackground(0.3, 0.3, 0.3)
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# Allow user to interact
istyle = vtk.vtkInteractorStyleTrackballCamera()
iren.SetInteractorStyle(istyle)
# Add actor
ren.AddActor(actor)
if scbar:
scalarBar = vtk.vtkScalarBarActor()
scalarBar.SetLookupTable(mapper.GetLookupTable())
# scalarBar.SetTitle('Quality')
scalarBar.SetNumberOfLabels(5)
ren.AddActor(scalarBar)
# Render
iren.Initialize()
renWin.Render()
iren.Start()
开发者ID:akaszynski,项目名称:PyACVD,代码行数:55,代码来源:VTK_Plotting.py
示例12: add_color_bar
def add_color_bar(self):
colorbar=vtk.vtkScalarBarActor()
colorbar.SetMaximumNumberOfColors(400)
colorbar.SetLookupTable(self.mapper_list[0].GetLookupTable())
colorbar.SetWidth(0.09)
colorbar.SetPosition(0.91,0.1)
colorbar.SetLabelFormat("%.3g mm")
colorbar.VisibilityOn()
if len(self.color_list) == 0:
self.ren.AddActor(colorbar)
开发者ID:151706061,项目名称:ChestImagingPlatform,代码行数:11,代码来源:display_particles.py
示例13: BuildView
def BuildView(self):
if not self.vmtkRenderer:
self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
self.vmtkRenderer.Initialize()
self.OwnRenderer = 1
self.vmtkRenderer.RegisterScript(self)
if self.Actor != None:
self.vmtkRenderer.Renderer.RemoveActor(self.Actor)
if self.ScalarBarActor != None:
self.vmtkRenderer.Renderer.RemoveActor(self.ScalarBarActor)
if self.Mesh != None:
mapper = vtk.vtkDataSetMapper()
mapper.SetInput(self.Mesh)
if (self.ArrayName != ''):
self.Mesh.GetPointData().SetActiveScalars(self.ArrayName)
if (self.Mesh.GetPointData().GetScalars() != None):
array = self.Mesh.GetPointData().GetScalars()
if (self.ScalarRange[1] > self.ScalarRange[0]):
mapper.SetScalarRange(self.ScalarRange)
else:
mapper.SetScalarRange(array.GetRange(0))
if (self.Grayscale == 1):
lut = vtk.vtkLookupTable()
lut.SetValueRange(0.0,1.0)
lut.SetSaturationRange(0.0,0.0)
mapper.SetLookupTable(lut)
self.Actor = vtk.vtkActor()
self.Actor.SetMapper(mapper)
if (self.FlatInterpolation == 1):
self.Actor.GetProperty().SetInterpolationToFlat()
self.Actor.GetProperty().SetOpacity(self.Opacity)
self.vmtkRenderer.Renderer.AddActor(self.Actor)
if (self.Legend == 1) & (self.Actor != None):
self.ScalarBarActor = vtk.vtkScalarBarActor()
self.ScalarBarActor.SetLookupTable(self.Actor.GetMapper().GetLookupTable())
self.ScalarBarActor.GetLabelTextProperty().ItalicOff()
self.ScalarBarActor.GetLabelTextProperty().BoldOff()
self.ScalarBarActor.GetLabelTextProperty().ShadowOff()
## self.ScalarBarActor.GetLabelTextProperty().SetColor(0.0,0.0,0.0)
self.ScalarBarActor.SetLabelFormat('%.2f')
self.vmtkRenderer.Renderer.AddActor(self.ScalarBarActor)
if (self.Display == 1):
self.vmtkRenderer.Render()
if self.OwnRenderer:
self.vmtkRenderer.Deallocate()
开发者ID:SaraZanchi,项目名称:vmtk,代码行数:53,代码来源:vmtkmeshviewer.py
示例14: __init__
def __init__(self, lut=None, **kwargs):
self.actor = vtk.vtkScalarBarActor()
self.actor.SetMaximumNumberOfColors(400)
if lut is None:
lut = get_jet_lut()
self.lut = lut
self.actor.SetLookupTable(lut)
self.actor.SetWidth(0.05)
self.actor.SetPosition(0.95, 0.1)
self.actor.SetLabelFormat("%.3g")
self.actor.VisibilityOn()
开发者ID:gbaydin,项目名称:autodiff,代码行数:13,代码来源:troupe.py
示例15: initVtkBar
def initVtkBar(self) :
'''Initialize the scalar bar for color levels'''
aSBar = vtk.vtkScalarBarActor()
aSBar.SetOrientationToVertical()
aSBar.SetLookupTable(self._lut)
aSBar.SetTitle("Residue score")
aSBar.GetLabelTextProperty().SetColor(0.8, 0.8, 0.8)
aSBar.GetTitleTextProperty().SetColor(0.8, 0.8, 0.8)
aSBar.SetWidth(0.1)
aSBar.SetHeight(0.9)
spc = aSBar.GetPositionCoordinate()
spc.SetCoordinateSystemToNormalizedViewport()
spc.SetValue(0.05, 0.05)
return aSBar
开发者ID:talavis,项目名称:Protein-Data-Visualisation,代码行数:15,代码来源:project.py
示例16: creaVertColorScaleBar
def creaVertColorScaleBar(self):
'''Creates the scalar bar that indicates to the viewer the correspondence
between color values and data values
'''
self.scalarBar= vtk.vtkScalarBarActor()
pos= self.scalarBar.GetPositionCoordinate()
pos.SetCoordinateSystemToNormalizedViewport()
pos.SetValue(0.85,0.25)
self.scalarBar.SetOrientationToVertical()
self.scalarBar.SetWidth(0.1)
self.scalarBar.SetHeight(0.7)
self.scalarBar.SetLookupTable(self.lookUpTable)
self.scalarBar.Modified()
return self.scalarBar
开发者ID:lcpt,项目名称:xc,代码行数:17,代码来源:vtk_lut_field.py
示例17: buildVTK
def buildVTK(self, infile_name, dirname=None):
self.infile_name = infile_name
self.rend = vtk.vtkRenderer()
self.scalarBar = vtk.vtkScalarBarActor()
self.load_nastran_geometry(self.infile_name, dirname)
self.main()
#self.renWin = vtk.vtkRenderWindow()
#renWin = window
cam = self.rend.GetActiveCamera()
mouseArgs = {'pipeline': self, 'camera': cam}
xSize = 800
ySize = 600
(x, y) = getScreenCorner(xSize, ySize)
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:17,代码来源:pan.py
示例18: createScalarBar
def createScalarBar(self, sliceViewName):
if self.hasVTKPVScalarBarActor:
scalarBar = slicer.vtkPVScalarBarActor()
else:
scalarBar = vtk.vtkScalarBarActor()
scalarBar.SetTitle(" ")
# adjust text property
if self.hasVTKPVScalarBarActor:
scalarBar.SetRangeLabelFormat(self.rangeLabelFormat)
lookupTable = vtk.vtkLookupTable()
scalarBar.SetLookupTable(lookupTable)
'''
scalarBarWidget = vtk.vtkScalarBarWidget()
scalarBarWidget.SetScalarBarActor(scalarBar)
self.scalarBarWidgets[sliceViewName] = scalarBarWidget
'''
return scalarBar
开发者ID:LucasGandel,项目名称:Slicer,代码行数:17,代码来源:SliceViewAnnotations.py
示例19: Save_VTK_data_to_picture_file
def Save_VTK_data_to_picture_file(inputFileName, field_name,
node_or_cell, outputFileName
):
reader = vtk.vtkXMLUnstructuredGridReader()
reader.SetFileName(inputFileName)
reader.Update()
if node_or_cell== 'CELLS':
reader.CellArrayStatus = [field_name]
reader.GetOutput().GetCellData().SetActiveScalars(field_name)
elif node_or_cell== 'NODES':
reader.PointArrayStatus = [field_name]
reader.GetOutput().GetPointData().SetActiveScalars(field_name)
else:
raise ValueError("unknown type : should be CELLS or NODES")
#-------------------------------------------------------------------------------
mapper = vtk.vtkDataSetMapper()
mapper.SetInputConnection(reader.GetOutputPort())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
scalarBar=vtk.vtkScalarBarActor()
scalarBar.SetLookupTable(mapper.GetLookupTable())
scalarBar.SetTitle(field_name)
mapper.SetScalarRange(reader.GetOutput().GetScalarRange())
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
ren.AddViewProp(actor)
ren.AddActor2D(scalarBar);
renWin.Render()
image = vtk.vtkWindowToImageFilter()
image.SetInput(renWin)
image.ReadFrontBufferOff()
image.Update()
writer = vtk.vtkPNGWriter()
writer.SetFileName(outputFileName+".png")
writer.SetInputConnection(image.GetOutputPort())
writer.Write()
开发者ID:mndjinga,项目名称:CDMATH,代码行数:45,代码来源:VTK_routines.py
示例20: addLegend
def addLegend(self, lut):
"""Add a color bar and a color legend"""
tprop = self.textProperty(fontsize = self.opt.legend_fontsize)
legend = vtk.vtkScalarBarActor()
legend.SetLookupTable(lut)
legend.SetLabelTextProperty(tprop)
legend.GetLabelTextProperty().BoldOff()
legend.SetLabelFormat(self.opt.legend_format)
legend.SetNumberOfLabels(self.opt.color_levels)
legend.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()
if self.opt.legend:
legend.SetTitle(self.opt.legend)
legend.SetTitleTextProperty(tprop)
legend.GetTitleTextProperty().BoldOff()
if self.opt.color_position in ('South', 'North'):
legend.SetOrientationToHorizontal()
else:
legend.SetOrientationToVertical()
__locations = {'North': (0.1, 0.9 , 0.8, 0.1),
'South': (0.1, 0.01, 0.8, 0.1),
'West': (0.01, 0.1, 0.1, 0.8),
'East': (0.9, 0.09, 0.1, 0.8)}
cbloc = __locations[self.opt.color_position]
if not self.opt.color_width:
legend.SetWidth(cbloc[2])
else:
legend.SetWidth(self.opt.color_width)
if not self.opt.color_height:
legend.SetHeight(cbloc[3])
else:
legend.SetHeight(self.opt.color_height)
if not self.opt.color_coord:
legend.GetPositionCoordinate().SetValue(cbloc[0], cbloc[1])
else:
legend.GetPositionCoordinate().SetValue(self.opt.color_coord[0],
self.opt.color_coord[1])
return legend
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:45,代码来源:PlotVTK.py
注:本文中的vtk.vtkScalarBarActor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论