[Neuroimaging] [dipy] connectivity_matrix

Jan Schreiber schreiber at cbs.mpg.de
Fri Aug 21 17:44:53 CEST 2015


Hi Dipy Experts,

the function "connectivity_matrix()" provides the option to produce a
symmetric connectivity matrix.
The computation is done in line 202 in
https://github.com/nipy/dipy/blob/master/dipy/tracking/utils.py

201  if symmetric:
202      matrix = np.maximum(matrix, matrix.T)

The test of this function defines the expected matrix as

100  expected = expected + expected.T

I think the test might not be correct and it should be

100  expected = expected + expected.T - np.diag(np.diag(expected))

This does pop up as an error because the test does not include a
connection with start and end point in the same ROI. A within-ROI
connection produces an entry on the diagonal and would be counted twice
with "expected + expected.T".


A patch for an extended test is attached. I also added some more
combinations of possible connections.

What keeps puzzling me is that the function that computes the symmetry as
  matrix = np.maximum(matrix, matrix.T)
gives the same result as
  expected = expected + expected.T - np.diag(np.diag(expected))

Cheers,
Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-added-test-for-within-ROI-connections-in-connectivit.patch
Type: text/x-patch
Size: 4092 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20150821/74743a10/attachment.bin>


More information about the Neuroimaging mailing list