# Extracting vtk streamlines

**URL:** <https://discourse.slicer.org/t/extracting-vtk-streamlines/3840>\
**Category:** Support\
**Created:** [August 19, 2018, 11:36pm UTC](https://discourse.slicer.org/t/extracting-vtk-streamlines/3840 "2018-08-19T23:36:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [August 19, 2018, 11:36pm UTC](https://discourse.slicer.org/t/extracting-vtk-streamlines/3840/1 "2018-08-19T23:36:27Z")

</div>

Hi,

I have a set of streamlines in vtk format that I’ve imported into 3d Slicer and also created a spherical model of 2 mm radius in 3d Slicer and saved it in vtk format. In the tri-planar views, I can see the cross section of the sphere in the axial/sagittal/coronal slices of the sphere model and the numerous points of the streamlines. What I’d like to do is filter out, i.e., select, streamlines that pass through the spherical model. Is there a module to do this in Slicer? Or if it has to be done programmatically in Python, what are the best vtk classes to do this type of operation?

Thanks for your help

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 20, 2018, 12:55am UTC](https://discourse.slicer.org/t/extracting-vtk-streamlines/3840/2 "2018-08-20T00:55:08Z")

</div>

There are several options. Are the streamlines result of CFD simulation or tractography? Do you need to select lines that are passing through a certain location or it is OK to assign an ID number to each line and display lines in a specific ID range?

---

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [August 20, 2018, 1:01am UTC](https://discourse.slicer.org/t/extracting-vtk-streamlines/3840/3 "2018-08-20T01:01:43Z")

</div>

these are tractography streamlines that were generated externally and i’d like to select a subset of these streamlines that pass through a sphere at defined location(s).

---

<div class="post-metadata">

**Author:** ![rkikinis](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rkikinis/32/791_2.png) [@rkikinis](https://discourse.slicer.org/u/rkikinis)\
**Post date:** [August 20, 2018, 1:24am UTC](https://discourse.slicer.org/t/extracting-vtk-streamlines/3840/4 "2018-08-20T01:24:42Z")

</div>

The tractography tools in the dMRI extension offer a variety of selection options out of the box, including brick shaped ROI’s that are customizable in shape and location.

---

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [August 20, 2018, 11:55am UTC](https://discourse.slicer.org/t/extracting-vtk-streamlines/3840/5 "2018-08-20T11:55:47Z")

</div>

Thanks for your help, I will try this out.

---

<div class="post-metadata">

**Author:** ![Vinny](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/vinny/32/7052_2.png) [@Vinny](https://discourse.slicer.org/u/Vinny)\
**Post date:** [August 21, 2018, 1:50am UTC](https://discourse.slicer.org/t/extracting-vtk-streamlines/3840/6 "2018-08-21T01:50:11Z")

</div>

Hi,

I was able to utilize the tractography tools in the dMRI extension for the imported vtk streamlines. I had generated a spherical model (in vtk format) in 3d Slicer and convert the sphere model into a label map in order to run tractography for these imported streamlines (using the Tractography ROI selection module). Is there a way to select streamlines that pass through the model itself without having to convert it to a label map? I noticed for the ‘Tractography seeding’ module, there is an option for use of a model as an input; however, it requires a DIffusionTensorVolume generated from the 3d Slicer workflow, which I don’t have.

Thanks
