Closed SebastienDam01 closed 1 year ago
Hi @SebastienDam01,
I think the error is caused by a wrong generation of the kernels. Since you have no EC compartment, in your script you have to specify no values when you generate the kernerls for that compartment, so d_perps_zep = []
.
Let us know if this solve your issue.
Hi @nightwnvol,
Thanks for your help, this indeed solved the error ! However, I got another issue while following the rest of the tutorial. I managed to fit the model but while preparing the anatomical prior on bundles, I could not compute the individual weight for each bundle.
# Model fitting
[...]
# Retrieve the streamline contributions
x_nnls, _, _ = mit.get_coeffs(get_normalized=False)
# Prepare the anatomical prior on bundles
C = np.loadtxt(f'{sub}_parcels.csv', delimiter=',')
C = np.triu( C ) # be sure to get only the upper-triangular part of the matrix
group_size = C[C>0].astype(np.int32)
# Indices of the streamlines composing each bundle
tmp = np.insert(np.cumsum(group_size), 0, 0)
group_idx = np.array( [np.arange(tmp[i],tmp[i+1]) for i in range(len(tmp)-1)], dtype=np.object_ )
# Individual weight for each bundle to penalize all groups of streamlines in the same manner regardless of their cardinality
group_w = np.empty_like( group_size, dtype=np.float64 )
for k in range(group_size.size) :
group_w[k] = np.sqrt(group_size[k]) / ( np.linalg.norm(x_nnls[group_idx[k]]) + 1e-12 )
IndexError: index 147765 is out of bounds for axis 0 with size 147765
My tractogram (passed to trk2dictionary.run()
) containing only the connecting streamlines fibers_connecting.tck
has 147765 streamlines, while the cumulative sum of streamlines in my connectome {sub}_parcels.csv
is equal to 7383185, thus far surpassing my tractogram. As the IC coefficients x_nnls
estimated is also the same size as my tractogram, x_nnls[group_idx[k]]
returns this index error.
I may be missing something again while constructing my tractogram or elsewhere. Please tell me if I can change something in my code.
Maybe an error with your fibers_assignment.txt
file?
I just noticed that in the connectome2tck
command, you've specified the assignments_{sub}_parcels.csv
file as input assignments, but your file should be fibers_assignment.txt
(output from the tck2connectome
command).
Yes, that solved my problem, sorry for those confusing errors !
Hello,
I am trying to run COMMIT2 on my data preprocessed by QSIPrep and tractogram obtained from MRtrix3. I followed the tutorial but got an error when building the linear operator.
The tractogram was obtained using the iFOD2 algorithm, based on anatomically constrained tractography.
Code input
Terminal output
This error originates from the file
core.pyx
line 691 when the following condition is met:if self.DICTIONARY['EC']['nE'] <= 0 and self.KERNELS['wmh'].shape[0] > 0 :
Having no EC compartments, the value
self.DICTIONARY['EC']['nE']
is set to 0. Thus, I do not understand this part but I may be missing something here.On a side note, the b-values of my data should be 1500s/mm2 and 3000s/mm2 but they oscillate around these values in the b-values file, resulting in more than 2 shells when loading the data. I am not sure if this could have an impact on my error, though.
Please let me know if I can provide any further information.
Thank you very much,
Sébastien