Closed smeisler closed 2 years ago
Hi @smeisler ,
the code in the tutorial is just one way of achieving the grouping needed by COMMIT2, and we opted for this solution as it uses MRtrix which is widely used. I a not sure if your fix works as it is, because we need to group the streamlines in a given order and I am not sure what is the actual ordering when using the wildcards. But thanks for the solution, we will investigate it and run some tests! Stay tuned and thanks again :-)
Ah I see. Upon further inspection, indeed just using a single wildcard will result in the order not being correct. However, perhaps looping over just the i
elements and using a wildcard for j
will work? E.g.:
CMD = 'tckedit -force -nthreads 0'
for i in range(C.shape[0]):
if C[i,j] > 0 :
CMD += ' bundles/bundle_%d-*.tck' %(i+1)
os.system( CMD + ' demo01_fibers_connecting.tck' )
At least in this way, fibers will be grouped by their node1 assignment.
Appending 0s to node numbers would also help the wildcard approach (e.g. bundles_001-020
instead of bundles_1-20
but this was a MRtrix command so I am not sure it would be possible to change that or if it would have bad downstream effects.
Hello,
Using a wildcard for j
may also create tractograms with an incorrect order. But, using a similar approach, a solution can be to create the tractogram in two steps.
i
CMD = 'tckedit -force -nthreads 0'
for i in range(C.shape[0]):
CMD_i = 'tckedit -force -nthreads 0'
for j in range(i,C.shape[0]):
if C[i,j] > 0 :
CMD_i += ' bundles/bundle_%d-%d.tck' %(i+1,j+1)
os.system( CMD_i + ' bundles/demo01_fibers_connecting_%d.tck' % (i+1) )
CMD += ' bundles/demo01_fibers_connecting_%d.tck' %(i+1)
os.system( CMD + ' demo01_fibers_connecting.tck' )
Let us know if this avoid the problems with the terminal.
Best Mario
Hi,
In the COMMIT 2 wiki when one is getting the tractogram that only has connecting fibers in the connectome, the
tckedit
command string is very long when using an atlas with a large amount of nodes (number of inputs is scaled by n^2). Many terminals will not be able to handle a string that large.However,
tckedit
accepts wildcard operators, so the code block that looks like:can simply be changed to:
Hopefully this helps, Steven