Public Member Functions | List of all members
ecvl::OpenSlideImage Class Reference

#include <support_openslide.h>

Public Member Functions

 OpenSlideImage (const ecvl::filesystem::path &filename)
 
int GetLevelCount ()
 Get the number of levels in the image. More...
 
void GetLevelsDimensions (std::vector< std::array< int, 2 >> &levels)
 Get width and height for each level of a whole-slide image. More...
 
void GetLevelDownsamples (std::vector< double > &levels)
 Get the downsampling factor for each level, or -1.0 if an error occurred. More...
 
int GetBestLevelForDownsample (const double &downsample)
 Get the best level to use for displaying the given downsample. More...
 
void GetProperties (Image &dst)
 Loads properties (metadata) from the OpenSlide file and saves them into an ECVL Image. More...
 
bool ReadRegion (Image &dst, const int level, const std::vector< int > &dims)
 Loads a region of a whole-slide image. More...
 
void Close ()
 Close the OpenSlide object. More...
 
 ~OpenSlideImage ()
 

Detailed Description

Examples
example_openslide.cpp.

Definition at line 23 of file support_openslide.h.

Constructor & Destructor Documentation

◆ OpenSlideImage()

ecvl::OpenSlideImage::OpenSlideImage ( const ecvl::filesystem::path &  filename)
inline

Definition at line 30 of file support_openslide.h.

◆ ~OpenSlideImage()

ecvl::OpenSlideImage::~OpenSlideImage ( )
inline

Definition at line 93 of file support_openslide.h.

Member Function Documentation

◆ Close()

void ecvl::OpenSlideImage::Close ( )
inline

Close the OpenSlide object.

Definition at line 87 of file support_openslide.h.

◆ GetBestLevelForDownsample()

int ecvl::OpenSlideImage::GetBestLevelForDownsample ( const double &  downsample)

Get the best level to use for displaying the given downsample.

Parameters
[in]downsampleThe downsample desired factor.
Returns
level OpenSlide image level extracted, or -1 if an error occurred.

◆ GetLevelCount()

int ecvl::OpenSlideImage::GetLevelCount ( )
inline

Get the number of levels in the image.

Definition at line 40 of file support_openslide.h.

◆ GetLevelDownsamples()

void ecvl::OpenSlideImage::GetLevelDownsamples ( std::vector< double > &  levels)

Get the downsampling factor for each level, or -1.0 if an error occurred.

Parameters
[out]levelsIt contains the downsampling factor for the corresponding level of that position.

◆ GetLevelsDimensions()

void ecvl::OpenSlideImage::GetLevelsDimensions ( std::vector< std::array< int, 2 >> &  levels)

Get width and height for each level of a whole-slide image.

Parameters
[out]levelsA std::vector of array containing two elements, width and height respectively. levels[k] are the dimensions of level k.

◆ GetProperties()

void ecvl::OpenSlideImage::GetProperties ( Image dst)

Loads properties (metadata) from the OpenSlide file and saves them into an ECVL Image.

Parameters
[out]dstImage in which metadata will be stored.

◆ ReadRegion()

bool ecvl::OpenSlideImage::ReadRegion ( Image dst,
const int  level,
const std::vector< int > &  dims 
)

Loads a region of a whole-slide image.

Supported formats are those supported by OpenSlide library. If the region cannot be read for any reason, the function creates an empty Image and returns false.

Parameters
[out]dstImage in which data will be stored. It will be a RGB image stored in a "cxy" layout.
[in]levelOpenSlide image level to be extracted.
[in]dimsstd::vector containing { x, y, w, h }. x and y are the top left x-coordinate and y-coordinate, in the level 0 reference frame. w and h are the width and height of the region.
Returns
true if the region is correctly read, false otherwise.
Examples
example_openslide.cpp.

The documentation for this class was generated from the following file: