pub struct DatasetAttributes { /* private fields */ }Expand description
Attributes of a tensor dataset.
Implementations§
Source§impl DatasetAttributes
impl DatasetAttributes
pub fn coord_iter(&self) -> impl Iterator<Item = Vec<u64>> + ExactSizeIterator
pub fn bounded_coord_iter( &self, bbox: &BoundingBox, ) -> impl Iterator<Item = Vec<u64>> + ExactSizeIterator
pub fn get_bounds(&self) -> BoundingBox
pub fn get_block_bounds(&self, coord: &GridCoord) -> BoundingBox
Source§impl DatasetAttributes
impl DatasetAttributes
pub fn new( dimensions: GridCoord, block_size: BlockCoord, data_type: DataType, compression: CompressionType, ) -> DatasetAttributes
pub fn get_dimensions(&self) -> &[u64]
pub fn get_block_size(&self) -> &[u32]
pub fn get_data_type(&self) -> &DataType
pub fn get_compression(&self) -> &CompressionType
pub fn get_ndim(&self) -> usize
Sourcepub fn get_num_elements(&self) -> usize
pub fn get_num_elements(&self) -> usize
Get the total number of elements possible given the dimensions.
Sourcepub fn get_block_num_elements(&self) -> usize
pub fn get_block_num_elements(&self) -> usize
Get the total number of elements possible in a block.
Sourcepub fn get_grid_extent(&self) -> GridCoord
pub fn get_grid_extent(&self) -> GridCoord
Get the upper bound extent of grid coordinates.
Sourcepub fn get_num_blocks(&self) -> u64
pub fn get_num_blocks(&self) -> u64
Get the total number of blocks.
use n5::prelude::*;
use n5::smallvec::smallvec;
let attrs = DatasetAttributes::new(
smallvec![50, 40, 30],
smallvec![11, 10, 10],
DataType::UINT8,
n5::compression::CompressionType::default(),
);
assert_eq!(attrs.get_num_blocks(), 60);Sourcepub fn in_bounds(&self, grid_position: &GridCoord) -> bool
pub fn in_bounds(&self, grid_position: &GridCoord) -> bool
Check whether a block grid position is in the bounds of this dataset.
use n5::prelude::*;
use n5::smallvec::smallvec;
let attrs = DatasetAttributes::new(
smallvec![50, 40, 30],
smallvec![11, 10, 10],
DataType::UINT8,
n5::compression::CompressionType::default(),
);
assert!(attrs.in_bounds(&smallvec![4, 3, 2]));
assert!(!attrs.in_bounds(&smallvec![5, 3, 2]));Trait Implementations§
Source§impl Clone for DatasetAttributes
impl Clone for DatasetAttributes
Source§fn clone(&self) -> DatasetAttributes
fn clone(&self) -> DatasetAttributes
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 moreSource§impl Debug for DatasetAttributes
impl Debug for DatasetAttributes
Source§impl<'de> Deserialize<'de> for DatasetAttributes
impl<'de> Deserialize<'de> for DatasetAttributes
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for DatasetAttributes
impl PartialEq for DatasetAttributes
Source§impl Serialize for DatasetAttributes
impl Serialize for DatasetAttributes
impl StructuralPartialEq for DatasetAttributes
Auto Trait Implementations§
impl Freeze for DatasetAttributes
impl RefUnwindSafe for DatasetAttributes
impl Send for DatasetAttributes
impl Sync for DatasetAttributes
impl Unpin for DatasetAttributes
impl UnwindSafe for DatasetAttributes
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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