Struct openslide_rs::OpenSlide
source · [−]pub struct OpenSlide {
pub properties: Properties,
/* private fields */
}
Expand description
Openslide object is a simple wrapper around openslide_t “C” type. Implementation provides all functions available in the “C” API It contains also openslide and vendor specific properties found in WSI.
Note : As stated by the OpenSlide documentation, all function are thread-safe except close() For this reason OpenSlide implement the Drop trait which call close() automatically
Fields
properties: Properties
Implementations
sourceimpl OpenSlide
impl OpenSlide
sourcepub fn new(filename: &Path) -> Result<OpenSlide>
pub fn new(filename: &Path) -> Result<OpenSlide>
This method tries to open the slide at the given filename location.
This function can be expensive; avoid calling it unnecessarily. For example, a tile server should not create a new object on every tile request. Instead, it should maintain a cache of OpenSlide objects and reuse them when possible.
sourcepub fn detect_vendor(filename: &Path) -> Result<String>
pub fn detect_vendor(filename: &Path) -> Result<String>
Quickly determine whether a whole slide image is recognized.
sourcepub fn get_level_count(&self) -> Result<u32>
pub fn get_level_count(&self) -> Result<u32>
Get the number of levels in the whole slide image.
sourcepub fn get_level0_dimensions(&self) -> Result<Size>
pub fn get_level0_dimensions(&self) -> Result<Size>
Get the dimensions of level 0 (the largest level).
This method returns the Size { width, height } number of pixels of the level 0 whole slide image.
This is the same as calling get_level_dimensions(level) with level=0.
sourcepub fn get_level_dimensions(&self, level: u32) -> Result<Size>
pub fn get_level_dimensions(&self, level: u32) -> Result<Size>
Get the dimensions of level 0 (the largest level).
This method returns the Size { width, height } number of pixels of the whole slide image at the specified level. Returns an error if the level is invalid
sourcepub fn get_all_level_dimensions(&self) -> Result<Vec<Size>>
pub fn get_all_level_dimensions(&self) -> Result<Vec<Size>>
Get dimensions of all available levels
sourcepub fn get_level_downsample(&self, level: u32) -> Result<f64>
pub fn get_level_downsample(&self, level: u32) -> Result<f64>
Get the downsampling factor of a given level.
sourcepub fn get_all_level_downsample(&self) -> Result<Vec<f64>>
pub fn get_all_level_downsample(&self) -> Result<Vec<f64>>
Get all downsampling factors for all available levels.
sourcepub fn get_best_level_for_downsample(&self, downsample: f64) -> Result<u32>
pub fn get_best_level_for_downsample(&self, downsample: f64) -> Result<u32>
Get the best level to use for displaying the given downsample factor.
sourcepub fn get_property_names(&self) -> Vec<String>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn get_property_names(&self) -> Vec<String>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Get the list of all available properties.
sourcepub fn get_property_value(&self, name: &str) -> Result<String>
pub fn get_property_value(&self, name: &str) -> Result<String>
Get the value of a single property.
sourcepub fn read_region(
&self,
offset: &Offset,
level: u32,
size: &Size
) -> Result<Vec<u8>>
pub fn read_region(
&self,
offset: &Offset,
level: u32,
size: &Size
) -> Result<Vec<u8>>
Copy pre-multiplied ARGB data from a whole slide image.
This function reads and decompresses a region of a whole slide image into a Vec
Args: offset: (x, y) coordinate (increasing downwards/to the right) of top left pixel position level: At which level to grab the region from size: (width, height) in pixels of the outputted region
Size of output Vec is Width * Height * 4 (RGBA pixels)
sourcepub fn get_associated_image_names(&self) -> Result<Vec<String>>
pub fn get_associated_image_names(&self) -> Result<Vec<String>>
Get the list name of all available associated image.
sourcepub fn read_associated_buffer(&self, name: &str) -> Result<(Size, Vec<u8>)>
pub fn read_associated_buffer(&self, name: &str) -> Result<(Size, Vec<u8>)>
Copy pre-multiplied ARGB data from a whole slide image.
This function reads and decompresses an associated image into an Vec
Args: name: name of the associated image we want to read
Size of output Vec is width * height * 4 (RGBA pixels)
sourcepub fn get_associated_image_dimensions(&self, name: &str) -> Result<Size>
pub fn get_associated_image_dimensions(&self, name: &str) -> Result<Size>
Get the size of an associated image
sourcepub fn read_associated_image(&self, name: &str) -> Result<RgbaImage>
pub fn read_associated_image(&self, name: &str) -> Result<RgbaImage>
Copy pre-multiplied ARGB data from a whole slide image.
This function reads and decompresses an associated image into an RgbaImage
Args: name: name of the associated image we want to read
sourcepub fn read_image(
&self,
offset: &Offset,
level: u32,
size: &Size
) -> Result<RgbaImage>
pub fn read_image(
&self,
offset: &Offset,
level: u32,
size: &Size
) -> Result<RgbaImage>
Copy pre-multiplied ARGB data from a whole slide image.
This function reads and decompresses a region of a whole slide image into an RgbaImage
Args: offset: (x, y) coordinate (increasing downwards/to the right) of top left pixel position level: At which level to grab the region from size: (width, height) in pixels of the outputted region