use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Error, Debug)]
pub enum Error {
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("invalid NIfTI magic: expected 'n+1' or 'ni1', got {0:?}")]
InvalidMagic([u8; 4]),
#[error("unsupported data type code: {0}")]
UnsupportedDataType(i16),
#[error("invalid dimensions: {0}")]
InvalidDimensions(String),
#[error("data type mismatch: expected {expected}, got {got}")]
DataTypeMismatch {
expected: &'static str,
got: &'static str,
},
#[error("invalid affine matrix: {0}")]
InvalidAffine(String),
#[error("decompression failed: {0}")]
Decompression(String),
#[error("shape mismatch: {0}")]
ShapeMismatch(String),
#[error("invalid crop region: {0}")]
InvalidCropRegion(String),
#[error("memory allocation failed: {0}")]
MemoryAllocation(String),
#[error("invalid file format: {0}")]
InvalidFileFormat(String),
#[error("transform error: {operation} failed: {reason}")]
TransformError {
operation: &'static str,
reason: String,
},
#[error("configuration error: {0}")]
Configuration(String),
#[error("iteration exhausted: {0}")]
Exhausted(String),
#[error("invalid orientation: {0}")]
InvalidOrientation(String),
#[error("array not contiguous: {0}")]
NonContiguousArray(String),
}