Filter streamlines by elimination not truncation

Hi everyone,
I have a question about tckedit command. Before, I used another software (DSI Studio) to dissect white matter fibers virtually. I am not a fan of ROI-based tractography, because over the years I found it to produce bundles that are smaller in volume. However, I do virtual dissection for all my patients’ data despite it is a time-consuming process but the results are much better in my opinion. Usually, in the beginning, I run an analysis with 10K streamlines of the white matter (to save memory) and do a virtual dissection to those streamlines to bring a certain tract (e.g., SLF2). This tract’s streamlines are later converted into masks. After that, I will run tractography for 3 million or more streamlines for the white matter and use that mask to filter “streamlines” running “totally” within that mask. In other words, the streamlines that exiting the mask will be “eliminated.”
When I tried to apply the same concept with mrtrix tckedit using -mask option, I faced a problem. The mask will not eliminate those tracts that exit the mask, but instead, it will truncate them. Then, I would end with a mask containing the targeted tract (the SLF2) and several other truncated white matter bundles.
Is there a way by using a mask to filter unwanted streamlines by eliminating and not truncating?
Hope to hear your suggestions and recommendations. Thanks.


Hi Mudathir,

I think there’s a lot of ambiguity in the terminology being used here, especially between different software packages. If I were to instead re-phrase your intention as:

“I wish to reject any streamline for which even a single vertex resides outside of my binary mask image”

, then it is hopefully more clear that the operation that you are performing is in fact better described as whole-streamline exclusion; unlike tckedit's -mask option, which operates vertex-wise.

The way then to apply such given the MRtrix3 interface is to invert your binary mask (mrcalc 1 mask.mif -sub -), and then provide that to tckedit using the -exclude option.