SlideIO 2.9.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
svsslide.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/core/cvscene.hpp"
8#include "slideio/core/cvslide.hpp"
9#include "slideio/imagetools/libtiff.hpp"
10#include <map>
11
12#include "slideio/imagetools/tiffkeeper.hpp"
13
14#if defined(_MSC_VER)
15#pragma warning( push )
16#pragma warning(disable: 4251)
17#endif
18
19namespace slideio
20{
21 class SVSSlide;
22}
23
24
25namespace slideio
26{
27 class SLIDEIO_SVS_EXPORTS SVSSlide : public slideio::CVSlide
28 {
29 protected:
30 SVSSlide();
31 public:
32 virtual ~SVSSlide();
33 int getNumScenes() const override;
34 std::string getFilePath() const override;
35 std::shared_ptr<slideio::CVScene> getScene(int index) const override;
36 // Unchanged, and used by the afi driver with its own id.
37 static std::shared_ptr<SVSSlide> openFile(const std::string& path, const std::string& id);
38 static void closeFile(libtiff::TIFF* hfile);
39 std::shared_ptr<CVScene> getAuxImage(const std::string& sceneName) const override;
40 void log();
41 protected:
42 MetadataBuilder buildMetadataTree() const override;
43 // Opens the file, scans the directories and hands them to slide->init(). The
44 // caller supplies the instance, which is what selects the format.
45 static std::shared_ptr<SVSSlide> openFile(const std::string& path, const std::string& id,
46 std::shared_ptr<SVSSlide> slide);
47 // Builds the scenes from the scanned directories. The keeper owns the tiff handle
48 // until the scene that reads from it is created: everything before that point can
49 // throw, and a handle nobody owns is a handle nobody closes. Ownership is passed on
50 // with TIFFKeeper::release at the one place it is handed to a scene.
51 virtual void init(const std::vector<TiffDirectory>& directories, TIFFKeeper& keeper);
52 protected:
53 std::vector<std::shared_ptr<slideio::CVScene>> m_Scenes;
54 std::map<std::string, std::shared_ptr<slideio::CVScene>> m_auxImages;
55 std::string m_filePath;
56 };
57}
58
59
60#if defined(_MSC_VER)
61#pragma warning( pop )
62#endif
CVSlide is an base class for representation of medical slide.
Definition: cvslide.hpp:29
Definition: exceptions.hpp:15