Connectivity matrix for cluster permutation test on 3D data

Dear all,

I’m trying to perform cluster permutation tests on 3D spatial data (100 x 100 x 100 voxels).
Hence, my data matrix is of shape (n subjects, 1, 10e6).
As far as I understand it, the automatic computation of the adjacency matrix is designed for 2D spatial data. Is there a way to automatically compute the adjacency matrix of a 3D regular grid of points?
Thanks in advance!

mne.stats.combine_adjacency(*data.shape) will generate a sparse adjacency matrix where immediate neighbors along any axis will be considered adjacent.

1 Like