SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
zviutils.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.#pragma once
4#ifndef OPENCV_slideio_zviutils_HPP
5#define OPENCV_slideio_zviutils_HPP
6
7#include "slideio/drivers/zvi/zvi_api_def.hpp"
8#include "slideio/drivers/zvi/pole_lib.hpp"
9#include "slideio/base/slideio_enums.hpp"
10#include <codecvt>
11#include <cstdint>
12#include <string>
13#include <variant>
14
15#if defined(_MSC_VER)
16#pragma warning( push )
17#pragma warning(disable: 4251)
18#endif
19
20enum class ZVIPixelFormat;
21
22namespace slideio
23{
24 namespace ZVIUtils
25 {
26 typedef enum tagVARENUM
27 {
28 VT_EMPTY = 0x0000,
29 VT_NULL = 0x0001,
30 VT_I2 = 0x0002,
31 VT_I4 = 0x0003,
32 VT_R4 = 0x0004,
33 VT_R8 = 0x0005,
34 VT_CY = 0x0006,
35 VT_DATE = 0x0007,
36 VT_BSTR = 0x0008,
37 VT_DISPATCH = 0x0009,
38 VT_ERROR = 0x000A,
39 VT_BOOL = 0x000B,
40 VT_VARIANT = 0x000C,
41 VT_UNKNOWN = 0x000D,
42 VT_DECIMAL = 0x000E,
43 VT_I1 = 0x0010,
44 VT_UI1 = 0x0011,
45 VT_UI2 = 0x0012,
46 VT_UI4 = 0x0013,
47 VT_I8 = 0x0014,
48 VT_UI8 = 0x0015,
49 VT_INT = 0x0016,
50 VT_UINT = 0x0017,
51 VT_VOID = 0x0018,
52 VT_HRESULT = 0x0019,
53 VT_PTR = 0x001A,
54 VT_SAFEARRAY = 0x001B,
55 VT_CARRAY = 0x001C,
56 VT_USERDEFINED = 0x001D,
57 VT_LPSTR = 0x001E,
58 VT_LPWSTR = 0x001F,
59 VT_RECORD = 0x0024,
60 VT_INT_PTR = 0x0025,
61 VT_UINT_PTR = 0x0026,
62 VT_BLOB = 0x0041,
63 VT_STREAM = 0x0042,
64 VT_STORAGE = 0x0043,
65 VT_STREAMED_OBJECT = 0x0044,
66 VT_STORED_OBJECT = 0x0045,
67 VT_ARRAY = 0x2000,
68 VT_BYREF = 0x4000
69 } VARENUM;
70 typedef std::variant<std::monostate, bool, int32_t, uint32_t, uint64_t, int64_t, double, std::string> Variant;
71 void SLIDEIO_ZVI_EXPORTS skipItem(ole::basic_stream& stream);
72 void SLIDEIO_ZVI_EXPORTS skipItems(ole::basic_stream& stream, int count);
73 int32_t SLIDEIO_ZVI_EXPORTS readIntItem(ole::basic_stream& stream);
74 double SLIDEIO_ZVI_EXPORTS readDoubleItem(ole::basic_stream& stream);
75 std::string SLIDEIO_ZVI_EXPORTS readStringItem(ole::basic_stream& stream);
76 Variant SLIDEIO_ZVI_EXPORTS readItem(ole::basic_stream& stream, bool skipUnusedTypes = true);
77 slideio::DataType dataTypeFromPixelFormat(const ZVIPixelFormat pixel_format);
78 int channelCountFromPixelFormat(ZVIPixelFormat pixelFormat);
79
80 class SLIDEIO_ZVI_EXPORTS StreamKeeper
81 {
82 public:
83 StreamKeeper(ole::compound_document& doc, const std::string& path);
84 operator ole::basic_stream& () {
85 return m_StreamPos->stream();
86 }
87 ole::basic_stream* operator ->() {
88 return &(m_StreamPos->stream());
89 }
90 private:
91 std::vector<ole::stream_path>::iterator m_StreamPos;
92 };
93 }
94}
95#if defined(_MSC_VER)
96#pragma warning( pop )
97#endif
98
99#endif
Definition: exceptions.hpp:15