コード例 #1
0
def process(sortedRegions):
  global base, centroidLoc, centroidVel
  # Order blob list by descending area
  #largest = list(Enumerable.OrderByDescending(sortedRegions, lambda x:x.Area))
  # Order component list by rightmost centroid
  #rightmost = list(Enumerable.OrderByDescending(sortedRegions, lambda x:x.Centroid.X))
  leftmost = list(Enumerable.OrderBy(sortedRegions, lambda x:x.Centroid.X))

  if len(leftmost) >= 1:
    blob1Index = 0
    currbase = base
    newbase = leftmost[blob1Index].Contour.ToArray[Point]()[0]
    if base is None:
      base = newbase
      #return float.NaN
    elif abs(distfromlastframe(currbase, newbase)) < 20:
      base = newbase
      #float(largest[0].Orientation)
      #return distfromlastframe(currbase, base)  
    else: # find which blob is which instead
      if len(leftmost) >= blob1Index+2:
        nextbase = leftmost[blob1Index+1].Contour.ToArray[Point]()[0]
        if abs(distfromlastframe(currbase, nextbase)) < 20:
          blob1Index = blob1Index+1
          base = nextbase
        else:
          if len(leftmost) >= blob1Index+3:
            nextbase = leftmost[blob1Index+2].Contour.ToArray[Point]()[0]
            if abs(distfromlastframe(currbase, nextbase)) < 20:
              blob1Index = blob1Index+2
              base = nextbase
            else: #keep previous value
              blob1Index = float.NaN
              base = base
          else:
            blob1Index = float.NaN
      else:
        blob1Index = float.NaN
      #return distfromlastframe(currbase, base)  
    blob1Index = float(blob1Index)
  else:
    # otherwise, return nan
    base = None
    blob1Index = float.NaN

  #return Tuple.Create(blob1Index,len(leftmost))

  Component = ConnectedComponentCollection(sortedRegions.ImageSize)
  # Order component list by leftmost centroid
  leftmost = list(Enumerable.OrderBy(sortedRegions, lambda x:x.Centroid.X))
  if Single.IsNaN(blob1Index) == False:
    Component.Add(leftmost[int(blob1Index)])
    if int(blob1Index)+1 <= len(leftmost)-1:
      Component.Add(leftmost[int(blob1Index)+1])
    if int(blob1Index)+2 <= len(leftmost)-1:
      Component.Add(leftmost[int(blob1Index)+2])
    
  return Component
def process(sortedRegions):
    global noWhisker, whiskerIndex, currBase, currCentroid
    # Order whisker components list by base point, bottom to top
    #vSortWhiskers = list(Enumerable.OrderByDescending(sortedRegions, lambda x:FindBasePoint(x.Contour.ToArray[Point]()).Y))
    hSortWhiskers = list(
        Enumerable.OrderBy(
            sortedRegions, lambda x: FindBasePoint(x.Contour.ToArray[Point]
                                                   ()).X))

    if noWhisker is True:  #on first pass, mostly
        whiskerIndex = 1
        currBase = FindBasePoint(
            hSortWhiskers[whiskerIndex].Contour.ToArray[Point]())
        currCentroid = hSortWhiskers[whiskerIndex].Centroid
        #print("init")

    # Compare base points and find closest base, within spatial treshold limits (typically, either index 0 or 1)
    # ToDo: need to find what to do when tracked whisker has jumped to a neigboring one.
    if len(hSortWhiskers) >= 1:
        baseDist = baseDistThd
        centroidDist = centroidDistThd
        bestIdx = whiskerIndex
        for wIdx, wCComp in enumerate(hSortWhiskers):
            thatBase = FindBasePoint(wCComp.Contour.ToArray[Point]())
            #print(DistBetweenPoints(currCentroid, thatCentroid))
            #print(DistBetweenPoints(currBase, thatBase))
            if DistBetweenPoints(
                    currBase, thatBase
            ) < baseDist:  #check if centroid is also compatible
                thatCentroid = wCComp.Centroid
                #print(DistBetweenPoints(currBase, thatBase))
                if DistBetweenPoints(currCentroid,
                                     thatCentroid) < centroidDist:
                    print("distance between centroids",
                          DistBetweenPoints(currCentroid, thatCentroid))
                    centroidDist = DistBetweenPoints(currCentroid,
                                                     thatCentroid)
                    baseDist = DistBetweenPoints(currBase, thatBase)
                    bestIdx = wIdx
                else:
                    print("Centroids too far: ",
                          DistBetweenPoints(currCentroid, thatCentroid))
        if baseDist < baseDistThd:
            whiskerIndex = bestIdx
            currBase = FindBasePoint(
                hSortWhiskers[whiskerIndex].Contour.ToArray[Point]())
            currCentroid = hSortWhiskers[whiskerIndex].Centroid
        else:
            whiskerIndex = float.NaN
        noWhisker = False
    else:
        # if no whisker components, return nan
        noWhisker = True
        whiskerIndex = float.NaN

    Component = ConnectedComponentCollection(sortedRegions.ImageSize)
    if Single.IsNaN(whiskerIndex) == False:
        Component.Add(hSortWhiskers[int(whiskerIndex)])

    return Component
