the-virtual-brain / tvb-recon

Tools for creating full TVB models from individual anatomical scans
Other
33 stars 21 forks source link

show_aparc_aseg_with_new_values fails w/ -1 index #22

Open maedoc opened 7 years ago

maedoc commented 7 years ago

Testing locally, I see a failure in test_show_aparc_aseg_with_new_values(), where in

            for i in xrange(aparc_aseg_matrix.shape[0]):
                for j in xrange(aparc_aseg_matrix.shape[1]):
                    if aparc_aseg_matrix[i][j] > 0:
                        if fs_to_conn_indices_mapping.has_key(aparc_aseg_matrix[i][j]):
                            aparc_aseg_matrix[i][j] = conn_measure[
                                fs_to_conn_indices_mapping.get(aparc_aseg_matrix[i][j])]
                        else:
                            aparc_aseg_matrix[i][j] = -1

I've fs_to_conn_indices_mapping.get(aparc_aseg_matrix[i][j]) returning -1.0, which is not a valid index. I don't see why this would pass on Travis but not locally (macos 10 10).

maedoc commented 7 years ago

This seems equivalent do a labelconvert from mrtrix.

I'm also certain this should be rewritten a la

aa_nnz = aparc_aseg_mat > 0
aparc_aseg_mat = aparc_aseg_mat * (~aa_nnz) + fs_conn_map[aparc_aseg_mat] * aa_nzz

but the issue remains: fs_conn_map has negative values, which are invalid for indexing.