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 std::string getName() const override;
45 Compression getCompression() const override;
46 void readResampledBlockChannelsEx(const cv::Rect& blockRect, const cv::Size& blockSize,
47 const std::vector<int>& componentIndices, int zSliceIndex, int tFrameIndex,
48 cv::OutputArray output) override;
49 public:
50 int getTileCount(void* userData) override;
51 bool getTileRect(int tileIndex, cv::Rect& tileRect, void* userData) override;
52 bool readTile(int tileIndex, const std::vector<int>& channelIndices, cv::OutputArray tileRaster,
53 void* userData) override;
54 void initializeBlock(const cv::Size& blockSize, const std::vector<int>& channelIndices, cv::OutputArray output) override;
55 private:
56 ZVIPixelFormat getPixelFormat() const;
57 void alignChannelInfoToPixelFormat();
58 void computeSceneDimensions();
59 void readImageItems();
60 void init();
61 void parseImageTags();
62 void parseImageInfo();
63 void computeTiles();
64 private:
65 std::string m_filePath;
66 ole::compound_document m_Doc;
67 int m_Width = 0;
68 int m_Height = 0;
69 int m_RawCount = 0;
70 ZVIPixelFormat m_PixelFormat = ZVIPixelFormat::PF_UNKNOWN;
71 int m_ChannelCount = 0;
72 int m_ZSliceCount = 0;
73 int m_TFrameCount = 0;
74 int m_TileCountX = 1;
75 int m_TileCountY = 1;
76 std::vector<DataType> m_ChannelDataTypes;
77 std::vector<std::string> m_ChannelNames;
78 std::vector<ZVIImageItem> m_ImageItems;
79 std::vector<ZVITile> m_Tiles;
80 Resolution m_res = {0,0};
81 double m_ZSliceRes = 0.;
82 std::string m_SceneName;
83 Compression m_Compression = Compression::Uncompressed;
84 };
85}
86
87
88#if defined(_MSC_VER)
89#pragma warning( pop )
90#endif
91
92#endif
Definition: exceptions.hpp:15
Compression
raster data compression enum
Definition: slideio_enums.hpp:12