import CellNeighborList from 'Artistoo/src/stats/CellNeighborList.js'
public class | source

CellNeighborList

Extends:

Stat → CellNeighborList
this class is experimental.

This stat computes a list of all cell ids of the cells that border to "cell" and belong to a different cellid, also giving the interface length for each contact.

Example:

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

// Set up a CPM and manipulator
let C = new CPM.CPM( [300,300], {
	T:20, 
	torus:[false,false],
	J:[[0,20],[20,10]], 
	V:[0,200], 
	LAMBDA_V:[0,2]
})
let gm = new CPM.GridManipulator( C )

// Seed a cells, run a little, then divide it
gm.seedCell(1)
for( let t = 0; t < 50; t++ ){
	C.timeStep()
}
gm.divideCell(1)

// Get neighborlist
console.log(  C.getStat( CPM.CellNeighborList ) )	

Member Summary

Public Members
public

M: CPM

The CPM to compute borderpixels for.

public set

model(M: CPM)

The set model function of CellNeighborList requires an object of type CPM.

Method Summary

Public Methods
public

The compute method of CellNeighborList computes for each cell on the grid a list of all pixels at its border that belong to a different cellid.

public

getNeighborsOfCell(cellid: CellId, cellborderpixels: CellArrayObject): CellObject

The getNeighborsOfCell method of CellNeighborList computes a list of all pixels that border to "cell" and belong to a different cellid.

Inherited Summary

From class Stat
public set

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

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 Members

public M: CPM source

The CPM to compute borderpixels for.

Override:

Stat#M

public set model(M: CPM) source

The set model function of CellNeighborList requires an object of type CPM.

Override:

Stat#model

Public Methods

public compute(): CellObject source

The compute method of CellNeighborList computes for each cell on the grid a list of all pixels at its border that belong to a different cellid.

Override:

Stat#compute

Return:

CellObject

a dictionairy with keys = cell ids, and values = an object produced by getNeighborsOfCell (which has keys for each neighboring cellid and values the number of contacting pixels for that cell).

public getNeighborsOfCell(cellid: CellId, cellborderpixels: CellArrayObject): CellObject source

The getNeighborsOfCell method of CellNeighborList computes a list of all pixels that border to "cell" and belong to a different cellid.

Params:

NameTypeAttributeDescription
cellid CellId

the unique cell id of the cell to get neighbors from.

cellborderpixels CellArrayObject

object produced by BorderPixelsByCell, with keys for each cellid and as corresponding value the border pixel indices of their pixels.

Return:

CellObject

a dictionairy with keys = neighbor cell ids, and values = number of neighbor cellpixels at the border.