コード例 #3
0
def process(sortedRegions):
  # Order component list by decreasing area size
  #largest = list(Enumerable.OrderByDescending(sortedRegions, lambda x:x.Area))
  # Order component list by centroid position
  #hSortRegionList = list(Enumerable.OrderBy(sortedRegions, lambda x:x.Centroid.X))
  vSortRegionList = list(Enumerable.OrderByDescending(sortedRegions, lambda x:x.Centroid.Y))

  if len(vSortRegionList) >=6:
    xCentroidList=Tuple.Create(float(vSortRegionList[0].Centroid.X),float(vSortRegionList[1].Centroid.X),float(vSortRegionList[2].Centroid.X),float(vSortRegionList[3].Centroid.X),float(vSortRegionList[4].Centroid.X),float(vSortRegionList[5].Centroid.X))
    yCentroidList=Tuple.Create(float(vSortRegionList[0].Centroid.Y),float(vSortRegionList[1].Centroid.Y),float(vSortRegionList[2].Centroid.Y),float(vSortRegionList[3].Centroid.Y),float(vSortRegionList[4].Centroid.Y),float(vSortRegionList[5].Centroid.Y))
  if len(vSortRegionList) ==5:
    xCentroidList=Tuple.Create(float(vSortRegionList[0].Centroid.X),float(vSortRegionList[1].Centroid.X),float(vSortRegionList[2].Centroid.X),float(vSortRegionList[3].Centroid.X),float(vSortRegionList[4].Centroid.X),float.NaN)
    yCentroidList=Tuple.Create(float(vSortRegionList[0].Centroid.Y),float(vSortRegionList[1].Centroid.Y),float(vSortRegionList[2].Centroid.Y),float(vSortRegionList[3].Centroid.Y),float(vSortRegionList[4].Centroid.Y),float.NaN)
  if len(vSortRegionList) ==4:
    xCentroidList=Tuple.Create(float(vSortRegionList[0].Centroid.X),float(vSortRegionList[1].Centroid.X),float(vSortRegionList[2].Centroid.X),float(vSortRegionList[3].Centroid.X),float.NaN,float.NaN)
    yCentroidList=Tuple.Create(float(vSortRegionList[0].Centroid.Y),float(vSortRegionList[1].Centroid.Y),float(vSortRegionList[2].Centroid.Y),float(vSortRegionList[3].Centroid.Y),float.NaN,float.NaN)
  if len(vSortRegionList) ==3:
    xCentroidList=Tuple.Create(float(vSortRegionList[0].Centroid.X),float(vSortRegionList[1].Centroid.X),float(vSortRegionList[2].Centroid.X),float.NaN,float.NaN,float.NaN)
    yCentroidList=Tuple.Create(float(vSortRegionList[0].Centroid.Y),float(vSortRegionList[1].Centroid.Y),float(vSortRegionList[2].Centroid.Y),float.NaN,float.NaN,float.NaN)
  elif len(vSortRegionList) ==2:
    xCentroidList=Tuple.Create(float(vSortRegionList[0].Centroid.X),float(vSortRegionList[1].Centroid.X),float.NaN,float.NaN,float.NaN,float.NaN)
    yCentroidList=Tuple.Create(float(vSortRegionList[0].Centroid.Y),float(vSortRegionList[1].Centroid.Y),float.NaN,float.NaN,float.NaN,float.NaN)
  elif len(vSortRegionList) == 1:
    xCentroidList=Tuple.Create(float(vSortRegionList[0].Centroid.X),float.NaN,float.NaN,float.NaN,float.NaN,float.NaN) 
    yCentroidList=Tuple.Create(float(vSortRegionList[0].Centroid.Y),float.NaN,float.NaN,float.NaN,float.NaN,float.NaN)
  else:
    xCentroidList=Tuple.Create(float.NaN,float.NaN,float.NaN,float.NaN,float.NaN,float.NaN)
    yCentroidList=Tuple.Create(float.NaN,float.NaN,float.NaN,float.NaN,float.NaN,float.NaN)

  return Tuple.Create(xCentroidList, yCentroidList)
コード例 #4
0
def process(sortedRegions):
    vSortRegionList = list(
        Enumerable.OrderByDescending(
            sortedRegions, lambda x: FindBasePoint(x.Contour.ToArray[Point]
                                                   ()).Y))
    if len(vSortRegionList) >= 3:
        baseList = Tuple.Create(
            Point2f(FindBasePoint(
                vSortRegionList[0].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[1].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[2].Contour.ToArray[Point]())))
        centroidList = Tuple.Create(
            Point2f(vSortRegionList[0].Centroid.X,
                    vSortRegionList[0].Centroid.Y),
            Point2f(vSortRegionList[1].Centroid.X,
                    vSortRegionList[1].Centroid.Y),
            Point2f(vSortRegionList[2].Centroid.X,
                    vSortRegionList[2].Centroid.Y))
        tipList = Tuple.Create(
            Point2f(FindTipPoint(vSortRegionList[0].Contour.ToArray[Point]())),
            Point2f(FindTipPoint(vSortRegionList[1].Contour.ToArray[Point]())),
            Point2f(FindTipPoint(vSortRegionList[2].Contour.ToArray[Point]())))
    elif len(vSortRegionList) == 2:
        baseList = Tuple.Create(
            Point2f(FindBasePoint(
                vSortRegionList[0].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[1].Contour.ToArray[Point]())), NaNPoint)
        centroidList = Tuple.Create(
            Point2f(vSortRegionList[0].Centroid.X,
                    vSortRegionList[0].Centroid.Y),
            Point2f(vSortRegionList[1].Centroid.X,
                    vSortRegionList[1].Centroid.Y), NaNPoint)
        tipList = Tuple.Create(
            Point2f(FindTipPoint(vSortRegionList[0].Contour.ToArray[Point]())),
            Point2f(FindTipPoint(vSortRegionList[1].Contour.ToArray[Point]())),
            NaNPoint)
    elif len(vSortRegionList) == 1:
        baseList = Tuple.Create(
            Point2f(FindBasePoint(
                vSortRegionList[0].Contour.ToArray[Point]())), NaNPoint,
            NaNPoint)
        centroidList = Tuple.Create(
            Point2f(vSortRegionList[0].Centroid.X,
                    vSortRegionList[0].Centroid.Y), NaNPoint, NaNPoint)
        tipList = Tuple.Create(
            Point2f(FindTipPoint(vSortRegionList[0].Contour.ToArray[Point]())),
            NaNPoint, NaNPoint)
    else:
        baseList = Tuple.Create(NaNPoint, NaNPoint, NaNPoint)
        centroidList = Tuple.Create(NaNPoint, NaNPoint, NaNPoint)
        tipList = Tuple.Create(NaNPoint, NaNPoint, NaNPoint)

    return Tuple.Create(baseList, centroidList, tipList)
コード例 #5
0
ファイル: Sample7.py プロジェクト: kbysknhr/rhino.inside
def CommitToDocument(doc):
    sphere = Sphere(Point3d.Origin, 12 * Revit.ModelUnits)
    brep = sphere.ToBrep()
    meshes = Mesh.CreateFromBrep(brep, MeshingParameters.Default)

    category = ElementId(BuiltInCategory.OST_GenericModel)
    ds = DirectShape.CreateElement(doc, category)

    for geometry in Enumerable.ToList(Convert.ToHost(meshes)):
        ds.AppendShape(geometry)
