• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python vtk.vtkProbeFilter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        # what a lame-assed filter, we have to make dummy inputs!
        # if we don't have a dummy input (but instead a None input) it
        # bitterly complains when we do a GetOutput() (it needs the input
        # to know the type of the output) - and GetPolyDataOutput() also
        # doesn't work.
        # NB: this does mean that our probeFilter NEEDS a PolyData as
        # probe geometry!
        ss = vtk.vtkSphereSource()
        ss.SetRadius(0)
        self._dummyInput = ss.GetOutput()

        #This is also retarded - we (sometimes, see below) need the "padder"
        #to get the image extent big enough to satisfy the probe filter. 
        #No apparent logical reason, but it throws an exception if we don't.
        self._padder = vtk.vtkImageConstantPad()
        self._source = None
        self._input = None
        
        self._probeFilter = vtk.vtkProbeFilter()
        self._probeFilter.SetInput(self._dummyInput)

        NoConfigModuleMixin.__init__(
            self,
            {'Module (self)' : self,
             'vtkProbeFilter' : self._probeFilter})

        module_utils.setup_vtk_object_progress(self, self._probeFilter,
                                           'Mapping source on input')
        
        self.sync_module_logic_with_config()
开发者ID:fvpolpeta,项目名称:devide,代码行数:34,代码来源:probeFilter.py


示例2: RemappedVtu

def RemappedVtu(inputVtu, targetVtu):
  """
  Remap (via probing) the input vtu onto the mesh of the target vtu
  """
      
  coordinates = targetVtu.GetLocations()
      
  ### The following is lifted from vtu.ProbeData in tools/vtktools.py (with 
  ### self -> inputVtu and invalid node remapping rather than repositioning)
  # Initialise locator
  locator = vtk.vtkPointLocator()
  locator.SetDataSet(inputVtu.ugrid)
  locator.SetTolerance(10.0)
  locator.Update()

  # Initialise probe
  points = vtk.vtkPoints()
  ilen, jlen = coordinates.shape
  for i in range(ilen):
    points.InsertNextPoint(coordinates[i][0], coordinates[i][1], coordinates[i][2])
  polydata = vtk.vtkPolyData()
  polydata.SetPoints(points)
  probe = vtk.vtkProbeFilter()
  if vtk.vtkVersion.GetVTKMajorVersion() <= 5:
    probe.SetInput(polydata)
    probe.SetSource(inputVtu.ugrid)
  else:
    probe.SetInputData(polydata)
    probe.SetSourceData(inputVtu.ugrid)
  probe.Update()

  # Generate a list invalidNodes, containing a map from invalid nodes in the
  # result to their closest nodes in the input
  valid_ids = probe.GetValidPoints()
  valid_loc = 0
  invalidNodes = []
  for i in range(ilen):
    if valid_ids.GetTuple1(valid_loc) == i:
      valid_loc += 1
    else:
      nearest = locator.FindClosestPoint([coordinates[i][0], coordinates[i][1], coordinates[i][2]])
      invalidNodes.append((i, nearest))
  ### End of code from vtktools.py

  # Construct output  
  result = vtu()
  result.ugrid = PolyDataToUnstructuredGrid(probe.GetOutput())
  # Add the cells
  result.ugrid.SetCells(targetVtu.ugrid.GetCellTypesArray(), targetVtu.ugrid.GetCellLocationsArray(), targetVtu.ugrid.GetCells())
  # Fix the point data at invalid nodes
  if len(invalidNodes) > 0:
    for i in range(inputVtu.ugrid.GetPointData().GetNumberOfArrays()):
      oldField = inputVtu.ugrid.GetPointData().GetArray(i)
      newField = result.ugrid.GetPointData().GetArray(i)      
      components = oldField.GetNumberOfComponents()
      for invalidNode, nearest in invalidNodes:
        for comp in range(components):
          newField.SetValue(invalidNode * components + comp, oldField.GetValue(nearest * components + comp))
            
  return result
开发者ID:Torgier,项目名称:fluidity,代码行数:60,代码来源:vtutools.py


