pub struct GradientTable {
pub bvals: Bvals,
pub bvecs: Bvecs,
}Expand description
Combined b-value + b-vector gradient table for a DWI acquisition.
Provides convenience methods for counting volumes, identifying b=0 images, and iterating over gradient directions.
Fields§
§bvals: BvalsB-values for each volume.
bvecs: BvecsGradient directions for each volume (unit vectors for diffusion, zero for b=0).
Implementations§
Source§impl GradientTable
impl GradientTable
Sourcepub fn new(bvals: Bvals, bvecs: Bvecs) -> Result<Self>
pub fn new(bvals: Bvals, bvecs: Bvecs) -> Result<Self>
Create a gradient table from b-values and b-vectors.
§Errors
Returns an error if the lengths don’t match.
Sourcepub fn from_files(bval_path: &Path, bvec_path: &Path) -> Result<Self>
pub fn from_files(bval_path: &Path, bvec_path: &Path) -> Result<Self>
Load from companion .bval and .bvec files.
§Errors
Returns an error if either file can’t be read/parsed or they have different volume counts.
Sourcepub fn n_diffusion_volumes(&self) -> usize
pub fn n_diffusion_volumes(&self) -> usize
Number of diffusion-weighted volumes (b > 0).
Sourcepub fn n_b0_volumes(&self) -> usize
pub fn n_b0_volumes(&self) -> usize
Number of b=0 volumes.
Sourcepub fn unique_bvals(&self) -> Vec<f64>
pub fn unique_bvals(&self) -> Vec<f64>
Unique b-values (sorted).
Sourcepub fn iter(&self) -> impl Iterator<Item = (f64, [f64; 3])> + '_
pub fn iter(&self) -> impl Iterator<Item = (f64, [f64; 3])> + '_
Iterate over (b-value, direction) pairs.
Sourcepub fn b0_indices(&self) -> Vec<usize>
pub fn b0_indices(&self) -> Vec<usize>
Get indices of b=0 volumes.
Sourcepub fn is_normalized(&self) -> bool
pub fn is_normalized(&self) -> bool
Check if the gradient directions are approximately unit-normalized for non-zero b-values.
Trait Implementations§
Source§impl Clone for GradientTable
impl Clone for GradientTable
Source§fn clone(&self) -> GradientTable
fn clone(&self) -> GradientTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more