def testCollectionChild(self): #check that iteration is being inherited correctly dataArray = vtk.vtkIntArray() dataArrayCollection = vtk.vtkDataArrayCollection() dataArrayCollection.AddItem(dataArray) self.assertEqual([obj for obj in dataArrayCollection], [dataArray])
def GetArray(self, name): ''' Returns the vtkDataArray contained in the DataSet or in metadataset, named name returns NULL if not found @param name: str @return: None ''' for i in self.__ArrayCollection.GetNumberOfItems(): if self.__ArrayCollection.GetItem(i).GetName() and self.__ArrayCollection.GetItem(i).GetName()=="name": return self.__ArrayCollection.GetItem(i) # then try in the pointdata and celldata array collections ret=None arrays = vtk.vtkDataArrayCollection() self.GetColorArrayCollection(arrays) for i in range(arrays.GetNumberofItems()): if arrays.GetItem(i).GetName() and arrays.GetItem(i).GetName()=="name": ret=arrays.GetItem(i) break # del array return ret
def __init__(self): ''' Constructor ''' self.__Type = self.VTK_META_UNKNOWN self.__pickedPointId = -1 #int self.__PickedCellId = -1 #int self.__DataSet = 0 #vtkDataSet self.__ActorList = vtk.vtkActorCollection() #vtkDataArrayCollection self.__Time = -1 #double self.__Property = 0 #vtkObject self.__ArrayCollection = vtk.vtkDataArrayCollection() #vtkDataArrayCollection self.__CurrentScalarArray = 0 #vtkDataArray self.__Name = "" #string self.__FilePath = "" #string self.__Tag = "" #string self.__Lock = 0 #int self.__MetaDataDictionary = None #itk.MetaDataDictionary self.__WirePolyData = None #vtkPolyData self.Initialize()