示例3: create_cut_acto_plane

    def create_cut_acto_plane(self,xpos,ypos,zpos,plane_id):
        #vtk plane
        plane=vtk.vtkPlane()
        plane.SetOrigin(xpos,ypos,zpos)

        if plane_id==0:
            plane.SetNormal(1,0,0)
        if plane_id==1:
            plane.SetNormal(0,1,0)
        if plane_id==2:
            plane.SetNormal(0.0,0.0,1)

        #create cutter
        cutter=vtk.vtkCutter()
        cutter.SetCutFunction(plane)
        cutter.SetInputConnection(self.dti_reader.GetOutputPort())
        cutter.Update()


        #probe filter for the cutting plane
        probe_filter=vtk.vtkProbeFilter()
        probe_filter.SetInputConnection(cutter.GetOutputPort())
        probe_filter.SetSourceConnection(self.dti_reader.GetOutputPort())


        self.plane1=plane

        return probe_filter
开发者ID:svelezsaffon,项目名称:Diffusion_Tensor_Visualization_VTK,代码行数:28,代码来源:tensor_glyphs.py


示例4: __init__

    def __init__(self,data_reader,main_renderer,main_interactor,chart_points):
        
        self.poly_data=vtk.vtkPolyData()
        self.lw=Line_Widget(data_reader,main_renderer,main_interactor,self,chart_points)
        
        self.probe_filter=vtk.vtkProbeFilter()
        self.probe_filter.SetInput(self.poly_data)
        
        self.probe_filter.SetSource(data_reader.get_data_set())
        self.actor=vtk.vtkXYPlotActor()
        self.actor.AddInput(self.probe_filter.GetOutput())
        self.actor.GetPositionCoordinate().SetValue(0.05,0.05,0)
        self.actor.GetPosition2Coordinate().SetValue(0.95,0.95,0)

        self.actor.SetYRange(data_reader.get_scalar_range())
        self.actor.SetXValuesToArcLength()
        self.actor.SetNumberOfXLabels(6)
        self.actor.SetTitle("Data")
        self.actor.SetXTitle("s")
        self.actor.SetYTitle("f(s)")
        self.actor.GetProperty().SetColor(0,0,0)
        self.actor.GetProperty().SetLineWidth(2)
        self.actor.SetLabelFormat("%g")
        self.actor.GetTitleTextProperty().SetFontFamilyToArial()
        #main_renderer.AddActor2D(self.actor)
         
        #main_renderer.Render()
        # tu wystartuje nowy watek z wykresem w nowym oknie
        newwin = New_Render_Widget_Package(self.actor)
        #newwin.widget.add_actor(actor)
        newwin.start()
开发者ID:bitcoinsoftware,项目名称:3D-Scientific-Visualization,代码行数:31,代码来源:XY_Plot.py


示例5: probeVolume

    def probeVolume(self, volumeNode, rulerNode):

        # get ruler ednpoints coordinates in RAS
        p0ras = rulerNode.GetPolyData().GetPoint(0) + (1,)
        p1ras = rulerNode.GetPolyData().GetPoint(1) + (1,)

        # RAS --> IJK
        ras2ijk = vtk.vtkMatrix4x4()
        volumeNode.GetRASToIJKMatrix(ras2ijk)
        p0ijk = [int(round(c)) for c in ras2ijk.MultiplyPoint(p0ras)[:3]]
        p1ijk = [int(round(c)) for c in ras2ijk.MultiplyPoint(p1ras)[:3]]

        # Create VTK line that will be used for sampling
        line = vtk.vtkLineSource()
        line.SetResolution(100)
        line.SetPoint1(p0ijk)
        line.SetPoint2(p1ijk)

        # Create VTK probe filter and sample the image
        probe = vtk.vtkProbeFilter()
        probe .SetInputConnection(line.GetOutputPort())
        probe.SetSourceData(volumeNode.GetImageData())
        probe.Update()

        # Return VTK array
        return probe.GetOutput().GetPointData().GetArray('ImageScalars')
开发者ID:quentan,项目名称:SlicerScript,代码行数:26,代码来源:LineIntersityProfile.py


