//! # RustyNeuro Core - Unified Neuroimaging Platform //! //! A consolidated super-crate that unifies 16 neuroimaging crates (47K LOC) into a single //! coherent API. This crate provides GPU-accelerated MEG/EEG/fMRI analysis capabilities //! inspired by Brainstorm, FieldTrip, and MNE-Python, built natively in Rust. //! //! ## Architecture //! //! This super-crate consolidates the following crates: //! //! ### Core Functionality (default features) //! - `rtx-neuro`: Core data types, channels, events, recordings //! - `rtx-neuro-io`: File I/O (EDF, BDF, FIF, CTF, BrainVision, BIDS, NWB) //! - `rtx-neuro-signal`: Signal processing (filtering, epoching, time-frequency) //! //! ### Analysis Modules (optional features) //! - `rtx-neuro-forward`: Forward modeling (spherical models, BEM) //! - `rtx-neuro-inverse`: Inverse solutions (MNE, dSPM, sLORETA, LCMV) //! - `rtx-neuro-connectivity`: Connectivity analysis (coherence, PLV, wPLI, Granger) //! - `rtx-neuro-artifacts`: Artifact detection/removal (SSP, ICA) //! - `rtx-neuro-stats`: Statistical analysis (cluster permutation tests) //! - `rtx-neuro-anatomy`: Anatomical structures (cortical surfaces, parcellations) //! //! ### Real-time & Streaming (optional features) //! - `rtx-neuro-realtime`: Real-time processing pipelines //! - `rtx-neuro-lsl`: Lab Streaming Layer integration //! //! ### Machine Learning Extensions (optional features) //! - `rtx-neuro-gnn`: Graph Neural Networks for brain connectivity //! - `rtx-neuro-pinn`: Physics-Informed Neural Networks //! - `rtx-neuro-fem`: Finite Element Method integration //! //! ### Database & Storage (optional features) //! - `rtx-neuro-db`: Database integration for large datasets //! //! ## Feature Flags //! //! - `default`: Core functionality (core, io, signal) //! - `core`: Core data types and recording structures //! - `io`: File I/O support for neuroimaging formats //! - `signal`: Signal processing and filtering //! - `forward`: Forward modeling capabilities //! - `inverse`: Inverse solution methods //! - `connectivity`: Connectivity analysis //! - `artifacts`: Artifact detection and removal //! - `stats`: Statistical analysis tools //! - `anatomy`: Anatomical structure support //! - `realtime`: Real-time processing and LSL integration //! - `ml`: Machine learning extensions (GNN, PINN, FEM) //! - `db`: Database support //! - `cuda`: CUDA GPU acceleration //! - `metal`: Metal GPU acceleration //! - `full`: All features enabled //! //! ## Quick Start //! //! ```rust,ignore //! use rtx_neuro_core::{NeuroData, Recording}; //! //! // Load an EDF file //! #[cfg(feature = "io")] //! { //! use rtx_neuro_core::io::edf::EdfReader; //! let recording = EdfReader::open("data.edf")?; //! //! // Apply bandpass filter (1-40 Hz) //! #[cfg(feature = "signal")] //! { //! let filtered = recording.filter(1.0, 40.0)?; //! //! // Create epochs around events //! let epochs = filtered.create_epochs(&events, -0.2, 0.5)?; //! //! // Compute average //! let evoked = epochs.average()?; //! } //! } //! ``` //! //! ## Edition 2024 Compliance //! //! This crate is built with Rust Edition 2024 and follows modern Rust best practices: //! - Strict lifetime capture rules for `impl Trait` //! - No deprecated patterns or unsafe code (unless absolutely necessary) //! - Full error handling with `Result` propagation //! - Zero-cost abstractions with trait-based design #![warn(missing_docs)] // Core error types (always available) pub mod error; // Re-export error types at the crate root pub use error::{NeuroError, NeuroResult}; // Conditional re-exports based on features // Core module (default feature) #[cfg(feature = "core")] pub mod core; #[cfg(feature = "core")] pub use core::{ Anatomy, Annotation, Annotations, Channel, ChannelInfo, ChannelType, Condition, ElectrodePosition, Epochs, EpochsConfig, Event, EventId, Events, Evoked, GroupAnalysis, Montage, MontageType, NeuroData, ProcessingHistory, ProcessingStep, Protocol, ProtocolSettings, Recording, RecordingFormat, RecordingInfo, ReferenceScheme, SampleIndex, SampleRate, Subject, TimeSeconds, channel, data, epoch, event, montage, protocol, recording, }; // I/O module (default feature) - now built-in #[cfg(feature = "io")] pub mod io; // Signal processing module (default feature) - now built-in #[cfg(feature = "signal")] pub mod signal; // Forward modeling module (optional) - now built-in #[cfg(feature = "forward")] pub mod forward; // Inverse solutions module (optional) - now built-in #[cfg(feature = "inverse")] pub mod inverse; // Connectivity analysis module (optional) - now built-in #[cfg(feature = "connectivity")] pub mod connectivity; // Anatomical structures module (optional) - now built-in #[cfg(feature = "anatomy")] pub mod anatomy; // Statistical analysis module (optional) - now built-in #[cfg(feature = "stats")] pub mod stats; // Artifact processing module (optional) #[cfg(feature = "artifacts")] pub use rtx_neuro_artifacts as artifacts; // Real-time processing module (optional) #[cfg(feature = "realtime")] pub use rtx_neuro_realtime as realtime; // Lab Streaming Layer module (optional) #[cfg(feature = "realtime")] pub use rtx_neuro_lsl as lsl; // Database module (optional) #[cfg(feature = "db")] pub use rtx_neuro_db as db; // Machine learning modules (optional) #[cfg(feature = "ml")] pub use rtx_neuro_gnn as gnn; #[cfg(feature = "ml")] pub use rtx_neuro_pinn as pinn; #[cfg(feature = "ml")] pub use rtx_neuro_fem as fem; /// Version information for rtx-neuro-core pub const VERSION: &str = env!("CARGO_PKG_VERSION"); /// Crate name pub const NAME: &str = env!("CARGO_PKG_NAME"); /// Edition compliance marker (Rust 2024) pub const EDITION: &str = "2024"; #[cfg(test)] mod tests { use super::*; #[test] fn test_version_info() { assert_eq!(VERSION, "1.0.0"); assert_eq!(NAME, "rtx-neuro-core"); assert_eq!(EDITION, "2024"); } #[test] fn test_error_types() { let err = NeuroError::Signal("test".to_string()); assert!(matches!(err, NeuroError::Signal(_))); } #[cfg(feature = "core")] #[test] fn test_core_types_available() { // Verify that core types are accessible use crate::core::ChannelType; let _channel_type: ChannelType = ChannelType::MegGrad; let sample_rate: SampleRate = 1000.0; assert_eq!(sample_rate, 1000.0); } #[cfg(not(feature = "core"))] #[test] fn test_minimal_build() { // Test that the crate can build without default features // Only error types should be available let err = NeuroError::InvalidData("test".to_string()); assert!(err.to_string().contains("Invalid data")); } }