SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
zviscene.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_zviscene_HPP
5#define OPENCV_slideio_zviscene_HPP
6
7#include "slideio/core/cvscene.hpp"
8#include "slideio/core/tools/tilecomposer.hpp"
9#include "slideio/drivers/zvi/zviimageitem.hpp"
10#include <pole/storage.hpp>
11#include "slideio/drivers/zvi/zvitile.hpp"
12#include "slideio/drivers/zvi/zvi_api_def.hpp"
13
14#if defined(_MSC_VER)
15#pragma warning( push )
16#pragma warning(disable: 4251)
17#endif
18
19namespace slideio
20{
21 class ZVISlide;
22
23 class SLIDEIO_ZVI_EXPORTS ZVIScene : public CVScene, public Tiler
24 {
25 private:
26 struct TilerData
27 {
28 int zSliceIndex = 0;
29 };
30 public:
31 ZVIScene(const std::string& filePath);
32 std::string getFilePath() const override;
33 cv::Rect getRect() const override;
34 int getNumChannels() const override;
35 int getNumZSlices() const override;
36 int getNumTFrames() const override;
37 double getZSliceResolution() const override;
38 double getTFrameResolution() const override;
39 void validateChannelIndex(int channel) const;
40 DataType getChannelDataType(int channel) const override;
41 std::string getChannelName(int channel) const override;
42 Resolution getResolution() const override;
43 double getMagnification() const override;
44 void readResampledBlockChannels(const cv::Rect& blockRect, const cv::Size& blockSize,
45 const std::vector<int>& componentIndices, cv::OutputArray output) override;
46 std::string getName() const override;
47 Compression getCompression() const override;
48 protected:
49 void readResampledBlockChannelsEx(const cv::Rect& blockRect, const cv::Size& blockSize,
50 const std::vector<int>& componentIndices, int zSliceIndex, int tFrameIndex,
51 cv::OutputArray output) override;
52 public:
53 int getTileCount(void* userData) override;
54 bool getTileRect(int tileIndex, cv::Rect& tileRect, void* userData) override;
55 bool readTile(int tileIndex, const std::vector<int>& channelIndices, cv::OutputArray tileRaster,
56 void* userData) override;
57 void initializeBlock(const cv::Size& blockSize, const std::vector<int>& channelIndices, cv::OutputArray output) override;
58 private:
59 ZVIPixelFormat getPixelFormat() const;
60 void alignChannelInfoToPixelFormat();
61 void computeSceneDimensions();
62 void readImageItems();
63 void init();
64 void parseImageTags();
65 void parseImageInfo();
66 void computeTiles();
67 private:
68 std::string m_filePath;
69 ole::compound_document m_Doc;
70 int m_Width = 0;
71 int m_Height = 0;
72 int m_RawCount = 0;
73 ZVIPixelFormat m_PixelFormat = ZVIPixelFormat::PF_UNKNOWN;
74 int m_ChannelCount = 0;
75 int m_ZSliceCount = 0;
76 int m_TFrameCount = 0;
77 int m_TileCountX = 1;
78 int m_TileCountY = 1;
79 std::vector<DataType> m_ChannelDataTypes;
80 std::vector<std::string> m_ChannelNames;
81 std::vector<ZVIImageItem> m_ImageItems;
82 std::vector<ZVITile> m_Tiles;
83 Resolution m_res = {0,0};
84 double m_ZSliceRes = 0.;
85 std::string m_SceneName;
86 Compression m_Compression = Compression::Uncompressed;
87 };
88}
89
90
91#if defined(_MSC_VER)
92#pragma warning( pop )
93#endif
94
95#endif
Definition: exceptions.hpp:12
Compression
raster data compression enum
Definition: slideio_enums.hpp:12