1 #ifndef TIFFDENSITYFILE_H
3 #define TIFFDENSITYFILE_H
5 #include "gridvalues.h"
10 class TIFFDensityFile :
public GridValues
14 virtual ~TIFFDensityFile();
17 bool_t init(
const std::string &fileName,
bool noNegativeValues =
true,
bool flipY =
false);
18 int getWidth()
const {
return m_width; }
19 int getHeight()
const {
return m_height; }
20 double getValue(
int x,
int y)
const;
21 void setValue(
int x,
int y,
double v);
22 bool isYFlipped()
const {
return m_yFlipped; }
24 bool_t readTiffFile(
const std::string &fileName,
bool noNeg,
bool flipY);
27 bool_t readTilesFromTIFF(
void *pTiffVoid,
int tileWidth,
int tileHeight,
int width,
int height,
bool noNeg,
const std::string &fileName);
29 int m_width, m_height;
30 std::vector<double> m_values;
38 Tile(
size_t s) { m_buffer.resize(s); }
39 Tile(
const Tile &src) { m_buffer = src.m_buffer; }
40 T *getData() { assert(m_buffer.size() > 0);
return &(m_buffer[0]); }
42 std::vector<T> m_buffer;
46 inline double TIFFDensityFile::getValue(
int x,
int y)
const
48 assert(x >= 0 && x < m_width);
49 assert(y >= 0 && y < m_height);
51 int idx = x + y*m_width;
52 assert(idx >= 0 && idx < (
int)m_values.size());
57 inline void TIFFDensityFile::setValue(
int x,
int y,
double v)
59 assert(x >= 0 && x < m_width);
60 assert(y >= 0 && y < m_height);
62 int idx = x + y*m_width;
63 assert(idx >= 0 && idx < (
int)m_values.size());
68 #endif // TIFFDENSITYFILE_H
Type to return true/false with error description.
Definition: booltype.h:25