CubicalImage

org.appliedtopology.tda4j.streams.CubicalImage
object CubicalImage

Converting greyscale images and dense voxel grids into CubicalGridStreams. Every constructor here reduces to fromFlatArray: a dense n-dimensional grid from a flat, row-major array of values plus an explicit shape.

sublevel = true (the default, matching GUDHI/DIPHA/Perseus's own convention) treats pixel intensity directly as filtration value -- ascending intensity = later in the filtration. sublevel = false negates every value before handing it to CubicalGridStream -- the standard "sublevel of -f is superlevel of f, reparametrized" trick (see CubicalStream.scala's own doc for why CubicalGridStream itself deliberately carries no direction flag). Reported birth/death values under sublevel = false are then in NEGATED-intensity units, not raw 0..255 -- documented, expected behavior of this trick, not a bug to "fix" by flipping signs back.

No image-I/O dependency is added for voxel (3D+) data -- there is no single standard JDK-readable volumetric format, so voxel constructors here take an already-in-memory array; callers with a specific file format (NRRD, NIfTI, a raw slice stack, ...) are expected to load it into an array upstream, with whatever library that needs, and hand the result to fromFlatArray/fromVoxelGrid3D directly.

Attributes

Experimental
true
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def fromBufferedImage(img: BufferedImage, sublevel: Boolean = ..., parallelFiltrationValue: Boolean = ...): CubicalGridStream

img.getRGB(x, y) grayscale (luma) values as a dense grid, shape (width, height) -- axis 0 is the image's own x-axis, axis 1 is y.

img.getRGB(x, y) grayscale (luma) values as a dense grid, shape (width, height) -- axis 0 is the image's own x-axis, axis 1 is y.

Attributes

def fromFile(path: String, sublevel: Boolean = ..., parallelFiltrationValue: Boolean = ...): CubicalGridStream

Reads an image file via javax.imageio.ImageIO (JDK-builtin, no new dependency) -- PNG/JPEG/BMP/GIF and whatever other formats the running JVM's registered ImageReaders support.

Reads an image file via javax.imageio.ImageIO (JDK-builtin, no new dependency) -- PNG/JPEG/BMP/GIF and whatever other formats the running JVM's registered ImageReaders support.

Attributes

def fromFlatArray(shape: IndexedSeq[Int], flatValues: IndexedSeq[Double], sublevel: Boolean = ..., parallelFiltrationValue: Boolean = ...): CubicalGridStream

Dense n-dimensional grid from a flat, row-major array of values and an explicit shape -- e.g. for shape = IndexedSeq(n0, n1, n2), index (i0, i1, i2) reads flatValues(i0*n1*n2 + i1*n2 + i2), the same convention Array[Array[...]].flatten produces, so fromGrayscale2D/fromVoxelGrid3D below can just flatten and delegate here.

Dense n-dimensional grid from a flat, row-major array of values and an explicit shape -- e.g. for shape = IndexedSeq(n0, n1, n2), index (i0, i1, i2) reads flatValues(i0*n1*n2 + i1*n2 + i2), the same convention Array[Array[...]].flatten produces, so fromGrayscale2D/fromVoxelGrid3D below can just flatten and delegate here.

Attributes

def fromGrayscale2D(pixels: Array[Array[Double]], sublevel: Boolean = ..., parallelFiltrationValue: Boolean = ...): CubicalGridStream

pixels(i)(j) as a dense 2D grid, shape (pixels.length, pixels(0).length).

pixels(i)(j) as a dense 2D grid, shape (pixels.length, pixels(0).length).

Attributes

def fromVoxelGrid3D(voxels: Array[Array[Array[Double]]], sublevel: Boolean = ..., parallelFiltrationValue: Boolean = ...): CubicalGridStream

voxels(i)(j)(k) as a dense 3D grid, shape (voxels.length, voxels(0).length, voxels(0)(0).length).

voxels(i)(j)(k) as a dense 3D grid, shape (voxels.length, voxels(0).length, voxels(0)(0).length).

Attributes