コード例 #6
0
def process(sortedRegions):
    global noWhisker, whiskerIndex, initialBase, firstPass, baseDistList  #, currCentroid
    # Order whisker components list by base point, bottom to top
    #vSortWhiskers = list(Enumerable.OrderByDescending(sortedRegions, lambda x:FindBasePoint(x.Contour.ToArray[Point]()).Y))
    vSortWhiskers = list(
        Enumerable.OrderBy(
            sortedRegions, lambda x: FindBasePoint(x.Contour.ToArray[Point]
                                                   ()).Y))

    if noWhisker is True:  #on first pass
        if len(vSortWhiskers) >= (1 + targetWhisker) and firstPass == True:
            print("init")
            whiskerIndex = targetWhisker
            initialBase = FindBasePoint(
                vSortWhiskers[whiskerIndex].Contour.ToArray[Point]())
            firstPass = False
        elif len(vSortWhiskers) < 1:
            print("still no whiskers")

    # Compare base points and find closest base, within spatial treshold limits (typically, either index 0 or 1)
    # ToDo: need to find what to do when tracked whisker has jumped to a neigboring one.
    if len(vSortWhiskers) >= 1:
        baseDistList[:] = []
        for wIdx, wCComp in enumerate(vSortWhiskers):
            thatBase = FindBasePoint(wCComp.Contour.ToArray[Point]())
            baseDist = DistBetweenPoints(initialBase, thatBase)
            if baseDist < baseDistThd:  # add it
                baseDistList.append(baseDist)
            else:
                baseDistList.append(None)
        listNotNones = [
            i for i, item in enumerate(baseDistList) if item is not None
        ]
        #print("baseDistList", baseDistList, "isnotnone", listNotNones)
        if len(listNotNones) > 0:
            baseDistList = [baseDistList[i] for i in listNotNones]
            whiskerIndex = baseDistList.index(min(baseDistList))
        else:
            noWhisker = True
            whiskerIndex = float.NaN
    else:
        noWhisker = True
        whiskerIndex = float.NaN

    # Create whisker component
    Component = ConnectedComponentCollection(sortedRegions.ImageSize)
    if Single.IsNaN(whiskerIndex) == False:
        #print("creating component")
        Component.Add(vSortWhiskers[int(listNotNones[0])])
        if len(listNotNones) > 1:
            Component.Add(vSortWhiskers[int(listNotNones[1])])
        if len(listNotNones) > 2:
            Component.Add(vSortWhiskers[int(listNotNones[2])])

    return Component
コード例 #7
0
def process(sortedRegions):
    global base, centroidLoc, centroidVel

    vSortRegionList = list(
        Enumerable.OrderByDescending(
            sortedRegions, lambda x: FindBasePoint(x.Contour.ToArray[Point]
                                                   ()).Y))

    if len(vSortRegionList) >= 3:
        blob1Index = 2
        newbase = Point2f(
            FindTipPoint(vSortRegionList[blob1Index].Contour.ToArray[Point]()))
        return newbase  #vSortRegionList[blob1Index].Orientation
    else:
        return NaNPoint  #float(0)
コード例 #8
0
def process(value):
    global base
    # Order blob list by descending area
    #largest = list(Enumerable.OrderByDescending(value, lambda x:x.Area))
    # Order component list by rightmost centroid
    rightmost = list(
        Enumerable.OrderByDescending(value, lambda x: x.Centroid.X))

    if len(rightmost) >= 1:
        blob1Index = 0
        currbase = base
        newbase = max(rightmost[blob1Index].Contour.ToArray[Point]())
        if base is None:
            base = newbase
            #return float.NaN
        elif abs(distfromlastframe(currbase, newbase)) < 20:
            base = newbase
            #float(largest[0].Orientation)
            #return distfromlastframe(currbase, base)
        else:  # find which blob is which instead
            if len(rightmost) >= blob1Index + 2:
                nextbase = max(rightmost[blob1Index +
                                         1].Contour.ToArray[Point]())
                if abs(distfromlastframe(currbase, nextbase)) < 20:
                    blob1Index = blob1Index + 1
                    base = nextbase
                else:
                    if len(rightmost) >= blob1Index + 3:
                        nextbase = max(rightmost[blob1Index +
                                                 2].Contour.ToArray[Point]())
                        if abs(distfromlastframe(currbase, nextbase)) < 20:
                            blob1Index = blob1Index + 2
                            base = nextbase
                        else:  #keep previous value
                            blob1Index = float.NaN
                            base = base
                    else:
                        blob1Index = float.NaN
            else:
                blob1Index = float.NaN
            #return distfromlastframe(currbase, base)
        blob1Index = float(blob1Index)
    else:
        # otherwise, return nan
        base = None
        blob1Index = float.NaN

    return Tuple.Create(blob1Index, len(rightmost))
def process(sortedRegions):
    global noWhisker, whiskerIndex, currBase
    # Order whisker components list by base point, bottom to top
    hSortWhiskers = list(
        Enumerable.OrderBy(
            sortedRegions, lambda x: FindBasePoint(x.Contour.ToArray[Point]
                                                   ()).X))

    if noWhisker is True:  #on first pass, mostly
        whiskerIndex = 1
        currBase = FindBasePoint(
            hSortWhiskers[whiskerIndex].Contour.ToArray[Point]())
        print("no whisker present")

    # Compare base points and find closest base, within spatial treshold limits (typically, either index 0 or 1)
    # ToDo: need to find what to do when tracked whisker has jumped to a neigboring one.
    if len(hSortWhiskers) >= 1:
        #print("number of whisker is", len(hSortWhiskers))
        baseDist = distThd
        bestIdx = whiskerIndex
        for wIdx, wCComp in enumerate(hSortWhiskers):
            thatBase = FindBasePoint(wCComp.Contour.ToArray[Point]())
            if DistBetweenPoints(currBase, thatBase) < baseDist:
                print(wIdx, "has base distance under threshold ", baseDist)
                baseDist = DistBetweenPoints(currBase, thatBase)
                bestIdx = wIdx
        if baseDist < distThd:
            #print("selected base", bestIdx, "distance is below threshold: ", baseDist)
            whiskerIndex = bestIdx
            currBase = FindBasePoint(
                hSortWhiskers[whiskerIndex].Contour.ToArray[Point]())
        else:
            #print("selected base", bestIdx, "distance", DistBetweenPoints(currBase, thatBase), "is above threshold: ", baseDist)
            whiskerIndex = float.NaN
        noWhisker = False
    else:
        # if no whisker components, return nan
        print("no whisker component")
        noWhisker = True
        whiskerIndex = float.NaN

    Component = ConnectedComponentCollection(sortedRegions.ImageSize)
    if Single.IsNaN(whiskerIndex) == False:
        print("whisker", whiskerIndex, "selected")
        Component.Add(hSortWhiskers[int(whiskerIndex)])

    return Component
