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

Python vtk.vtkStreamLine函数代码示例

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

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



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

示例1: create_stream_line

    def create_stream_line(self,y1,y2,y3,n,r=10):

        seeds = vtk.vtkPointSource()
        seeds.SetNumberOfPoints(n)
        seeds.SetCenter(y1, y2, y3)
        seeds.SetRadius(r)
        seeds.SetDistributionToShell()



        integ = vtk.vtkRungeKutta4()
        streamline = vtk.vtkStreamLine()
        streamline.SetInputConnection(self.vec_reader.GetOutputPort())
        streamline.SetSourceConnection(seeds.GetOutputPort())
        streamline.SetMaximumPropagationTime(220)
        streamline.SetIntegrationStepLength(0.05)
        streamline.SetStepLength(0.5)
        streamline.SpeedScalarsOn()
        streamline.SetNumberOfThreads(1)
        streamline.SetIntegrationDirectionToIntegrateBothDirections()

        streamline.SetIntegrator(integ)
        streamline.SetSpeedScalars(220);

        streamlineMapper = vtk.vtkPolyDataMapper()
        streamlineMapper.SetInputConnection(streamline.GetOutputPort())
        streamlineMapper.SetLookupTable(self.arrowColor)


        streamline_actor = vtk.vtkActor()
        streamline_actor.SetMapper(streamlineMapper)
        streamline_actor.VisibilityOn()

        return streamline_actor
开发者ID:svelezsaffon,项目名称:vector_field_visualization_vtk,代码行数:34,代码来源:streamlines.py


示例2: __init__

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


示例3: create_stream_line

    def create_stream_line(self,x,y,z,opa):

        rake = vtk.vtkLineSource()
        rake.SetPoint1(x, -y, z)
        rake.SetPoint2(x, y, z)
        rake.SetResolution(150)

        """
        rake_mapper = vtk.vtkPolyDataMapper()
        rake_mapper.SetInputConnection(rake.GetOutputPort())
        rake_actor = vtk.vtkActor()
        rake_actor.SetMapper(rake_mapper)
        self.ren.AddActor(rake_actor)
        """

        integ = vtk.vtkRungeKutta4()
        streamline = vtk.vtkStreamLine()
        streamline.SetInputConnection(self.vec_reader.GetOutputPort())
        streamline.SetSourceConnection(rake.GetOutputPort())
        streamline.SetIntegrator(integ)
        streamline.SetMaximumPropagationTime(300)
        streamline.SetIntegrationStepLength(0.01)
        streamline.SetIntegrationDirectionToForward()
        streamline.SpeedScalarsOn()
        streamline.SetStepLength(0.05)

        scalarSurface = vtk.vtkRuledSurfaceFilter()
        scalarSurface.SetInputConnection(streamline.GetOutputPort())
        #scalarSurface.SetOffset(0)
        scalarSurface.SetOnRatio(1)
        scalarSurface.PassLinesOn()
        scalarSurface.SetRuledModeToPointWalk()
        scalarSurface.SetDistanceFactor(30)

        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInputConnection(scalarSurface.GetOutputPort())
        #mapper.SetScalarRange(self.vec_reader.GetOutput().GetScalarRange())
        mapper.SetLookupTable(self.arrowColor)

        actor = vtk.vtkActor()
        actor.SetMapper(mapper)
        actor.GetProperty().SetOpacity(opa)

        return actor
开发者ID:svelezsaffon,项目名称:vector_field_visualization_vtk,代码行数:44,代码来源:streamsurfaces.py


示例4: initStreamlines

    def initStreamlines(self):
        print "initializing Streamlines"
        RK4 = vtk.vtkRungeKutta4()
        self.initSeedPoint()

        self.vtkStreamline = vtk.vtkStreamLine()
        self.vtkStreamline.SetInputData(self.vtkStructuredGrid)
        self.vtkStreamline.SetSourceConnection(self.vtkSeeds.GetOutputPort())
        self.vtkStreamline.SetMaximumPropagationTime(500)
        self.vtkStreamline.SetIntegrationStepLength(.2)
        self.vtkStreamline.SetStepLength(0.001)
        self.vtkStreamline.SetNumberOfThreads(1)
        self.vtkStreamline.SetIntegrationDirectionToIntegrateBothDirections()
        self.vtkStreamline.SetIntegrator(RK4)
        self.vtkStreamline.VorticityOn()

        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInputConnection(self.vtkStreamline.GetOutputPort())
        self.vtkFlowActor.SetMapper(mapper)
        self.vtkFlowActor.VisibilityOn()
