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