5#ifndef OPENCV_slideio_tiffkeeper_HPP
6#define OPENCV_slideio_tiffkeeper_HPP
9#include "tifftools.hpp"
10#include "slideio/imagetools/slideio_imagetools_def.hpp"
11#include "slideio/imagetools/imagetools.hpp"
21 class TIFFMessageHandler;
23 class SLIDEIO_IMAGETOOLS_EXPORTS TIFFKeeper
26 TIFFKeeper(libtiff::TIFF* hfile =
nullptr);
27 TIFFKeeper(
const std::string& filePath,
bool readOnly =
true);
29 libtiff::TIFF* getHandle()
const {
32 bool isValid()
const {
33 return getHandle() !=
nullptr;
35 operator libtiff::TIFF* ()
const {
38 TIFFKeeper& operator = (libtiff::TIFF* hFile) {
42 libtiff::TIFF* release() {
43 libtiff::TIFF* handle = m_hFile;
47 void openTiffFile(
const std::string& filePath,
bool readOnly =
true);
49 void writeDirectory();
50 void setTags(
const TiffDirectory& dir);
51 void writeTile(
int x,
int y, Compression compression,
const EncodeParameters& params,
const cv::Mat& mat,
52 uint8_t* buffer,
int bufferSize);
53 void readTile(
const slideio::TiffDirectory& dir,
int tile,
54 const std::vector<int>& channelIndices, cv::OutputArray output);
55 std::string readStringTag(uint16_t tag);
56 void initSubDirs(
int numDirs);
59 libtiff::TIFF* m_hFile;
60 std::shared_ptr<TIFFMessageHandler> m_messageHandler;
65#define TIFFKeeperPtr std::shared_ptr<slideio::TIFFKeeper>
Definition: exceptions.hpp:15