Skip to content

Collection

Introduction

vtkCollection is a container of multiple vtkObject items. This can be useful for encapsulating multiple vtkObjects such as images into a single vtkObject (vtkCollection instance) to be passed as input to other filters and mappers as a single unit.

Methods

addItem

Add item (vtkObject) to the collection

ArgumentTypeRequiredDescription
itemvtkObjectYesitem to be added to the collection

empty

Check if the collection is empty

extend

Method used to decorate a given object (publicAPI+model) with vtkCollection characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesICollectionInitialValuesNo(default: {})

getItem

get the current item and provided index, returns null if index is out of bounds

getNumberOfItems

Get the total number of items in the collection

insertItem

Add item (vtkObject) to the collection at the given index. This differs from VTK-C++ where insertItem inserts at position after the provided index value.

ArgumentTypeRequiredDescription
idxnumberYesindex where the new item should be inserted.
itemvtkObjectYesitem to be inserted

isItemPresent

Check if a provided item is already present in the collection

newInstance

Method used to create a new instance of vtkCollection.

ArgumentTypeRequiredDescription
initialValuesICollectionInitialValuesNofor pre-setting some of its content

removeAllItems

Remove all items from the collection

removeItem

Remove an existing item from the collection

ArgumentTypeRequiredDescription
inValuenumber or vtkObjectYesindex or reference of an item to be removed

replaceItem

Replace an existing item (vtkObject) with a new one

ArgumentTypeRequiredDescription
idxnumberYesindex of item to be replaced
itemvtkObjectYes

updateMTimeWithElements

Check each element for modified time and update the collection's MTime to the latest timestamp from individual items in the collection.