本文整理汇总了Python中vtk.vtkMath函数的典型用法代码示例。如果您正苦于以下问题:Python vtkMath函数的具体用法?Python vtkMath怎么用?Python vtkMath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkMath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: computeYaw
def computeYaw(self, markupsNode1, landmark1Index, markupsNode2, landmark2Index, markupsNode3, landmark3Index, markupsNode4, landmark4Index):
# Yaw is computed by projection on the plan (x,y)
coord1 = [-1, -1, -1]
coord2 = [-1, -1, -1]
coord3 = [-1, -1, -1]
coord4 = [-1, -1, -1]
markupsNode1.GetNthFiducialPosition(landmark1Index, coord1)
markupsNode2.GetNthFiducialPosition(landmark2Index, coord2)
markupsNode3.GetNthFiducialPosition(landmark3Index, coord3)
markupsNode4.GetNthFiducialPosition(landmark4Index, coord4)
vectLine1 = [coord2[0]-coord1[0], coord2[1]-coord1[1], 0 ]
normVectLine1 = numpy.sqrt( vectLine1[0]*vectLine1[0] + vectLine1[1]*vectLine1[1] )
print "vecline1", vectLine1, normVectLine1
vectLine2 = [coord4[0]-coord3[0],coord4[1]-coord3[1], 0]
normVectLine2 = numpy.sqrt( vectLine2[0]*vectLine2[0] + vectLine2[1]*vectLine2[1] )
print "vecline2", vectLine2, normVectLine2
yawNotSigned = round(vtk.vtkMath().DegreesFromRadians(vtk.vtkMath().AngleBetweenVectors(vectLine1, vectLine2)), self.numberOfDecimals)
print"YAWCOMPUTED", yawNotSigned
if normVectLine1 != 0 and normVectLine2 != 0:
normalizedVectLine1 = [(1/normVectLine1)*vectLine1[0], (1/normVectLine1)*vectLine1[1], 0]
print "normalizedVectLine1" , normalizedVectLine1
normalizedVectLine2 = [(1/normVectLine2)*vectLine2[0], (1/normVectLine2)*vectLine2[1], 0]
print "normalizedVectLine2" , normalizedVectLine2
det2D = normalizedVectLine1[0]*normalizedVectLine2[1] - normalizedVectLine1[1]*normalizedVectLine2[0]
print det2D
print math.copysign(yawNotSigned, det2D)
return math.copysign(yawNotSigned, det2D)
else:
print " ERROR, norm of your vector is 0! DEFINE A VECTOR!"
return None
示例2: calc_seg_perp_vector
def calc_seg_perp_vector(Xpts,Ypts,Zpts,direction):
## @brief Function to calculate the normal to three points. This is used for
# the first and last segmentations to specify as an end derivative.
# @param Xpts, x coordinate for three points
# @param Ypts, y coordinate for three points
# @param Zpts, z coordinate for three points
# @param direction, direction in which the normal should face. The dot
# product of this and the normal calculated will be > 0.
# @return perp, the normal to the given three points
math = vtk.vtkMath()
#Initiate vecs for cross product
vec1 = [Xpts[1]-Xpts[0],Ypts[1]-Ypts[0],Zpts[1]-Zpts[0]]
vec2 = [Xpts[2]-Xpts[0],Ypts[2]-Ypts[2],Zpts[2]-Zpts[0]]
perp = [0.0,0.0,0.0]
dirl = [0.0,0.0,0.0]
for i in range(3):
dirl[i] = direction[i]
math.Cross(vec1,vec2,perp)
dotval = math.Dot(perp,dirl)
if (dotval < 0):
for i in range(3):
perp[i] = -1.0*perp[i]
return perp
示例3: __init__
def __init__(self):
self._ROIVisibility = False
self._ROIStencil = None
self._IgnoreResetPoints = False
self._Objects3D = []
self.bIsConnected = False
self._Math = vtk.vtkMath()
self.__Cube = ROICubeFactory.ROICubeFactory()
self.__Cylinder = ROICylinderFactory.ROICylinderFactory()
self.__Sphere = ROISphereFactory.ROISphereFactory()
self.__Cube.SetVisibility(True)
self.__Cylinder.SetVisibility(False)
self.__Sphere.SetVisibility(False)
# two marks for visual cues for key 7 and 8
self._Mark = []
for i in range(2):
m = SphereMarkFactory.SphereMarkFactory()
m.SetColor(1.0, 1.0, 0.0)
m.SetSize(10.)
m.SetOpacity(0.)
self._Mark.append(m)
self._Objects3D.append(self.__Cylinder)
self._Objects3D.append(self.__Cube)
self._Objects3D.append(self.__Sphere)
self._Objects3D.append(self._Mark[0])
self._Objects3D.append(self._Mark[1])
# Bind some events
self.__Cube.AddObserver('StartAction', self.onStartAction)
示例4: display
def display(data, data2=None, data3=None):
# Generate some random points
math = vtk.vtkMath()
points = vtk.vtkPoints()
[data, scalefactor]=scaledata(data)
for i in range(len(data)):
points.InsertNextPoint( data[i,0],data[i,1], data[i,2]);
ballActor = vtksetup(points, color=red, radius=.001)
[ren,renWin,iren]=vtkwindow()
ren.AddActor(ballActor) # Add the actors to the renderer, set the background and size
if data2 != None:
data=data2*scalefactor
points = vtk.vtkPoints()
for i in range(len(data)):
points.InsertNextPoint( data[i,0],data[i,1], data[i,2]);
ballActor = vtksetup(points, color=blue)
ren.AddActor(ballActor)
if data3 != None:
data=data3*scalefactor
points = vtk.vtkPoints()
for i in range(len(data)):
points.InsertNextPoint( data[i,0],data[i,1], data[i,2]);
ballActor = vtksetup(points, color=green, radius=.007)
ren.AddActor(ballActor)
# Interact with the data.
iren.Initialize()
renWin.Render()
iren.Start()
示例5: defineDistances
def defineDistances(self, markupsNode1, landmark1Index, markupsNode2, landmark2Index):
coord1 = [-1, -1, -1]
coord2 = [-1, -1, -1]
markupsNode1.GetNthFiducialPosition(landmark1Index, coord1)
markupsNode2.GetNthFiducialPosition(landmark2Index, coord2)
print "point A: ", coord1
print "point B: ", coord2
diffRAxis = coord2[0] - coord1[0]
diffAAxis = coord2[1] - coord1[1]
diffSAxis = coord2[2] - coord1[2]
threeDDistance = math.sqrt(vtk.vtkMath().Distance2BetweenPoints(coord1, coord2))
return round(diffRAxis, self.numberOfDecimals), round(diffAAxis, self.numberOfDecimals), round(diffSAxis, self.numberOfDecimals), round(threeDDistance, self.numberOfDecimals)
示例6: AddTimestamp
def AddTimestamp( self, time, matrix, point, role ):
if ( time == self.timePrev ):
return
if ( self.timePrev == None or self.matrixPrev == None ):
self.timePrev = time
self.matrixPrev = vtk.vtkMatrix4x4()
self.matrixPrev.DeepCopy( matrix )
return
invertPrev = vtk.vtkMatrix4x4()
invertPrev.DeepCopy( self.matrixPrev )
invertPrev.Invert()
currChangeMatrix = vtk.vtkMatrix4x4()
vtk.vtkMatrix4x4().Multiply4x4( matrix, invertPrev, currChangeMatrix )
currChangeTransform = vtk.vtkTransform()
currChangeTransform.SetMatrix( currChangeMatrix )
currVelocity = [ 0, 0, 0 ]
currChangeTransform.GetPosition( currVelocity )
vtk.vtkMath().MultiplyScalar( currVelocity, 1 / ( time - self.timePrev ) )
currAbsVelocity = math.sqrt( currVelocity[ 0 ] * currVelocity[ 0 ] + currVelocity[ 1 ] * currVelocity[ 1 ] + currVelocity[ 2 ] * currVelocity[ 2 ] )
currentTestState = ( currAbsVelocity > TranslationalActions.VELOCITY_THRESHOLD )
if ( currentTestState == self.actionState ):
self.completeActionTime = time
else:
if ( ( time - self.completeActionTime ) > TranslationalActions.TIME_THRESHOLD ):
self.actionState = currentTestState
self.completeActionTime = time
if ( currentTestState == 1 ):
self.numActions += 1
self.timePrev = time
self.matrixPrev = vtk.vtkMatrix4x4()
self.matrixPrev.DeepCopy( matrix )
示例7: updateLine
def updateLine(self):
"""
Update the line to be near the selected point
"""
self.polyGrid = vtk.vtkUnstructuredGrid()
self.mapper.SetInput(self.polyGrid)
pts = []
pts.append((10, 105, 0))
pts.append((10, 95, 0))
pts.append((10, 100, 0))
pts.append((10 + self.widthPx, 100, 0))
pts.append((10 + self.widthPx, 105, 0))
pts.append((10 + self.widthPx, 95, 0))
n, points = self.pointsToPolyline(pts)
print "widthPx=", 100
pts2 = [(0, 0, 0), (self.widthPx, 0, 0)]
n, points2 = self.pointsToPolyline(pts2, 1)
p1, p2 = points2
m = vtk.vtkMath()
x, y, z = p1
x *= self.voxelSize[0] * 1000000
y *= self.voxelSize[1] * 1000000
z *= self.voxelSize[2] * 1000000
p1 = (x, y, z)
x, y, z = p2
x *= self.voxelSize[0] * 1000000
y *= self.voxelSize[1] * 1000000
z *= self.voxelSize[2] * 1000000
p2 = (x, y, z)
diff = m.Distance2BetweenPoints(p2, p1)
print "got diff=", diff
self.width = diff
self.textActor.SetDisplayPosition(-40 + self.widthPx / 2, 80)
self.textActor.SetInput("%.2fum" % self.width)
self.polyLine.GetPointIds().SetNumberOfIds(n)
for i in range(n):
self.polyLine.GetPointIds().SetId(i, i)
self.polyGrid.InsertNextCell(self.polyLine.GetCellType(),
self.polyLine.GetPointIds())
self.polyGrid.SetPoints(points)
示例8: colorCells
def colorCells (__vtk__temp0=0,__vtk__temp1=0):
randomColorGenerator = vtk.vtkMath()
input = randomColors.GetInput()
output = randomColors.GetOutput()
numCells = input.GetNumberOfCells()
colors = vtk.vtkFloatArray()
colors.SetNumberOfTuples(numCells)
i = 0
while i < numCells:
colors.SetValue(i,randomColorGenerator.Random(0,1))
i = i + 1
output.GetCellData().CopyScalarsOff()
output.GetCellData().PassData(input.GetCellData())
output.GetCellData().SetScalars(colors)
del colors
#reference counting - it's ok
del randomColorGenerator
示例9: calc_seg_perp_vector
def calc_seg_perp_vector(Xpts,Ypts,Zpts,direction):
math = vtk.vtkMath()
#Initiate vecs for cross product
vec1 = [Xpts[1]-Xpts[0],Ypts[1]-Ypts[0],Zpts[1]-Zpts[0]]
vec2 = [Xpts[2]-Xpts[0],Ypts[2]-Ypts[2],Zpts[2]-Zpts[0]]
perp = [0.0,0.0,0.0]
dirl = [0.0,0.0,0.0]
for i in range(3):
dirl[i] = direction[i]
math.Cross(vec1,vec2,perp)
dotval = math.Dot(perp,dirl)
if (dotval < 0):
for i in range(3):
perp[i] = -1.0*perp[i]
return perp
示例10: __init__
def __init__(self, sim, pos, dims, density, fixed=False):
# ODE initialization
x, y, z = pos # initial pos
lx, ly, lz = dims # dimensions
self.sim = sim # link to the sim object
self.body = ode.Body(self.sim.world) # ode body
mass = ode.Mass() # mass object
mass.setBox(density, lx, ly, lz) # calculate mass
self.body.setMass(mass) # link mass to body
self.body.setPosition(pos) # set the initial pos
self.geom = ode.GeomBox(self.sim.space, lengths=dims) # geometry
self.geom.setBody(self.body) # link geometry and body
if fixed:
self.fixedJoint = ode.FixedJoint(self.sim.world)
self.fixedJoint.attach(self.body,self.sim.space.getBody())
self.fixedJoint.setFixed()
# VTK initialization
self.math = vtk.vtkMath()
self.cube = vtk.vtkCubeSource()
self.cube.SetXLength(lx)
self.cube.SetYLength(ly)
self.cube.SetZLength(lz)
self.cube.SetCenter((0.0,0.0,0.0))
self.reader = vtk.vtkJPEGReader()
self.reader.SetFileName(ROBOT_IMAGE)
self.texture = vtk.vtkTexture()
transform = vtk.vtkTransform()
transform.Scale(1.0,1.0,1.0)
self.texture.SetTransform(transform)
self.texture.SetInput(self.reader.GetOutput())
self.mapper = vtk.vtkPolyDataMapper()
self.mapper.SetInput(self.cube.GetOutput())
self.actor = vtk.vtkActor()
self.actor.SetMapper(self.mapper)
self.actor.SetTexture(self.texture)
sim.renderer.AddActor(self.actor)
# Self-include in the bodies for visualization
sim.bodies.append(self)
示例11: testPlatonicSolids
def testPlatonicSolids(self):
# Create five instances of vtkPlatonicSolidSource
# corresponding to each of the five Platonic solids.
#
tet = vtk.vtkPlatonicSolidSource()
tet.SetSolidTypeToTetrahedron()
tetMapper = vtk.vtkPolyDataMapper()
tetMapper.SetInputConnection(tet.GetOutputPort())
tetActor = vtk.vtkActor()
tetActor.SetMapper(tetMapper)
cube = vtk.vtkPlatonicSolidSource()
cube.SetSolidTypeToCube()
cubeMapper = vtk.vtkPolyDataMapper()
cubeMapper.SetInputConnection(cube.GetOutputPort())
cubeActor = vtk.vtkActor()
cubeActor.SetMapper(cubeMapper)
cubeActor.AddPosition(2.0, 0, 0)
oct = vtk.vtkPlatonicSolidSource()
oct.SetSolidTypeToOctahedron()
octMapper = vtk.vtkPolyDataMapper()
octMapper.SetInputConnection(oct.GetOutputPort())
octActor = vtk.vtkActor()
octActor.SetMapper(octMapper)
octActor.AddPosition(4.0, 0, 0)
icosa = vtk.vtkPlatonicSolidSource()
icosa.SetSolidTypeToIcosahedron()
icosaMapper = vtk.vtkPolyDataMapper()
icosaMapper.SetInputConnection(icosa.GetOutputPort())
icosaActor = vtk.vtkActor()
icosaActor.SetMapper(icosaMapper)
icosaActor.AddPosition(6.0, 0, 0)
dode = vtk.vtkPlatonicSolidSource()
dode.SetSolidTypeToDodecahedron()
dodeMapper = vtk.vtkPolyDataMapper()
dodeMapper.SetInputConnection(dode.GetOutputPort())
dodeActor = vtk.vtkActor()
dodeActor.SetMapper(dodeMapper)
dodeActor.AddPosition(8.0, 0, 0)
# Create rendering stuff
#
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
# Add the actors to the renderer, set the background and size
#
ren.AddActor(tetActor)
ren.AddActor(cubeActor)
ren.AddActor(octActor)
ren.AddActor(icosaActor)
ren.AddActor(dodeActor)
colors = self.Colors()
# Create a lookup table with colors for each face
#
math = vtk.vtkMath()
lut = vtk.vtkLookupTable()
lut.SetNumberOfColors(20)
lut.Build()
lut.SetTableValue(0, colors.GetRGBAColor("red"))
lut.SetTableValue(1, colors.GetRGBAColor("lime"))
lut.SetTableValue(2, colors.GetRGBAColor("yellow"))
lut.SetTableValue(3, colors.GetRGBAColor("blue"))
lut.SetTableValue(4, colors.GetRGBAColor("magenta"))
lut.SetTableValue(5, colors.GetRGBAColor("cyan"))
lut.SetTableValue(6, colors.GetRGBAColor("spring_green"))
lut.SetTableValue(7, colors.GetRGBAColor("lavender"))
lut.SetTableValue(8, colors.GetRGBAColor("mint_cream"))
lut.SetTableValue(9, colors.GetRGBAColor("violet"))
lut.SetTableValue(10, colors.GetRGBAColor("ivory_black"))
lut.SetTableValue(11, colors.GetRGBAColor("coral"))
lut.SetTableValue(12, colors.GetRGBAColor("pink"))
lut.SetTableValue(13, colors.GetRGBAColor("salmon"))
lut.SetTableValue(14, colors.GetRGBAColor("sepia"))
lut.SetTableValue(15, colors.GetRGBAColor("carrot"))
lut.SetTableValue(16, colors.GetRGBAColor("gold"))
lut.SetTableValue(17, colors.GetRGBAColor("forest_green"))
lut.SetTableValue(18, colors.GetRGBAColor("turquoise"))
lut.SetTableValue(19, colors.GetRGBAColor("plum"))
lut.SetTableRange(0, 19)
tetMapper.SetLookupTable(lut)
tetMapper.SetScalarRange(0, 19)
cubeMapper.SetLookupTable(lut)
cubeMapper.SetScalarRange(0, 19)
octMapper.SetLookupTable(lut)
octMapper.SetScalarRange(0, 19)
icosaMapper.SetLookupTable(lut)
icosaMapper.SetScalarRange(0, 19)
dodeMapper.SetLookupTable(lut)
dodeMapper.SetScalarRange(0, 19)
cam = ren.GetActiveCamera()
#.........这里部分代码省略.........
示例12: distance2
def distance2(pnt1,pnt2):
return vtk.vtkMath().Distance2BetweenPoints(pnt1,pnt2)
示例13: testSkinOrder
def testSkinOrder(self):
# Create the RenderWindow, Renderer and Interactor
#
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
RESOLUTION = 64
START_SLICE = 50
END_SLICE = 60
PIXEL_SIZE = 3.2
centerX = RESOLUTION / 2
centerY = RESOLUTION / 2
centerZ = (END_SLICE - START_SLICE) / 2
endX = RESOLUTION - 1
endY = RESOLUTION - 1
endZ = END_SLICE - 1
origin = (RESOLUTION / 2.0) * PIXEL_SIZE * -1.0
math = vtk.vtkMath()
orders = ["ap", "pa", "si", "iss", "lr", "rl"]
sliceOrder = SliceOrder.SliceOrder()
reader = list()
iso = list()
mapper = list()
actor = list()
skinColors = [
[0.875950, 0.598302, 0.656878],
[0.641134, 0.536594, 0.537889],
[0.804079, 0.650506, 0.558249],
[0.992896, 0.603716, 0.660385],
[0.589101, 0.513448, 0.523095],
[0.650247, 0.700527, 0.752458],
]
for idx, order in enumerate(orders):
reader.append(vtk.vtkVolume16Reader())
reader[idx].SetDataDimensions(RESOLUTION, RESOLUTION)
reader[idx].SetFilePrefix(VTK_DATA_ROOT + "/Data/headsq/quarter")
reader[idx].SetDataSpacing(PIXEL_SIZE, PIXEL_SIZE, 1.5)
reader[idx].SetDataOrigin(origin, origin, 1.5)
reader[idx].SetImageRange(START_SLICE, END_SLICE)
if order == "ap":
reader[idx].SetTransform(sliceOrder.ap)
elif order == "pa":
reader[idx].SetTransform(sliceOrder.pa)
elif order == "si":
reader[idx].SetTransform(sliceOrder.si)
elif order == "iss":
reader[idx].SetTransform(sliceOrder.iss)
elif order == "lr":
reader[idx].SetTransform(sliceOrder.lr)
elif order == "rl":
reader[idx].SetTransform(sliceOrder.rl)
else:
s = "No such transform exists."
raise Exception(s)
reader[idx].SetHeaderSize(0)
reader[idx].SetDataMask(0x7FFF)
reader[idx].SetDataByteOrderToLittleEndian()
reader[idx].GetExecutive().SetReleaseDataFlag(0, 1)
iso.append(vtk.vtkContourFilter())
iso[idx].SetInputConnection(reader[idx].GetOutputPort())
iso[idx].SetValue(0, 550.5)
iso[idx].ComputeScalarsOff()
iso[idx].ReleaseDataFlagOn()
mapper.append(vtk.vtkPolyDataMapper())
mapper[idx].SetInputConnection(iso[idx].GetOutputPort())
mapper[idx].ImmediateModeRenderingOn()
actor.append(vtk.vtkActor())
actor[idx].SetMapper(mapper[idx])
# r = math.Random(.5, 1)
# g = math.Random(.5, 1)
# b = math.Random(.5, 1)
# print r, g, b
actor[idx].GetProperty().SetDiffuseColor(
# math.Random(.5, 1), math.Random(.5, 1), math.Random(.5, 1))
# r, g, b)
skinColors[idx]
)
ren.AddActor(actor[idx])
renWin.SetSize(300, 300)
ren.ResetCamera()
ren.GetActiveCamera().Azimuth(210)
ren.GetActiveCamera().Elevation(30)
ren.GetActiveCamera().Dolly(1.2)
ren.ResetCameraClippingRange()
ren.SetBackground(0.8, 0.8, 0.8)
# render and interact with data
#.........这里部分代码省略.........
示例14: SetRandomSeed
def SetRandomSeed(caller, eventId):
#print "Restart random number generator"
raMath = vtk.vtkMath()
raMath.RandomSeed(6)
示例15: display
def display(data, datascalevec=None, radius=None, color=None, shape_type=None):
"""display(data, radius=1, datascalevec=.5):
or
r = random.randn(10,3)
d = {1:r,2:r+2}
plotvtk.display(d,color=[[255,0,0],[0,0,255]],radius=[[.004],[.01]])
or
radius={'0':.004,'1':.004}
color={'0':[255,0,0],'1':[0,0,255]}
plotvtk.display(d,color=color,radius=radius)
"""
try:
if shape(data)[0] == 3 and shape(data)[1] != 3:
print "array is probably transposed wrong. transposing"
data = transpose(data)
except IndexError: # it probably a dictionary
pass
for i in data.keys():
if len(shape(data[i])) == 1:
# data 1D array
pass
elif shape(data[i])[0] == 3 and shape(data[i])[1] != 3:
print "dictionary array is probably transposed wrong. transposing"
data[i] = transpose(data[i])
# set some defaults if nothing defined
defcolor = array([[255, 0, 0]]) # red
defradius = array([[0.004]])
# Adding feature to handle a single array or a dictionary of arrays
# so as to handle multiple data.
if type(data) == dict:
for d in data.keys():
numdata = len(data[d])
if color == None:
# color = red
print "making default color scheme"
color = array(
[
arange(0, 255, 255 / len(data[d]))[::-1],
arange(0, 255, 255 / len(data[d])),
arange(0, 255, 255 / len(data[d])),
]
).T
if radius == None:
radius = tile([defradius], len(data[d])).T
else:
print "data in non dict form"
data = {1: data}
radius = defradius
color = defcolor
[ren, renWin, iren] = vtkwindow()
print "ln", len(data.keys())
for k in range(0, len(data.keys())):
print shape(data[data.keys()[k]]) # , len(data[k]), shape(color)
if k == -1:
[sdata, scalefactor] = scaledata(float_(data[data.keys()[k]]))
print "scaled data"
else:
sdata = float_(data[data.keys()[k]])
points = vtk.vtkPoints()
math = vtk.vtkMath()
# some 2 pnts of fake data at 0,0,0
pointsfake = vtk.vtkPoints()
pointsfake.InsertNextPoint(0, 0, 0)
pointsfake.InsertNextPoint(0, 0, 0)
pointsfake.InsertNextPoint(0, 0, 0)
ballActor, profile = vtkpoints(pointsfake, color=[0, 255, 0], radius=0.0000) # radius[k])
ren.AddActor(ballActor) # Add the actors to the renderer, set the background and size
# end of fake data
print "lengthofdata", len(sdata)
if len(shape(sdata)) == 1: # add dimension
sdata = array([sdata])
if len(sdata) < 3: # tile to fix some bug where no points plotted unless = or greater than 3 points
sdata = tile(sdata, [3 - len(sdata) + 1, 1])
print "len", len(sdata)
for i in range(len(sdata)):
points.InsertNextPoint(sdata[i, 0], sdata[i, 1], sdata[i, 2])
# make color and radius dictonaries.
if type(color) == list and type(radius) == list:
c = {}
r = {}
for cr in range(0, len(color)):
c[cr] = color[cr]
for cr in range(len(radius)):
r[cr] = radius[cr]
color = c
radius = r
print k
# print shape_type.keys()[k]#shape_type[shape_type.keys()[k]]
try:
if shape_type.keys()[k] == "points":
#.........这里部分代码省略.........