<div dir="ltr">Hi Ilaria,<div><br></div><div>I just tested the filter_tracks command, and it appears to be behaving as expected:</div><br>> filter_tracks is doing an OR operation rather than AND, when I use two combined ROIs.<br><br>If by "combined ROIs" you mean that you have taken two separate ROI images, each with a single "blob", and then taken e.g. the sum of those two images and written it to a new image, and provided that final image in filter_tracks using the -include option: Then yes, MRtrix will effectively perform an OR operation. Once those images are combined, MRtrix doesn't care whether or not there are multiple individual "blobs" in the image; it's simply testing each streamline to see if the image is non-zero at any point along the streamline. Similarly, if you do the same experiment but in conjunction with the -invert option, then only streamlines that do not intersect the mask image at any point along their length will be written to the output file.<br><br>> I don’t get any filtering when I use -include roi1 -include roi2<br><div><br></div><div>By "no filtering", do you mean that all input streamlines are being written to the output file? This behaved exactly as expected for me:</div><div><font face="monospace, monospace">filter_tracks in.tck -include ROI0.mif -include ROI1.mif out.tck</font> selects only those streamlines that go through <i>both</i> ROIs.</div><div><font face="monospace, monospace">filter_tracks in.tck -include ROI0.mif -include ROI1.mif -invert out.tck</font> omits those streamlines that traverse both ROIs, but writes all other streamlines to file (including those that intersect one ROI but not the other).<br></div><div><br></div><div>I would suggest checking your data very closely to make sure you are in fact providing the correct images / tracks to the command. If you are struggling to extract a complex bundle, I would suggest instead manually drawing very simple ROIs in the middle of the white matter, and experimenting with the filter_tracks command using those ROIs, in order to ensure that everything is behaving as it should.</div><div><br></div><div>Cheers</div><div>Rob</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><br>--<br><br><span style="color:rgb(255,102,0)"><b>Robert Smith, Ph.D</b><br>Senior Research Officer, Imaging Division</span><br><br>The Florey Institute of Neuroscience and Mental Health<br>Melbourne Brain Centre - Austin Campus<br>245 Burgundy Street<br>Heidelberg Vic 3084<br>Ph: +61 3 9035 7128<br>Fax: +61 3 9035 7301<br><a href="http://www.florey.edu.au/" target="_blank">www.florey.edu.au</a><br></div></div><div dir="ltr"><br></div><div><i>MRtrix3</i>: Advanced tools for the analysis of diffusion MRI data</div><div><a href="http://www.mrtrix.org/" target="_blank">Website</a> - <a href="http://www.mrtrix.org/blog/" target="_blank">Blog</a> - <a href="https://github.com/MRtrix3/mrtrix3" target="_blank">Repository</a> - <a href="http://community.mrtrix.org/" target="_blank">Community forum</a></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Wed, Jun 14, 2017 at 6:50 AM, Ilaria Sani <span dir="ltr"><<a href="mailto:isani01@mail.rockefeller.edu" target="_blank">isani01@mail.rockefeller.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div class="m_-5772326043025380713WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Sorry Rob, I made a mistake…<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">My problem is that:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">filter_tracks is doing an OR operation rather than AND, when I use two combined ROIs.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">+<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I don’t get any filtering when I use </span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">-include roi1 -include roi2<u></u><u></u></span></p><span class="">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Is that working for you?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Am I doing something wrong/different?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><a name="m_-5772326043025380713__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></a></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Ilaria<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
</span><div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <a href="mailto:mrtrix-discussion-bounces@www.nitrc.org" target="_blank">mrtrix-discussion-bounces@www.<wbr>nitrc.org</a> [mailto:<a href="mailto:mrtrix-discussion-bounces@www.nitrc.org" target="_blank">mrtrix-discussion-<wbr>bounces@www.nitrc.org</a>]
<b>On Behalf Of </b>Ilaria Sani<br>
<b>Sent:</b> Tuesday, June 13, 2017 3:21 PM<br>
<b>To:</b> Robert Smith <<a href="mailto:robert.smith@florey.edu.au" target="_blank">robert.smith@florey.edu.au</a>></span></p><div><div class="h5"><br>
<b>Cc:</b> <a href="mailto:mrtrix-discussion@www.nitrc.org" target="_blank">mrtrix-discussion@www.nitrc.<wbr>org</a><br>
<b>Subject:</b> Re: [Mrtrix-discussion] filter_tracks<u></u><u></u></div></div><p></p>
</div>
</div><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Hi Rob,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I’m using the syntax suggested in filter_tracks documentation:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:13.5pt;color:black">filter_tracks [ options ] input output</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">that is:
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">filter_tracks -invert -include
<i>my-combined-rois</i> <i>my-input-connectome</i> <i>output.tck</i><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">This is working, but it’s doing an AND operation rather than OR.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I also tried to use –include twice, once for each roi.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I don’t get any error, but no filtering is happening.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">For example, if my input connectome has 500k streamlines, the filtered output connectome will have 500k streamlines too.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Here is my syntax:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">filter_tracks
<i>my-intput-connectome</i> -include roi1 -include roi2 -invert <i>output.tck<u></u><u></u></i></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">or<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">filter_tracks -include roi1 -include roi2 -invert <i>my-intput-connectome</i>
<i>output.tck<u></u><u></u></i></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Is that working for you?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Am I doing something wrong/different?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Ilaria<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Robert Smith [<a href="mailto:robert.smith@florey.edu.au" target="_blank">mailto:robert.smith@florey.<wbr>edu.au</a>]
<br>
<b>Sent:</b> Monday, June 12, 2017 9:05 PM<br>
<b>To:</b> Ilaria Sani <<a href="mailto:isani01@rockefeller.edu" target="_blank">isani01@rockefeller.edu</a>><br>
<b>Cc:</b> <a href="mailto:mrtrix-discussion@www.nitrc.org" target="_blank">mrtrix-discussion@www.nitrc.<wbr>org</a><br>
<b>Subject:</b> Re: [Mrtrix-discussion] filter_tracks<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hi <span style="font-size:9.5pt">Ilaria,</span><u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt">If you combine the two ROIs into a single image, then filter_tracks will treat that singular image as a single ROI, and<br>
hence operate on any track that touches any highlighted voxel in that image.<br>
This is why any track touching <i>either</i> of the two ROIs is being removed.</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt">In order to perform your desired operation (remove all tracks that touch both ROIs), you want to use the following:</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:"Courier New"">filter_tracks in.tck -include ROI1.mif -include ROI2.mif -invert out.tck</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt">By providing the two ROIs separately to filter_tracks using separate -include options, you are specifying that you are</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt">interested only in tracks that touch both ROIs. The -invert option then specifies that those streamlines elected by the</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt">ROIs are to be <i>excluded</i> from the output, rather than being the only streamlines included in the output.</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt">Cheers</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt">Rob</span><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><br clear="all">
<u></u><u></u></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><br>
--<br>
<br>
<b><span style="color:#ff6600">Robert Smith, Ph.D</span></b><span style="color:#ff6600"><br>
Senior Research Officer, Imaging Division</span><br>
<br>
The Florey Institute of Neuroscience and Mental Health<br>
Melbourne Brain Centre - Austin Campus<br>
245 Burgundy Street<br>
Heidelberg Vic 3084<br>
Ph: <a href="tel:+61%203%209035%207128" value="+61390357128" target="_blank">+61 3 9035 7128</a><br>
Fax: <a href="tel:+61%203%209035%207301" value="+61390357301" target="_blank">+61 3 9035 7301</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.florey.edu.au_&d=DwMFaQ&c=JeTkUgVztGMmhKYjxsy2rfoWYibK1YmxXez1G3oNStg&r=YP6hL_RiH1GzLni5-fQIc9iVR40St75EyTMGejOj-k4&m=Vu67mF4YNrX2iO4rwrovBrbhXAwd-oou9Cr88dECwo0&s=azRcMvKDTbK_t1OtNcmpCVjII20tAA99t5Sr3yu4Jq4&e=" target="_blank">www.florey.edu.au</a><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><i>MRtrix3</i>: Advanced tools for the analysis of diffusion MRI data<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mrtrix.org_&d=DwMFaQ&c=JeTkUgVztGMmhKYjxsy2rfoWYibK1YmxXez1G3oNStg&r=YP6hL_RiH1GzLni5-fQIc9iVR40St75EyTMGejOj-k4&m=Vu67mF4YNrX2iO4rwrovBrbhXAwd-oou9Cr88dECwo0&s=hPkZWFiRlkAopMx3WsLeANC99YUEkTBc4tHENjhzZJg&e=" target="_blank">Website</a> -
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mrtrix.org_blog_&d=DwMFaQ&c=JeTkUgVztGMmhKYjxsy2rfoWYibK1YmxXez1G3oNStg&r=YP6hL_RiH1GzLni5-fQIc9iVR40St75EyTMGejOj-k4&m=Vu67mF4YNrX2iO4rwrovBrbhXAwd-oou9Cr88dECwo0&s=gEf4eHJ21qIW_lpQImNlPP8EdjUcCSia7-ecw-Hd0CY&e=" target="_blank">
Blog</a> - <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_MRtrix3_mrtrix3&d=DwMFaQ&c=JeTkUgVztGMmhKYjxsy2rfoWYibK1YmxXez1G3oNStg&r=YP6hL_RiH1GzLni5-fQIc9iVR40St75EyTMGejOj-k4&m=Vu67mF4YNrX2iO4rwrovBrbhXAwd-oou9Cr88dECwo0&s=48EQDWs-nHYYCnkgaJQ3hpcXHR5WhpOKgpVK50mXvYo&e=" target="_blank">
Repository</a> - <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__community.mrtrix.org_&d=DwMFaQ&c=JeTkUgVztGMmhKYjxsy2rfoWYibK1YmxXez1G3oNStg&r=YP6hL_RiH1GzLni5-fQIc9iVR40St75EyTMGejOj-k4&m=Vu67mF4YNrX2iO4rwrovBrbhXAwd-oou9Cr88dECwo0&s=CUiQWQ8ND7m-y9_G9tTqj19USd5e-7VReXeZUdnCvEM&e=" target="_blank">
Community forum</a><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Mon, Jun 12, 2017 at 4:18 AM, Ilaria Sani <<a href="mailto:isani01@mail.rockefeller.edu" target="_blank">isani01@mail.rockefeller.edu</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt">Dear All,<br>
<br>
I'm using Mrtrix 0.2<br>
<br>
I would like to remove some specific tracks from my connectome. Specifically all the tracks between two ROIs.<br>
<br>
The closest thing I found is filter_tracks.<br>
The ROI I’m using is the combination of the two ROIs.<br>
However filter_tracks removes all the streamlines touching one OR the other ROI.<br>
<br>
Is there a way to select only the streamlines touching both?<br>
Alternatively, is there any other tool that removes tracks between two ROIs from the connectome?<br>
<br>
Thanks!!<br>
<br>
Ilaria<br>
______________________________<wbr>_________________<br>
Mrtrix-discussion mailing list<br>
<a href="mailto:Mrtrix-discussion@www.nitrc.org" target="_blank">Mrtrix-discussion@www.nitrc.<wbr>org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.nitrc.org_mailman_listinfo_mrtrix-2Ddiscussion&d=DwMFaQ&c=JeTkUgVztGMmhKYjxsy2rfoWYibK1YmxXez1G3oNStg&r=YP6hL_RiH1GzLni5-fQIc9iVR40St75EyTMGejOj-k4&m=Vu67mF4YNrX2iO4rwrovBrbhXAwd-oou9Cr88dECwo0&s=UD94m_2Uuz6CbYnaYaw3aR0t6FUHjL-FbrtKDdj4pOg&e=" target="_blank">http://www.nitrc.org/mailman/<wbr>listinfo/mrtrix-discussion</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div>
</blockquote></div><br></div>