コード例 #10
0
def process(sortedRegions):
    global noWhisker, whiskerIndex, currBase
    # Order whisker components list by base point, bottom to top
    vSortWhiskers = list(
        Enumerable.OrderByDescending(
            sortedRegions, lambda x: FindBasePoint(x.Contour.ToArray[Point]
                                                   ()).Y))

    if noWhisker is True:  #on first pass, mostly
        whiskerIndex = 0
        currBase = FindBasePoint(
            vSortWhiskers[whiskerIndex].Contour.ToArray[Point]())
        #print("init")

    # Compare base points and find closest base, within spatial treshold limits (typically, either index 0 or 1)
    # ToDo: need to find what to do when tracked whisker has jumped to a neigboring one.
    # Try and prevent these limit cases by comparing centroids. Or take direction / velocity into account
    if len(vSortWhiskers) >= 1:
        baseDist = distThd
        bestIdx = whiskerIndex
        for wIdx, wCComp in enumerate(vSortWhiskers):
            thatBase = FindBasePoint(wCComp.Contour.ToArray[Point]())
            if DistBetweenPoints(currBase, thatBase) < baseDist:
                baseDist = DistBetweenPoints(currBase, thatBase)
                bestIdx = wIdx
        if baseDist < distThd:
            whiskerIndex = bestIdx
            currBase = FindBasePoint(
                vSortWhiskers[whiskerIndex].Contour.ToArray[Point]())
        else:
            whiskerIndex = float.NaN
        noWhisker = False
    else:
        # if no whisker components, return nan
        noWhisker = True
        whiskerIndex = float.NaN

    Component = ConnectedComponentCollection(sortedRegions.ImageSize)
    if Single.IsNaN(whiskerIndex) == False:
        Component.Add(vSortWhiskers[int(whiskerIndex)])

    return Component
コード例 #11
0
ファイル: ConvertModel.py プロジェクト: mlunnay/minotaur
 def toBinaryArray(self):
     res = List[Byte]()
     res.AddRange(BitConverter.GetBytes(self.position.X))
     res.AddRange(BitConverter.GetBytes(self.position.Y))
     res.AddRange(BitConverter.GetBytes(self.normal.X))
     res.AddRange(BitConverter.GetBytes(self.normal.Y))
     res.AddRange(BitConverter.GetBytes(self.normal.Z))
     res.AddRange(BitConverter.GetBytes(self.position.Z))
     res.AddRange(BitConverter.GetBytes(self.texCoord.X))
     res.AddRange(BitConverter.GetBytes(self.texCoord.Y))
     res.AddRange(BitConverter.GetBytes(clr.Convert(self.boneIDs[0],
                                                    Int32)))
     res.AddRange(BitConverter.GetBytes(clr.Convert(self.boneIDs[1],
                                                    Int32)))
     res.AddRange(BitConverter.GetBytes(clr.Convert(self.boneIDs[2],
                                                    Int32)))
     res.AddRange(BitConverter.GetBytes(clr.Convert(self.boneIDs[3],
                                                    Int32)))
     res.AddRange(BitConverter.GetBytes(self.boneWeights.X))
     res.AddRange(BitConverter.GetBytes(self.boneWeights.Y))
     res.AddRange(BitConverter.GetBytes(self.boneWeights.Z))
     res.AddRange(BitConverter.GetBytes(self.boneWeights.W))
     return Enumerable.ToArray(res)
