4#ifndef OPENCV_slideio_dcmfile_HPP
5#define OPENCV_slideio_dcmfile_HPP
7#include "slideio/drivers/dcm/dcm_api_def.hpp"
8#include "slideio/base/slideio_enums.hpp"
11#include <opencv2/core.hpp>
13#include "slideio/base/slideio_enums.hpp"
14#include "slideio/core/cvstructs.hpp"
17#pragma warning( push )
18#pragma warning(disable: 4251)
28 enum class EPhotoInterpetation
47 class SLIDEIO_DCM_EXPORTS DCMFile
50 DCMFile(
const std::string& filePath);
54 int getWidth()
const {
58 int getHeight()
const {
62 int getNumSlices()
const {
66 const std::string& getFilePath()
const {
70 const std::string& getSeriesUID()
const {
74 int getInstanceNumber()
const {
75 return m_instanceNumber;
78 int getNumChannels()
const {
82 const std::string& getSeriesDescription()
const {
83 return m_seriesDescription;
86 DataType getDataType()
const {
90 bool getPlanarConfiguration()
const {
91 return m_planarConfiguration;
94 EPhotoInterpetation getPhotointerpretation()
const {
95 return m_photoInterpretation;
102 const std::string& getModality()
const {
107 void readPixelValues(std::vector<cv::Mat>& frames,
int startFrame = 0,
int numFrames = 1);
109 bool isWSIFile()
const {
113 std::string getMetadata();
114 double getMagnification()
const {
115 return m_magnification;
117 const Resolution& getResolution()
const {
120 static bool isDicomDirFile(
const std::string& filePath);
121 static bool isWSIFile(
const std::string& filePath);
123 const cv::Size& getTileSize()
const {
127 int getNumFrames()
const {
130 bool getTileRect(
int tileIndex, cv::Rect& tileRect)
const;
131 bool readFrame(
int tileIndex, cv::OutputArray tileRaster);
132 double getScale()
const {
135 void setScale(
double scale) {
138 bool isTiled()
const {
141 const std::string& getImageType()
const {
144 bool isAuxImage()
const {
145 return m_imageType !=
"VOLUME";
148 void readFrames(std::vector<cv::Mat>& frames,
int startFrame,
int numFrames);
149 void extractPixelsWholeFileDecompression(std::vector<cv::Mat>& mats,
int startFrame,
int numFrames);
150 std::shared_ptr<DicomImage> createImage(
int firstSlice = 0,
int numSlices = 1);
151 void initPhotoInterpretaion();
152 void defineCompression();
153 DcmDataset* getDataset()
const;
154 DcmDataset* getValidDataset()
const;
155 bool getIntTag(
const DcmTagKey& tag,
int& value,
int pos = 0)
const;
156 bool getStringTag(
const DcmTagKey& tag, std::string& value)
const;
157 bool getStringTag(
const DcmTagKey& tag,
int index, std::string& value)
const;
158 bool getDblTag(
const DcmTagKey& tag,
double& value,
double defaultValue);
160 std::string m_filePath;
161 std::shared_ptr<DcmFileFormat> m_file;
165 int m_instanceNumber = -1;
166 std::string m_seriesUID;
167 std::string m_seriesDescription;
168 int m_numChannels = 0;
169 DataType m_dataType = DataType::DT_Unknown;
170 bool m_planarConfiguration =
false;
171 EPhotoInterpetation m_photoInterpretation = EPhotoInterpetation::PHIN_UNKNOWN;
172 double m_windowCenter = -1;
173 double m_windowWidth = -1;
174 double m_rescaleSlope = 1.;
175 double m_rescaleIntercept = 0.;
176 bool m_useWindowing =
false;
177 bool m_useRescaling =
false;
179 bool m_decompressWholeFile =
false;
180 int m_bitsAllocated = 0;
181 std::string m_modality;
182 bool m_WSISlide =
false;
184 cv::Size m_tileSize = {0, 0};
185 double m_magnification = 0.;
186 Resolution m_resolution = { 0. };
188 bool m_bTiled =
false;
189 std::string m_imageType;
194#pragma warning( pop )
Definition: exceptions.hpp:12
Compression
raster data compression enum
Definition: slideio_enums.hpp:12