开发者ID:CreativeCodingLab,项目名称:DarkSkyVis,代码行数:20,代码来源:vtkDarkSkyFlow.py


示例5: create_stream_line

    def create_stream_line(self,y1,y2,y3,n,r=10,tr=2):

        seeds = vtk.vtkPointSource()
        seeds.SetNumberOfPoints(n)
        seeds.SetCenter(y1, y2, y3)
        seeds.SetRadius(r)
        seeds.SetDistributionToShell()


        integ = vtk.vtkRungeKutta4()
        streamline = vtk.vtkStreamLine()
        streamline.SetInputConnection(self.vec_reader.GetOutputPort())
        streamline.SetSourceConnection(seeds.GetOutputPort())
        streamline.SetMaximumPropagationTime(220)
        streamline.SetIntegrationStepLength(0.05)
        streamline.SetStepLength(0.5)
        streamline.SpeedScalarsOn()
        streamline.SetNumberOfThreads(1)
        streamline.SetIntegrationDirectionToIntegrateBothDirections()
        streamline.SetIntegrator(integ)
        streamline.SetSpeedScalars(220);


        streamline_mapper = vtk.vtkPolyDataMapper()
        streamline_mapper.SetInputConnection(streamline.GetOutputPort())


        streamTube = vtk.vtkTubeFilter()
        streamTube.SetInputConnection(streamline.GetOutputPort())
        streamTube.SetRadius(tr)
        streamTube.SetNumberOfSides(12)
        streamTube.SetVaryRadiusToVaryRadiusByVector()
        mapStreamTube = vtk.vtkPolyDataMapper()
        mapStreamTube.SetInputConnection(streamTube.GetOutputPort())
        mapStreamTube.SetLookupTable(self.arrowColor)

        streamTubeActor = vtk.vtkActor()
        streamTubeActor.SetMapper(mapStreamTube)
        streamTubeActor.GetProperty().BackfaceCullingOn()

        return streamTubeActor
开发者ID:svelezsaffon,项目名称:vector_field_visualization_vtk,代码行数:41,代码来源:streamtubes.py


示例6: __init__

    def __init__ (self, mod_m):
        debug ("In PointStreamer::__init__ ()")
        Common.state.busy ()
        Base.Objects.Module.__init__ (self, mod_m)
        self.sphere_src = vtk.vtkSphereSource ()
        self.sphere_map = vtk.vtkPolyDataMapper ()
        self.sphere_act = vtk.vtkActor ()        
        self.seed = SeedManager ()
        self.radius = 1.0
        self.cen = [0.0, 0.0, 0.0]
        self.n_pnt = 50
        self.strmln_mode = 0
        self.color_mode = 1 # 1 is vector, 0 is scalar, -1 is no color
        self.integration_mode = 2 # 2 is Runge-Kutta 2 and 4 is RK 4.

        self.strmln = vtk.vtkStreamLine ()
        self.ribbonf = vtk.vtkRibbonFilter ()
        self.tubef = vtk.vtkTubeFilter ()
        self.mapper = self.stream_map = vtk.vtkPolyDataMapper ()
        self.actor = self.stream_act = vtk.vtkActor ()
        self.done_init = 0
        Common.state.idle ()
开发者ID:sldion,项目名称:DNACC,代码行数:22,代码来源:Streamlines.py


示例7: main