コード例 #12
0
def process(sortedRegions):
	global noWhisker, whiskerIndex, initialBase, currBase, firstPass, numWhiskers, baseList, baseDistList  #, currCentroid
	# Order whisker components list by base point, bottom to top
	#vSortWhiskers = list(Enumerable.OrderByDescending(sortedRegions, lambda x:FindBasePoint(x.Contour.ToArray[Point]()).Y))
	vSortWhiskers = list(Enumerable.OrderBy(sortedRegions, lambda x:FindBasePoint(x.Contour.ToArray[Point]()).Y))

	if noWhisker is True: #on first pass
		if len(vSortWhiskers) >= (1 + targetWhisker) and firstPass == True:
			print("init")
			whiskerIndex = targetWhisker
			initialBase = currBase = FindBasePoint(vSortWhiskers[whiskerIndex].Contour.ToArray[Point]())
			#currCentroid = vSortWhiskers[whiskerIndex].Centroid
			numWhiskers = len(vSortWhiskers)
			firstPass = False
		elif len(vSortWhiskers) < 1:
			print("still no whiskers")
		
	# Compare base points and find closest base, within spatial treshold limits (typically, either index 0 or 1)
	# ToDo: need to find what to do when tracked whisker has jumped to a neigboring one.  
	if len(vSortWhiskers) >= 1:
		#baseDist=baseDistThd
		#centroidDist=centroidDistThd
		#bestIdx=whiskerIndex
		baseList[:] = []
		baseDistList[:] = [] 
		#centroidDistList = []
		for wIdx, wCComp in enumerate(vSortWhiskers):
			thatBase = FindBasePoint(wCComp.Contour.ToArray[Point]())
			baseDist = DistBetweenPoints(currBase, thatBase)
			if baseDist < baseDistThd: # add it
				baseList.append(thatBase)
				baseDistList.append(baseDist)
			else:
				baseList.append(None)
				baseDistList.append(None)
		#listnans = lambda array: any(filter(math.isnan, baseDistList)) #math.isnan(baseDistList))
		listNotNones = [i for i, item in enumerate(baseDistList) if item is not None]
		print("baseDistList", baseDistList, "isnotnone", listNotNones)
		#vSortWhiskers = [vSortWhiskers[i] for i in listnotnones]
		if len(listNotNones) > 0:
			baseList = [baseList[i] for i in listNotNones]
			baseDistList = [baseDistList[i] for i in listNotNones]
			
				#thatCentroid = wCComp.Centroid
				#centroidDistList.append(DistBetweenPoints(currCentroid, thatCentroid))
				#print("whisker", wIdx, "baseX", thatBase.X, "distance", DistBetweenPoints(currBase, thatBase))
			
			#if len(vSortWhiskers) == numWhiskers and baseDistList[targetWhisker]<baseDistThd:
			#	bestIdx = targetWhisker
			#else:
			#	bestIdx = baseDistList.index(min(baseDistList)) 
			#print("bestBaseIdx", bestBaseIdx)
			#print("selecting Idx")
			if len(baseDistList) == numWhiskers and len(baseDistList) > whiskerIndex and baseDistList[whiskerIndex]<baseDistThd: #len(baseDistList) == numWhiskers and 
				bestIdx = whiskerIndex
				#print("option 1, bestIdx is", bestIdx)
			elif len(baseDistList) > numWhiskers: # e.g., whiskers have fused, then unfused
				baseDistList[:] = []
				for thatBase in baseList:
					baseDist = DistBetweenPoints(initialBase, thatBase)
					baseDistList.append(baseDist)
				bestIdx = baseDistList.index(min(baseDistList))
			else:
				bestIdx = baseDistList.index(min(baseDistList))
				#print("option 3, bestIdx is", bestIdx)

			if Single.IsNaN(whiskerIndex) == True:
				#bestIdx = bestBaseIdx
				whiskerIndex = bestIdx
			# check that nothing is amiss for big base jumps or changes in index
			# thatBase = FindBasePoint(vSortWhiskers[bestBaseIdx].Contour.ToArray[Point]())
			# if DistBetweenPoints(currBase, thatBase) > baseDist or bestBaseIdx!=whiskerIndex: #check if centroid is also compatible
			# 	print("centroid based check because", DistBetweenPoints(currBase, thatBase) > baseDist , bestBaseIdx!=whiskerIndex)
			# 	centroidDistList = [] 
			# 	for wIdx, wCComp in enumerate(vSortWhiskers):
			# 		thatCentroid = wCComp.Centroid
			# 		centroidDistList.append(DistBetweenPoints(currCentroid, thatCentroid))
			# 		#print("whisker", wIdx, "centroidX", thatCentroid.X, "distance", DistBetweenPoints(currCentroid, thatCentroid))
			# 	bestCentroidIdx = centroidDistList.index(min(centroidDistList))
			# 	print("Best centroid is whisker", bestCentroidIdx)
			# 	# But careful: could be that the whisker has disappeared, or reappeared
			# 	if bestBaseIdx!=bestCentroidIdx: #resolve
			# 		if len(vSortWhiskers)<numWhiskers:
			# 			print("Conflict with best base. Use centroid index", bestCentroidIdx)
			# 			bestIdx = bestCentroidIdx #be conservative
			# 		else:
			# 			print("Conflict with best base. Keep current index", whiskerIndex)
			# 			bestIdx = whiskerIndex #be conservative
			# 	else:
			# 		if len(vSortWhiskers) == numWhiskers:
			# 			print("No conflict, no whisker number change so keep current index", whiskerIndex)
			# 			bestIdx = whiskerIndex #be conservative
			# 		else:
			# 			print("No conflict but whisker number change so use base index", bestBaseIdx)
			# 			bestIdx = bestBaseIdx #       
			# else:
			# 	bestIdx = bestBaseIdx
			#print("whisker Index is now", bestIdx)
			#if bestIdx!=whiskerIndex:
			#	print("Jump!")
			#vSortWhiskers = [vSortWhiskers[i] for i in listNotNones]
			print("get base from candidate whisker",bestIdx,"among",len(baseList))
			thatBase = baseList[bestIdx] #FindBasePoint(vSortWhiskers[bestIdx].Contour.ToArray[Point]())
			baseDist = baseDistList[bestIdx] #DistBetweenPoints(currBase, thatBase)
			if baseDist < 2*baseDistThd:
				#print("selected whisker is ", bestIdx)
				whiskerIndex = bestIdx
				currBase = thatBase
				#currCentroid = vSortWhiskers[whiskerIndex].Centroid
			else:
				#print("no whisker selected")
				whiskerIndex = float.NaN
			noWhisker = False
		else:
			noWhisker = True
			whiskerIndex = float.NaN
	else:
		# if no whisker components, return nan
		#print("no whisker present")
		noWhisker = True
		whiskerIndex = float.NaN
	# Keep track of the number of whiskers
	#numWhiskers=len(vSortWhiskers)
	numWhiskers=len(baseDistList)

 	# Create whisker component
	Component = ConnectedComponentCollection(sortedRegions.ImageSize)
	if Single.IsNaN(whiskerIndex) == False:
		#print("creating component")
		Component.Add(vSortWhiskers[int(listNotNones[whiskerIndex])])
		
	return Component
def FindBasePoint(inputPointArray):
    pointList = Enumerable.OrderBy(
        inputPointArray, lambda x: x.Y)  #Y point for horizontal head position
    firstPoint = Enumerable.First(pointList)
    return firstPoint
