SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
scnscene.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_scnscene_HPP
5#define OPENCV_slideio_scnscene_HPP
6
7#include "slideio/drivers/scn/scn_api_def.hpp"
8#include "slideio/core/cvscene.hpp"
9#include "slideio/imagetools/tifftools.hpp"
10#include "slideio/core/tools/tilecomposer.hpp"
11#include "slideio/drivers/scn/scnstruct.h"
12#include "slideio/imagetools/tiffkeeper.hpp"
13
14namespace tinyxml2
15{
16 class XMLElement;
17}
18
19#if defined(_MSC_VER)
20#pragma warning( push )
21#pragma warning(disable: 4251)
22#endif
23
24namespace slideio
25{
26 class SLIDEIO_SCN_EXPORTS SCNScene : public CVScene, public Tiler
27 {
28 public:
34 SCNScene(const std::string& filePath, const tinyxml2::XMLElement* xmlImage);
35
36 virtual ~SCNScene();
37
38 std::string getFilePath() const override {
39 return m_filePath;
40 }
41 std::string getName() const override {
42 return m_name;
43 }
44 Compression getCompression() const override{
45 return m_compression;
46 }
47 slideio::Resolution getResolution() const override{
48 return m_resolution;
49 }
50 double getMagnification() const override{
51 return m_magnification;
52 }
53 DataType getChannelDataType(int channelIndex) const override{
54 return m_channelDataType[channelIndex];
55 }
56 const std::vector<TiffDirectory>& getChannelDirectories(int channelIndex) const {
57 const int dirIndex = m_interleavedChannels ? 0 : channelIndex;
58 return m_channelDirectories[dirIndex];
59 }
60 cv::Rect getRect() const override;
61 int getNumChannels() const override;
62 void readResampledBlockChannels(const cv::Rect& blockRect, const cv::Size& blockSize,
63 const std::vector<int>& channelIndices, cv::OutputArray output) override;
64 std::string getChannelName(int channel) const override;
65 int getTileCount(void* userData) override;
66 bool getTileRect(int tileIndex, cv::Rect& tileRect, void* userData) override;
67 bool readTile(int tileIndex, const std::vector<int>& channelIndices, cv::OutputArray tileRaster,
68 void* userData) override;
69 void initializeBlock(const cv::Size& blockSize, const std::vector<int>& channelIndices, cv::OutputArray output) override;
70 const TiffDirectory& findZoomDirectory(int channelIndex, double zoom) const;
71 protected:
72 void init(const tinyxml2::XMLElement* xmlImage);
73 static std::vector<SCNDimensionInfo> parseDimensions(const tinyxml2::XMLElement* xmlPixels);
74 void parseChannelNames(const tinyxml2::XMLElement* xmlImage);
75 void parseGeometry(const tinyxml2::XMLElement* xmlImage);
76 void parseMagnification(const tinyxml2::XMLElement* xmlImage);
77 void defineChannelDataType();
78 void setupChannels(const tinyxml2::XMLElement* xmlPixels);
79 libtiff::TIFF* getFileHandle() {
80 return m_tiff;
81 }
82
83 protected:
84 TIFFKeeper m_tiff;
85 std::string m_filePath;
86 std::string m_name;
87 std::string m_reawMetadata;
88 Compression m_compression;
89 Resolution m_resolution;
90 double m_magnification;
91 cv::Rect m_rect;
92 int m_numChannels;
93 std::vector<std::string> m_channelNames;
94 std::vector<DataType> m_channelDataType;
95 std::vector<std::vector<TiffDirectory>> m_channelDirectories;
96 bool m_interleavedChannels;
97 };
98}
99
100#if defined(_MSC_VER)
101#pragma warning( pop )
102#endif
103
104#endif
Definition: exceptions.hpp:12
Compression
raster data compression enum
Definition: slideio_enums.hpp:12