67 lines
2.0 KiB
Rust
67 lines
2.0 KiB
Rust
//! Medical imaging file format support for RustyTorch.
|
|
//!
|
|
//! This crate provides readers and writers for common medical imaging file formats,
|
|
//! enabling integration with the RustyTorch ecosystem for GPU-accelerated medical
|
|
//! image processing and analysis.
|
|
//!
|
|
//! # Supported Formats
|
|
//!
|
|
//! - **NIfTI** (`.nii`, `.nii.gz`): Neuroimaging Informatics Technology Initiative format
|
|
//! - NIfTI-1 and NIfTI-2 support
|
|
//! - Full header parsing with affine transforms
|
|
//! - Support for all common data types
|
|
//!
|
|
//! # Example
|
|
//!
|
|
//! ```ignore
|
|
//! use rtx_medical_io::{nifti, Volume};
|
|
//!
|
|
//! // Read a NIfTI file
|
|
//! let volume = nifti::read_nifti("brain.nii.gz")?;
|
|
//!
|
|
//! // Access metadata
|
|
//! println!("Shape: {:?}", volume.shape());
|
|
//! println!("Spacing: {:?}", volume.spacing());
|
|
//! println!("Origin: {:?}", volume.origin());
|
|
//!
|
|
//! // Process the volume
|
|
//! let thresholded = volume.threshold(100.0);
|
|
//!
|
|
//! // Write back
|
|
//! nifti::write_nifti(&thresholded, "output.nii.gz", nifti::NiftiDataType::Float32)?;
|
|
//! ```
|
|
//!
|
|
//! # Compatibility with MRI2FE
|
|
//!
|
|
//! This crate is designed to be compatible with the MRI2FE workflow:
|
|
//!
|
|
//! - Read segmented NIfTI images for mesh generation
|
|
//! - Support for labeled volumes (segmentation masks)
|
|
//! - INR format export for CGAL-compatible mesh generation
|
|
//! - Affine transform handling for spatial coordinates
|
|
//!
|
|
//! # Features
|
|
//!
|
|
//! - `dicom` - Enable DICOM format support (future)
|
|
//! - `gpu` - Enable GPU acceleration for volume operations (future)
|
|
|
|
pub mod error;
|
|
pub mod nifti;
|
|
pub mod volume;
|
|
|
|
// Re-exports for convenience
|
|
pub use error::{MedicalIoError, Result};
|
|
pub use nifti::{
|
|
Affine4, NiftiDataType, NiftiHeader, read_nifti, read_nifti_header, write_inr, write_nifti,
|
|
};
|
|
pub use volume::Volume;
|
|
|
|
/// Prelude module for commonly used items.
|
|
pub mod prelude {
|
|
pub use crate::error::{MedicalIoError, Result};
|
|
pub use crate::nifti::{
|
|
Affine4, NiftiDataType, NiftiHeader, read_nifti, read_nifti_header, write_inr, write_nifti,
|
|
};
|
|
pub use crate::volume::Volume;
|
|
}
|