コード例 #14
0
def process(sortedRegions):
    global base, centroidLoc, centroidVel
    # Order blob list by descending Y base point (ie, bottom to top)
    vSortRegionList = list(
        Enumerable.OrderByDescending(
            sortedRegions, lambda x: FindBasePoint(x.Contour.ToArray[Point]
                                                   ()).Y))

    if len(vSortRegionList) >= 1:
        blob1Index = 0
        currbase = base
        newbase = FindBasePoint(
            vSortRegionList[blob1Index].Contour.ToArray[Point]
            ())  #vSortRegionList[blob1Index].Contour.ToArray[Point]()[0]
        if base is None:
            base = newbase
            #return float.NaN
        elif abs(VDistFromLastFrame(currbase, newbase)) < distThd:
            base = newbase
            #float(largest[0].Orientation)
            #return distfromlastframe(currbase, base)
        else:  # find which blob is which instead
            if len(vSortRegionList) >= blob1Index + 2:
                nextbase = FindBasePoint(
                    vSortRegionList[blob1Index + 1].Contour.ToArray[Point]())
                if abs(VDistFromLastFrame(currbase, nextbase)) < distThd:
                    blob1Index = blob1Index + 1
                    base = nextbase
                else:
                    if len(vSortRegionList) >= blob1Index + 3:
                        nextbase = FindBasePoint(
                            vSortRegionList[blob1Index +
                                            2].Contour.ToArray[Point]())
                        if abs(VDistFromLastFrame(currbase,
                                                  nextbase)) < distThd:
                            blob1Index = blob1Index + 2
                            base = nextbase
                        else:  #keep previous value
                            blob1Index = float.NaN
                            base = base
                    else:
                        blob1Index = float.NaN
            else:
                blob1Index = float.NaN
            #return distfromlastframe(currbase, base)
        blob1Index = float(blob1Index)
    else:
        # otherwise, return nan
        base = None
        blob1Index = float.NaN

    #return Tuple.Create(blob1Index,len(leftmost))

    Component = ConnectedComponentCollection(sortedRegions.ImageSize)
    vSortRegionList = list(
        Enumerable.OrderByDescending(
            sortedRegions, lambda x: FindBasePoint(x.Contour.ToArray[Point]
                                                   ()).Y))
    if Single.IsNaN(blob1Index) == False:
        Component.Add(vSortRegionList[int(blob1Index)])
        if int(blob1Index) + 1 <= len(vSortRegionList) - 1:
            Component.Add(vSortRegionList[int(blob1Index) + 1])
        if int(blob1Index) + 2 <= len(vSortRegionList) - 1:
            Component.Add(vSortRegionList[int(blob1Index) + 2])

    return Component
コード例 #15
0
def FindTipPoint(inputPointArray):
    pointList = Enumerable.OrderByDescending(inputPointArray, lambda x: x.X)
    lastPoint = Enumerable.First(pointList)
    return lastPoint
コード例 #16
0
def FindBasePoint(inputPointArray):
    pointList = Enumerable.OrderBy(inputPointArray, lambda x: x.X)
    firstPoint = Enumerable.First(pointList)
    return firstPoint
コード例 #17
0
def toarray(col):
    return Enumerable.ToArray(col)
コード例 #18
0
 def IsDayOff(day, holidays):
     return day.DayOfWeek == DayOfWeek.Saturday or day.DayOfWeek == DayOfWeek.Sunday \
       or Enumerable.Count(holidays, lambda h: h.LegalHolidayDate.Day == day.Day) > 0
コード例 #19
0
def process(sortedRegions):
    # Order component list by decreasing area size
    #largest = list(Enumerable.OrderByDescending(sortedRegions, lambda x:x.Area))
    # Order component list by centroid position
    #hSortRegionList = list(Enumerable.OrderBy(sortedRegions, lambda x:x.Centroid.X))
    vSortRegionList = list(
        Enumerable.OrderByDescending(
            sortedRegions, lambda x: FindBasePoint(x.Contour.ToArray[Point]
                                                   ()).Y))
    if len(vSortRegionList) >= 6:
        baseList = Tuple.Create(
            Point2f(FindBasePoint(
                vSortRegionList[0].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[1].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[2].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[3].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[4].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[5].Contour.ToArray[Point]())))
        centroidList = Tuple.Create(
            Point2f(vSortRegionList[0].Centroid.X,
                    vSortRegionList[0].Centroid.Y),
            Point2f(vSortRegionList[1].Centroid.X,
                    vSortRegionList[1].Centroid.Y),
            Point2f(vSortRegionList[2].Centroid.X,
                    vSortRegionList[2].Centroid.Y),
            Point2f(vSortRegionList[3].Centroid.X,
                    vSortRegionList[3].Centroid.Y),
            Point2f(vSortRegionList[4].Centroid.X,
                    vSortRegionList[4].Centroid.Y),
            Point2f(vSortRegionList[5].Centroid.X,
                    vSortRegionList[5].Centroid.Y))
    elif len(vSortRegionList) == 5:
        baseList = Tuple.Create(
            Point2f(FindBasePoint(
                vSortRegionList[0].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[1].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[2].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[3].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[4].Contour.ToArray[Point]())), NaNPoint)
        centroidList = Tuple.Create(
            Point2f(vSortRegionList[0].Centroid.X,
                    vSortRegionList[0].Centroid.Y),
            Point2f(vSortRegionList[1].Centroid.X,
                    vSortRegionList[1].Centroid.Y),
            Point2f(vSortRegionList[2].Centroid.X,
                    vSortRegionList[2].Centroid.Y),
            Point2f(vSortRegionList[3].Centroid.X,
                    vSortRegionList[3].Centroid.Y),
            Point2f(vSortRegionList[4].Centroid.X,
                    vSortRegionList[4].Centroid.Y), NaNPoint)
    elif len(vSortRegionList) == 4:
        baseList = Tuple.Create(
            Point2f(FindBasePoint(
                vSortRegionList[0].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[1].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[2].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[3].Contour.ToArray[Point]())), NaNPoint,
            NaNPoint)
        centroidList = Tuple.Create(
            Point2f(vSortRegionList[0].Centroid.X,
                    vSortRegionList[0].Centroid.Y),
            Point2f(vSortRegionList[1].Centroid.X,
                    vSortRegionList[1].Centroid.Y),
            Point2f(vSortRegionList[2].Centroid.X,
                    vSortRegionList[2].Centroid.Y),
            Point2f(vSortRegionList[3].Centroid.X,
                    vSortRegionList[3].Centroid.Y), NaNPoint, NaNPoint)
    elif len(vSortRegionList) == 3:
        baseList = Tuple.Create(
            Point2f(FindBasePoint(
                vSortRegionList[0].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[1].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[2].Contour.ToArray[Point]())), NaNPoint,
            NaNPoint, NaNPoint)
        centroidList = Tuple.Create(
            Point2f(vSortRegionList[0].Centroid.X,
                    vSortRegionList[0].Centroid.Y),
            Point2f(vSortRegionList[1].Centroid.X,
                    vSortRegionList[1].Centroid.Y),
            Point2f(vSortRegionList[2].Centroid.X,
                    vSortRegionList[2].Centroid.Y), NaNPoint, NaNPoint,
            NaNPoint)
    elif len(vSortRegionList) == 2:
        baseList = Tuple.Create(
            Point2f(FindBasePoint(
                vSortRegionList[0].Contour.ToArray[Point]())),
            Point2f(FindBasePoint(
                vSortRegionList[1].Contour.ToArray[Point]())), NaNPoint,
            NaNPoint, NaNPoint, NaNPoint)
        centroidList = Tuple.Create(
            Point2f(vSortRegionList[0].Centroid.X,
                    vSortRegionList[0].Centroid.Y),
            Point2f(vSortRegionList[1].Centroid.X,
                    vSortRegionList[1].Centroid.Y), NaNPoint, NaNPoint,
            NaNPoint, NaNPoint)
    elif len(vSortRegionList) == 1:
        baseList = Tuple.Create(
            Point2f(FindBasePoint(
                vSortRegionList[0].Contour.ToArray[Point]())), NaNPoint,
            NaNPoint, NaNPoint, NaNPoint, NaNPoint)
        centroidList = Tuple.Create(
            Point2f(vSortRegionList[0].Centroid.X,
                    vSortRegionList[0].Centroid.Y), NaNPoint, NaNPoint,
            NaNPoint, NaNPoint, NaNPoint)
    else:
        baseList = Tuple.Create(NaNPoint, NaNPoint, NaNPoint, NaNPoint,
                                NaNPoint, NaNPoint)
        centroidList = Tuple.Create(NaNPoint, NaNPoint, NaNPoint, NaNPoint,
                                    NaNPoint, NaNPoint)

    return Tuple.Create(baseList, centroidList)
