SlideIO 2.9.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
phtmetadata.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#include "slideio/drivers/svs/svs_api_def.hpp"
6#include "slideio/base/resolution.hpp"
7#include <opencv2/core.hpp>
8#include <string>
9#include <vector>
10
11namespace slideio
12{
13 // One zoom level as the philips metadata declares it. The declared size is optional:
14 // the metadata may omit LEVEL_COLUMNS/LEVEL_ROWS, and a zero size means "not stated".
15 struct PHTLevelDeclaration
16 {
17 int number = 0;
18 cv::Size declaredSize = {};
19 Resolution spacing = {};
20 };
21
22 // One DPScannedImage: the whole slide image or an auxiliary one.
23 struct PHTImageDeclaration
24 {
25 std::string type;
26 cv::Size size = {};
27 Resolution spacing = {};
28 std::vector<PHTLevelDeclaration> levels; // empty for an auxiliary image
29 };
30
31 // Everything the driver needs from the philips xml, parsed once per open. What only
32 // the metadata tree needs is deliberately absent: building that tree needs nearly the
33 // whole document, and it is built lazily, so folding it in here would parse 844 KB on
34 // every open for callers that never ask for metadata.
35 struct SLIDEIO_SVS_EXPORTS PHTMetadata
36 {
37 std::vector<PHTImageDeclaration> images;
38 const PHTImageDeclaration* wholeSlideImage() const;
39 };
40
41 // Raises if the description is not parseable philips metadata. An image or level
42 // declaration that is incomplete is skipped with a warning, not raised on.
43 SLIDEIO_SVS_EXPORTS PHTMetadata readPHTMetadata(const std::string& description);
44}
Definition: exceptions.hpp:15