# Filter streamlines by endpoint landing ROIs

**URL:** <https://community.mrtrix.org/t/filter-streamlines-by-endpoint-landing-rois/8817>\
**Category:** Uncategorized\
**Tags:** connectomics, tractography\
**Created:** [August 18, 2026, 2:07pm UTC](https://community.mrtrix.org/t/filter-streamlines-by-endpoint-landing-rois/8817 "2026-08-18T14:07:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhlegarreta](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jhlegarreta/32/4369_2.png) [@jhlegarreta](https://community.mrtrix.org/u/jhlegarreta)\
**Post date:** [August 18, 2026, 2:07pm UTC](https://community.mrtrix.org/t/filter-streamlines-by-endpoint-landing-rois/8817/1 "2026-08-18T14:07:32Z")

</div>

Hi folks,

I would like to make sure that the below usage of `tckedit` answers the following problem: having a tractogram that has been seeded from a region in the GMWMI, I am trying to find the streamlines that connect a number of ROI pairs defined on that GMWMI region. I am calling

```auto
tckedit ${in_tractogram_fname} \
  ${out_tractogram_fname} \
  -include ${mask1_fname} \
  -include ${mask2_fname} \
  -ends_only

```

Streamlines visually seem to be doing what is described above, but I have read several posts in the forum where this solution is not proposed, maybe because some of the options (e.g. `ends_only`) were not available at the time.

So, I am wondering whether the command above is the correct one to achieve the desired behavior.

Thank you.

---

<div class="post-metadata">

**Author:** ![adsouza](https://community.mrtrix.org/user_avatar/community.mrtrix.org/adsouza/32/4571_2.png) [@adsouza](https://community.mrtrix.org/u/adsouza)\
**Post date:** [August 26, 2026, 1:24am UTC](https://community.mrtrix.org/t/filter-streamlines-by-endpoint-landing-rois/8817/2 "2026-08-26T01:24:25Z")

</div>

Hi Jon,  
This seems sensible. Multiple `-include` options are combined with AND logic (a streamline must satisfy all of them), and `-ends_only` restricts the test to the two terminal points of each streamline rather than its whole path. So this extracts the streamlines with one endpoint in `mask1` and the other in `mask2`.

Hope this helps 🙂  
Arkiev

---

<div class="post-metadata">

**Author:** ![jhlegarreta](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jhlegarreta/32/4369_2.png) [@jhlegarreta](https://community.mrtrix.org/u/jhlegarreta)\
**Post date:** [September 29, 2026, 8:16am UTC](https://community.mrtrix.org/t/filter-streamlines-by-endpoint-landing-rois/8817/3 "2026-09-29T08:16:41Z")

</div>

Hi Arkiev,

sorry for the long delay and thanks for the reply. It is actually very helpful 👍 .
