1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Clippy configuration for the crate
// Allow these pedantic lints that are too noisy for this numeric/scientific codebase
// Numeric casts are intentional
// Precision loss in f32/f64 casts is acceptable
// Sign handling is managed explicitly
// Using `as` for clarity in numeric code
// Wrap behavior is handled
// c00, c01, c10, c11 naming is intentional for interpolation
// x, y, z naming is standard in 3D code
// Some functions are necessarily long
// NiftiImage in nifti module is clear
// Not all returns need #[must_use]
// Builder pattern returns don't need #[must_use]
// Error docs would be redundant
// Panics are being converted to Results
// mul_add suggestions hurt readability
// pub(crate) is intentional for visibility
// const fn suggestions are premature optimization
// NIfTI doesn't need backticks everywhere
// Pointer casts are intentional for binary parsing
// Alignment is handled in binary parsing
// format!("{}", x) is clearer than format!("{x}")
// Self vs TypeName is stylistic
// Closures can be clearer
// % 0 == 0 is clearer than is_multiple_of
// map().unwrap_or is clearer
// Pass by value is intentional for small types
// Float comparison is intentional in some cases
// Wildcard matches are intentional
// for x in iter is clearer than for x in &collection
// Borrow is intentional for clarity
// Manual copy is clearer in some contexts
// Deny panic-prone patterns to prevent regressions
// No panic!() in library code
// No .unwrap() in library code
// No .expect() in library code
//! # medrs
//!
//! High-performance medical image I/O and processing library for Rust and Python.
//!
//! `medrs` is designed for throughput-critical medical imaging workflows,
//! particularly deep learning pipelines that process large 3D volumes.
//!
//! ## Key Features
//!
//! - **Fast `NIfTI` I/O**: Memory-mapped reading, crop-first loading, optimized gzip
//! - **Transform Pipeline**: Lazy evaluation with automatic fusion and SIMD acceleration
//! - **Random Augmentation**: GPU-friendly augmentations for ML training
//! - **Python Bindings**: Zero-copy numpy views, direct PyTorch/JAX tensor creation
//!
//! ## Quick Start (Rust)
//!
//! ```ignore
//! use medrs::nifti;
//! use medrs::transforms::{resample_to_spacing, Interpolation};
//!
//! // Load a NIfTI image
//! let img = nifti::load("brain.nii.gz")?;
//! println!("Shape: {:?}, Spacing: {:?}", img.shape(), img.spacing());
//!
//! // Resample to isotropic 1mm spacing
//! let resampled = resample_to_spacing(&img, [1.0, 1.0, 1.0], Interpolation::Trilinear);
//!
//! // Save result
//! nifti::save(&resampled, "output.nii.gz")?;
//! ```
//!
//! ## Transform Pipeline
//!
//! ```ignore
//! use medrs::pipeline::compose::TransformPipeline;
//!
//! let pipeline = TransformPipeline::new()
//! .z_normalize()
//! .clamp(-1.0, 1.0)
//! .resample_to_shape([64, 64, 64]);
//!
//! let processed = pipeline.apply(&img);
//! ```
//!
//! ## Random Augmentation
//!
//! ```ignore
//! use medrs::transforms::{random_flip, random_gaussian_noise, random_augment};
//!
//! // Individual augmentations with reproducible seeds
//! let flipped = random_flip(&img, &[0, 1, 2], Some(0.5), Some(42))?;
//! let noisy = random_gaussian_noise(&img, Some(0.1), Some(42));
//!
//! // Combined augmentation pipeline
//! let augmented = random_augment(&img, Some(42))?;
//! ```
//!
//! ## Module Overview
//!
//! - [`nifti`]: `NIfTI` file I/O with memory mapping and crop-first loading
//! - [`transforms`]: Image transforms (resampling, intensity, spatial, augmentation)
//! - [`pipeline`]: Transform composition with lazy evaluation
//! - [`error`]: Error types for the library
pub use ;
// Re-export commonly used items at crate root
pub use ;