SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
smalltiffwrapper.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 "smallimage.hpp"
6#include "slideio/imagetools/slideio_imagetools_def.hpp"
7#include "slideio/imagetools/tiffkeeper.hpp"
8#include "slideio/base/size.hpp"
9#include "slideio/drivers/vsi/vsifile.hpp"
10
11namespace libtiff
12{
13 struct tiff;
14 typedef tiff TIFF;
15}
16
17namespace slideio
18{
19 class SLIDEIO_IMAGETOOLS_EXPORTS SmallTiffWrapper : public SmallImage
20 {
21 public:
22 class SLIDEIO_IMAGETOOLS_EXPORTS SmallTiffPage : public SmallImagePage
23 {
24 public:
25 SmallTiffPage(SmallTiffWrapper* parent, int pageIndex);
26 Size getSize() const override;
27 DataType getDataType() const override;
28 int getNumChannels() const override;
29 Compression getCompression() const override;
30 const std::string& getMetadata() const override;
31 void readRaster(cv::OutputArray raster) override;
32 Resolution getResolution() const override;
33 private:
34 void extractMetadata();
35 private:
36 SmallTiffWrapper* m_parent;
37 int m_pageIndex;
38 Size m_size = {};
39 DataType m_dataType = DataType::DT_Unknown;
40 int m_numChannels;
41 std::string m_metadata;
42 };
43 public:
44 SmallTiffWrapper(const std::string& filePath);
45 int getNumPages() const override;
46 bool isValid() const override;
47 SmallImagePage* readPage(int pageIndex) override;
48 const TiffDirectory& getDirectory(int dirIndex);
49 libtiff::TIFF* getHandle() const;
50 private:
51 TIFFKeeper m_pTiff;
52 std::vector<TiffDirectory> m_directories;
53 std::vector<std::shared_ptr<SmallTiffPage>> m_pages;
54 };
55
56}
Definition: exceptions.hpp:15
Compression
raster data compression enum
Definition: slideio_enums.hpp:12