SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
convertertools.hpp
1// This file is part of slideio project.
2// It is subject to the license terms in the LICENSE file found in the top-level directory
3// of this distribution and at http://slideio.com/license.html.
4#ifndef OPENCV_slideio_convertertools_HPP
5#define OPENCV_slideio_convertertools_HPP
6
7#include <vector>
8#include <opencv2/core/mat.hpp>
9
10#include "slideio/converter/converter_def.hpp"
11#include "slideio/base/size.hpp"
12#include "slideio/base/range.hpp"
13#include "slideio/base/rect.hpp"
14
15namespace slideio
16{
17 class CVScene;
18 namespace converter
19 {
20 class ConverterParameters;
21 class SLIDEIO_CONVERTER_EXPORTS ConverterTools
22 {
23 public:
24 static int computeNumZoomLevels(int width, int height);
25 static Size scaleSize(const Size& size, int zoomLevel, bool downScale = true);
26 static Rect scaleRect(const Rect& rect, int zoomLevel, bool downScale);
27 static void readTile(const std::shared_ptr <CVScene>& scene, const std::vector<int> channels, int zoomLevel, const cv::Rect& sceneBlockRect,
28 int slice, int frame, cv::OutputArray tile);
29 static Rect computeZoomLevelRect(const Rect& sceneRect, const Size& tileSize, int zoomLevel);
30 static int computeNumTiles(const Size& imageSize, const Size& tileSize) {
31 const int numTilesX = (imageSize.width + tileSize.width - 1) / tileSize.width;
32 const int numTilesY = (imageSize.height + tileSize.height - 1) / tileSize.height;
33 return numTilesX * numTilesY;
34 }
35
36 };
37 }
38}
39
40#endif
Definition: exceptions.hpp:15