SlideIO 2.9.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
ndpiscene.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 "ndpitifftools.hpp"
7#include "slideio/drivers/ndpi/ndpi_api_def.hpp"
8#include "slideio/core/cvscene.hpp"
9#include "slideio/core/tools/tilecomposer.hpp"
10
11#if defined(_MSC_VER)
12#pragma warning( push )
13#pragma warning(disable: 4251)
14#endif
15
16namespace slideio
17{
18 class NDPIFile;
19}
20
21namespace slideio
22{
23 class SLIDEIO_NDPI_EXPORTS NDPIScene : public CVScene, public Tiler
24 {
25 friend class NDPISlide;
26 protected:
27 NDPIScene();
28 public:
29 virtual ~NDPIScene();
30 void init(const std::string& name, int sceneIndex, const std::string& driverId, NDPIFile* file, int32_t startDirIndex, int32_t endDirIndex);
31 int getNumChannels() const override;
32 cv::Rect getRect() const override;
33 std::string getFilePath() const override;
34 const std::string& getDriverId() const override {
35 return m_driverId;
36 }
37 int getSceneIndex() const override {
38 return m_sceneIndex;
39 }
40 std::string getName() const override {
41 return m_sceneName;
42 }
43 slideio::DataType getChannelDataType(int channel) const override;
44 Resolution getResolution() const override;
45 double getMagnification() const override;
46 Compression getCompression() const override;
47 void readResampledBlockChannelsEx(const cv::Rect& blockRect, const cv::Size& blockSize,
48 const std::vector<int>& componentIndices, int zSliceIndex, int tFrameIndex, cv::OutputArray output) override;
49 void readResampledLevelBlockChannelsEx(int level, const cv::Rect& levelRect,
50 const cv::Size& blockSize, const std::vector<int>& channelIndices,
51 int zSliceIndex, int tFrameIndex, cv::OutputArray output) override;
52 // The index of the level serving a zoom. NDPIFile::findZoomDirectory performs this
53 // same search and then returns the directory; the level path needs the index itself.
54 int findZoomLevelIndex(double zoom) const;
55 const NDPITiffDirectory& findZoomDirectory(const cv::Rect& imageBlockRect, const cv::Size& requiredBlockSize) const;
56 void scaleBlockToDirectory(const cv::Rect& imageBlockRect, const slideio::NDPITiffDirectory& dir, cv::Rect& dirBlockRect) const;
57 int getTileCount(void* userData) override;
58 bool getTileRect(int tileIndex, cv::Rect& tileRect, void* userData) override;
59 bool readTile(int tileIndex, const std::vector<int>& channelIndices, cv::OutputArray tileRaster,
60 void* userData) override;
61 void initializeBlock(const cv::Size& blockSize, const std::vector<int>& channelIndices, cv::OutputArray output) override;
62 private:
63 void makeSureValidDirectoryType(NDPITiffDirectory::Type directoryType);
64 protected:
65 NDPIFile* m_pfile;
66 int m_startDir;
67 int m_endDir;
68 std::string m_sceneName;
69 cv::Rect m_rect;
70 int m_sceneIndex;
71 std::string m_driverId;
72 };
73
74}
75
76#if defined(_MSC_VER)
77#pragma warning( pop )
78#endif
Definition: exceptions.hpp:15
Compression
raster data compression enum
Definition: slideio_enums.hpp:12