コード例 #20
0
ファイル: ConvertModel.py プロジェクト: mlunnay/minotaur
# # bone weights
# writer.WriteSByte(4)
# writer.WriteSByte(6)
# writer.WriteUInt32(7)

# vertex declaration
writer.WriteUInt32(vertexDeclaration.stride)
writer.WriteUInt32(vertexDeclaration.elementCount)
for e in vertexDeclaration.elements:
    writer.WriteSByte(e.dimension)
    writer.WriteSByte(e.type)
    writer.WriteUInt32(e.usage)

writer.WriteUInt32(vertices.Count / vertexDeclaration.stride)
# data = List[Byte]()
# for v in vertices:
# data.AddRange(vertexDeclaration.toBinaryArray(v))
# assert(data.Count == len(vertices) * vertexDeclaration.stride)
writer.WriteByteArray(Enumerable.ToArray(vertices))

# index buffer
writer.WriteInt(3)
data = List[Byte]()
for i in indices:
    data.AddRange(BitConverter.GetBytes(i))
writer.WriteUInt32(data.Count)
writer.WriteByteArray(Enumerable.ToArray(data))

writer.Flush()
f.Close()
コード例 #21
0
ファイル: ConvertModel.py プロジェクト: mlunnay/minotaur
 def toBinaryArray(self, mesh, i):
     res = List[Byte]()
     for e in self.elements:
         res.AddRange(e.toBinaryArray(mesh, i))
     return Enumerable.ToArray(res)
コード例 #22
0
import clr
clr.AddReference('System.Core')
clr.AddReference('RhinoInside.Revit')
clr.AddReference('RevitAPI')

from System.Linq import Enumerable
from Autodesk.Revit.DB import *
from Rhino.Geometry import *
from RhinoInside.Revit import Revit, Convert

doc = Revit.ActiveDBDocument

with Transaction(doc, "Sample7") as trans:
    trans.Start()

    sphere = Sphere(Point3d.Origin, 12 * Revit.ModelUnits)
    brep = sphere.ToBrep()
    meshes = Mesh.CreateFromBrep(brep, MeshingParameters.Default)

    category = ElementId(BuiltInCategory.OST_GenericModel)
    ds = DirectShape.CreateElement(doc, category)

    for geometry in Enumerable.ToList(Convert.ToHost(meshes)):
        ds.AppendShape(geometry)

    trans.Commit()
def FindBasePoint(inputPointArray):
    pointList = Enumerable.OrderBy(
        inputPointArray, lambda x: x.X)  #X point for vertical head position
    firstPoint = Enumerable.First(pointList)
    return firstPoint
コード例 #24
0
    def AddWorksheet(user, year, month, workbook):
        # Get all timesheets for the user
        timesheets = Context.SelectWithParams({
            "Query":
            "From T In Timesheet Where T.UserDetail.Username = @Username And :Year(T.BeginTime) = @YearFilter And :Month(T.BeginTime) = @MonthFilter Order By T.BeginTime Select T",
            "@Username": user.Username,
            "@YearFilter": Decimal(year),
            "@MonthFilter": Decimal(month)
        })

        # Get holidays for the corresponding month
        holidays = Context.SelectWithParams({
            "Query":
            "From H In LegalHoliday Where :Year(H.LegalHolidayDate) = @YearFilter And :Month(H.LegalHolidayDate) = @MonthFilter Order By H.LegalHolidayDate Select H",
            "@YearFilter": Decimal(year),
            "@MonthFilter": Decimal(month)
        })

        # Add sheet for user
        workbook.Worksheets["Tabelle1"].Copy(Before=workbook.Worksheets[1])
        ws = workbook.Worksheets[1]
        ws.Name = user.Lastname + ", " + user.Firstname
        ws.Activate()

        rowIndex = 2
        totalWorkingHours = 0
        hoursPerDay = user.WeeklyHoursOfWork / 5
        prevDay = 0

        # Loop over all days of the month
        for currentDay in range(
                1,
                DateTime(year, month, 1).AddMonths(1).AddDays(-1).Day + 1):
            currentDayDate = DateTime(year, month, currentDay)
            dailyTimesheets = Enumerable.Where(
                timesheets, lambda t: t.BeginTime.Day == currentDay)

            if Enumerable.Count(dailyTimesheets) > 0:
                # There are timesheets for this day
                for timesheet in dailyTimesheets:
                    # Add row for timesheet
                    HandleRowColor(currentDayDate, ws.Cells[rowIndex, 1],
                                   holidays)
                    if prevDay != timesheet.BeginTime.Day:
                        # Don't repeat day index for mulitple rows of the same day
                        ws.Cells[rowIndex, 1].Value2 = timesheet.BeginTime.Day
                    ws.Cells[rowIndex, 2].Value2 = timesheet.BeginTime
                    ws.Cells[rowIndex, 3].Value2 = timesheet.EndTime
                    ws.Cells[rowIndex,
                             4].Value2 = timesheet.DurationInHours / 24
                    ws.Cells[rowIndex, 5].Value2 = timesheet.Description
                    totalWorkingHours = totalWorkingHours + timesheet.DurationInHours
                    prevDay = timesheet.BeginTime.Day
                    rowIndex = rowIndex + 1
            else:
                # There are no timesheets for this day
                HandleRowColor(currentDayDate, ws.Cells[rowIndex, 1], holidays)
                ws.Cells[rowIndex, 1].Value2 = currentDay
                rowIndex = rowIndex + 1

        # Add sums
        ws.Cells[rowIndex, 2].Value2 = 'Gesamt:'
        ws.Cells[rowIndex, 4].Value2 = (totalWorkingHours) / 24
        rowIndex = rowIndex + 1
