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


Python Testing.main方法代码示例

本文整理汇总了Python中vtk.test.Testing.main方法的典型用法代码示例。如果您正苦于以下问题:Python Testing.main方法的具体用法?Python Testing.main怎么用?Python Testing.main使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vtk.test.Testing的用法示例。


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

示例1: onError

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
        be set to the string 'string0'.
        """
        self.onErrorCalldata = ""

        @vtk.calldata_type("string0")
        def onError(caller, event, calldata):
            self.onErrorCalldata = calldata

        lt = vtk.vtkLookupTable()
        lt.AddObserver(vtk.vtkCommand.ErrorEvent, onError)
        lt.SetTableRange(2, 1)
        self.assertTrue(self.onErrorCalldata.startswith("ERROR: In"))

    def testUseCallDataTypeWithDecorator(self):
        """Test adding an observer associated with a callback expecting a CallData
        """
        self.onErrorCalldata = ""

        @vtk.calldata_type(vtk.VTK_STRING)
        def onError(caller, event, calldata):
            self.onErrorCalldata = calldata

        lt = vtk.vtkLookupTable()
        lt.AddObserver(vtk.vtkCommand.ErrorEvent, onError)
        lt.SetTableRange(2, 1)
        self.assertTrue(self.onErrorCalldata.startswith("ERROR: In"))


if __name__ == "__main__":
    Testing.main([(TestCommand, "test")])
开发者ID:hepburnfans,项目名称:VTK,代码行数:32,代码来源:TestCommand.py

示例2:

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
    mapper.ScalarVisibilityOff()
    head = vtk.vtkActor()
    head.SetMapper(mapper)
    head.GetProperty().SetColor(1,0.7,0.6)
    # Create the RenderWindow, Renderer and Interactor
    #
    ren1 = vtk.vtkRenderer()
    renWin = vtk.vtkRenderWindow()
    renWin.AddRenderer(ren1)
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetRenderWindow(renWin)
    # Add the actors to the renderer, set the background and size
    #
    ren1.AddActor(head)
    ren1.SetBackground(1,1,1)
    renWin.SetSize(400,400)
    ren1.SetBackground(0.5,0.5,0.6)
    ren1.GetActiveCamera().SetPosition(99.8847,537.926,15)
    ren1.GetActiveCamera().SetFocalPoint(99.8847,109.81,15)
    ren1.GetActiveCamera().SetViewAngle(20)
    ren1.GetActiveCamera().SetViewUp(0,0,-1)
    ren1.ResetCameraClippingRange()
    # render the image
    #
    renWin.Render()
    # prevent the tk window from showing up then start the event loop
    # --- end of script --

if __name__ == "__main__":
  Testing.main([(TestSynchronizedTemplates3D, 'test')])
开发者ID:0004c,项目名称:VTK,代码行数:32,代码来源:TestSynchronizedTemplates3D.py

示例3: testArgumentConversion

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
        self.assertEqual((v[0], v[1], v[2]), (3, 4, 5))
        v = vtk.vtkVector3d(6)
        self.assertEqual((v[0], v[1], v[2]), (6, 6, 6))
        # resolve by argument type
        v = vtk.vtkVariant(3.0)
        self.assertEqual(v.GetType(), vtk.VTK_DOUBLE)
        v = vtk.vtkVariant(1)
        self.assertEqual(v.GetType(), vtk.VTK_INT)
        v = vtk.vtkVariant("hello")
        self.assertEqual(v.GetType(), vtk.VTK_STRING)
        v = vtk.vtkVariant(vtk.vtkObject())
        self.assertEqual(v.GetType(), vtk.VTK_OBJECT)

    def testArgumentConversion(self):
        """Test argument conversion via implicit constructors"""
        # automatic conversion to vtkVariant
        a = vtk.vtkVariantArray()
        a.InsertNextValue(2.5)
        a.InsertNextValue(vtk.vtkObject())
        self.assertEqual(a.GetValue(0), vtk.vtkVariant(2.5))
        self.assertEqual(a.GetValue(1).GetType(), vtk.VTK_OBJECT)
        # same, but this one is via "const vtkVariant&" argument
        a = vtk.vtkDenseArray[float]()
        a.Resize(1)
        a.SetVariantValue(0, 2.5)
        self.assertEqual(a.GetVariantValue(0).ToDouble(), 2.5)


if __name__ == "__main__":
    Testing.main([(TestOverloads, 'test')])
开发者ID:ALouis38,项目名称:VTK,代码行数:32,代码来源:TestOverloads.py

示例4:

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
        renWin.SetSize(600, 600)
        ren.SetBackground(0.1, 0.1, 0.2)

        current_widget = planeWidgetZ
        mode_widget = planeWidgetZ

        # Set the interactor for the widgets
        iact = vtk.vtkRenderWindowInteractor()
        iact.SetRenderWindow(renWin)
        planeWidgetX.SetInteractor(iact)
        planeWidgetX.On()
        planeWidgetY.SetInteractor(iact)
        planeWidgetY.On()
        planeWidgetZ.SetInteractor(iact)
        planeWidgetZ.On()

        # Create an initial interesting view
        ren.ResetCamera()
        cam1 = ren.GetActiveCamera()
        cam1.Elevation(110)
        cam1.SetViewUp(0, 0, -1)
        cam1.Azimuth(45)
        ren.ResetCameraClippingRange()

        iact.Initialize()
        renWin.Render()


if __name__ == "__main__":
    Testing.main([(TestMapperLUT, "test")])
开发者ID:RCBiczok,项目名称:VTK,代码行数:32,代码来源:TestMapperLUT.py

示例5: range

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
        grad.Update()

        vals = (10, 0, 0)

        for i in range(3):
            r = grad.GetOutput().GetPointData().GetArray("Gradients").GetRange(i)

            self.assertTrue(abs(r[0] - vals[i]) < 1E-4)
            self.assertTrue(abs(r[1] - vals[i]) < 1E-4)

        elev.SetLowPoint(0.05, -0.05, 0)
        elev.SetHighPoint(0.05, 0.05, 0)
        grad.Update()

        vals = (0, 10, 0)

        for i in range(3):
            r = grad.GetOutput().GetPointData().GetArray("Gradients").GetRange(i)

            self.assertTrue(abs(r[0] - vals[i]) < 1E-4)
            self.assertTrue(abs(r[1] - vals[i]) < 1E-4)

    def testQuadraticQuad(self):
        self._test("/Data/Disc_QuadraticQuads_0_0.vtu")

    def testBiQuadraticQuad(self):
        self._test("/Data/Disc_BiQuadraticQuads_0_0.vtu")

if __name__ == "__main__":
    Testing.main([(TestCommand, 'test')])
开发者ID:0004c,项目名称:VTK,代码行数:32,代码来源:quadraticQuadDeriv.py

示例6: testBitArrayArguments

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
    def testBitArrayArguments(self):
        a = vtk.vtkBitArray()
        a.SetNumberOfComponents(2)
        a.SetNumberOfTuples(1)
        ti = [0,1]
        to = [0,0]
        a.SetTuple(0, ti)
        a.GetTuple(0, to);
        self.assertEqual(ti, [int(x) for x in to])

    def testNDimArrayArguments(self):
        a = [[0,0,0],[0,0,0],[0,0,0]]
        vtk.vtkMath.Identity3x3(a)
        x = [0.5, 0.2, 0.1]
        y = [0.0, 0.0, 0.0]
        vtk.vtkMath.Multiply3x3(a, x, y)
        self.assertEqual(x, y)

    def testInformationVectorKeys(self):
        a = vtk.vtkImageGridSource()
        spacing = (3.0, 2.0, 1.0)
        a.SetDataSpacing(spacing)
        a.UpdateInformation()
        info = a.GetOutputInformation(0)
        t = info.Get(vtk.vtkDataObject.SPACING())
        self.assertEqual(t, spacing)

if __name__ == "__main__":
    Testing.main([(TestArrayArguments, 'test')])
开发者ID:EricAlex,项目名称:ThirdParty-dev,代码行数:31,代码来源:TestArrayArguments.py

示例7:

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
        iact = vtk.vtkRenderWindowInteractor()
        iact.SetRenderWindow(renWin)
        planeWidgetX.SetInteractor(iact)
        planeWidgetX.On()
        planeWidgetY.SetInteractor(iact)
        planeWidgetY.On()
        planeWidgetZ.SetInteractor(iact)
        planeWidgetZ.On()

        # Create an initial interesting view
        ren.ResetCamera();
        cam1 = ren.GetActiveCamera()
        cam1.Elevation(110)
        cam1.SetViewUp(0, 0, -1)
        cam1.Azimuth(45)
        ren.ResetCameraClippingRange()

        iact.Initialize()
        renWin.Render()

        # Compare the images and test.
        img_file = "TestImagePlaneWidget.png"
        Testing.compareImage(renWin, Testing.getAbsImagePath(img_file))
        # Interact if necessary.
        if Testing.isInteractive():
            iact.Start()

if __name__ == "__main__":
    Testing.main([(TestMapperLUT, 'test')])

开发者ID:AndreasFetzer,项目名称:VTK,代码行数:31,代码来源:TestMapperLUT.py

示例8: parseArgs

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
    else:
        print "Testing CPU indirect render path"

    src = vtk.vtkSphereSource()

    d2p = vtk.vtkDataSetToPiston()
    d2p.SetInputConnection(src.GetOutputPort())

    mapper = vtk.vtkPistonMapper()
    mapper.SetInputConnection(d2p.GetOutputPort())
    mapper.Update() #TODO: shouldn't need this

    actor = vtk.vtkActor()
    actor.SetMapper(mapper)

    renderer.AddActor(actor)

    renderer.ResetCamera()
    renwin.Render()

    img_file = "TestRendering.png"
    Testing.compareImage(renwin, Testing.getAbsImagePath(img_file))

    if Testing.isInteractive():
        iren.Start()

if __name__ == "__main__":
    global args
    args = parseArgs()
    Testing.main([(TestRendering, 'test')])
开发者ID:gaoyi,项目名称:VTK,代码行数:32,代码来源:TestRendering.py

示例9: range

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
    km.SetColumnStatus( 'y', 1 )
    km.RequestSelectedColumns()
    km.SetLearnOption( 1 )
    km.SetDeriveOption( 1 )
    km.SetAssessOption( 1 )
    km.Update()
    av = km.GetOutput( 0 )
    # We should always converge to a cluster center at [ 1.4, 2.8 ]
    # These distances are the distances of each input observation to that cluster center:
    dists = [ 3.1304951684997055, 2.8284271247461898, 2.2803508501982757, 1.8439088914585773, 9.879271228182775 ]
    for i in range(5):
      self.failUnlessAlmostEqual( dists[i], av.GetColumn( 2 ).GetValue( i ) )

  def testParse(self):
    "Test if vtkKMeansDistanceFunctorCalculator is parseable"
    tg = vtk.vtkKMeansDistanceFunctorCalculator()
    self._testParse(tg)

  def testGetSet(self):
    "Testing Get/Set methods of vtkKMeansDistanceFunctorCalculator"
    tg = vtk.vtkKMeansDistanceFunctorCalculator()
    self._testGetSet(tg)

  def testParse(self):
    "Testing Boolean methods of vtkKMeansDistanceFunctorCalculator"
    tg = vtk.vtkKMeansDistanceFunctorCalculator()
    self._testBoolean(tg)

if __name__ == "__main__":
    Testing.main([(kMeansDistanceCalculator, 'test')])
开发者ID:Armand0s,项目名称:homemade_vtk,代码行数:32,代码来源:kMeansDistanceCalculator.py

示例10: testNonLinearHidden

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
        ghosts.SetValue(4, duplicate)
        ghosts.SetValue(5, duplicate)
        ghosts.SetValue(6, duplicate)
        ghosts.SetValue(7, 0)
        ghosts.SetValue(8, 0)
        ghosts.SetValue(9, 0)

        self.doNonLinear(ghosts, 48)

    def testNonLinearHidden(self):
        hidden = vtk.vtkDataSetAttributes.HIDDENPOINT

        ghosts = vtk.vtkUnsignedCharArray()
        ghosts.SetName(vtk.vtkDataSetAttributes.GhostArrayName())
        ghosts.SetNumberOfTuples(10)
        ghosts.SetValue(0, hidden)
        ghosts.SetValue(1, hidden)
        ghosts.SetValue(2, hidden)
        ghosts.SetValue(3, 0)
        ghosts.SetValue(4, hidden)
        ghosts.SetValue(5, hidden)
        ghosts.SetValue(6, hidden)
        ghosts.SetValue(7, 0)
        ghosts.SetValue(8, 0)
        ghosts.SetValue(9, 0)

        self.doNonLinear(ghosts, 0)

if __name__ == "__main__":
    Testing.main([(TestGhostPoints, 'test')])
开发者ID:ElsevierSoftwareX,项目名称:SOFTX-D-15-00004,代码行数:32,代码来源:TestGhostPoints.py

示例11: testArray

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
            elif t in ['vtkVariant', vtk.vtkVariant]:
                value = vtk.vtkVariant("world")
                a.SetValue(i, value)
                result = a.GetValue(i)
                self.assertEqual(value, result)
            else:
                value = 12
                a.SetValue(i, value)
                result = a.GetValue(i)
                self.assertEqual(value, result)

    def testArray(self):
        """Test array CreateArray"""
        o = vtk.vtkArray.CreateArray(vtk.vtkArray.DENSE, vtk.VTK_DOUBLE)
        self.assertEqual(o.__class__, vtk.vtkDenseArray[float])

    def testVector(self):
        """Test vector templates"""
        # make sure Rect inherits operators
        r = vtk.vtkRectf(0, 0, 2, 2)
        self.assertEqual(r[2], 2.0)
        c = vtk.vtkColor4ub(0, 0, 0)
        self.assertEqual(list(c), [0, 0, 0, 255])
        e = vtk.vtkVector['float32', 3]([0.0, 1.0, 2.0])
        self.assertEqual(list(e), [0.0, 1.0, 2.0])
        i = vtk.vtkVector3['i'](0)
        self.assertEqual(list(i), [0, 0, 0])

if __name__ == "__main__":
    Testing.main([(TestTemplates, 'test')])
开发者ID:0004c,项目名称:VTK,代码行数:32,代码来源:TestTemplates.py

示例12: PartitionCollectionAwareFilter

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
            info = countArray.GetInformation()
            self.assertEqual(countArray.GetValue(0), i);
            self.assertEqual(info.Get(dm.vtkDataObject.DATA_TYPE_NAME()), "vtkPartitionedDataSet")

        # PartitionCollectionAwareFilter
        pcf = PartitionCollectionAwareFilter()
        pcf.SetInputDataObject(c)
        pcf.Update()
        self.assertEqual(pcf.GetOutputDataObject(0).GetNumberOfPartitionedDataSets(), 0)
        pdsc = pcf.GetOutputDataObject(0)
        self.assertEqual(pdsc.GetClassName(), "vtkPartitionedDataSetCollection")
        countArray = pdsc.GetFieldData().GetArray("counter")
        info = countArray.GetInformation()
        self.assertEqual(countArray.GetValue(0), 0);
        self.assertEqual(info.Get(dm.vtkDataObject.DATA_TYPE_NAME()), "vtkPartitionedDataSetCollection")

        # CompositeAwareFilter
        cf = CompositeAwareFilter()
        cf.SetInputDataObject(c)
        cf.Update()
        self.assertEqual(pcf.GetOutputDataObject(0).GetNumberOfPartitionedDataSets(), 0)
        pdsc = pcf.GetOutputDataObject(0)
        self.assertEqual(pdsc.GetClassName(), "vtkPartitionedDataSetCollection")
        countArray = pdsc.GetFieldData().GetArray("counter")
        info = countArray.GetInformation()
        self.assertEqual(countArray.GetValue(0), 0);
        self.assertEqual(info.Get(dm.vtkDataObject.DATA_TYPE_NAME()), "vtkPartitionedDataSetCollection")

if __name__ == "__main__":
    Testing.main([(TestPartitionedData, 'test')])
开发者ID:Kitware,项目名称:VTK,代码行数:32,代码来源:TestPartitionedData.py

示例13: testDefaultPointer

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
        """Test an array arg with default value of 0."""
        image = vtk.vtkImageData()
        image.SetExtent(0,9,0,9,0,9)
        image.AllocateScalars(vtk.VTK_UNSIGNED_CHAR, 1)
        ipi = vtk.vtkImagePointIterator()
        # call this method with the parameter set
        ipi.Initialize(image, (0,9,0,9,0,9))
        # call this method without extent parameter
        ipi.Initialize(image)
        # do another method for good measure
        source = vtk.vtkImageGridSource()
        source.SetDataExtent((0,99,0,99,0,0))
        # set the parameter
        source.UpdateExtent((0,50,0,50,0,0))
        # use default parameter value
        source.UpdateExtent()

    def testDefaultPointer(self):
        """Test a POD pointer arg with default value of 0."""
        a = vtk.vtkIntArray()
        a.SetNumberOfComponents(3)
        # pass an int pointer arg, expect something back
        inc = [0]
        vtk.vtkImagePointDataIterator.GetVoidPointer(a, 0, inc)
        self.assertEqual(inc, [3])
        # do not pass the pointer arg, default value 0 is passed
        vtk.vtkImagePointDataIterator.GetVoidPointer(a, 0)

if __name__ == "__main__":
    Testing.main([(TestDefaultArgs, 'test')])
开发者ID:TheInterventionCentre,项目名称:VTK,代码行数:32,代码来源:TestDefaultArgs.py

示例14: hasattr

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
        """
        # defined in vtkGenericEnSightReader.h
        if hasattr(vtk, 'vtkGenericEnsightReader'):
            self.assertEqual(vtk.SINGLE_PROCESS_MODE, 0)
            self.assertEqual(vtk.SPARSE_MODE, 1)
            self.assertEqual(type(vtk.SINGLE_PROCESS_MODE),
                             vtk.EnsightReaderCellIdMode)
            self.assertEqual(type(vtk.SPARSE_MODE),
                             vtk.EnsightReaderCellIdMode)

    def testClassNamespaceEnum(self):
        """Check that an enum in a class namespace was wrapped.
        """
        # defined in vtkColorSeries.h
        self.assertEqual(vtk.vtkColorSeries.SPECTRUM, 0)
        self.assertEqual(type(vtk.vtkColorSeries.SPECTRUM),
                         vtk.vtkColorSeries.ColorSchemes)
        # defined in vtkErrorCode.h
        self.assertEqual(vtk.vtkErrorCode.FirstVTKErrorCode, 20000)
        self.assertEqual(type(vtk.vtkErrorCode.FirstVTKErrorCode),
                         vtk.vtkErrorCode.ErrorIds)

    def testAnonymousEnum(self):
        """Check that anonymous enums are wrapped.
        """
        # defined in vtkAbstractArray.h
        self.assertEqual(vtk.vtkAbstractArray.AbstractArray, 0)

