CubicalGridStream

org.appliedtopology.tda4j.CubicalGridStream
See theCubicalGridStream companion object
open class CubicalGridStream(val shape: IndexedSeq[Int], val topCellValue: IndexedSeq[Int] => Double, val parallelFiltrationValue: Boolean = ..., val nanMask: Boolean = ...) extends StratifiedCellStream[Cube, Double], DoubleFiltration[Cube]

The cubical complex of a full rectangular grid, filtered by the values of its top cells (pixels, voxels): every other cube gets the minimum value of the top cells containing it, the sublevel-set convention of GUDHI, DIPHA and Perseus. A face is contained in every top cell its cofaces are, so the filtration is monotone. For superlevel sets, negate the values (what CubicalImage's sublevel = false does).

A top cell of value Double.NaN is masked: it is not in the complex. NaN has no sign and compares to nothing, so it means the same in a sublevel and a superlevel image. Every other cube takes the minimum over the UNMASKED top cells containing it, and is not in the complex either when all of them are masked: the complex is the closure of the unmasked top cells. Infinite values are ordinary values: a top cell of value +Infinity enters at +Infinity. With nanMask = false masks are off: a NaN value is an error, naming the pixel, when the values are first read.

shape(i) is the number of pixels along axis i. The complex has prod_i (2 shape(i) + 1) cells (totalCellCount): a 256x256 image has 513² = 263169.

Attributes

Companion
object
Experimental
true
Source
CubicalStream.scala
Graph
Supertypes
trait StratifiedCellStream[Cube, Double]
trait CellStream[Cube, Double]
trait IterableOnce[Cube]
trait Filtration[Cube, Double]
trait Filterable[Double]
class Object
trait Matchable
class Any
Show all
Known subtypes

Members list

Value members

Concrete methods

override def iterateDimension: PartialFunction[Int, Iterator[Cube]]

The cubes of dimension d (0 <= d <= ambientDim) in the complex (masked ones left out), oldest first. Each call builds and sorts the whole dimension.

The cubes of dimension d (0 <= d <= ambientDim) in the complex (masked ones left out), oldest first. Each call builds and sorts the whole dimension.

Attributes

Definition Classes
Source
CubicalStream.scala
def onBoundary(c: Cube): Boolean

Whether c lies on the boundary of the grid, the rectangle or box the pixels fill: along some axis it is the point at the first or the last lattice coordinate (a pixel never is). A face of a boundary cube is a boundary cube, so these cubes form the subcomplex that Relative.ofBoundary divides out.

Whether c lies on the boundary of the grid, the rectangle or box the pixels fill: along some axis it is the point at the first or the last lattice coordinate (a pixel never is). A face of a boundary cube is a boundary cube, so these cubes form the subcomplex that Relative.ofBoundary divides out.

Attributes

Source
CubicalStream.scala
def topValues: IndexedSeq[Double]

Every top cell's value in row-major order (the last axis fastest), read from topCellValue once (in parallel when parallelFiltrationValue): the pixels of the image, as CubicalImage.fromFlatArray takes them. A read-only view of topCellValues, which is not copied.

Every top cell's value in row-major order (the last axis fastest), read from topCellValue once (in parallel when parallelFiltrationValue): the pixels of the image, as CubicalImage.fromFlatArray takes them. A read-only view of topCellValues, which is not copied.

Attributes

Source
CubicalStream.scala
def totalCellCount: Long

Total cell count of the full grid complex, by the "sum over subsets of a product = product of (in-choice + out-choice)" identity: for a fixed set of non-degenerate axes there are shape(i) choices along a non-degenerate axis and shape(i)+1 along a degenerate one, and summing that product over every subset of non-degenerate axes collapses to prod_i (shape(i) + (shape(i)+1)). O(ambientDim), no enumeration needed.

Total cell count of the full grid complex, by the "sum over subsets of a product = product of (in-choice + out-choice)" identity: for a fixed set of non-degenerate axes there are shape(i) choices along a non-degenerate axis and shape(i)+1 along a degenerate one, and summing that product over every subset of non-degenerate axes collapses to prod_i (shape(i) + (shape(i)+1)). O(ambientDim), no enumeration needed.

Attributes

Source
CubicalStream.scala

Inherited methods

def homologyDegreeLimit: Option[Int]

Some(k) for a complex cut off to compute homology in degrees 0..k (what VietorisRips(points, maxDimension = k) returns, holding cells up to dimension k + 1): its higher degrees are not the homology of the full complex. None (the default) for a complete complex.

Some(k) for a complex cut off to compute homology in degrees 0..k (what VietorisRips(points, maxDimension = k) returns, holding cells up to dimension k + 1): its higher degrees are not the homology of the full complex. None (the default) for a complete complex.

Attributes

Inherited from:
StratifiedCellStream
Source
SimplexStream.scala
override def iterator: Iterator[Cube]

All the cells, dimension by dimension. Stops at the first undefined dimension (takeWhile, never filter, which would search forever past the last one).

All the cells, dimension by dimension. Stops at the first undefined dimension (takeWhile, never filter, which would search forever past the last one).

Attributes

Definition Classes
StratifiedCellStream -> IterableOnce
Inherited from:
StratifiedCellStream
Source
SimplexStream.scala
def knownSize: Int

The number of elements in this collection, if it can be cheaply computed, -1 otherwise. Cheaply usually means: Not requiring a collection traversal.

The number of elements in this collection, if it can be cheaply computed, -1 otherwise. Cheaply usually means: Not requiring a collection traversal.

Attributes

Inherited from:
IterableOnce
Source
IterableOnce.scala
def stepper[S <: Stepper[_]](implicit shape: StepperShape[Cube, S]): S

Returns a scala.collection.Stepper for the elements of this collection.

Returns a scala.collection.Stepper for the elements of this collection.

The Stepper enables creating a Java stream to operate on the collection, see scala.jdk.StreamConverters. For collections holding primitive values, the Stepper can be used as an iterator which doesn't box the elements.

The implicit scala.collection.StepperShape parameter defines the resulting Stepper type according to the element type of this collection.

  • For collections of Int, Short, Byte or Char, an scala.collection.IntStepper is returned
  • For collections of Double or Float, a scala.collection.DoubleStepper is returned
  • For collections of Long a scala.collection.LongStepper is returned
  • For any other element type, an scala.collection.AnyStepper is returned

Note that this method is overridden in subclasses and the return type is refined to S with EfficientSplit, for example scala.collection.IndexedSeqOps.stepper. For Steppers marked with scala.collection.Stepper.EfficientSplit, the converters in scala.jdk.StreamConverters allow creating parallel streams, whereas bare Steppers can be converted only to sequential streams.

Attributes

Inherited from:
IterableOnce
Source
IterableOnce.scala

Concrete fields

val ambientDim: Int

Attributes

Source
CubicalStream.scala
override val filtrationOrdering: Ordering[Cube]

FiltrationOrdering.canonical with cubeOrdering as tie-break. Ties are common here: a face shares its value with at least one coface.

FiltrationOrdering.canonical with cubeOrdering as tie-break. Ties are common here: a face shares its value with at least one coface.

Attributes

Source
CubicalStream.scala
override val filtrationValue: PartialFunction[Cube, Double]

Attributes

Source
CubicalStream.scala
val nanMask: Boolean

Attributes

Source
CubicalStream.scala

Attributes

Source
CubicalStream.scala
val shape: IndexedSeq[Int]

Attributes

Source
CubicalStream.scala
val topCellValue: IndexedSeq[Int] => Double

Attributes

Source
CubicalStream.scala

Inherited fields

val largest: Double

Attributes

Inherited from:
DoubleFiltration
Source
SimplexStream.scala
val smallest: Double

Attributes

Inherited from:
DoubleFiltration
Source
SimplexStream.scala