示例6: __init__

  def __init__(self, ugrid, coordinates):
    # Initialise locator
    locator = vtk.vtkPointLocator()
    locator.SetDataSet(ugrid)
    locator.SetTolerance(10.0)
    locator.Update()

    # Initialise probe
    points = vtk.vtkPoints()
    points.SetDataTypeToDouble()
    ilen, jlen = coordinates.shape
    for i in range(ilen):
      points.InsertNextPoint(coordinates[i][0], coordinates[i][1], coordinates[i][2])
    polydata = vtk.vtkPolyData()
    polydata.SetPoints(points)
    self.probe = vtk.vtkProbeFilter()
    self.probe.SetInput(polydata)
    self.probe.SetSource(ugrid)
    self.probe.Update()

    # Generate a list invalidNodes, containing a map from invalid nodes in the
    # result to their closest nodes in the input
    valid_ids = self.probe.GetValidPoints()
    valid_loc = 0
    self.invalidNodes = []
    for i in range(ilen):
      if valid_ids.GetTuple1(valid_loc) == i:
        valid_loc += 1
      else:
        nearest = locator.FindClosestPoint([coordinates[i][0], coordinates[i][1], coordinates[i][2]])
        self.invalidNodes.append((i, nearest))
    self.ugrid = ugrid
开发者ID:Nasrollah,项目名称:fluidity,代码行数:32,代码来源:vtktools.py


示例7: interpolate_over_line

def interpolate_over_line(line, reader):

    # Interpolate the data from the VTK-file on the created line.

    # vtkProbeFilter, the probe line is the input, and the underlying dataset
    # is the source.
    probe = vtk.vtkProbeFilter()
    probe.SetInputConnection(line.GetOutputPort())
    probe.SetSourceData(reader.GetOutput())
    probe.Update()

    # Get the data from the VTK-object (probe) to an numpy array
    q = vtk_to_numpy(probe.GetOutput().GetPointData().GetArray(displacement))

    samples_on_line = probe.GetOutput().GetNumberOfPoints()

    # initialise the points on the line
    x = np.zeros(samples_on_line)
    y = np.zeros(samples_on_line)
    z = np.zeros(samples_on_line)
    points = np.zeros((samples_on_line , 3))

    # Get the coordinates of the points on the line
    for i in range(samples_on_line):
        x[i], y[i], z[i] = probe.GetOutput().GetPoint(i)
        points[i, 0] = x[i]
        points[i, 1] = y[i]
        points[i, 2] = z[i]
    return points,q
开发者ID:dbeurle,项目名称:neon,代码行数:29,代码来源:verify.py


示例8: samplepiv

def samplepiv(piv, xyslice):
    """Sample piv image with xyslice"""
    prober = vtk.vtkProbeFilter()
    prober.SetInput(xyslice)
    prober.SetSource(piv)
    prober.Update()
    return prober.GetOutput()
开发者ID:BijanZarif,项目名称:visc11,代码行数:7,代码来源:contourplot_xyplane.py


示例9: GetIntensities

    def GetIntensities(self,selector):
        probe = vtk.vtkProbeFilter()
        volume = Globals.imagePipeline.volume
        
        m = vtk.vtkMatrix4x4()
        # populate the matrix
        m.DeepCopy( selector.GetDirectionCosines() )
        axesOrigin = selector.GetAxesOrigin()
        m.SetElement(0,3, axesOrigin[0])
        m.SetElement(1,3, axesOrigin[1])
        m.SetElement(2,3, axesOrigin[2])
        
        # use the selector to project points in the right spatial position
        volSpline = PlaneSpline()
        for pt in self.points:
            wpt = m.MultiplyPoint( [pt[0],pt[1],0,1] )
            volSpline.AddPoint(wpt[0:3])

        polyData = volSpline.GetVtkPolyData()
        probe.SetInput(polyData)
        probe.SetSource(volume)
        probe.Update()
        
        lstValues = []
        vtkValues = probe.GetOutput().GetPointData().GetScalars()
        for i in range(vtkValues.GetNumberOfTuples()):
            lstValues.append( vtkValues.GetComponent(i,0) )
            
        return str(lstValues)[1:-1]
