Tckedit to traverse ANY inclusion regions in a mask

Dear all,

I would like to use tckedit to filter a tractogram to identify streamlines that traverse ANY inclusion regions in a mask. For example, I have a binary mask with two distinct clusters (cluster A and cluster B). I would like to identify the streamlines that traverse through only cluster A, only cluster B, and cluster A and cluster B. Is this possible?

I’ve seen the -include spec option. From my understanding, this would only provide the streamlines that traverse through cluster A and cluster B. Is this correct? A workaround would be to run tckedit -include spec twice for each cluster, however, ideally, I would like to do it in one step.

Apologises if this has been covered elsewhere and I’ve missed it, or if I’ve missed something in the documentation.

Many thanks in advance,
Ashlea

Hi Ashlea!

I think you’re right, multiple uses of -include is effectively an AND operation. You could do A OR B by combining the two regions into one single mask (e.g. using mrcalc) before feeding that to -include. You can do this in one step (sorta) using bash piping or command substitution like this:

# With a pipe
mrcalc A.mif B.mif -or -datatype bit - | tckedit tracks.tck -include - A_or_B.tck
# Or with substitution
tckedit tracks.tck -include $(mrcalc A.mif B.mif -or -datatype bit -) A_or_B.tck

I’m not enough of a bash poweruser to know the practical difference between those options though (something something, subprocesses and variables… :upside_down_face: ) so I’d say take your pick.

Hope that helps!
Fiona

1 Like