14 #ifndef SUPPORT_OPENSLIDE_H_ 15 #define SUPPORT_OPENSLIDE_H_ 19 #include "openslide.h" 26 const ecvl::filesystem::path filename_;
30 OpenSlideImage(
const ecvl::filesystem::path& filename) : filename_{ filename }
32 osr_ = openslide_open(filename.string().c_str());
33 if (osr_ == NULL || openslide_get_error(osr_) != NULL) {
36 n_levels_ = openslide_get_level_count(osr_);
84 bool ReadRegion(
Image& dst,
const int level,
const std::vector<int>& dims);
89 openslide_close(osr_);
106 #endif // SUPPORT_OPENSLIDE_H_
int GetBestLevelForDownsample(const double &downsample)
Get the best level to use for displaying the given downsample.
#define ECVL_ERROR_CANNOT_LOAD_IMAGE
bool ReadRegion(Image &dst, const int level, const std::vector< int > &dims)
Loads a region of a whole-slide image.
void GetLevelsDimensions(std::vector< std::array< int, 2 >> &levels)
Get width and height for each level of a whole-slide image.
void Close()
Close the OpenSlide object.
int GetLevelCount()
Get the number of levels in the image.
void GetProperties(Image &dst)
Loads properties (metadata) from the OpenSlide file and saves them into an ECVL Image.
OpenSlideImage(const ecvl::filesystem::path &filename)
void GetLevelDownsamples(std::vector< double > &levels)
Get the downsampling factor for each level, or -1.0 if an error occurred.