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