SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
cvslide.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/core/slideio_core_def.hpp"
7#include "slideio/core/cvscene.hpp"
8#include "slideio/core/metadata.hpp"
9#include <string>
10#include <mutex>
11
12#if defined(_MSC_VER)
13#pragma warning( push )
14#pragma warning(disable: 4251)
15#endif
16
17namespace slideio
18{
28 class SLIDEIO_CORE_EXPORTS CVSlide
29 {
30 friend class ImageDriver;
31 protected:
32 virtual ~CVSlide() = default;
33 public:
35 virtual int getNumScenes() const = 0;
37 virtual std::string getFilePath() const = 0;
42 virtual const std::string& getRawMetadata() const {return m_rawMetadata;}
44 const Metadata& getMetadata() const;
46 virtual std::shared_ptr<CVScene> getScene(int index) const = 0;
48 virtual std::shared_ptr<CVScene> getSceneByName(const std::string& name);
52 virtual const std::list<std::string>& getAuxImageNames() const {
53 return m_auxNames;
54 }
56 virtual int getNumAuxImages() const {
57 return static_cast<int>(m_auxNames.size());
58 }
63 virtual std::shared_ptr<CVScene> getAuxImage(const std::string& sceneName) const;
68 virtual MetadataFormat getMetadataFormat() const { return m_metadataFormat; }
70 void setDriverId(const std::string& driverId) {
71 m_driverId = driverId;
72 }
74 const std::string& getDriverId() const {
75 return m_driverId;
76 }
78 static MetadataFormat recognizeMetadataFormat(const std::string& metadata);
80 std::string toString() const;
81 protected:
82 virtual MetadataBuilder buildMetadataTree() const;
83
84 protected:
85 std::string m_rawMetadata;
86 MetadataFormat m_metadataFormat = MetadataFormat::None;
87 std::list<std::string> m_auxNames;
88 std::string m_driverId;
89
90 private:
91 mutable std::once_flag m_metadataOnce;
92 mutable Metadata m_metadata;
93 };
94}
95
96#define CVSlidePtr std::shared_ptr<slideio::CVSlide>
97
98#if defined(_MSC_VER)
99#pragma warning( pop )
100#endif
CVSlide is an base class for representation of medical slide.
Definition: cvslide.hpp:29
virtual std::string getFilePath() const =0
The method returns a string which represents file path of the slide.
virtual int getNumAuxImages() const
The method returns number of auxiliary images contained in the slide.
Definition: cvslide.hpp:56
virtual const std::list< std::string > & getAuxImageNames() const
The method returns list of names of auxiliary images contained in the slide.
Definition: cvslide.hpp:52
virtual int getNumScenes() const =0
The method returns number of Scene objects contained in the slide.
virtual std::shared_ptr< CVScene > getScene(int index) const =0
The method returns a CVScene object by the scene index.
virtual MetadataFormat getMetadataFormat() const
The method returns a string containing serialized metadata of the slide.
Definition: cvslide.hpp:68
void setDriverId(const std::string &driverId)
The method sets driver id of the slide.
Definition: cvslide.hpp:70
virtual const std::string & getRawMetadata() const
The method returns a string containing serialized metadata of the slide.
Definition: cvslide.hpp:42
const std::string & getDriverId() const
The method returns driver id of the slide.
Definition: cvslide.hpp:74
Read-only tree view over slide/scene metadata.
Definition: metadata.hpp:26
Definition: exceptions.hpp:15