10#include "tifftools.hpp"
11#include "slideio/imagetools/slideio_imagetools_def.hpp"
12#include "slideio/imagetools/imagetools.hpp"
22 class TIFFMessageHandler;
33 class SLIDEIO_IMAGETOOLS_EXPORTS TIFFKeeper
36 explicit TIFFKeeper(libtiff::TIFF* hFile =
nullptr);
37 explicit TIFFKeeper(
const std::string& filePath,
bool readOnly =
true);
42 TIFFKeeper(
const TIFFKeeper&) =
delete;
43 TIFFKeeper& operator=(
const TIFFKeeper&) =
delete;
49 TIFFKeeper(TIFFKeeper&& other)
noexcept;
50 TIFFKeeper& operator=(TIFFKeeper&& other)
noexcept;
52 libtiff::TIFF* getHandle()
const {
55 bool isValid()
const {
56 return m_hFile !=
nullptr;
60 void reset(libtiff::TIFF* hFile =
nullptr);
62 libtiff::TIFF* release();
63 void openTiffFile(
const std::string& filePath,
bool readOnly =
true);
65 void writeDirectory();
66 void setTags(
const TiffDirectory& dir);
67 void writeTile(
int x,
int y, Compression compression,
const EncodeParameters& params,
const cv::Mat& mat,
68 uint8_t* buffer,
int bufferSize);
69 void readTile(
const slideio::TiffDirectory& dir,
int tile,
70 const std::vector<int>& channelIndices, cv::OutputArray output);
71 std::string readStringTag(uint16_t tag);
72 void initSubDirs(
int numDirs);
73 void writeRawTile(
int x,
int y,
const uint8_t* data,
int size);
77 void initMessageHandler();
79 libtiff::TIFF* m_hFile =
nullptr;
80 std::shared_ptr<TIFFMessageHandler> m_messageHandler;
84 using TIFFKeeperPtr = std::shared_ptr<TIFFKeeper>;
Definition: exceptions.hpp:15