开发者ID:ewong718,项目名称:freesurfer,代码行数:29,代码来源:Spline.py


示例10: ProbeData

  def ProbeData(self, coordinates, name):
    """Interpolate field values at these coordinates."""

    # Initialise locator
    locator = vtk.vtkPointLocator()
    locator.SetDataSet(self.ugrid)
    locator.SetTolerance(10.0)
    locator.Update()

    # Initialise probe
    points = vtk.vtkPoints()
    points.SetDataTypeToDouble()
    ilen, jlen = coordinates.shape
    for i in range(ilen):
      points.InsertNextPoint(coordinates[i][0], coordinates[i][1], coordinates[i][2])
    polydata = vtk.vtkPolyData()
    polydata.SetPoints(points)
    probe = vtk.vtkProbeFilter()
    probe.SetInput(polydata)
    probe.SetSource(self.ugrid)
    probe.Update()

    # Generate a list invalidNodes, containing a map from invalid nodes in the
    # result to their closest nodes in the input
    valid_ids = probe.GetValidPoints()
    valid_loc = 0
    invalidNodes = []
    for i in range(ilen):
      if valid_ids.GetTuple1(valid_loc) == i:
        valid_loc += 1
      else:
        nearest = locator.FindClosestPoint([coordinates[i][0], coordinates[i][1], coordinates[i][2]])
        invalidNodes.append((i, nearest))

    # Get final updated values
    pointdata=probe.GetOutput().GetPointData()
    vtkdata=pointdata.GetArray(name)
    nc=vtkdata.GetNumberOfComponents()
    nt=vtkdata.GetNumberOfTuples()
    array = arr([vtkdata.GetValue(i) for i in range(nt * nc)])
    
    # Fix the point data at invalid nodes
    if len(invalidNodes) > 0:
      try:
        oldField = self.ugrid.GetPointData().GetArray(name)
        components = oldField.GetNumberOfComponents()
      except:
        try:
          oldField = self.ugrid.GetCellData().GetArray(name)
          components = oldField.GetNumberOfComponents()
        except:
          raise Exception("ERROR: couldn't find point or cell field data with name "+name+" in file "+self.filename+".")
      for invalidNode, nearest in invalidNodes:
        for comp in range(nc):
          array[invalidNode * nc + comp] = oldField.GetValue(nearest * nc + comp)
          
    valShape = self.GetField(name)[0].shape
    array.shape = tuple([nt] + list(valShape))
          
    return array
开发者ID:TerraFERMA,项目名称:TerraFERMA,代码行数:60,代码来源:vtktools.py


示例11: StructuredPointProbe

  def StructuredPointProbe(self, nx, ny, nz, bounding_box=None):
    """ Probe the unstructured grid dataset using a structured points dataset. """

    probe = vtk.vtkProbeFilter ()
    probe.SetSource (self.ugrid)

    sgrid = vtk.vtkStructuredPoints()

    bbox = [0.0,0.0, 0.0,0.0, 0.0,0.0]
    if bounding_box==None:
      bbox = self.ugrid.GetBounds()
    else:
      bbox = bounding_box

    sgrid.SetOrigin([bbox[0], bbox[2], bbox[4]])

    sgrid.SetDimensions(nx, ny, nz)

    spacing = [0.0, 0.0, 0.0]
    if nx>1: spacing[0] = (bbox[1]-bbox[0])/(nx-1.0)
    if ny>1: spacing[1] = (bbox[3]-bbox[2])/(ny-1.0)
    if nz>1: spacing[2] = (bbox[5]-bbox[4])/(nz-1.0)

    sgrid.SetSpacing(spacing)

    probe.SetInput (sgrid)
    probe.Update ()

    return probe.GetOutput()
开发者ID:TerraFERMA,项目名称:TerraFERMA,代码行数:29,代码来源:vtktools.py


示例12: __init__

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


