pub enum AnyTrxFile {
F16(TrxFile<f16>),
F32(TrxFile<f32>),
F64(TrxFile<f64>),
}Expand description
A type-erased TRX container that can hold any position dtype.
Use this when the position dtype is not known at compile time (e.g. CLI tools
that accept arbitrary .trx files).
Variants§
Implementations§
Source§impl AnyTrxFile
impl AnyTrxFile
Sourcepub fn load(path: &Path) -> Result<Self>
pub fn load(path: &Path) -> Result<Self>
Load a TRX file, detecting the positions dtype at runtime.
Sourcepub fn positions_ref(&self) -> PositionsRef<'_>
pub fn positions_ref(&self) -> PositionsRef<'_>
Get a reference to the positions, dispatched by dtype.
Sourcepub fn nb_streamlines(&self) -> usize
pub fn nb_streamlines(&self) -> usize
Number of streamlines.
Sourcepub fn nb_vertices(&self) -> usize
pub fn nb_vertices(&self) -> usize
Number of vertices.
Sourcepub fn with_typed<R>(
&self,
on_f16: impl FnOnce(&TrxFile<f16>) -> R,
on_f32: impl FnOnce(&TrxFile<f32>) -> R,
on_f64: impl FnOnce(&TrxFile<f64>) -> R,
) -> R
pub fn with_typed<R>( &self, on_f16: impl FnOnce(&TrxFile<f16>) -> R, on_f32: impl FnOnce(&TrxFile<f32>) -> R, on_f64: impl FnOnce(&TrxFile<f64>) -> R, ) -> R
Dispatch to a closure with a concrete &TrxFile<P>.
pub fn positions_f32(&self) -> Vec<[f32; 3]>
pub fn offsets_vec(&self) -> Vec<u32>
pub fn dpv_entries(&self) -> Vec<(String, DataArrayInfo)>
pub fn dps_entries(&self) -> Vec<(String, DataArrayInfo)>
pub fn groups_owned(&self) -> Vec<(String, Vec<u32>)>
pub fn dpg_group_entries(&self) -> Vec<(String, Vec<(String, DataArrayInfo)>)>
pub fn scalar_dpv_f32(&self, name: &str) -> Result<Vec<f32>>
pub fn scalar_dps_f32(&self, name: &str) -> Result<Vec<f32>>
Sourcepub fn with_updated_header(self, header: Header) -> Self
pub fn with_updated_header(self, header: Header) -> Self
Return a new AnyTrxFile with the header replaced.
pub fn save(&self, path: &Path) -> Result<()>
pub fn convert_positions_dtype(&self, dtype: DType) -> Result<Self>
Trait Implementations§
Source§impl Debug for AnyTrxFile
impl Debug for AnyTrxFile
Source§impl From<&AnyTrxFile> for Tractogram
impl From<&AnyTrxFile> for Tractogram
Source§fn from(value: &AnyTrxFile) -> Self
fn from(value: &AnyTrxFile) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for AnyTrxFile
impl RefUnwindSafe for AnyTrxFile
impl Send for AnyTrxFile
impl Sync for AnyTrxFile
impl Unpin for AnyTrxFile
impl UnsafeUnpin for AnyTrxFile
impl UnwindSafe for AnyTrxFile
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.