Files
rustytorch/crates/specialized/rtx-neuro-fem/src/lib.rs
T
2026-03-04 00:08:42 +00:00

76 lines
2.8 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! # rtx-neuro-fem
//!
//! GPU-Accelerated Finite Element Head Modeling for MEG/EEG forward solutions.
//!
//! This crate provides realistic head models using the Finite Element Method (FEM)
//! with GPU-accelerated solvers for computing electric potentials and lead fields.
//!
//! ## Key Features
//!
//! - **Tetrahedral Meshing**: Automatic mesh generation from FreeSurfer surfaces
//! - **Multi-Layer Models**: Support for scalp, skull, CSF, gray/white matter
//! - **Anisotropic Conductivity**: DTI-based white matter anisotropy
//! - **GPU Acceleration**: Leverages rtx-fea for fast sparse solvers
//! - **Lead Field Computation**: Efficient gain matrix calculation
//!
//! ## Head Model Layers
//!
//! ```text
//! ┌─────────────────────────────────────┐
//! │ Scalp (σ=0.43 S/m) │
//! ├─────────────────────────────────────┤
//! │ Skull (σ=0.01 S/m) │ ← Anisotropic
//! ├─────────────────────────────────────┤
//! │ CSF (σ=1.79 S/m) │
//! ├─────────────────────────────────────┤
//! │ Gray Matter (σ=0.33 S/m) │
//! ├─────────────────────────────────────┤
//! │ White Matter (σ=0.14 S/m tensor) │ ← Anisotropic from DTI
//! └─────────────────────────────────────┘
//! ```
//!
//! ## Example
//!
//! ```ignore
//! use rtx_neuro_fem::{HeadFEM, HeadFEMConfig, TissueConfig};
//!
//! // Create FEM model from FreeSurfer surfaces
//! let config = HeadFEMConfig::standard_5_layer();
//!
//! let mut fem = HeadFEM::new(config)?;
//!
//! // Generate mesh from surfaces
//! fem.mesh_from_surfaces(&surfaces)?;
//!
//! // Compute lead field matrix
//! let leadfield = fem.compute_leadfield(&source_space, &sensors)?;
//! ```
#![warn(missing_docs)]
pub mod assembly;
pub mod conductivity;
pub mod error;
pub mod leadfield;
pub mod mesh;
pub mod solver;
// Re-export main types
pub use assembly::{FemAssembler, StiffnessMatrix};
pub use conductivity::{AnisotropicModel, ConductivityTensor, TissueConductivity};
pub use error::{FemError, FemResult};
pub use leadfield::{LeadField, LeadFieldConfig};
pub use mesh::{HeadMesh, MeshQuality, TetElement};
pub use solver::{FemSolver, SolverConfig};
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_basic_imports() {
// Test that main types are accessible
let _: FemResult<()> = Ok(());
}
}