import ConnectedComponentsByCell from 'Artistoo/src/stats/ConnectedComponentsByCell.js'
public class

# ConnectedComponentsByCell

#### Extends:

Stat → ConnectedComponentsByCell

This Stat creates an object with the connected components of each cell on the grid. Keys are the CellId of all cells on the grid, corresponding values are objects where each element is a connected component. Each element of that array contains the ArrayCoordinate for that pixel.

#### Example:

let CPM = require( "path/to/build" )

// Make a CPM, seed a cell, and get the ConnectedComponentsByCell
let C = new CPM.CPM( [100,100], {
T:20,
J:[[0,20],[20,10]],
V:[0,200],
LAMBDA_V:[0,2]
} )
let gm = new CPM.GridManipulator( C )
gm.seedCell(1)
gm.seedCell(1)
for( let t = 0; t < 100; t++ ){ C.timeStep() }
C.getStat( CPM.ConnectedComponentsByCell )

## Method Summary

 Public Methods public The compute method of ConnectedComponentsByCell creates an object with connected components of the border of each cell on the grid. public connectedComponentsOfCell(cellid: CellId): object This method computes the connected components of a specific cell.

## Inherited Summary

 From class Stat public set model(M: GridBasedModel) Every stat is linked to a specific model. public The model to compute the stat on. public Configuration object for the stat, which should not change its value but may be used for logging and debugging options. public abstract compute() The compute method of the base Stat class throws an error, enforcing that you have to implement this method when you build a new stat class extending this base class.

## Public Methods

### publiccompute(): CellObject source

The compute method of ConnectedComponentsByCell creates an object with connected components of the border of each cell on the grid.

Stat#compute

#### Return:

 CellObject object with for each cell on the grid an object of components. These components in turn consist of the pixels (specified by ArrayCoordinate) belonging to that cell.

### publicconnectedComponentsOfCell(cellid: CellId): object source

This method computes the connected components of a specific cell.

#### Params:

 Name Type Attribute Description cellid CellId the unique cell id of the cell to get connected components of.

#### Return:

 object object of cell connected components. These components in turn consist of the pixels (specified by ArrayCoordinate) belonging to that cell.