This page

scikits.learn.feature_extraction.image.grid_to_graph

scikits.learn.feature_extraction.image.grid_to_graph(n_x, n_y, n_z=1, mask=None, return_as=<class 'scipy.sparse.coo.coo_matrix'>, dtype=<type 'bool'>)

Graph of the pixel-to-pixel connections

Edges exist if 2 voxels are connected.

Parameters :

n_x: int :

Dimension in x axis

n_y: int :

Dimension in y axis

n_z: int, optional, default 1 :

Dimension in z axis

mask : ndarray of booleans, optional

An optional mask of the image, to consider only part of the pixels.

return_as: np.ndarray or a sparse matrix class, optional :

The class to use to build the returned adjacency matrix.

dtype: dtype, optional, default bool :

The data of the returned sparse matrix. By default it is bool