pub struct CubicalComplex {
pub cells: Vec<(CubicalCell, f64)>,
pub spatial_dim: usize,
}Expand description
A filtered cubical complex.
Filtration values are stored per cell and sorted in non-decreasing order.
Fields§
§cells: Vec<(CubicalCell, f64)>Sorted list of (cell, filtration_value).
spatial_dim: usizeSpatial dimension of the complex (2 for images, 3 for volumes).
Implementations§
Source§impl CubicalComplex
impl CubicalComplex
Sourcepub fn from_image_2d(image: &[Vec<f64>]) -> Result<Self>
pub fn from_image_2d(image: &[Vec<f64>]) -> Result<Self>
Build a 2D cubical complex from a 2D image (rows × cols).
Filtration value of each cell = max pixel value over all vertices of that cell (sup-level set filtration). Cells:
- 0-cells:
rows+1×cols+1vertices - 1-cells: horizontal and vertical edges between adjacent vertices
- 2-cells:
rows×colsfaces (pixel cells)
Sourcepub fn from_image_3d(image: &[Vec<Vec<f64>>]) -> Result<Self>
pub fn from_image_3d(image: &[Vec<Vec<f64>>]) -> Result<Self>
Build a 3D cubical complex from a 3D image (slices × rows × cols).
Sourcepub fn boundary(&self, cell: &CubicalCell) -> Vec<CubicalCell>
pub fn boundary(&self, cell: &CubicalCell) -> Vec<CubicalCell>
Compute the boundary faces of a cubical cell.
For a k-cell, the boundary consists of 2k faces obtained by decreasing or increasing each “active” (odd) coordinate by 1.
Sourcepub fn persistence_diagram(&self) -> Vec<(f64, f64, usize)>
pub fn persistence_diagram(&self) -> Vec<(f64, f64, usize)>
Compute persistence diagram via boundary matrix reduction.
Returns (birth, death, dimension) triples sorted by birth value.
Sourcepub fn cell_count(&self, dim: usize) -> usize
pub fn cell_count(&self, dim: usize) -> usize
Count cells by dimension.
Trait Implementations§
Source§impl Clone for CubicalComplex
impl Clone for CubicalComplex
Source§fn clone(&self) -> CubicalComplex
fn clone(&self) -> CubicalComplex
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CubicalComplex
impl RefUnwindSafe for CubicalComplex
impl Send for CubicalComplex
impl Sync for CubicalComplex
impl Unpin for CubicalComplex
impl UnsafeUnpin for CubicalComplex
impl UnwindSafe for CubicalComplex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.