SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
dcmscene.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 <map>
7
8#include "slideio/drivers/dcm/dcm_api_def.hpp"
9#include "slideio/core/cvscene.hpp"
10#include "slideio/drivers/dcm/dcmfile.hpp"
11
12#if defined(_MSC_VER)
13#pragma warning( push )
14#pragma warning(disable: 4251)
15#endif
16
17namespace slideio
18{
19 class DCMSlide;
20 class SLIDEIO_DCM_EXPORTS DCMScene : public CVScene
21 {
22 public:
23 DCMScene();
24 std::string getFilePath() const override;
25 int getSceneIndex() const override {
26 return m_sceneIndex;
27 }
28 const std::string& getDriverId() const override {
29 return m_driverId;
30 }
31 void setDriverId(const std::string& driverId) {
32 m_driverId = driverId;
33 }
34 cv::Rect getRect() const override;
35 int getNumChannels() const override;
36 int getNumZSlices() const override;
37 int getNumTFrames() const override;
38 double getZSliceResolution() const override;
39 double getTFrameResolution() const override;
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 void readResampledBlockChannelsEx(const cv::Rect& blockRect, const cv::Size& blockSize,
45 const std::vector<int>& componentIndices, int zSliceIndex, int tFrameIndex, cv::OutputArray output) override;
46 std::string getName() const override;
47 Compression getCompression() const override;
48 void addFile(std::shared_ptr<DCMFile>& file);
49 void init(const std::string& slideFilePath, int sceneIndex, const std::string& driverId);
50 protected:
51 void prepareSliceIndices();
52 void checkScene();
53 void extractSliceRaster(const cv::Mat& frame,
54 const cv::Rect& blockRect,
55 const cv::Size& blockSize,
56 const std::vector<int>& componentIndices,
57 cv::OutputArray output);
58 std::pair<int, int> findFileIndex(int zSliceIndex);
59 private:
60 std::vector<std::shared_ptr<DCMFile>> m_files;
61 std::map<int, int> m_sliceMap;
62 cv::Rect m_rect = { 0, 0, 0, 0 };
63 std::string m_name;
64 int m_numSlices = 1;
65 int m_numFrames = 1;
66 int m_numChannels = 0;
67 std::string m_filePath;
68 int m_sceneIndex = 0;
69 DataType m_dataType = DataType::DT_Unknown;
70 Compression m_compression = Compression::Unknown;
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