示例13: __init__

    def __init__(self, module_manager):
        # initialise our base class
        ModuleBase.__init__(self, module_manager)

        self._reslicer = vtk.vtkImageReslice()
        self._probefilter = vtk.vtkProbeFilter()

        self._config.paddingValue = 0.0
        
        #This is retarded - we (sometimes, see below) need the padder 
        #to get the image extent big enough to satisfy the probe filter. 
        #No apparent logical reason, but it throws an exception if we don't.
        self._padder = vtk.vtkImageConstantPad()

        configList = [
            ('Padding value:', 'paddingValue', 'base:float', 'text',
             'The value used to pad regions that are outside the supplied volume.')]        
        
        # initialise any mixins we might have
        ScriptedConfigModuleMixin.__init__(
            self, configList,
            {'Module (self)': self,
             'vtkImageReslice': self._reslicer,
             'vtkProbeFilter': self._probefilter,
             'vtkImageConstantPad': self._padder})

        module_utils.setup_vtk_object_progress(self, self._reslicer,
                                               'Transforming image (Image Reslice)')
        module_utils.setup_vtk_object_progress(self, self._probefilter,
                                               'Performing remapping (Probe Filter)')

        self.sync_module_logic_with_config()
开发者ID:fvpolpeta,项目名称:devide,代码行数:32,代码来源:transformImageToTarget.py


示例14: probeOverLine

	def probeOverLine(self, line):
		"""
		Interpolate the data from the VTK-file on the created line.
		"""
		data = self.mesh_reader_output
		
		probe = vtk.vtkProbeFilter()
		#probe.SetInputConnection(line.GetOutputPort())
		probe.SetInputConnection(line.GetOutputPort())
		probe.SetSourceData(data)

		probe.Update()

		# get the data from the VTK-object (probe) to an numpy array
		q = v2n(probe.GetOutput().GetPointData().GetArray(self.active_scalar_field))
		numPoints = probe.GetOutput().GetNumberOfPoints() # get the number of points on the line
		
		# intialise the points on the line    
		x = np.zeros(numPoints)
		y = np.zeros(numPoints)
		z = np.zeros(numPoints)
		points = np.zeros((numPoints , 3))
		
		# get the coordinates of the points on the line
		for i in range(numPoints):
			x[i], y[i], z[i] = probe.GetOutput().GetPoint(i)
			points[i, 0] = x[i]
			points[i, 1] = y[i]
			points[i, 2] = z[i]
		return points, q
开发者ID:majroy,项目名称:pyCM,代码行数:30,代码来源:postprocess.py


示例15: starInterpolation

    def starInterpolation(self, data, xy, h):
        """
        Interpolate along a star stencil 
        @param data either self.refData or self.spcData
        @param xy x and y coordinates at center of stencil
        @param h excursion from the center
        @return {'w': value, 'e': value, 'n': value, 's': value}
        """
        
        lineX = vtk.vtkLineSource()
        lineX.SetPoint1(xy[0] - h, xy[1], 0.0)
        lineX.SetPoint2(xy[0] + h, xy[1], 0.0)
        lineX.SetResolution(1)

        lineY = vtk.vtkLineSource()
        lineY.SetPoint1(xy[0], xy[1] - h, 0.0)
        lineY.SetPoint2(xy[0], xy[1] + h, 0.0)
        lineY.SetResolution(1)

        probeX = vtk.vtkProbeFilter()
        if vtk.VTK_MAJOR_VERSION >= 6:
            probeX.SetSourceData(data['polydata'])
        else:
            probeX.SetSource(data['polydata'])
        probeX.SetInputConnection(lineX.GetOutputPort())
        probeX.Update()

        probeY = vtk.vtkProbeFilter()
        if vtk.VTK_MAJOR_VERSION >= 6:
            probeY.SetSourceData(data['polydata'])
        else:
            probeY.SetSource(data['polydata'])
        probeY.SetInputConnection(lineY.GetOutputPort())
        probeY.Update()
        
        res = {}
        
        # west and east
        res['w'] = probeX.GetOutput().GetPointData().GetArray(0).GetTuple(0)
        res['e'] = probeX.GetOutput().GetPointData().GetArray(0).GetTuple(1)
        
        # south and north
        res['s'] = probeY.GetOutput().GetPointData().GetArray(0).GetTuple(0)
        res['n'] = probeY.GetOutput().GetPointData().GetArray(0).GetTuple(1)
        
        return res