def main(vector_file, magnitude_file):

    num_critical_points = 6
    CriticalPoints = vtk.vtkPoints()

    CriticalPoints.InsertNextPoint(35, 14, 20)
    CriticalPoints.InsertNextPoint(55, 15, 20)
    CriticalPoints.InsertNextPoint(65, 45, 19)
    CriticalPoints.InsertNextPoint(45, 44.8, 20)
    CriticalPoints.InsertNextPoint(20, 29.7, 19.8)
    CriticalPoints.InsertNextPoint(10, 32.2, 16.1)

    ColorRange = vtk.vtkLookupTable()
    ColorRange.SetTableRange(0, 1)
    ColorRange.SetHueRange(0, 1)
    ColorRange.SetSaturationRange(1, 1)
    ColorRange.SetAlphaRange(0.3, 0.5)
    ColorRange.Build()

    reader = vtk.vtkStructuredPointsReader()
    reader.SetFileName(vector_file)
    reader.Update()

    mags = reader.GetOutput()

    range1 = mags.GetScalarRange()
    v0 = range1[0]
    v1 = range1[1]

    reader_magnitude = vtk.vtkStructuredPointsReader()
    reader_magnitude.SetFileName(magnitude_file)
    reader_magnitude.Update()

    # All entities initialized equal to number of critical points
    sphere1, stream1, scalarSurface1, tube1, dataMapper1, dataActor1, criticalMarker1, criticalMapper1, criticalActor1, probe1, mask1, glyph1, glyphMapper1, glyphActor1, plane1 = (
        [],
        [],
        [],
        [],
        [],
        [],
        [],
        [],
        [],
        [],
        [],
        [],
        [],
        [],
        [],
    )
    for i in range(0, num_critical_points):
        sphere1.append(vtk.vtkSphereSource())
        stream1.append(vtk.vtkStreamLine())
        scalarSurface1.append(vtk.vtkRuledSurfaceFilter())
        tube1.append(vtk.vtkTubeFilter())
        dataMapper1.append(vtk.vtkPolyDataMapper())
        dataActor1.append(vtk.vtkActor())

        criticalMarker1.append(vtk.vtkSphereSource())
        criticalMapper1.append(vtk.vtkPolyDataMapper())
        criticalActor1.append(vtk.vtkActor())

        probe1.append(vtk.vtkProbeFilter())
        mask1.append(vtk.vtkMaskPoints())
        glyph1.append(vtk.vtkGlyph3D())
        glyphMapper1.append(vtk.vtkPolyDataMapper())
        glyphActor1.append(vtk.vtkActor())

        plane1.append(vtk.vtkPlaneSource())

    integ = vtk.vtkRungeKutta4()

    cone = vtk.vtkConeSource()
    cone.SetResolution(8)
    cone.SetHeight(1.0)
    cone.SetRadius(0.2)

    transform = vtk.vtkTransform()
    transform.Translate(0, 0, 0)

    transformFilter = vtk.vtkTransformPolyDataFilter()
    transformFilter.SetInput(cone.GetOutput())
    transformFilter.SetTransform(transform)

    outline = vtk.vtkOutlineFilter()
    outline.SetInput(reader.GetOutput())

    outlineMapper = vtk.vtkPolyDataMapper()
    outlineMapper.SetInput(outline.GetOutput())

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

    bar = vtk.vtkScalarBarActor()
    bar.SetLookupTable(ColorRange)

    renderer = vtk.vtkRenderer()

#.........这里部分代码省略.........
开发者ID:arun04ceg,项目名称:Vector-Visualization,代码行数:101,代码来源:Chal_Large1.py


示例8:

isoVzActor.GetProperty().SetColor(0.4,0.5,1)
mf = vtk.vtkMergeFields()
mf.SetInputConnection(sf.GetOutputPort())
mf.SetOutputField("merged","POINT_DATA")
mf.SetNumberOfComponents(3)
mf.Merge(0,"vy",0)
mf.Merge(1,"vz",0)
mf.Merge(2,"vx",0)
#mf.Print()
aa = vtk.vtkAssignAttribute()
aa.SetInputConnection(mf.GetOutputPort())
aa.Assign("merged","SCALARS","POINT_DATA")
aa2 = vtk.vtkAssignAttribute()
aa2.SetInputConnection(aa.GetOutputPort())
aa2.Assign("SCALARS","VECTORS","POINT_DATA")
sl = vtk.vtkStreamLine()
sl.SetInputConnection(aa2.GetOutputPort())
sl.SetStartPosition(2,-2,26)
sl.SetMaximumPropagationTime(40)
sl.SetIntegrationStepLength(0.2)
sl.SetIntegrationDirectionToForward()
sl.SetStepLength(0.001)
rf = vtk.vtkRibbonFilter()
rf.SetInputConnection(sl.GetOutputPort())
rf.SetWidth(1.0)
rf.SetWidthFactor(5)
slMapper = vtk.vtkPolyDataMapper()
slMapper.SetInputConnection(rf.GetOutputPort())
slMapper.ImmediateModeRenderingOn()
slActor = vtk.vtkActor()
slActor.SetMapper(slMapper)
开发者ID:151706061,项目名称:VTK,代码行数:31,代码来源:splitVectors.py


示例9: use

# select the integration order to use (RungeKutta order 4) and
# associate it with the streamer. The start position is the position
# in world space where we want to begin streamline integration; and we
# integrate in both directions. The step length is the length of the
# line segments that make up the streamline (i.e., related to
# display). The IntegrationStepLength specifies the integration step
# length as a fraction of the cell size that the streamline is in.

# Create source for streamtubes
seeds = vtk.vtkPointSource()
seeds.SetRadius(0.15)
seeds.SetCenter(0.1, 2.1, 0.5)
seeds.SetNumberOfPoints(6)

