SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
wsiscene.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/drivers/dcm/dcm_api_def.hpp"
7#include "slideio/core/cvscene.hpp"
8#include "slideio/core/tools/tilecomposer.hpp"
9#include "slideio/drivers/dcm/dcmfile.hpp"
10#include <map>
11
12#if defined(_MSC_VER)
13#pragma warning( push )
14#pragma warning(disable: 4251)
15#endif
16
17namespace slideio
18{
19 class DCMScene;
20 class DCMSlide;
21 class SLIDEIO_DCM_EXPORTS WSIScene : public CVScene, public Tiler
22 {
23 public:
24 struct TilerData
25 {
26 int zoomLevelIndex = 0;
27 int zSliceIndex = 0;
28 int tFrameIndex = 0;
29 double relativeZoom = 1.;
30 };
31 public:
32 WSIScene();
33 void addFile(std::shared_ptr<DCMFile>& file);
34 void init();
35 std::string getFilePath() const override;
36 std::string getName() const override;
37 cv::Rect getRect() const override;
38 int getNumChannels() const override;
39 slideio::DataType getChannelDataType(int channel) const override;
40 Resolution getResolution() const override;
41 double getMagnification() const override;
42 Compression getCompression() const override;
43 private:
44 std::shared_ptr<DCMFile> getBaseFile() const;
45
46 public:
47 int getTileCount(void* userData) override;
48 bool getTileRect(int tileIndex, cv::Rect& tileRect, void* userData) override;
49 bool readTile(int tileIndex, const std::vector<int>& channelIndices, cv::OutputArray tileRaster,
50 void* userData) override;
51 void initializeBlock(const cv::Size& blockSize, const std::vector<int>& channelIndices,
52 cv::OutputArray output) override;
53 void readResampledBlockChannelsEx(const cv::Rect& blockRect, const cv::Size& blockSize,
54 const std::vector<int>& componentIndices, int zSliceIndex, int tFrameIndex,
55 cv::OutputArray output) override;
56 std::shared_ptr<CVScene> getAuxImage(const std::string& imageName) const override;
57
58 private:
59 std::vector<std::shared_ptr<DCMFile>> m_files;
60 cv::Rect m_rect = { 0, 0, 0, 0 };
61 std::string m_name;
62 int m_numSlices = 1;
63 int m_numFrames = 1;
64 int m_numChannels = 0;
65 std::string m_filePath;
66 DataType m_dataType = DataType::DT_Unknown;
67 Compression m_compression = Compression::Unknown;
68 double m_magnification = 0;
69 Resolution m_resolution = { 0, 0 };
70 std::map<std::string, std::shared_ptr<DCMScene>> m_auxImages;
71 };
72};
Definition: exceptions.hpp:15
Compression
raster data compression enum
Definition: slideio_enums.hpp:12