SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
tifffiles.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/imagetools/slideio_imagetools_def.hpp"
6#include <unordered_map>
7#include <memory>
8#include <string>
9
10namespace libtiff
11{
12 struct tiff;
13 typedef tiff TIFF;
14}
15
16namespace slideio
17{
18
19 class SLIDEIO_IMAGETOOLS_EXPORTS TIFFFiles {
20 public:
21 TIFFFiles() = default;
22 TIFFFiles(const TIFFFiles&) = delete;
23 TIFFFiles& operator=(const TIFFFiles&) = delete;
24 TIFFFiles(TIFFFiles&&) = delete;
25 TIFFFiles& operator=(TIFFFiles&&) = delete;
26 ~TIFFFiles();
27 libtiff::TIFF* getOrOpen(const std::string& filename);
28 void close(const std::string& filename);
29 void closeAll();
30 int getNumberOfOpenFiles() const { return static_cast<int>(m_openFiles.size());}
31 int getOpenFileCounter() const { return m_openFileCounter; }
32 private:
33 std::unordered_map<std::string, std::shared_ptr<libtiff::TIFF>> m_openFiles;
34 int m_openFileCounter = 0;
35 };
36
37}
Definition: exceptions.hpp:15