integ = vtk.vtkRungeKutta4()
streamer = vtk.vtkStreamLine()
streamer.SetInputConnection(reader.GetOutputPort())
streamer.SetSource(seeds.GetOutput())
streamer.SetMaximumPropagationTime(500)
streamer.SetStepLength(0.5)
streamer.SetIntegrationStepLength(0.05)
streamer.SetIntegrationDirectionToIntegrateBothDirections()
streamer.SetIntegrator(integ)

# The tube is wrapped around the generated streamline. By varying the
# radius by the inverse of vector magnitude, we are creating a tube
# whose radius is proportional to mass flux (in incompressible flow).
streamTube = vtk.vtkTubeFilter()
streamTube.SetInputConnection(streamer.GetOutputPort())
streamTube.SetRadius(0.02)
streamTube.SetNumberOfSides(12)
开发者ID:Buddington,项目名称:omegalib-evl-apps,代码行数:31,代码来源:OfficeTubes.py


示例10:

# Start by loading some data.
pl3d = vtk.vtkMultiBlockPLOT3DReader()
pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
pl3d.SetScalarFunctionNumber(100)
pl3d.SetVectorFunctionNumber(202)
pl3d.Update()

seeds = vtk.vtkPlaneSource()
seeds.SetXResolution(4)
seeds.SetYResolution(4)
seeds.SetOrigin(2,-2,26)
seeds.SetPoint1(2, 2,26)
seeds.SetPoint2(2,-2,32)

streamline = vtk.vtkStreamLine()
streamline.SetInputData(pl3d.GetOutput().GetBlock(0))
streamline.SetSourceConnection(seeds.GetOutputPort())
streamline.SetMaximumPropagationTime(200)
streamline.SetIntegrationStepLength(.2)
streamline.SetStepLength(0.001)
streamline.SetNumberOfThreads(1)
streamline.SetIntegrationDirectionToForward()
streamline.VorticityOn()

streamline_mapper = vtk.vtkPolyDataMapper()
streamline_mapper.SetInputConnection(streamline.GetOutputPort())
streamline_actor = vtk.vtkActor()
streamline_actor.SetMapper(streamline_mapper)
streamline_actor.VisibilityOn()
开发者ID:CreativeCodingLab,项目名称:DarkSkyVis,代码行数:30,代码来源:StreamlinesVTK.py


示例11:


#	Calculating starting point of particles
dims = reader.GetOutput().GetExtent()
cy = (dims[3] - dims[2]) / 4.0
cz = (dims[5] - dims[4]) / 2.0


#	Creation of patricle source 1
particle_source = vtk.vtkPointSource()
particle_source.SetCenter(0, cy, cz)
particle_source.SetRadius(radius)
particle_source.SetNumberOfPoints(num_points)

#	Add streamlines from pointsource
stream_lines = vtk.vtkStreamLine()
stream_lines.SetInputConnection(reader.GetOutputPort())
stream_lines.SetSourceConnection(particle_source.GetOutputPort())
stream_lines.SetStepLength(step_len)
stream_lines.SetMaximumPropagationTime(prop_time)
stream_lines.SetTerminalSpeed(0.05)
stream_lines.SetIntegrationDirectionToForward()

#	Add tube around streamlines
tube_filter = vtk.vtkTubeFilter()
tube_filter.SetInputConnection(stream_lines.GetOutputPort())
tube_filter.SetVaryRadiusToVaryRadiusByVector()
tube_filter.CappingOn()
tube_filter.SetNumberOfSides(10)

#	Map data, set coloring through scalar off
开发者ID:louissmit,项目名称:SVVR,代码行数:29,代码来源:exercise3.py


示例12: main

