# Fast way to convert a vtkIdList to vtkIdTypeArray

**URL:** https://discourse.slicer.org/t/fast-way-to-convert-a-vtkidlist-to-vtkidtypearray/31271
**Category:** Development
**Tags:** python
**Created:** [August 22, 2023, 3:43am UTC](https://discourse.slicer.org/t/fast-way-to-convert-a-vtkidlist-to-vtkidtypearray/31271 "2023-08-22T03:43:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![lucsdjango](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lucsdjango/32/65958_2.png) [@lucsdjango](https://discourse.slicer.org/u/lucsdjango)
#### Post date: [August 22, 2023, 3:43am UTC](https://discourse.slicer.org/t/fast-way-to-convert-a-vtkidlist-to-vtkidtypearray/31271/1 "2023-08-22T03:43:01Z")

</div>

Hello

I am working on a python scripted module and want to convert a vtkIdList (output from vtkStaticPointLocator::FindPointsWithinRadius) to a vtkIdTypeArray. What is the best way to do this?

So far I have only found code examples where they iterate through all items, adding them to the array, which for me runs quite slow.

I have not found any working examples using vtkIdList::SetArray, and cannot seem to get it working myself. Is there an quick way to access vtkIdList’s underlying array?

Thankful for any advice!  
/Jens
