SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
cvtools.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.org/license.html.
4#ifndef OPENCV_slideio_cvtools_HPP
5#define OPENCV_slideio_cvtools_HPP
6
7#include <opencv2/core.hpp>
8#include "slideio/imagetools/slideio_imagetools_def.hpp"
9#include "slideio/core/cvslide.hpp"
10#include "slideio/base/slideio_enums.hpp"
11#include <string>
12#include <vector>
13
14namespace slideio
15{
16 class SLIDEIO_IMAGETOOLS_EXPORTS CVTools
17 {
18 public:
19 static std::shared_ptr<CVSlide> cvOpenSlide(const std::string& path, const std::string& driver);
20 static std::vector<std::string> cvGetDriverIDs();
21
22 static inline DataType fromOpencvType(int type)
23 {
24 return static_cast<DataType>(type);
25 }
26 static inline int toOpencvType(DataType dt)
27 {
28 return static_cast<int>(dt);
29 }
30
31 static inline bool isValidDataType(slideio::DataType dt)
32 {
33 return dt <= slideio::DataType::DT_LastValid;
34 }
35
36 static int cvGetDataTypeSize(DataType dt);
37 static int cvTypeFromDataType(DataType dt);
38 static void extractSliceFrom3D(cv::Mat mat3D, int sliceIndex, cv::OutputArray output);
39 static void extractSliceFromMultidimMatrix(cv::Mat multidimMat, const std::vector<int>& indices,
40 cv::OutputArray output);
47 static void insertSliceInMultidimMatrix(cv::Mat& multidimMat, const cv::Mat& sliceMat,
48 const std::vector<int>& indices);
49 static std::string dataTypeToString(DataType dataType);
50 static std::string compressionToString(Compression dataType);
51 };
52}
53
54#endif
Definition: exceptions.hpp:12