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#pragma once
5
6#include <vector>
7#include <opencv2/core/mat.hpp>
8
9#include "slideio/converter/converter_def.hpp"
10#include "slideio/base/size.hpp"
11#include "slideio/base/rect.hpp"
12
13namespace slideio
14{
15 class CVScene;
16 namespace converter
17 {
18 class ConverterParameters;
19 class SLIDEIO_CONVERTER_EXPORTS ConverterTools
20 {
21 public:
22 static int computeNumZoomLevels(int width, int height);
23 static Size scaleSize(const Size& size, int zoomLevel, bool downScale = true);
24 static Rect scaleRect(const Rect& rect, int zoomLevel, bool downScale);
25 static void readTile(const std::shared_ptr <CVScene>& scene, const std::vector<int> channels, int zoomLevel, const cv::Rect& sceneBlockRect,
26 int slice, int frame, cv::OutputArray tile);
27 static Rect computeZoomLevelRect(const Rect& sceneRect, const Size& tileSize, int zoomLevel);
28 static int computeNumTiles(const Size& imageSize, const Size& tileSize) {
29 const int numTilesX = (imageSize.width + tileSize.width - 1) / tileSize.width;
30 const int numTilesY = (imageSize.height + tileSize.height - 1) / tileSize.height;
31 return numTilesX * numTilesY;
32 }
33
34 };
35 }
36}
Definition: exceptions.hpp:15