4#ifndef OPENCV_slideio_tifftools_HPP
5#define OPENCV_slideio_tifftools_HPP
7#include "slideio/imagetools/slideio_imagetools_def.hpp"
8#include "slideio/core/cvstructs.hpp"
9#include "slideio/base/slideio_enums.hpp"
10#include "slideio/base/base.hpp"
11#include <opencv2/core.hpp>
15#include "imagetools.hpp"
35 int YCbCrSubsampling[2];
40 std::string description;
41 std::vector<TiffDirectory> subdirectories;
48 int compressionQuality;
52 class SLIDEIO_IMAGETOOLS_EXPORTS TiffTools
55 static libtiff::TIFF* openTiffFile(
const std::string& path,
bool readOnly=
true);
56 static void closeTiffFile(libtiff::TIFF* file);
57 static void scanTiffDirTags(libtiff::TIFF* tiff,
int dirIndex, int64_t dirOffset, slideio::TiffDirectory& dir);
58 static void scanTiffDir(libtiff::TIFF* tiff,
int dirIndex, int64_t dirOffset, slideio::TiffDirectory& dir);
59 static void scanFile(libtiff::TIFF* file, std::vector<TiffDirectory>& directories);
60 static void scanFile(
const std::string& filePath, std::vector<TiffDirectory>& directories);
61 static void readNotRGBStripedDir(libtiff::TIFF* tiff,
const TiffDirectory& dir, cv::_OutputArray output);
62 static void readRegularStripedDir(libtiff::TIFF* file,
const slideio::TiffDirectory& dir, cv::OutputArray output);
63 static void readStripedDir(libtiff::TIFF* file,
const slideio::TiffDirectory& dir, cv::OutputArray output);
64 static void readTile(libtiff::TIFF* hFile,
const slideio::TiffDirectory& dir,
int tile,
65 const std::vector<int>& channelIndices, cv::OutputArray output);
66 static void setCurrentDirectory(libtiff::TIFF* hFile,
const slideio::TiffDirectory& dir);
67 static void scaleBlockToDirectory(
const TiffDirectory& basisDir,
const TiffDirectory& dir,
68 const cv::Rect& basisDirRect, cv::Rect& dirBlockRect);
69 static void readJ2KTile(libtiff::TIFF* hFile,
const slideio::TiffDirectory& dir,
int tile,
70 const std::vector<int>& channelIndices, cv::OutputArray output);
71 static void readRegularTile(libtiff::TIFF* hFile,
const slideio::TiffDirectory& dir,
int tile,
72 const std::vector<int>& channelIndices, cv::OutputArray output);
73 static void readNotRGBTile(libtiff::TIFF* hFile,
const slideio::TiffDirectory& dir,
int tile,
74 const std::vector<int>& channelIndices, cv::OutputArray output);
75 static void writeDirectory(libtiff::TIFF* tiff);
76 static void setTags(libtiff::TIFF* tiff,
const TiffDirectory& dir,
bool newDirectory);
77 static void writeTile(libtiff::TIFF* tiff,
int x,
int y, Compression compression,
78 const cv::Mat& tileRaster,
const EncodeParameters& parameters,
79 uint8_t* buffer=
nullptr,
int bufferSize=0);
80 static std::string readStringTag(libtiff::TIFF* tiff, uint16_t tag);
81 static int getNumberOfDirectories(libtiff::TIFF* tiff);
Definition: exceptions.hpp:12
Compression
raster data compression enum
Definition: slideio_enums.hpp:12