lucem_hist::density
Density maps: on a grid over a region, how many objects (of a class, or positive ones) are within a radius of each grid pixel — or what percentage of them are positive; then the hotspots (the highest maxima, apart from each other) and the regions above a value.
DensitySettings
Section titled “DensitySettings”pub struct DensitySettingsFields
pixel_um: f64: The map’s pixel (µm).radius_um: f64: The radius counted around each map pixel (µm).class: Option<String>: Only objects of this class.value: DensityValue
Implements Clone, Debug, Default, Deserialize, PartialEq, Serialize.
DensityMap
Section titled “DensityMap”pub struct DensityMapFields
width: usizeheight: usizeorigin: Point: Level-0 position of the first map pixel, and level-0 pixels per map pixel.ds: f64values: Vec<f32>
Methods
pub fn centre_of(&self, i: usize) -> PointImplements Clone, Debug, PartialEq.
DensityValue
Section titled “DensityValue”pub enum DensityValueVariants
Count: Objects within the radius.PerMm2: Objects per mm².PercentPositive: Positive objects (intensity class) as a percentage of those within the radius.
Implements Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize.
Functions
Section titled “Functions”density_map
Section titled “density_map”pub fn density_map( objects: &[HistObject], bounds: (f64, f64, f64, f64), pixel_um: f64, s: &DensitySettings,) -> DensityMapThe density of objects over bounds (level-0 x0, y0, x1, y1); pixel_um µm per level-0
pixel.
hotspots
Section titled “hotspots”pub fn hotspots( map: &DensityMap, count: usize, min_distance_um: f64, min_value: f32, pixel_um: f64,) -> Vec<(Point, f32)>The count highest local maxima of the map at least min_value, each at least
min_distance_um from the ones before it (level-0 points, highest first).
regions_above
Section titled “regions_above”pub fn regions_above( map: &DensityMap, value: f32, min_area_um2: f64, pixel_um: f64,) -> Vec<Polygon>The regions where the map is at least value (pieces under min_area_um2 dropped), as
level-0 outlines.