本文整理汇总了Python中vtk.vtkThreshold函数的典型用法代码示例。如果您正苦于以下问题:Python vtkThreshold函数的具体用法?Python vtkThreshold怎么用?Python vtkThreshold使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkThreshold函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: stripGrid
def stripGrid(vtk_grid):
# Strip out masked points.
if vtk_grid.IsA("vtkStructuredGrid"):
if vtk_grid.GetCellBlanking():
visArray = vtk_grid.GetCellVisibilityArray()
visArray.SetName("BlankingArray")
vtk_grid.GetCellData().AddArray(visArray)
thresh = vtk.vtkThreshold()
thresh.SetInputData(vtk_grid)
thresh.ThresholdByUpper(0.5)
thresh.SetInputArrayToProcess(0, 0, 0,
"vtkDataObject::FIELD_ASSOCIATION_CELLS",
"BlankingArray")
thresh.Update()
vtk_grid = thresh.GetOutput()
elif vtk_grid.GetPointBlanking():
visArray = vtk_grid.GetPointVisibilityArray()
visArray.SetName("BlankingArray")
vtk_grid.GetPointData().AddArray(visArray)
thresh = vtk.vtkThreshold()
thresh.SetInputData(vtk_grid)
thresh.SetUpperThreshold(0.5)
thresh.SetInputArrayToProcess(0, 0, 0,
"vtkDataObject::FIELD_ASSOCIATION_POINTS",
"BlankingArray")
thresh.Update()
vtk_grid = thresh.GetOutput()
return vtk_grid
开发者ID:UNESCO-IHE,项目名称:uvcdat,代码行数:28,代码来源:vcs2vtk.py
示例2: testUnstructured
def testUnstructured(self):
rt = vtk.vtkRTAnalyticSource()
rt.SetWholeExtent(-5, 5, -5, 5, -5, 5)
t = vtk.vtkThreshold()
t.SetInputConnection(rt.GetOutputPort())
t.ThresholdByUpper(-10)
s = vtk.vtkSphere()
s.SetRadius(2)
s.SetCenter(0,0,0)
c = vtk.vtkTableBasedClipDataSet()
c.SetInputConnection(t.GetOutputPort())
c.SetClipFunction(s)
c.SetInsideOut(1)
c.Update()
self.assertEqual(c.GetOutput().GetNumberOfCells(), 64)
eg = vtk.vtkEnSightGoldReader()
eg.SetCaseFileName(VTK_DATA_ROOT + "/Data/EnSight/elements.case")
eg.Update()
pl = vtk.vtkPlane()
pl.SetOrigin(3.5, 3.5, 0.5)
pl.SetNormal(0, 0, 1)
c.SetInputConnection(eg.GetOutputPort())
c.SetClipFunction(pl)
c.SetInsideOut(1)
c.Update()
data = c.GetOutputDataObject(0).GetBlock(0)
self.assertEqual(data.GetNumberOfCells(), 75)
rw = vtk.vtkRenderWindow()
ren = vtk.vtkRenderer()
rw.AddRenderer(ren)
mapper = vtk.vtkDataSetMapper()
mapper.SetInputData(data)
actor = vtk.vtkActor()
actor.SetMapper(mapper)
ren.AddActor(actor)
ac = ren.GetActiveCamera()
ac.SetPosition(-7.9, 9.7, 14.6)
ac.SetFocalPoint(3.5, 3.5, 0.5)
ac.SetViewUp(0.08, 0.93, -0.34)
rw.Render()
ren.ResetCameraClippingRange()
rtTester = vtk.vtkTesting()
for arg in sys.argv[1:]:
rtTester.AddArgument(arg)
rtTester.AddArgument("-V")
rtTester.AddArgument("tableBasedClip.png")
rtTester.SetRenderWindow(rw)
rw.Render()
rtResult = rtTester.RegressionTest(10)
开发者ID:timkrentz,项目名称:SunTracker,代码行数:60,代码来源:tableBasedClip.py
示例3: threshold
def threshold(polydata, arrayname, valuerange=[0, 1], iscelldata=True,
allscalars=True):
"""Extract those cells from polydata whose pointdata/celldata values are
within a specified range.
For pointdata, cells are included if scalar values of all cell points are
within the range (allscalars=True) or if the scalar value of at least one of
the cell points is within the range (allscalar=False).
"""
thresholdfilter = vtk.vtkThreshold()
thresholdfilter.SetInput(polydata)
thresholdfilter.ThresholdBetween(valuerange[0], valuerange[1])
if iscelldata:
thresholdfilter.SetInputArrayToProcess(0, 0, 0,
vtk.vtkDataObject.
FIELD_ASSOCIATION_CELLS, arrayname)
else:
thresholdfilter.SetInputArrayToProcess(0, 0, 0,
vtk.vtkDataObject.
FIELD_ASSOCIATION_POINTS, arrayname)
if allscalars:
thresholdfilter.AllScalarsOn()
else:
thresholdfilter.AllScalarsOff()
thresholdfilter.Update()
surfacefilter = vtk.vtkDataSetSurfaceFilter()
surfacefilter.SetInput(thresholdfilter.GetOutput())
surfacefilter.Update()
return surfacefilter.GetOutput()
开发者ID:ajgeers,项目名称:utils,代码行数:30,代码来源:vtklib.py
示例4: save_lesion
def save_lesion(output_file, input_file, field, limits):
reader = v.vtkXMLUnstructuredGridReader()
reader.SetFileName(input_file)
reader.Update()
threshold = v.vtkThreshold()
threshold.SetInput(reader.GetOutput())
if limits[0] is None:
threshold.ThresholdByLower(limits[1])
elif limits[1] is None:
threshold.ThresholdByUpper(limits[0])
else:
threshold.ThresholdBetween(*limits)
threshold.SetInputArrayToProcess(0, 0, 0, v.vtkDataObject.FIELD_ASSOCIATION_CELLS, field)
threshold.Update()
extract_surface = v.vtkDataSetSurfaceFilter()
extract_surface.SetInput(threshold.GetOutput())
extract_surface.Update()
writer = v.vtkXMLPolyDataWriter()
writer.SetFileName(output_file)
writer.SetInput(extract_surface.GetOutput())
writer.Write()
开发者ID:philtweir,项目名称:glossia-fenics-ire-example,代码行数:26,代码来源:vtk_tools.py
示例5: getThresholdedUGrid
def getThresholdedUGrid(
ugrid,
field_support,
field_name,
threshold_value,
threshold_by_upper_or_lower,
verbose=0):
mypy.my_print(verbose, "*** getThresholdedUGrid ***")
threshold = vtk.vtkThreshold()
if (vtk.vtkVersion.GetVTKMajorVersion() >= 6):
threshold.SetInputData(ugrid)
else:
threshold.SetInput(ugrid)
if (field_support == "points"):
association = vtk.vtkDataObject.FIELD_ASSOCIATION_POINTS
elif (field_support == "cells"):
association = vtk.vtkDataObject.FIELD_ASSOCIATION_CELLS
threshold.SetInputArrayToProcess(0, 0, 0, association, field_name)
if (threshold_by_upper_or_lower == "upper"):
threshold.ThresholdByUpper(threshold_value)
elif (threshold_by_upper_or_lower == "lower"):
threshold.ThresholdByLower(threshold_value)
threshold.Update()
thresholded_ugrid = threshold.GetOutput()
return thresholded_ugrid
开发者ID:mgenet,项目名称:myVTKPythonLibrary,代码行数:28,代码来源:getThresholdedUGrid.py
示例6: __init__
def __init__(self, module_manager):
SimpleVTKClassModuleBase.__init__(
self, module_manager,
vtk.vtkThreshold(), 'Processing.',
('vtkDataSet',), ('vtkUnstructuredGrid',),
replaceDoc=True,
inputFunctions=None, outputFunctions=None)
开发者ID:fvpolpeta,项目名称:devide,代码行数:7,代码来源:vtkThreshold.py
示例7: initialize
def initialize (self):
debug ("In Threshold::initialize ()")
self.fil = vtk.vtkThreshold ()
self.fil.SetInput (self.prev_fil.GetOutput ())
self.data_name = self.mod_m.get_scalar_data_name ()
dr = self.mod_m.get_scalar_data_range ()
self.fil.ThresholdBetween (dr[0], dr[1])
self.fil.Update ()
开发者ID:sldion,项目名称:DNACC,代码行数:8,代码来源:Threshold.py
示例8: CreateSurfaceCells
def CreateSurfaceCells(self,inMesh):
#Remove the surface cells from the mesh
cellDimFilter = vtkvmtkcontrib.vtkvmtkCellDimensionFilter()
cellDimFilter.SetInput(inMesh)
cellDimFilter.ThresholdByUpper(3)
cellDimFilter.Update()
volumetricMesh = cellDimFilter.GetOutput()
#Get new surface cells
geomFilter = vtk.vtkGeometryFilter()
geomFilter.SetInput(cellDimFilter.GetOutput())
geomFilter.Update()
newSurfaceCells = geomFilter.GetOutput()
#If the celEntityIdArray exist, project the original entity ids
cellEntityIdsArray = newSurfaceCells.GetCellData().GetArray(self.CellEntityIdsArrayName)
if (cellEntityIdsArray != None):
#Convert the surface cells to poly data
surfaceCellsToSurface = vmtkscripts.vmtkMeshToSurface()
surfaceCellsToSurface.Mesh = newSurfaceCells
surfaceCellsToSurface.Execute()
#Get the original surface cells
meshThreshold = vtk.vtkThreshold()
meshThreshold.SetInput(self.Mesh)
meshThreshold.ThresholdByUpper(self.WallCellEntityId+0.5)
meshThreshold.SetInputArrayToProcess(0,0,0,1,self.CellEntityIdsArrayName)
meshThreshold.Update()
meshToSurface = vmtkscripts.vmtkMeshToSurface()
meshToSurface.Mesh = meshThreshold.GetOutput()
meshToSurface.Execute()
#Project the entity ids form the old surface cells to the new surface cells
#TODO: This is hackish(need for a tolerance), find a beeter way
projector = vtkvmtkcontrib.vtkvmtkSurfaceProjectCellArray()
projector.SetInput(surfaceCellsToSurface.Surface)
projector.SetReferenceSurface(meshToSurface.Surface)
projector.SetProjectedArrayName(self.CellEntityIdsArrayName)
projector.SetDefaultValue(self.WallCellEntityId)
projector.SetDistanceTolerance(self.Tolerance)
projector.Update()
#Convert the surface cells back to unstructured grid
surfaceToMesh = vmtkscripts.vmtkSurfaceToMesh()
surfaceToMesh.Surface = projector.GetOutput()
surfaceToMesh.Execute()
newSurfaceCells = surfaceToMesh.Mesh
#append the new surface cells to the volumetric elements
appendFilter = vtkvmtk.vtkvmtkAppendFilter()
appendFilter.AddInput(volumetricMesh)
appendFilter.AddInput(newSurfaceCells)
appendFilter.Update()
return appendFilter.GetOutput()
开发者ID:ValentinaRossi,项目名称:vmtk,代码行数:58,代码来源:vmtkmeshclipcenterlines.py
示例9: _plotInternalCustomBoxfill
def _plotInternalCustomBoxfill(self):
"""Implements the logic to render a custom boxfill."""
self._mappers = []
self._customBoxfillArgs = self._prepContours()
tmpLevels = self._customBoxfillArgs["tmpLevels"]
tmpColors = self._customBoxfillArgs["tmpColors"]
tmpOpacities = self._customBoxfillArgs["tmpOpacities"]
style = self._gm.fillareastyle
luts = []
geos = []
wholeDataMin, wholeDataMax = vcs.minmax(self._originalData1)
_colorMap = self.getColorMap()
assert(style != 'solid' or len(tmpLevels) == 1)
for i, l in enumerate(tmpLevels):
# Ok here we are trying to group together levels can be, a join
# will happen if: next set of levels continues where one left off
# AND pattern is identical
# TODO this should really just be a single polydata/mapper/actor:
for j, color in enumerate(tmpColors[i]):
mapper = vtk.vtkPolyDataMapper()
lut = vtk.vtkLookupTable()
th = vtk.vtkThreshold()
th.ThresholdBetween(l[j], l[j + 1])
th.SetInputConnection(self._vtkPolyDataFilter.GetOutputPort())
geoFilter2 = vtk.vtkDataSetSurfaceFilter()
geoFilter2.SetInputConnection(th.GetOutputPort())
# Make the polydata output available here for patterning later
geoFilter2.Update()
geos.append(geoFilter2)
mapper.SetInputConnection(geoFilter2.GetOutputPort())
lut.SetNumberOfTableValues(1)
r, g, b, a = self.getColorIndexOrRGBA(_colorMap, color)
if style == 'solid':
tmpOpacity = tmpOpacities[j]
if tmpOpacity is None:
tmpOpacity = a / 100.
else:
tmpOpacity = tmpOpacities[j] / 100.
lut.SetTableValue(0, r / 100., g / 100., b / 100., tmpOpacity)
else:
lut.SetTableValue(0, 1., 1., 1., 0.)
mapper.SetLookupTable(lut)
mapper.SetScalarRange(l[j], l[j + 1])
luts.append([lut, [l[j], l[j + 1], False]])
# Store the mapper only if it's worth it?
# Need to do it with the whole slab min/max for animation
# purposes
if not (l[j + 1] < wholeDataMin or l[j] > wholeDataMax):
self._mappers.append(mapper)
self._resultDict["vtk_backend_luts"] = luts
if len(geos) > 0:
self._resultDict["vtk_backend_geofilters"] = geos
开发者ID:Xunius,项目名称:uvcdat,代码行数:57,代码来源:boxfillpipeline.py
示例10: ThresholdMesh
def ThresholdMesh(self):
thresholder = vtk.vtkThreshold()
thresholder.SetInputData(self.InitialMesh)
if (self.ThresholdUpper):
thresholder.ThresholdByUpper(self.Threshold)
else:
thresholder.ThresholdByLower(self.Threshold)
thresholder.SetInputArrayToProcess(0,0,0,1,self.ArrayName)
thresholder.Update()
self.Mesh = thresholder.GetOutput()
开发者ID:151706061,项目名称:vmtk,代码行数:10,代码来源:vmtkmeshviewer2.py
示例11: cellthreshold
def cellthreshold(polydata, arrayname, start=0, end=1):
threshold = vtk.vtkThreshold()
threshold.SetInputData(polydata)
threshold.SetInputArrayToProcess(0,0,0,vtk.vtkDataObject.FIELD_ASSOCIATION_CELLS,arrayname)
threshold.ThresholdBetween(start,end)
threshold.Update()
surfer = vtk.vtkDataSetSurfaceFilter()
surfer.SetInputConnection(threshold.GetOutputPort())
surfer.Update()
return surfer.GetOutput()
开发者ID:catactg,项目名称:SUM,代码行数:11,代码来源:basefunctions.py
示例12: makeUnstructVTKVOIThres
def makeUnstructVTKVOIThres(vtkObj,extent,limits):
"""Make volume of interest and threshold for rectilinear grid."""
# Check for the input
cellCore = vtk.vtkExtractUnstructuredGrid()
cellCore.SetExtent(extent)
cellCore.SetInput(vtkObj)
cellThres = vtk.vtkThreshold()
cellThres.AllScalarsOn()
cellThres.SetInputConnection(cellCore.GetOutputPort())
cellThres.ThresholdBetween(limits[0],limits[1])
cellThres.Update()
return cellThres.GetOutput(), cellCore.GetOutput()
开发者ID:simpeg,项目名称:simpegviz,代码行数:13,代码来源:vtkTools.py
示例13: pointthreshold
def pointthreshold(polydata, arrayname, start=0, end=1,alloff=0):
threshold = vtk.vtkThreshold()
threshold.SetInputData(polydata)
threshold.SetInputArrayToProcess(0,0,0,vtk.vtkDataObject.FIELD_ASSOCIATION_POINTS,arrayname)
threshold.ThresholdBetween(start,end)
if (alloff):
threshold.AllScalarsOff()
threshold.Update()
surfer = vtk.vtkDataSetSurfaceFilter()
surfer.SetInputConnection(threshold.GetOutputPort())
surfer.Update()
return surfer.GetOutput()
开发者ID:catactg,项目名称:SUM,代码行数:13,代码来源:basefunctions.py
示例14: thresFilt
def thresFilt(vtkObj,arrName,value,thType='Upper'):
thresFilt = vtk.vtkThreshold()
thresFilt.SetInputData(vtkObj)
if thType in 'Upper':
thresFilt.ThresholdByUpper(value)
elif thType in 'Lower':
thresFilt.ThresholdByLower(value)
elif thType in 'Between':
thresFilt.ThresholdBetween(value[0],value[1])
thresFilt.AllScalarsOn()
thresFilt.SetInputArrayToProcess(0,0,0,vtk.vtkDataObject.FIELD_ASSOCIATION_CELLS,arrName)
thresFilt.Update()
return thresFilt.GetOutput()
开发者ID:grosenkj,项目名称:telluricpy,代码行数:13,代码来源:dataset.py
示例15: _plotInternalBoxfill
def _plotInternalBoxfill(self):
"""Implements the logic to render a non-custom boxfill."""
# Prep mapper
mapper = vtk.vtkPolyDataMapper()
self._mappers = [mapper]
if self._gm.ext_1 and self._gm.ext_2:
mapper.SetInputConnection(self._vtkPolyDataFilter.GetOutputPort())
self._resultDict["vtk_backend_geofilters"] = \
[self._vtkPolyDataFilter]
else:
thr = vtk.vtkThreshold()
thr.SetInputConnection(self._vtkPolyDataFilter.GetOutputPort())
if not self._gm.ext_1 and not self._gm.ext_2:
thr.ThresholdBetween(self._contourLevels[0],
self._contourLevels[-1])
elif self._gm.ext_1 and not self._gm.ext_2:
thr.ThresholdByLower(self._contourLevels[-1])
elif not self._gm.ext_1 and self._gm.ext_2:
thr.ThresholdByUpper(self._contourLevels[0])
geoFilter2 = vtk.vtkDataSetSurfaceFilter()
geoFilter2.SetInputConnection(thr.GetOutputPort())
mapper.SetInputConnection(geoFilter2.GetOutputPort())
self._resultDict["vtk_backend_geofilters"] = [geoFilter2]
# Colortable bit
# make sure length match
numLevels = len(self._contourLevels)
while len(self._contourColors) < numLevels:
self._contourColors.append(self._contourColors[-1])
lut = vtk.vtkLookupTable()
lut.SetNumberOfTableValues(numLevels)
_colorMap = self.getColorMap()
for i in range(numLevels):
r, g, b, a = self.getColorIndexOrRGBA(_colorMap, self._contourColors[i])
lut.SetTableValue(i, r / 100., g / 100., b / 100., a / 100.)
mapper.SetLookupTable(lut)
if numpy.allclose(self._contourLevels[0], -1.e20):
lmn = self._min - 1.
else:
lmn = self._contourLevels[0]
if numpy.allclose(self._contourLevels[-1], 1.e20):
lmx = self._mx + 1.
else:
lmx = self._contourLevels[-1]
mapper.SetScalarRange(lmn, lmx)
self._resultDict["vtk_backend_luts"] = [[lut, [lmn, lmx, True]]]
开发者ID:Xunius,项目名称:uvcdat,代码行数:50,代码来源:boxfillpipeline.py
示例16: removeEndCaps
def removeEndCaps(self):
self.PrintLog("Using thresholding to remove endcaps.")
th = vtk.vtkThreshold()
th.SetInputData(self.Surface)
th.SetInputArrayToProcess(0, 0, 0, 1, self.CellEntityIdsArrayName)
th.ThresholdBetween(self.EndcapsThresholdLow, self.EndcapsThresholdHigh)
th.Update()
gf = vtk.vtkGeometryFilter()
gf.SetInputConnection(th.GetOutputPort())
gf.Update()
self.DoubleSurface = gf.GetOutput()
开发者ID:151706061,项目名称:vmtk,代码行数:14,代码来源:vmtksurfaceextractannularwalls.py
示例17: Execute
def Execute(self):
if self.Surface == None and self.Mesh == None:
self.PrintError('Error: No Surface or Mesh.')
if self.Surface != None and self.Mesh != None:
self.PrintError('Error: Both Surface and Mesh, expecting only one.')
input = self.Surface or self.Mesh
th = vtk.vtkThreshold()
th.SetInputData(input)
th.SetInputArrayToProcess(0, 0, 0, 1, self.CellEntityIdsArrayName)
th.ThresholdBetween(self.LowThreshold, self.HighThreshold)
th.Update()
if self.Mesh != None:
self.Mesh = th.GetOutput()
else:
assert self.Surface != None
gf = vtk.vtkGeometryFilter()
gf.SetInputConnection(th.GetOutputPort())
gf.Update()
self.Surface = gf.GetOutput()
开发者ID:151706061,项目名称:vmtk,代码行数:22,代码来源:vmtkthreshold.py
示例18: get_vtk_by_group
def get_vtk_by_group(vtkdata, group_lower, group_upper=None):
"""
Get submesh by material group id.
Parameters
----------
vtkdata : VTK object
Mesh, scalar, vector and tensor data.
group_lower : int
The lower material id.
group_lower : int
The Upper material id.
Returns
-------
slection : VTK object
Mesh, scalar, vector and tensor data.
"""
selection = vtk.vtkThreshold()
if vtk_version < 6:
selection.SetInput(vtkdata)
else:
selection.SetInputData(vtkdata)
selection.SetInputArrayToProcess(0, 0, 0,
vtk.vtkDataObject.FIELD_ASSOCIATION_CELLS,
"mat_id")
if group_upper is None:
group_upper = group_lower
selection.ThresholdBetween(group_lower, group_upper)
selection.Update()
return selection.GetOutput()
开发者ID:Gkdnz,项目名称:sfepy,代码行数:37,代码来源:utils_vtk.py
示例19: thresholdUGrid
def thresholdUGrid(
ugrid_mesh,
field_support,
field_name,
threshold_value,
threshold_by_upper_or_lower,
verbose=1):
myVTK.myPrint(verbose, "*** thresholdUGrid ***")
threshold = vtk.vtkThreshold()
threshold.SetInputData(ugrid_mesh)
if (field_support == "points"):
association = vtk.vtkDataObject.FIELD_ASSOCIATION_POINTS
elif (field_support == "cells"):
association = vtk.vtkDataObject.FIELD_ASSOCIATION_CELLS
threshold.SetInputArrayToProcess(0, 0, 0, association, field_name)
if (threshold_by_upper_or_lower == "upper"):
threshold.ThresholdByUpper(threshold_value)
elif (threshold_by_upper_or_lower == "lower"):
threshold.ThresholdByLower(threshold_value)
threshold.Update()
ugrid_thresholded_mesh = threshold.GetOutput()
return ugrid_thresholded_mesh
开发者ID:gacevedobolton,项目名称:myVTKPythonLibrary,代码行数:24,代码来源:thresholdDataSet.py
示例20: _plotInternal
def _plotInternal(self):
prepedContours = self._prepContours()
tmpLevels = prepedContours["tmpLevels"]
tmpIndices = prepedContours["tmpIndices"]
tmpColors = prepedContours["tmpColors"]
tmpOpacities = prepedContours["tmpOpacities"]
style = self._gm.fillareastyle
# self._patternActors = []
mappers = []
luts = []
geos = []
wholeDataMin, wholeDataMax = vcs.minmax(self._originalData1)
plotting_dataset_bounds = self.getPlottingBounds()
x1, x2, y1, y2 = plotting_dataset_bounds
_colorMap = self.getColorMap()
self._patternActors = []
for i, l in enumerate(tmpLevels):
# Ok here we are trying to group together levels can be, a join
# will happen if: next set of levels contnues where one left off
# AND pattern is identical
# TODO this should really just be a single polydata that is
# colored by scalars:
for j, color in enumerate(tmpColors[i]):
mapper = vtk.vtkPolyDataMapper()
lut = vtk.vtkLookupTable()
th = vtk.vtkThreshold()
th.ThresholdBetween(l[j], l[j + 1])
th.SetInputConnection(self._vtkPolyDataFilter.GetOutputPort())
geoFilter2 = vtk.vtkDataSetSurfaceFilter()
geoFilter2.SetInputConnection(th.GetOutputPort())
# Make the polydata output available here for patterning later
geoFilter2.Update()
geos.append(geoFilter2)
mapper.SetInputConnection(geoFilter2.GetOutputPort())
lut.SetNumberOfTableValues(1)
r, g, b, a = self.getColorIndexOrRGBA(_colorMap, color)
if style == 'solid':
tmpOpacity = tmpOpacities[j]
if tmpOpacity is None:
tmpOpacity = a / 100.
else:
tmpOpacity = tmpOpacities[j] / 100.
lut.SetTableValue(
0, r / 100., g / 100., b / 100., tmpOpacity)
else:
lut.SetTableValue(0, 1., 1., 1., 0.)
mapper.SetLookupTable(lut)
mapper.SetScalarRange(l[j], l[j + 1])
luts.append([lut, [l[j], l[j + 1], True]])
# Store the mapper only if it's worth it?
# Need to do it with the whole slab min/max for animation
# purposes
if not (l[j + 1] < wholeDataMin or l[j] > wholeDataMax):
mappers.append(mapper)
# Since pattern creation requires a single color, assuming the
# first
c = self.getColorIndexOrRGBA(_colorMap, tmpColors[i][0])
act = fillareautils.make_patterned_polydata(geoFilter2.GetOutput(),
fillareastyle=style,
fillareaindex=tmpIndices[i],
fillareacolors=c,
fillareaopacity=tmpOpacities[i],
size=(x2 - x1, y2 - y1))
if act is not None:
self._patternActors.append(act)
self._resultDict["vtk_backend_luts"] = luts
if len(geos) > 0:
self._resultDict["vtk_backend_geofilters"] = geos
"""
numLevels = len(self._contourLevels)
if mappers == []: # ok didn't need to have special banded contours
mapper = vtk.vtkPolyDataMapper()
mappers = [mapper]
# Colortable bit
# make sure length match
while len(self._contourColors) < numLevels:
self._contourColors.append(self._contourColors[-1])
lut = vtk.vtkLookupTable()
lut.SetNumberOfTableValues(numLevels)
for i in range(numLevels):
r, g, b, a = self._colorMap.index[self._contourColors[i]]
lut.SetTableValue(i, r / 100., g / 100., b / 100., a / 100.)
mapper.SetLookupTable(lut)
if numpy.allclose(self._contourLevels[0], -1.e20):
lmn = self._min - 1.
else:
lmn = self._contourLevels[0]
if numpy.allclose(self._contourLevels[-1], 1.e20):
lmx = self._max + 1.
else:
lmx = self._contourLevels[-1]
mapper.SetScalarRange(lmn, lmx)
#.........这里部分代码省略.........
开发者ID:chaosphere2112,项目名称:uvcdat,代码行数:101,代码来源:meshfillpipeline.py
注:本文中的vtk.vtkThreshold函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论