scilpy.connectivity package

scilpy.connectivity.connectivity_tools module

scilpy.connectivity.connectivity_tools.apply_olo(array, perm)[source]

Apply the permutation from compute_RCM.

Parameters:
  • array (ndarray (NxN)) – Sparse connectivity matrix.

  • perm (ndarray (N,)) – Permutations for rows and columns to be applied.

Returns:

Reordered array.

Return type:

ndarray (N,N)

scilpy.connectivity.connectivity_tools.apply_reordering(array, ordering)[source]

Apply a non-symmetric array ordering that support non-square output. The ordering can contain duplicated or discarded rows/columns.

Parameters:
  • array (ndarray (NxN)) – Sparse connectivity matrix.

  • ordering (list of lists) – First elements of the list is the permutation to apply to the rows. First elements of the list is the permutation to apply to the columns.

Returns:

tmp_array – Reordered array.

Return type:

ndarray (N,N)

scilpy.connectivity.connectivity_tools.compute_olo(array)[source]

Optimal Leaf Ordering permutes a weighted matrix that has a symmetric sparsity pattern using hierarchical clustering.

Parameters:

array (ndarray (NxN)) – Connectivity matrix.

Returns:

perm – Output permutations for rows and columns.

Return type:

ndarray (N,)

scilpy.connectivity.connectivity_tools.evaluate_graph_measures(conn_matrix, len_matrix, avg_node_wise, small_world)[source]

toDo Finish docstring

Parameters:
  • conn_matrix (np.ndarray of shape ??)

  • len_matrix (np.ndarray of shape ??)

  • avg_node_wise (bool) – If true, return a single value for node-wise measures.

  • small_world (bool) – If true, compute measure related to small worldness (omega and sigma). This option is much slower.

scilpy.connectivity.connectivity_tools.normalize_matrix_from_parcel(matrix, atlas_img, labels_list, parcel_from_volume)[source]
Parameters:
  • matrix (np.ndarray) – Connectivity matrix

  • atlas_img (nib.Nifti1Image) – Atlas for edge-wise division.

  • labels_list (np.ndarray) – The list of labels of interest for edge-wise division.

  • parcel_from_volume (bool) – If true, parcel from volume. Else, parcel from surface.

scilpy.connectivity.connectivity_tools.normalize_matrix_from_values(matrix, norm_factor, inverse)[source]
Parameters:
  • matrix (np.ndarray) – Connectivity matrix

  • norm_factor (np.ndarray of shape ?) – Matrix used for edge-wise multiplication. Ex: length or volume of the bundles.

  • inverse (bool) – If true, divide by the matrix rather than multiply.