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 EtsFile;
19 class IDimensionOrder;
20
21 struct TileInfo
22 {
23 std::vector<int> coordinates;
24 int64_t offset = 0;
25 uint32_t size = 0;
26 };
27
28 class SLIDEIO_VSI_EXPORTS PyramidLevel
29 {
30 friend class Pyramid;
31
32 public:
33 int getScaleLevel() const { return m_scaleLevel; }
34 cv::Size getSize() const { return m_size; }
35 int getNumTiles() const { return static_cast<int>(m_tileIndices.size()); }
36 const TileInfo& getTile(int tileIndex, int channelIndex, int zIndex, int tIndex) const;
37 private:
38 int m_scaleLevel = 1;
39 cv::Size m_size;
40 std::vector<TileInfo> m_tiles;
41 std::vector<int> m_tileIndices;
42 int m_channelDimIndex = -1;
43 int m_zDimIndex = -1;
44 int m_tDimIndex = -1;
45 };
46
47 typedef std::shared_ptr<EtsFile> EtsFilePtr;
48 typedef std::vector<TileInfo> TileInfoList;
49 typedef std::shared_ptr<TileInfoList> TileInfoListPtr;
50
51 class SLIDEIO_VSI_EXPORTS Pyramid
52 {
53 public:
54 int getNumLevels() const { return static_cast<int>(m_levels.size()); }
55 const PyramidLevel& getLevel(int index) const { return m_levels[index]; }
56 void init(const TileInfoListPtr& tiles, const cv::Size& imageSize, const cv::Size& tileSize,
57 const IDimensionOrder* dimOrder);
58 int getNumChannelIndices() const { return m_numChannelIndices; }
59 int getNumZIndices() const { return m_numZIndices; }
60 int getNumTIndices() const { return m_numTIndices; }
61 private:
62 std::vector<PyramidLevel> m_levels;
63 int m_numChannelIndices = 1;
64 int m_numZIndices = 1;
65 int m_numTIndices = 1;
66 };
67
68
69 }
70}
71
72#if defined(_MSC_VER)
73#pragma warning( pop )
74#endif
Definition: exceptions.hpp:15