SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
pyramid.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#include "slideio/drivers/vsi/vsi_api_def.hpp"
6#include <opencv2/core.hpp>
7#include <vector>
8
9#if defined(_MSC_VER)
10#pragma warning( push )
11#pragma warning(disable: 4251)
12#endif
13
14namespace slideio
15{
16 namespace vsi
17 {
18 class IDimensionOrder;
19
20 struct TileInfo
21 {
22 std::vector<int> coordinates;
23 int64_t offset = 0;
24 uint32_t size = 0;
25 };
26
27 class SLIDEIO_VSI_EXPORTS PyramidLevel
28 {
29 friend class Pyramid;
30
31 public:
32 int getScaleLevel() const { return m_scaleLevel; }
33 cv::Size getSize() const { return m_size; }
34 int getNumTiles() const { return static_cast<int>(m_tileIndices.size()); }
35 const TileInfo& getTile(int tileIndex, int channelIndex, int zIndex, int tIndex) const;
36 private:
37 int m_scaleLevel = 1;
38 cv::Size m_size;
39 std::vector<TileInfo> m_tiles;
40 std::vector<int> m_tileIndices;
41 int m_channelDimIndex = -1;
42 int m_zDimIndex = -1;
43 int m_tDimIndex = -1;
44 };
45
46 class SLIDEIO_VSI_EXPORTS Pyramid
47 {
48 public:
49 int getNumLevels() const { return static_cast<int>(m_levels.size()); }
50 const PyramidLevel& getLevel(int index) const { return m_levels[index]; }
51 void init(std::vector<TileInfo>& tiles, const cv::Size& imageSize, const cv::Size& tileSize,
52 const IDimensionOrder* dimOrder);
53 int getNumChannelIndices() const { return m_numChannelIndices; }
54 int getNumZIndices() const { return m_numZIndices; }
55 int getNumTIndices() const { return m_numTIndices; }
56 private:
57 std::vector<PyramidLevel> m_levels;
58 int m_numChannelIndices = 1;
59 int m_numZIndices = 1;
60 int m_numTIndices = 1;
61 };
62 }
63}
64
65#if defined(_MSC_VER)
66#pragma warning( pop )
67#endif
Definition: exceptions.hpp:12