pub struct CubicalComplex {
pub cells: Vec<Vec<bool>>,
pub dims: Vec<usize>,
}Expand description
A cubical complex built from a binary (voxel) image.
Each cell is a multi-dimensional boolean array; a true entry indicates
a filled voxel.
Fields§
§cells: Vec<Vec<bool>>Flattened cell data (row-major).
dims: Vec<usize>Dimensions of the array: dims[i] is the size along axis i.
Implementations§
Source§impl CubicalComplex
impl CubicalComplex
Sourcepub fn from_image(image: &[Vec<bool>]) -> Self
pub fn from_image(image: &[Vec<bool>]) -> Self
Build a CubicalComplex from a 2-D binary image given as rows.
image[i][j] is true if the pixel at row i, column j is filled.
Sourcepub fn boundary_map(&self) -> Vec<(usize, usize, i32)>
pub fn boundary_map(&self) -> Vec<(usize, usize, i32)>
Compute the boundary map as an incidence list.
Returns a list of (cell_idx, face_idx, sign) triples.
Sourcepub fn homology_ranks(&self) -> Vec<usize>
pub fn homology_ranks(&self) -> Vec<usize>
Compute homology ranks of the cubical complex (0-D and 1-D only).
Returns [β_0, β_1] using a simple connected-components / cycle count.
Trait Implementations§
Source§impl Clone for CubicalComplex
impl Clone for CubicalComplex
Source§fn clone(&self) -> CubicalComplex
fn clone(&self) -> CubicalComplex
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.