if __name__ == "__main__":
    Testing.main([(TestEnum, 'test')])
开发者ID:ALouis38,项目名称:VTK,代码行数:32,代码来源:TestEnums.py

示例15: testFilter

# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import main [as 别名]
            w.GetOutput().GetPointData().GetScalars().GetRange())
        vtkSDDP = vtk.vtkStreamingDemandDrivenPipeline
        self.assertEqual(ex.GetOutputInformation(0).Get(vtkSDDP.WHOLE_EXTENT()),\
            w.GetOutputInformation(0).Get(vtkSDDP.WHOLE_EXTENT()))

    def testFilter(self):
        class MyAlgorithm(vta.VTKAlgorithm):
            def RequestData(self, vtkself, request, inInfo, outInfo):
                inp = self.GetInputData(inInfo, 0, 0)
                out = self.GetOutputData(outInfo, 0)
                out.ShallowCopy(inp)
                return 1

        sphere = vtk.vtkSphereSource()

        ex = vtk.vtkPythonAlgorithm()
        ex.SetPythonObject(MyAlgorithm())

        ex.SetInputConnection(sphere.GetOutputPort())

        ex.Update()

        output = ex.GetOutputDataObject(0)
        ncells = output.GetNumberOfCells()
        self.assertNotEqual(ncells, 0)
        self.assertEqual(ncells, sphere.GetOutput().GetNumberOfCells())
        self.assertEqual(output.GetBounds(), sphere.GetOutput().GetBounds())

if __name__ == "__main__":
    Testing.main([(TestPythonAlgorithm, 'test')])
开发者ID:AmirKhooj,项目名称:VTK,代码行数:32,代码来源:TestPythonAlgorithm.py


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