SlideIO 2.9.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
svstools.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
6#include "slideio/drivers/svs/svs_api_def.hpp"
7#include "slideio/imagetools/tifftools.hpp"
8#include <opencv2/core.hpp>
9#include <nlohmann/json.hpp>
10#include <string>
11
12namespace slideio
13{
14 class SLIDEIO_SVS_EXPORTS SVSTools
15 {
16 public:
17 // Extracts magnification value from image information string
18 static int extractMagnifiation(const std::string& description);
19 // Extracts resolution value from image information string
20 static double extractResolution(const std::string& description);
21 // The magnification of the base zoom level, derived from the description of a
22 // philips zoom level directory ("level=1 mag=20 quality=80" -> 40). Philips names
23 // the magnification of every level but the base, whose directory carries the xml
24 // metadata instead; a level covers 2^-level of the base, so the base is
25 // mag * 2^level. Returns 0 if the description names no usable magnification.
26 static double extractPhilipsMagnification(const std::string& description);
27 // The zoom level a philips level directory's description names
28 // ("level=1 mag=20 quality=80" -> 1), or -1 if it names none. The base level's
29 // directory carries the xml metadata instead and so names none.
30 static int extractPhilipsLevelNumber(const std::string& description);
31 // Parses an Aperio-format metadata string into a structured JSON tree.
32 // Header lines (before the first '|') become "application" and "image";
33 // subsequent "name = value" tokens become entries under "properties".
34 static nlohmann::json parseAperioMetadata(const std::string& description);
35 // Serializes a TiffDirectory (and its subdirectories) to JSON.
36 static nlohmann::json tiffDirectoryToJson(const TiffDirectory& dir);
37 };
38}
Definition: exceptions.hpp:15