Skip to main content

Module bio

Module bio 

Source
Expand description

Bio / medical CV algorithms — specialized_libs::computer_vision::bio.

Modules§

dicom_lite
Honest partial DICOM helpers — not a full pydicom replacement.
histopathology
Histopathology color / stain algorithms (pure Rust, caller-buffered).
medical
Medical volume helpers (pure Rust).
morphology
Native pure-Rust morphology / cell-detection kernels.
radiomics
Radiomics feature extractors (pure Rust).
tracking
Particle tracking: Crocker–Grier linking + centroid extraction.

Structs§

AnonymizeReport
Report of anonymization actions.
CrockerGrierLinker
Bounded Crocker–Grier particle tracker.
CrockerGrierParams
Parameters for Crocker–Grier linking.
Detection2
Compact detection for the free-function linker (x, y, frame only).
FirstOrderStats
First-order radiomics features (IBSI-style subset).
GlcmFeatures
Haralick-style features averaged over 0° and 90° (symmetric GLCM).
LabStats
Lab mean (L, a, b).
LinkedParticle
One linked particle observation (detection + assigned track id).
MacenkoResult
Result of Macenko: two unit-ish stain vectors in OD space (rows: H, E; cols: R,G,B).
NucleusFeature
Fixed-layout region feature (no heap).
OdPositiveIndex
Result of a positive-OD index computation.
ParsedDicomTags
Subset returned as typed convenience fields + full map of found strings.
ParticleCentroid
2D particle feature used by super::crocker_grier_link().
RgbBg
Per-channel background estimate (linear RGB8 mean of bright pixels).
Shape2d
Compact 2D shape summary.
Shape2dFeatures
2D shape features from a binary mask (nonzero = foreground).
Shape3dFeatures
3D shape features from a sparse voxel list.
StainBasis
Stain basis in optical-density space: up to 3 vectors × RGB.
TrackLink
Per-detection link result for crocker_grier_link.
UnmixResult
Result of a single spectrum unmix.

Enums§

DicomLiteError
DICOM-lite errors (fail closed).
HistoError
Errors for histopathology kernels.
MedicalError
Medical imaging helper errors.
MipAxis
Projection axis for a 3D volume stored as stacked 2D slices.
RadiomicsError
Shared radiomics error for the radiomics submodule.
TopHatKind
Top-hat polarity.

Constants§

DEFAULT_HE_TARGET_MEAN
Approximate H&E appearance targets in CIE Lab (D65).
DEFAULT_HE_TARGET_STD
Companion std for DEFAULT_HE_TARGET_MEAN.
GLCM_LEVELS_16
Common quantization levels for radiomics GLCM.
GLCM_LEVELS_32
MAX_FRAME_DETS
Max detections considered per frame (association scratch).
MAX_NUCLEUS_LABELS
Maximum distinct labels tracked in one pass (stack/table bound).
MAX_OD_LABELS
Maximum distinct nucleus labels for OD aggregation.
MAX_PARTICLES_PER_FRAME
Maximum particles reported from a single frame (stack-friendly bound for callers).
MAX_PARTICLE_TRACKS
Maximum simultaneous active tracks.
NO_TRACK_ID
Sentinel: detection not assigned a track.
PHI_TAG_KEYS
PHI / identity tags zeroed or replaced with a fixed placeholder.

Functions§

anonymize_tag_map
Zero/redact known PHI keys in map (in place).
apply_background_correct
Correct RGB illumination: out = clamp(rgb * 255 / bg, 0..255) per channel.
apply_hu_window_f32
Window/level on f32 intensity (HU or similar) → u8 display.
apply_hu_window_i16
Window/level on i16 HU values → u8 display.
background_intensity_sample
Sample background as the mean RGB of pixels whose luminance is at or above the given percentile (e.g. percentile = 95.0 → top ~5% brightest).
centroid_from_bbox
Centroid of a bounding box (integer mid-point) — convenience for box→particle bridges.
centroids_from_binary
Extract centroids of connected components where pixel ≥ thresh (4-connected).
centroids_from_labels
Extract centroids from a pre-labelled u8 mask (label 0 = background).
crocker_grier_link
Free-function Crocker–Grier link over compact Detection2 rows.
extended_minima
Compute extended minima of a gray topographic surface.
first_order_stats
Compute first-order stats over samples (gray / intensity ROI values).
glcm_features
Compute GLCM features on a 2D gray image at distance 1 with 16 levels (default).
glcm_features_d1
Compute GLCM features on a 2D gray image at distance 1.
hu_window_i16
Window/level on i16 HU values → u8 display.
intensity_to_od_u8
Map brightfield intensity to an 8-bit optical-density-like value.
isotropic_resample_2d_nn
Resample a 2D image from anisotropic pixel spacing to isotropic.
isotropic_resample_3d_nn
Resample a 3D volume (stacked slices) to isotropic voxel spacing.
isotropic_resample_nn_2d
Resample a 2D image from anisotropic pixel spacing to isotropic.
lab_to_rgb
Convert interleaved Lab f32 to packed RGB8. out length ≥ lab.len().
link_particles
One-shot convenience: link a full detection list with fresh linker state.
macenko_deconvolution
Macenko deconvolution.
mip_project_axis
Max-intensity project a 3D volume of f32 voxels.
mip_project_z
MIP along Z (classic axial max-intensity projection).
morphological_tophat
Morphological top-hat into caller buffer (width * height bytes).
nucleus_features
Extract geometric features for each labeled nucleus region.
optical_density_rgb
Convert packed RGB8 intensities to optical density (f32, same layout).
otsu_threshold_from_hist
Otsu threshold for a Gray8 histogram (returns 0 if image empty / single-tone).
parse_dicom_tags_basic
Scan bytes for common DICOM tags (little-endian explicit VR).
positive_od_threshold
Compute Ki-67-style positive index from a gray channel and nucleus label map.
reinhard_normalize
Reinhard-normalize packed RGB8 toward target Lab stats (or H&E defaults if None).
rgb_to_lab
Convert packed RGB8 to interleaved Lab f32. out length ≥ rgb.len().
shape_2d_features
Extract 2D shape from a binary mask (nonzero = object).
shape_2d_from_mask
Extract 2D shape from a binary mask (nonzero = object).
shape_3d_from_voxels
Extract 3D shape from a sparse list of voxel coordinates.
snmf_unmix_lite
Unmix packed RGB into non-negative concentrations via multiplicative updates.
spectral_unmix_nnls
Unmix one observed spectrum y (length n_channels) against endmember matrix endmembers laid out as column-major: component k occupies endmembers[k * n_channels .. (k+1) * n_channels].
spectral_unmix_roi_mean
Mean the ROI spectra then unmix once (cheap path for bulk regions).
suv_bw
Convenience: SUV_bw from activity concentration, injected activity (Bq), body weight in kg, and decay factor.
suv_from_activity
Body-weight SUV (SUV_bw).
voronoi_otsu_label
Voronoi–Otsu label map: split touching bright objects.
watershed_markers
Marker-controlled watershed.

Type Aliases§

DicomTagMap
Simple string-valued attribute map after parse/anonymize.