pub struct NiftiHeader {
pub ndim: usize,
pub dim: [i64; 8],
pub pixdim: [f64; 8],
pub datatype: i16,
pub bitpix: i16,
pub version: u8,
pub vox_offset: u64,
pub scl_slope: f64,
pub scl_inter: f64,
pub affine: [[f64; 4]; 4],
pub sform_code: i16,
pub qform_code: i16,
}Fields§
§ndim: usizeNumber of dimensions (1-7).
dim: [i64; 8]Size of each dimension: dim[0]=ndim, dim[1..8].
pixdim: [f64; 8]Voxel sizes / TR: pixdim[1..3] = voxel mm, pixdim[4] = TR for 4D.
datatype: i16Data type code.
bitpix: i16Bits per voxel.
version: u8NIfTI version (1 or 2).
vox_offset: u64Byte offset to the start of voxel data.
scl_slope: f64Slope for intensity scaling: scaled = raw * scl_slope + scl_inter. If 0.0, no scaling is applied.
scl_inter: f64Intercept for intensity scaling.
affine: [[f64; 4]; 4]sform affine matrix (4×4, row-major). Maps voxel (i,j,k) → (x,y,z) in mm. Set from sform if sform_code > 0, else from qform.
sform_code: i16sform code (0=unknown, 1=scanner, 2=aligned, 3=Talairach, 4=MNI).
qform_code: i16qform code.
Implementations§
Source§impl NiftiHeader
impl NiftiHeader
Sourcepub fn from_file(path: &Path) -> Result<Self, NiftiError>
pub fn from_file(path: &Path) -> Result<Self, NiftiError>
Read header from a NIfTI file (.nii, .nii.gz, .hdr).
Sourcepub fn voxel_size(&self) -> (f64, f64, f64)
pub fn voxel_size(&self) -> (f64, f64, f64)
Voxel dimensions in mm: (x, y, z).
Sourcepub fn matrix_size(&self) -> (usize, usize, usize)
pub fn matrix_size(&self) -> (usize, usize, usize)
Matrix size: (nx, ny, nz).
Sourcepub fn has_scaling(&self) -> bool
pub fn has_scaling(&self) -> bool
Whether slope/intercept scaling should be applied.
Trait Implementations§
Source§impl Clone for NiftiHeader
impl Clone for NiftiHeader
Source§fn clone(&self) -> NiftiHeader
fn clone(&self) -> NiftiHeader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NiftiHeader
impl RefUnwindSafe for NiftiHeader
impl Send for NiftiHeader
impl Sync for NiftiHeader
impl Unpin for NiftiHeader
impl UnsafeUnpin for NiftiHeader
impl UnwindSafe for NiftiHeader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more