42 int offset()
const {
return m_offset; }
43 int count()
const {
return m_size*m_size; }
44 int size()
const {
return m_offset*2+1; }
47 float *
data() {
return m_data; }
49 const float *
end()
const {
return &m_data[m_size*m_size]; }
51 inline float *
data(
const int x,
const int y)
const {
return m_data +
index(x,y); }
52 void setData(
const int x,
const int y,
const float value) { *
data(x,y) = value; }
54 inline int index(
const int x,
const int y)
const { Q_ASSERT(y*m_size + x < m_size*m_size);
return y*m_size + x; }
56 inline float operator()(
const int x,
const int y)
const {
return *
data(x,y); }
64 void setCrownRadius(
const float r) { m_crownRadius = r; m_crownArea=r*r*M_PI; }
68 void load(QDataStream &in);
69 void save(QDataStream &out);
72 void setup(
const int size);
const T & constValueAtIndex(const QPoint &pos) const
value at position defined by a (integer) QPoint
Definition: grid.h:109
Stamp is the basic class for the LIP field of a individual tree.
Definition: stamp.h:32
Stamp()
Definition: stamp.cpp:28
~Stamp()
Definition: stamp.cpp:33
Stamp(const int size)
Definition: stamp.h:39
int index(const int x, const int y) const
get index (e.g. for data()[index]) for indices x and y
Definition: stamp.h:54
float crownRadius() const
Definition: stamp.h:62
float crownArea() const
Definition: stamp.h:63
static void setDistanceGrid(const Grid< float > *grid)
Definition: stamp.h:41
int offset() const
delta between edge of the stamp and the logical center point (of the tree). e.g. a 5x5 stamp in an 8x...
Definition: stamp.h:42
QString dump() const
Definition: stamp.cpp:62
void setCrownRadius(const float r)
Definition: stamp.h:64
const Stamp * reader() const
Definition: stamp.h:58
int count() const
count of pixels (rectangle)
Definition: stamp.h:43
void save(QDataStream &out)
save to stream (predefined binary structure)
Definition: stamp.cpp:109
StampType
defines different grid sizes for stamps (4x4 floats, ... 48x48 floats).
Definition: stamp.h:36
@ est12x12
Definition: stamp.h:36
@ est64x64
Definition: stamp.h:36
@ est32x32
Definition: stamp.h:36
@ est4x4
Definition: stamp.h:36
@ est24x24
Definition: stamp.h:36
@ est48x48
Definition: stamp.h:36
@ est8x8
Definition: stamp.h:36
@ est16x16
Definition: stamp.h:36
int dataSize() const
internal size of the stamp; e.g.
Definition: stamp.h:45
const float * end() const
get pointer to the element after the last element (iterator style)
Definition: stamp.h:49
float distanceToCenter(const int ix, const int iy) const
Definition: stamp.h:65
float * data()
get a full access pointer to internal data
Definition: stamp.h:47
void load(QDataStream &in)
load from stream (predefined binary structure)
Definition: stamp.cpp:95
float offsetValue(const int x, const int y, const int offset) const
Definition: stamp.h:57
int size() const
logical size of the stamp
Definition: stamp.h:44
void setReader(Stamp *reader)
Definition: stamp.h:59
void setData(const int x, const int y, const float value)
Definition: stamp.h:52
float * data(const int x, const int y) const
get pointer to data item with indices x and y
Definition: stamp.h:51
void loadFromFile(const QString &fileName)
Definition: stamp.cpp:77
void setOffset(const int offset)
Definition: stamp.h:40
float operator()(const int x, const int y) const
retrieve the value of the stamp at given indices x and y
Definition: stamp.h:56
Stamp * stampFromGrid(const FloatGrid &grid, const int width)
create a stamp from a FloatGrid with any size
Definition: stamp.cpp:119