def process(sortedRegions):
    global noWhisker, whiskerIndex, currBase, currCentroid, firstPass, numWhiskers
    # Order whisker components list by base point, bottom to top
    #vSortWhiskers = list(Enumerable.OrderByDescending(sortedRegions, lambda x:FindBasePoint(x.Contour.ToArray[Point]()).Y))
    vSortWhiskers = list(
        Enumerable.OrderBy(
            sortedRegions, lambda x: FindBasePoint(x.Contour.ToArray[Point]
                                                   ()).Y))

    if noWhisker is True:  #on first pass
        if len(vSortWhiskers) >= 2 and firstPass == True:
            print("init")
            whiskerIndex = 1
            currBase = FindBasePoint(
                vSortWhiskers[whiskerIndex].Contour.ToArray[Point]())
            currCentroid = vSortWhiskers[whiskerIndex].Centroid
            firstPass = False
        elif len(vSortWhiskers) < 1:
            print("still no whiskers")

    # Compare base points and find closest base, within spatial treshold limits (typically, either index 0 or 1)
    # ToDo: need to find what to do when tracked whisker has jumped to a neigboring one.
    if len(vSortWhiskers) >= 1:
        baseDist = baseDistThd
        centroidDist = centroidDistThd
        #bestIdx=whiskerIndex
        baseDistList = []
        for wIdx, wCComp in enumerate(vSortWhiskers):
            thatBase = FindBasePoint(wCComp.Contour.ToArray[Point]())
            baseDistList.append(DistBetweenPoints(currBase, thatBase))
            #print("whisker", wIdx, "baseX", thatBase.X, "distance", DistBetweenPoints(currBase, thatBase))
        bestBaseIdx = baseDistList.index(min(baseDistList))
        #print("bestBaseIdx", bestBaseIdx)
        if Single.IsNaN(whiskerIndex) == True:
            bestIdx = bestBaseIdx
        # check that nothing is amiss for big base jumps or changes in index
        thatBase = FindBasePoint(
            vSortWhiskers[bestBaseIdx].Contour.ToArray[Point]())
        if DistBetweenPoints(
                currBase, thatBase
        ) > baseDist or bestBaseIdx != whiskerIndex:  #check if centroid is also compatible
            print("centroid based check because",
                  DistBetweenPoints(currBase, thatBase) > baseDist,
                  bestBaseIdx != whiskerIndex)
            centroidDistList = []
            for wIdx, wCComp in enumerate(vSortWhiskers):
                thatCentroid = wCComp.Centroid
                centroidDistList.append(
                    DistBetweenPoints(currCentroid, thatCentroid))
                #print("whisker", wIdx, "centroidX", thatCentroid.X, "distance", DistBetweenPoints(currCentroid, thatCentroid))
            bestCentroidIdx = centroidDistList.index(min(centroidDistList))
            print("Best centroid is whisker", bestCentroidIdx)
            # But careful: could be that the whisker has disappeared, or reappeared
            if bestBaseIdx != bestCentroidIdx:  #resolve
                if len(vSortWhiskers) < numWhiskers:
                    print("Conflict with best base. Use centroid index",
                          bestCentroidIdx)
                    bestIdx = bestCentroidIdx  #be conservative
                else:
                    print("Conflict with best base. Keep current index",
                          whiskerIndex)
                    bestIdx = whiskerIndex  #be conservative
            else:
                if len(vSortWhiskers) == numWhiskers:
                    print(
                        "No conflict, no whisker number change so keep current index",
                        whiskerIndex)
                    bestIdx = whiskerIndex  #be conservative
                else:
                    print(
                        "No conflict but whisker number change so use base index",
                        bestBaseIdx)
                    bestIdx = bestBaseIdx  #
        else:
            bestIdx = bestBaseIdx
        #print("whisker Index is now", bestIdx)
        if bestIdx != whiskerIndex:
            print("Jump!")
        thatBase = FindBasePoint(
            vSortWhiskers[bestIdx].Contour.ToArray[Point]())
        baseDist = DistBetweenPoints(currBase, thatBase)
        if baseDist < 2 * baseDistThd:
            #print("selected whisker is ", bestIdx)
            whiskerIndex = bestIdx
            currBase = thatBase
            currCentroid = vSortWhiskers[whiskerIndex].Centroid
        else:
            #print("no whisker selected")
            whiskerIndex = float.NaN
        noWhisker = False
    else:
        # if no whisker components, return nan
        #print("no whisker present")
        noWhisker = True
        whiskerIndex = float.NaN
    # Keep track dof the number of whiskers
    numWhiskers = len(vSortWhiskers)
    # Create whisker component
    Component = ConnectedComponentCollection(sortedRegions.ImageSize)
    if Single.IsNaN(whiskerIndex) == False:
        #print("creating component")
        Component.Add(vSortWhiskers[int(whiskerIndex)])

    return Component
コード例 #26
0
def tolist(col):
    return Enumerable.ToList(col)