开发者ID:pletzer,项目名称:compos,代码行数:46,代码来源:compos2d.py


示例16: probe

def probe(source, probe):
    """Compute point attributes (e.g. scalars, vectors, etc.) at all points of
    the probe object by interpolating the source data."""
    prober = vtk.vtkProbeFilter()
    prober.SetInput(probe)
    prober.SetSource(source)
    prober.Update()
    return prober.GetOutput()
开发者ID:ajgeers,项目名称:utils,代码行数:8,代码来源:vtklib.py


示例17: sample_vtk

def sample_vtk(file, p1=None, p2=None, x_c=0, N_points=101, solver=None, verbose=True):
    """
    Samples velocity field in a given VTK file, along a line defined with p1 and p2, or x_c.
    :param file: Path to the VTK file
    :type file: str
    :param p1: Coordinates of the starting point of the sample line. Can be either 2D or 3D [x, y] or [x, y, z]
    :type p1: list
    :param p2: Coordinates of the ending point of the sample line. Can be either 2D or 3D [x, y] or [x, y, z]
    :type p2: list
    :param x_c: If p1 and p2 are not provided, this parameter serves the x coordinate of the vertical line.
    :type x_c: float
    :param N_points: The number of points to sample the velocity in.
    :type N_points: int
    """
    if verbose:
        print 'Sampling a VTK file: {}'.format(file)

    solver=solver or postprocess.determineSolver(file)
    if type(file) == str:
        vtkFile = vtkextract.vtkFile()
        vtkFile.solver = solver
        vtkFile.readFile(file, verbose=False)
    else:
        vtkFile = file
    
    centers = vtkFile.getCenters()
    vtkFile.getVolumes()
    bounds = vtkFile.bounds
        
    p1 = p1 or [x_c, 0, -1]
    p2 = p2 or [x_c, 0, np.max(bounds[:, 4:])]
    
    if len(p1) == 2: p1.insert(1, 0)  #if 2D data is provided
    if len(p2) == 2: p2.insert(1, 0)

    line = vtk.vtkLineSource()
    line.SetResolution(N_points - 1)
    line.SetPoint1(p1)
    line.SetPoint2(p2)
    
    probe = vtk.vtkProbeFilter()
    probe.SetInputConnection(line.GetOutputPort())
    probe.SetSourceConnection(vtkFile.outputPort)
    
    probe.Update()
    probe = probe.GetOutput()
    
    vel=probe.GetPointData().GetArray(vtkFile.velArray[solver])
    vel=np.array([vel.GetTuple(j) for j in range(probe.GetNumberOfPoints())])
    line=np.array([probe.GetPoint(j) for j in range(probe.GetNumberOfPoints())])
    
    return line, vel
开发者ID:pawelaw,项目名称:phd,代码行数:52,代码来源:cross_sections.py


