8#include "tifftools.hpp"
9#include "slideio/imagetools/slideio_imagetools_def.hpp"
10#include "slideio/imagetools/imagetools.hpp"
20 class TIFFMessageHandler;
22 class SLIDEIO_IMAGETOOLS_EXPORTS TIFFKeeper
25 TIFFKeeper(libtiff::TIFF* hfile =
nullptr);
26 TIFFKeeper(
const std::string& filePath,
bool readOnly =
true);
28 libtiff::TIFF* getHandle()
const {
31 bool isValid()
const {
32 return getHandle() !=
nullptr;
34 operator libtiff::TIFF* ()
const {
37 TIFFKeeper& operator = (libtiff::TIFF* hFile) {
41 libtiff::TIFF* release() {
42 libtiff::TIFF* handle = m_hFile;
46 void openTiffFile(
const std::string& filePath,
bool readOnly =
true);
48 void writeDirectory();
49 void setTags(
const TiffDirectory& dir);
50 void writeTile(
int x,
int y, Compression compression,
const EncodeParameters& params,
const cv::Mat& mat,
51 uint8_t* buffer,
int bufferSize);
52 void readTile(
const slideio::TiffDirectory& dir,
int tile,
53 const std::vector<int>& channelIndices, cv::OutputArray output);
54 std::string readStringTag(uint16_t tag);
55 void initSubDirs(
int numDirs);
56 void writeRawTile(
int x,
int y,
const uint8_t* data,
int size);
59 libtiff::TIFF* m_hFile;
60 std::shared_ptr<TIFFMessageHandler> m_messageHandler;
65#define TIFFKeeperPtr std::shared_ptr<slideio::TIFFKeeper>
Definition: exceptions.hpp:15