pub struct MultiBandBuffer { /* private fields */ }Expand description
A multi-band raster buffer holding multiple single-band buffers.
All bands must share identical dimensions and data type.
Implementations§
Source§impl MultiBandBuffer
impl MultiBandBuffer
Sourcepub fn from_bands(
bands: Vec<RasterBuffer>,
colors: Vec<ColorInterpretation>,
) -> Result<Self>
pub fn from_bands( bands: Vec<RasterBuffer>, colors: Vec<ColorInterpretation>, ) -> Result<Self>
Create a MultiBandBuffer from individual band buffers and color interpretations.
All bands must have the same width, height, and data type.
§Errors
Returns an error if bands have mismatched dimensions or data types, or if the color interpretation count doesn’t match the band count.
Sourcepub fn from_interleaved(
data: &[u8],
width: u64,
height: u64,
band_count: u32,
data_type: RasterDataType,
nodata: NoDataValue,
) -> Result<Self>
pub fn from_interleaved( data: &[u8], width: u64, height: u64, band_count: u32, data_type: RasterDataType, nodata: NoDataValue, ) -> Result<Self>
Create a MultiBandBuffer from interleaved (BIP) data.
Deinterleaves band-interleaved-by-pixel data into separate band buffers.
§Errors
Returns an error if the data size doesn’t match dimensions × band_count × type_size.
Sourcepub fn from_bsq(
data: &[u8],
width: u64,
height: u64,
band_count: u32,
data_type: RasterDataType,
nodata: NoDataValue,
) -> Result<Self>
pub fn from_bsq( data: &[u8], width: u64, height: u64, band_count: u32, data_type: RasterDataType, nodata: NoDataValue, ) -> Result<Self>
Create a MultiBandBuffer from band-sequential (BSQ) data.
§Errors
Returns an error if the data size doesn’t match dimensions × band_count × type_size.
Sourcepub fn from_bil(
data: &[u8],
width: u64,
height: u64,
band_count: u32,
data_type: RasterDataType,
nodata: NoDataValue,
) -> Result<Self>
pub fn from_bil( data: &[u8], width: u64, height: u64, band_count: u32, data_type: RasterDataType, nodata: NoDataValue, ) -> Result<Self>
Create a MultiBandBuffer from Band-Interleaved-by-Line (BIL) data.
Rearranges BIL-layout bytes into the internal BSQ (band-sequential) representation.
BIL layout: for each row r and then each band b, the width * pixel_size bytes
for that (row, band) slice are contiguous:
[row0_band0_col0..colN, row0_band1_col0..colN, …, row0_bandN_col0..colN,
row1_band0_col0..colN, row1_band1_col0..colN, …, rowH_bandN_col0..colN]§Errors
Returns an error if the data size doesn’t match width × height × band_count × pixel_size.
Sourcepub fn band_count(&self) -> u32
pub fn band_count(&self) -> u32
Returns the number of bands.
Sourcepub fn data_type(&self) -> RasterDataType
pub fn data_type(&self) -> RasterDataType
Returns the data type (same for all bands).
Sourcepub fn layout(&self) -> PixelLayout
pub fn layout(&self) -> PixelLayout
Returns the pixel layout.
Sourcepub fn set_band_nodata(&mut self, band: u32, nodata: NoDataValue) -> Result<()>
pub fn set_band_nodata(&mut self, band: u32, nodata: NoDataValue) -> Result<()>
Set per-band nodata override value.
Sourcepub fn band_mut(&mut self, band: u32) -> Result<&mut RasterBuffer>
pub fn band_mut(&mut self, band: u32) -> Result<&mut RasterBuffer>
Get a mutable reference to a specific band buffer.
§Errors
Returns an error if band is out of range.
Sourcepub fn bands(&self) -> BandIterator<'_> ⓘ
pub fn bands(&self) -> BandIterator<'_> ⓘ
Returns a lazy iterator over all bands.
Sourcepub fn to_interleaved(&self) -> Vec<u8> ⓘ
pub fn to_interleaved(&self) -> Vec<u8> ⓘ
Interleave all bands into a single BIP byte buffer.
Returns pixels in band-interleaved-by-pixel order: R₁G₁B₁ R₂G₂B₂ …
Sourcepub fn to_bsq(&self) -> Vec<u8> ⓘ
pub fn to_bsq(&self) -> Vec<u8> ⓘ
Flatten all bands into BSQ byte buffer.
Returns band-sequential data: all of band 0, then all of band 1, etc.
Sourcepub fn to_bil(&self) -> Vec<u8> ⓘ
pub fn to_bil(&self) -> Vec<u8> ⓘ
Emits the buffer data in Band-Interleaved-by-Line (BIL) layout.
BIL layout: for each row r and then each band b, all width * pixel_size bytes
for that (row, band) slice are written contiguously:
[row0_band0, row0_band1, …, row0_bandN, row1_band0, …, rowH_bandN]Sourcepub fn compute_all_statistics(&self) -> Result<Vec<BufferStatistics>>
pub fn compute_all_statistics(&self) -> Result<Vec<BufferStatistics>>
Compute statistics for all bands.
§Errors
Returns an error if statistics computation fails for any band.
Sourcepub fn into_bands(self) -> Vec<RasterBuffer>
pub fn into_bands(self) -> Vec<RasterBuffer>
Consume and return the inner band buffers.
Trait Implementations§
Source§impl Clone for MultiBandBuffer
impl Clone for MultiBandBuffer
Source§fn clone(&self) -> MultiBandBuffer
fn clone(&self) -> MultiBandBuffer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more