示例18: plot

    def plot(self):
        """
        plot visualization of data
        """
        self.ren.RemoveAllViewProps()
        # self.marker_widget.EnabledOff()
        active_scalar = self.data.grid[self.current_timestep].GetPointData().GetScalars()
        # print 'active scalar is', active_scalar.GetName()

        line = vtk.vtkLineSource()
        line.SetResolution(30)
        line.SetPoint1(self.line_points[0])
        line.SetPoint2(self.line_points[1])
        probe = vtk.vtkProbeFilter()
        probe.SetInputConnection(line.GetOutputPort())
        probe.SetSourceData(self.data.grid[self.current_timestep])

        tuber = vtk.vtkTubeFilter()
        tuber.SetInputConnection(probe.GetOutputPort())
        tuber.SetRadius(0.02)
        line_mapper = vtk.vtkPolyDataMapper()
        line_mapper.SetInputConnection(tuber.GetOutputPort())
        line_actor = vtk.vtkActor()
        line_actor.SetMapper(line_mapper)
        # self.ren.AddActor(line_actor)

        xyplot = vtk.vtkXYPlotActor()
        if vtk.VTK_MAJOR_VERSION <= 5:
            xyplot.AddInput(probe.GetOutput())
        else:
            xyplot.AddDataSetInputConnection(probe.GetOutputPort())
        xyplot.GetPositionCoordinate().SetValue(0.05, 0.05, 0.0)
        xyplot.GetPosition2Coordinate().SetValue(0.9, 0.9, 0.0) #relative to Position
        xyplot.SetXValuesToArcLength()
        xyplot.SetNumberOfXLabels(6)
        xyplot.SetNumberOfYLabels(6)
        xyplot.SetTitle("title")
        xyplot.SetXTitle("length")
        xyplot.SetYTitle("var")
        # xyplot.SetXRange(.1, .35)
        # xyplot.SetYRange(.2, .4)
        # xyplot.GetProperty().SetColor(0, 0, 0)
        xyplot.GetProperty().SetLineWidth(2)
        self.ren.AddActor2D(xyplot)
        # self.xyplotWidget = vtk.vtkXYPlotWidget()
        # self.xyplotWidget.SetXYPlotActor(xyplot)
        # self.xyplotWidget.SetInteractor(self.iren)
        # self.xyplotWidget.EnabledOn()

        self.ren_win.Render()
开发者ID:capitalaslash,项目名称:radcal-gui,代码行数:50,代码来源:vtkgui.py


示例19: initialize

 def initialize (self):
     debug ("In StructuredPointsProbe::__init__ ()")
     self.spacing_var = Tkinter.StringVar()
     self.dimension_var = Tkinter.StringVar()
     self.conv_scalar_var = Tkinter.IntVar()
     self.conv_scalar_var.set(1)
     self.p_data = vtk.vtkStructuredPoints()
     self.p_data_gui = None        
     self.init_p_data()
     self.fil = vtk.vtkProbeFilter ()
     self.fil.SetSource (self.prev_fil.GetOutput ())
     self.fil.SetInput(self.p_data)
     self.fil.Update ()
     self.set_scaled_scalars()
     self.pipe_objs = self.fil
开发者ID:sldion,项目名称:DNACC,代码行数:15,代码来源:StructuredPointsProbe.py


示例20: pick_world

    def pick_world (self, event=None):
        """ Picks a world point and probes for data there."""
        debug ("In Picker::pick_world ()")
        h = self.renwin.tkwidget.winfo_height() - 1 
        self.worldpicker.Pick( (float(event.x), float(h-event.y), \
                                float(0)), self.renwin.get_renderer())

        # use the cell picker to get the data that needs to be probed.
        self.cellpicker.Pick( (float(event.x), float(h-event.y), \
                                float(0)), self.renwin.get_renderer())

        wp = self.worldpicker
        cp = self.cellpicker
        coord = wp.GetPickPosition()
        self.probe_point.SetPoint(0, coord)

        if (cp.GetMapper()):
            self.write_pick ("Picked generic point.")            
            data = get_last_input(cp.GetMapper().GetInput())
            # I need to create the probe each time because otherwise
            # it does not seem to work properly.            
            probe = vtk.vtkProbeFilter()
            probe.SetSource(data)
            probe.SetInput(self.probe_data)
            probe.Update()
            out = probe.GetOutput().GetPointData()
            prn = format(coord, out, 0)
            self.write_pick(prn)

            bounds = cp.GetMapper().GetInput().GetBounds()

            dx = 0.3*(bounds[1]-bounds[0])
            dy = 0.3*(bounds[3]-bounds[2])
            dz = 0.3*(bounds[5]-bounds[4])

            scale = max(dx, dy, dz)

            self.p_source.SetOrigin (coord)
            self.p_source.SetScaleFactor (scale)

            self.p_actor.VisibilityOn()
        else:
            self.write_pick ("No valid data near picked point.")
            self.p_actor.VisibilityOff()

        self.renwin.Render()
        self.write_pick("\n")
开发者ID:sldion,项目名称:DNACC,代码行数:47,代码来源:Picker.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python vtk.vtkProperty函数代码示例发布时间:2022-05-26
下一篇:
Python vtk.vtkPolygon函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap