本文整理汇总了Python中vtk.vtkTimerLog函数的典型用法代码示例。如果您正苦于以下问题:Python vtkTimerLog函数的具体用法?Python vtkTimerLog怎么用?Python vtkTimerLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkTimerLog函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main(cases):
""" Pass a list of tuples containing test classes and the starting
string of the functions used for testing.
Example:
main ([(vtkTestClass, 'test'), (vtkTestClass1, 'test')])
"""
processCmdLine()
timer = vtk.vtkTimerLog()
s_time = timer.GetCPUTime()
s_wall_time = time.time()
# run the tests
result = test(cases)
tot_time = timer.GetCPUTime() - s_time
tot_wall_time = float(time.time() - s_wall_time)
# output measurements for Dart
print "<DartMeasurement name=\"WallTime\" type=\"numeric/double\">",
print " %f </DartMeasurement>"%tot_wall_time
print "<DartMeasurement name=\"CPUTime\" type=\"numeric/double\">",
print " %f </DartMeasurement>"%tot_time
# Delete these to eliminate debug leaks warnings.
del cases, timer
if result.wasSuccessful():
sys.exit(0)
else:
sys.exit(1)
示例2: showPointCloud
def showPointCloud(modelNodeID):
model = slicer.mrmlScene.GetNodeByID(modelNodeID)
polydata = model.GetPolyData()
# Reuse the locator
locator = vtk.vtkStaticPointLocator()
locator.SetDataSet(polydata)
locator.BuildLocator()
# Remove isolated points
removal = vtk.vtkRadiusOutlierRemoval()
removal.SetInputData(polydata)
removal.SetLocator(locator)
removal.SetRadius(10)
removal.SetNumberOfNeighbors(2)
removal.GenerateOutliersOn()
# Time execution
timer = vtk.vtkTimerLog()
timer.StartTimer()
removal.Update()
timer.StopTimer()
time = timer.GetElapsedTime()
print("Time to remove points: {0}".format(time))
print(" Number removed: {0}".format(removal.GetNumberOfPointsRemoved()),
" (out of: {}".format(polydata.GetNumberOfPoints()))
# First output are the non-outliers
remMapper = vtk.vtkPointGaussianMapper()
remMapper.SetInputConnection(removal.GetOutputPort())
remMapper.EmissiveOff()
remMapper.SetScaleFactor(0.0)
remActor = vtk.vtkActor()
remActor.SetMapper(remMapper)
lm = slicer.app.layoutManager()
tdWidget = lm.threeDWidget(0)
tdView = tdWidget.threeDView()
rWin = tdView.renderWindow()
rCollection = rWin.GetRenderers()
renderer = rCollection.GetItemAsObject(0)
# Add the actors to the renderer, set the background and size
#
renderer.AddActor(remActor)
示例3:
dist = vtk.vtkUnsignedDistance()
dist.SetInputData(polyData)
dist.SetRadius(0.25) #how far out to propagate distance calculation
dist.SetDimensions(res,res,res)
dist.CappingOn()
dist.AdjustBoundsOn()
dist.SetAdjustDistance(0.01)
# Extract the surface with modified flying edges
fe = vtk.vtkFlyingEdges3D()
fe.SetInputConnection(dist.GetOutputPort())
fe.SetValue(0, 0.075)
fe.ComputeNormalsOff()
# Time the execution
timer = vtk.vtkTimerLog()
timer.StartTimer()
fe.Update()
timer.StopTimer()
time = timer.GetElapsedTime()
print("Points processed: {0}".format(NPts))
print(" Time to generate and extract distance function: {0}".format(time))
print(dist)
feMapper = vtk.vtkPolyDataMapper()
feMapper.SetInputConnection(fe.GetOutputPort())
feActor = vtk.vtkActor()
feActor.SetMapper(feMapper)
# Create an outline
示例4: __init__
def __init__(self, renderer):
self._renderer = renderer
self._timerLog = vtkTimerLog()
self._numberOfTrials = 10
示例5: print
closest = vtk.vtkIdList()
closest.SetNumberOfIds(numProbes)
staticClosest = vtk.vtkIdList()
staticClosest.SetNumberOfIds(numProbes)
# Print initial statistics
print("Processing NumPts: {0}".format(numPts))
print("\n")
# Time the creation and building of the incremental point locator
locator = vtk.vtkPointLocator()
locator.SetDataSet(polydata)
locator.SetNumberOfPointsPerBucket(5)
locator.AutomaticOn()
timer = vtk.vtkTimerLog()
timer.StartTimer()
locator.BuildLocator()
timer.StopTimer()
time = timer.GetElapsedTime()
print("Build Point Locator: {0}".format(time))
# Probe the dataset with FindClosestPoint() and time it
timer.StartTimer()
for i in range (0,numProbes):
closest.SetId(i, locator.FindClosestPoint(probePoints.GetPoint(i)))
timer.StopTimer()
opTime = timer.GetElapsedTime()
print(" Closest point probing: {0}".format(opTime))
print(" Divisions: {0}".format( locator.GetDivisions() ))