def main(vector_file, magnitude_file):

    ColorRange = vtk.vtkLookupTable()
    ColorRange.SetTableRange(0, 1)
    ColorRange.SetHueRange(0, 1)
    ColorRange.SetSaturationRange(1, 1)
    ColorRange.SetAlphaRange(0.3, 0.5)
    ColorRange.Build()

    reader = vtk.vtkStructuredPointsReader()
    reader.SetFileName(vector_file)
    reader.Update()

    data = reader.GetOutput()

    range1 = data.GetScalarRange()
    v0 = range1[0]
    v1 = range1[1]

    reader_magnitude = vtk.vtkStructuredPointsReader()
    reader_magnitude.SetFileName(magnitude_file)
    reader_magnitude.Update()

    contour = vtk.vtkContourFilter()
    contour.SetInput(reader_magnitude.GetOutput())
    contour.SetValue(0, 1)

    normals = vtk.vtkPolyDataNormals()
    normals.SetInput(contour.GetOutput())
    normals.SetFeatureAngle(60)
    normals.ConsistencyOff()
    normals.SplittingOff()

    mapper_magnitude = vtk.vtkPolyDataMapper()
    mapper_magnitude.SetInput(normals.GetOutput())
    mapper_magnitude.SetLookupTable(ColorRange)
    mapper_magnitude.SetColorModeToMapScalars()
    mapper_magnitude.SetScalarRange(v0, v1)

    actor_magnitude = vtk.vtkActor()
    actor_magnitude.SetMapper(mapper_magnitude)

    sphere = vtk.vtkSphereSource()
    sphere.SetRadius(2)
    sphere.SetCenter(15, 15, 15)  # Critical point for all 3 test datasets
    sphere.SetThetaResolution(10)

    integrator = vtk.vtkRungeKutta4()

    stream = vtk.vtkStreamLine()
    stream.SetInput(reader.GetOutput())
    stream.SetSource(sphere.GetOutput())
    stream.SetIntegrator(integrator)
    stream.SetMaximumPropagationTime(500)
    stream.SetIntegrationStepLength(0.1)
    stream.SetIntegrationDirectionToIntegrateBothDirections()
    stream.SetStepLength(0.1)

    scalarSurface = vtk.vtkRuledSurfaceFilter()
    scalarSurface.SetInput(stream.GetOutput())
    scalarSurface.SetOffset(0)
    scalarSurface.SetOnRatio(2)
    scalarSurface.PassLinesOn()
    scalarSurface.SetRuledModeToPointWalk()
    scalarSurface.SetDistanceFactor(50)

    tube = vtk.vtkTubeFilter()
    tube.SetInput(scalarSurface.GetOutput())
    tube.SetRadius(0.1)
    tube.SetNumberOfSides(6)

    dataMapper = vtk.vtkPolyDataMapper()
    dataMapper.SetInput(tube.GetOutput())
    dataMapper.SetScalarRange(v0, v1)
    dataMapper.SetLookupTable(ColorRange)

    dataActor = vtk.vtkActor()
    dataActor.SetMapper(dataMapper)

    probe = vtk.vtkProbeFilter()
    probe.SetInput(stream.GetOutput())
    probe.SetSource(reader.GetOutput())

    mask = vtk.vtkMaskPoints()
    mask.SetInput(probe.GetOutput())
    mask.SetOnRatio(60)
    mask.RandomModeOn()

    cone = vtk.vtkConeSource()
    cone.SetResolution(8)
    cone.SetHeight(1.0)
    cone.SetRadius(0.2)

    transform = vtk.vtkTransform()
    transform.Translate(0, 0, 0)

    transformFilter = vtk.vtkTransformPolyDataFilter()
    transformFilter.SetInput(cone.GetOutput())
    transformFilter.SetTransform(transform)

#.........这里部分代码省略.........
开发者ID:arun04ceg,项目名称:Vector-Visualization,代码行数:101,代码来源:Test.py


示例13:

ctf = vtk.vtkLookupTable()
ctf.SetHueRange(0.667, 0.0)
ctf.SetValueRange(1.0, 1.0)
ctf.SetSaturationRange(1.0, 1.0)
ctf.SetTableRange(a,b)

# A plane for the seeds
plane = vtk.vtkPlaneSource()
plane.SetOrigin(xmi,math.ceil(ymi),zmi)
plane.SetPoint1(xma,math.ceil(ymi),zmi)
plane.SetPoint2(xmi,math.ceil(ymi),zma)
plane.SetXResolution(6)
plane.SetYResolution(6)

# Streamlines
stream = vtk.vtkStreamLine()
stream.SetSource(plane.GetOutput())
stream.SetInput(reader.GetOutput())
stream.SetIntegrationDirectionToForward()
stream.SetIntegrator(vtk.vtkRungeKutta4())
stream.SetStepLength(0.1)

streamMapper = vtk.vtkPolyDataMapper()
streamMapper.SetLookupTable(ctf)
streamMapper.SetInput(stream.GetOutput())
streamMapper.SetScalarRange(a,b)
streamActor = vtk.vtkActor()
streamActor.SetMapper(streamMapper)
streamActor.GetProperty().SetLineWidth(3.0)

#Colour Bar
开发者ID:IMagicianI,项目名称:ComputationalScience,代码行数:31,代码来源:wind.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python vtk.vtkStringArray函数代码示例发布时间:2022-05-26
下一篇:
Python vtk.vtkSphereSource函数代码示例发布时间: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