The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cImageSearchData.h
Go to the documentation of this file.
1 /**
2  * @file cImageSearchData
3  * file name: cImageSearchData.h
4  * @author Betti Oesterholz
5  * @date 14.08.2012
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This header specifies a class to store the data for a search on image data.
11  *
12  * Copyright (C) @c GPL3 2012 Betti Oesterholz
13  *
14  * This program is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License (GPL) as
16  * published by the Free Software Foundation, either version 3 of the
17  * License, or any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * This header specifies a class to store the data for a search on image data.
25  * If you want to convert an image to Fib structures, you have to search
26  * the image for structures, which can be converted to Fib.
27  * To mark for which points structures wher found and which points you can
28  * set to any overwritten property because the points are overwritten, you
29  * can use this class.
30  *
31  * All positions vectors (cVectorPosition) elements should be positiv
32  * integers from 0 to ulWidth or ulHeight respectively.
33  *
34  */
35 /*
36 History:
37 14.08.2012 Oesterholz created
38 */
39 
40 
41 #ifndef ___C_IMAGE_SEARCH_DATA_H__
42 #define ___C_IMAGE_SEARCH_DATA_H__
43 
44 #include "version.h"
45 
46 #include "iImageData.h"
47 #include "cImageStructure.h"
48 #include "cVectorPosition.h"
49 
50 #include <set>
51 
52 
53 using namespace std;
54 
55 
56 namespace fib{
57 
58 namespace algorithms{
59 
60 namespace nConvertToFib{
61 
62 namespace nImage{
63 
64 namespace nStructureData{
65 
66 
68 protected:
69 
70  /**
71  * A pointer to the image data, of the image for the search.
72  */
74 
75  /**
76  * The width of the image to search.
77  */
78  unsigned long ulWidth;
79 
80  /**
81  * The height of the image to search.
82  */
83  unsigned long ulHeight;
84 
85  /**
86  * The matrix with the data, which points of the image wher found (converted).
87  * The values are 1 bit: 0 for not found and 1 for found
88  *
89  * The pointer will point to an one dimensional array. You have to evalue
90  * the single entries by hand (with:
91  * *((pImageData + ((y * ulWidth + x) / 8)) ) & ( 0x01 << (y * ulWidth + x) % 8 ) )
92  * ( x in dim 1 or ulWidth, y in dim 2 or ulHeight )
93  */
94  unsigned char * pImageDataFound;
95 
96  /**
97  * The matrix with the data, which points of the image wher overlapped
98  * by found structures.
99  * The values are 1 bit: 0 for not overlapped and 1 for overlapped
100  *
101  * The pointer will point to an one dimensional array. You have to evalue
102  * the single entries by hand (with:
103  * *((pImageDataOverlapped + ((y * ulWidth + x) / 8)) ) & ( 0x01 << (y * ulWidth + x) % 8 ) )
104  * ( x in dim 1 or ulWidth, y in dim 2 or ulHeight )
105  */
106  unsigned char * pImageDataOverlapped;
107 
108 
109 
110 public:
111 
112 
113  /**
114  * parameter constructor
115  *
116  * @param ulInWidth the width of the image to search @see ulWidth
117  * @param ulInHeight the height of the image to search @see ulHeight
118  */
119  cImageSearchData( const unsigned long ulInWidth, const unsigned long ulInHeight );
120 
121  /**
122  * parameter constructor
123  *
124  * @param pInImageData pointer to the image data, of the image to convert
125  * @see pImageData
126  */
127  cImageSearchData( const iImageData * pInImageData );
128 
129 
130  /**
131  * destructor
132  */
133  ~cImageSearchData();
134 
135 
136  /**
137  * @return the width of the image to search
138  * @see ulWidth
139  */
140  unsigned long getWidth() const;
141 
142  /**
143  * @return the height of the image to search
144  * @see ulHeight
145  */
146  unsigned long getHeight() const;
147 
148  /**
149  * @return a pointer to the image data, of the image for the search
150  * @see pImageData
151  */
152  const iImageData * getImageData() const;
153 
154 
155  /**
156  * @see pImageDataFound
157  * @param position the position of the point, for which to check, if it
158  * was found
159  * @return true if the point on the position was found, else false
160  */
161  bool isFound( const cVectorPosition& position ) const;
162 
163  /**
164  * @see pImageDataFound
165  * @param lX the x / first dimension position of the point, for which to
166  * check, if it was found
167  * @param lY the y / second dimension position of the point, for which to
168  * check, if it was found
169  * @return true if the point on the position was found, else false
170  */
171  bool isFound( const unsigned long lX, const unsigned long lY ) const;
172 
173  /**
174  * @see pImageDataOverlapped
175  * @param position the position of the point, for which to check, if it
176  * is overlapped
177  * @return true if the point on the position is overlapped, else false
178  */
179  bool isOverlapped( const cVectorPosition& position ) const;
180 
181  /**
182  * @see pImageDataOverlapped
183  * @param lX the x / first dimension position of the point, for which to
184  * check, if it is overlapped
185  * @param lY the y / second dimension position of the point, for which to
186  * check, if it is overlapped
187  * @return true if the point on the position is overlapped, else false
188  */
189  bool isOverlapped( const unsigned long lX, const unsigned long lY ) const;
190 
191 
192  /**
193  * @see isFound()
194  * @see registerFound()
195  * @return a set of all found points in the image
196  * @see pImageDataFound
197  */
198  set<cVectorPosition> getFoundPoints() const;
199 
200  /**
201  * @see isFound()
202  * @see registerFound()
203  * @return a set of all not found points in the image
204  * @see pImageDataFound
205  */
206  set<cVectorPosition> getNotFoundPoints() const;
207 
208  /**
209  * @see isOverlapped()
210  * @see registerOverlapped()
211  * @return a set of all overlapped points in the image
212  * @see pImageDataOverlapped
213  */
214  set<cVectorPosition> getOverlappedPoints() const;
215 
216  /**
217  * @see isOverlapped()
218  * @see registerOverlapped()
219  * @return a set of all not overlapped points in the image
220  * @see pImageDataOverlapped
221  */
222  set<cVectorPosition> getNotOverlappedPoints() const;
223 
224 
225  /**
226  * @see registerFound()
227  * @see getFoundNeighbours()
228  * @param position the position of the point, for which to return the
229  * neighbour points
230  * @return a set of the neighbour points of the given point
231  */
232  set<cVectorPosition> getNeighbours( const cVectorPosition& position ) const;
233 
234  /**
235  * @see isFound()
236  * @see registerFound()
237  * @param position the position of the point, for which to return the
238  * found neighbour points
239  * @return a set of the found neighbour points of the given point
240  * @see pImageDataFound
241  */
242  set<cVectorPosition> getFoundNeighbours( const cVectorPosition& position ) const;
243 
244  /**
245  * @see isFound()
246  * @see registerFound()
247  * @param position the position of the point, for which to return the
248  * not found neighbour points
249  * @return a set of the not found neighbour points of the given point
250  * @see pImageDataFound
251  */
252  set<cVectorPosition> getNotFoundNeighbours( const cVectorPosition& position ) const;
253 
254  /**
255  * @see isOverlapped()
256  * @see registerOverlapped()
257  * @param position the position of the point, for which to return the
258  * overlapped neighbour points
259  * @return a set of the overlapped neighbour points of the given point
260  * @see pImageDataOverlapped
261  */
262  set<cVectorPosition> getOverlappedNeighbours( const cVectorPosition& position ) const;
263 
264  /**
265  * @see isOverlapped()
266  * @see registerOverlapped()
267  * @param position the position of the point, for which to return the
268  * not overlapped neighbour points
269  * @return a set of the not overlapped neighbour points of the given point
270  * @see pImageDataOverlapped
271  */
272  set<cVectorPosition> getNotOverlappedNeighbours( const cVectorPosition& position ) const;
273 
274 
275  /**
276  * This method registers the given point as found or not found point.
277  *
278  * @see pImageDataFound
279  * @see isFound()
280  * @see getFoundNeighbours()
281  * @param foundPoint the point to register (/set) as (/not) found point
282  * @param bFound if true the point will be registered as found, else
283  * the point will be registered as not found
284  * @return true if the point wher (/not) registered as found, else false
285  */
286  bool registerFound( const cVectorPosition & foundPoint,
287  const bool bFound=true );
288 
289  /**
290  * This method registers the given points as found or not found points.
291  *
292  * @see pImageDataFound
293  * @see isFound()
294  * @see getFoundNeighbours()
295  * @param setFoundPoints a set with the points to register (/set) as
296  * (/not) found points
297  * @param bFound if true the points will be registered as found, else
298  * the points will be registered as not found
299  * @return true if the points wher (/not) registered as found,
300  * else false and no data changed
301  */
302  bool registerFound( const set<cVectorPosition> & setFoundPoints,
303  const bool bFound=true );
304 
305  /**
306  * This method registers the points of the given image structure as
307  * found or not found points.
308  *
309  * @see pImageDataFound
310  * @see isFound()
311  * @see getFoundNeighbours()
312  * @see cImageStructure
313  * @param pImageStrFoundPoints the cImageStructure with the points to
314  * register (/set) as (/not) found points
315  * @param bFound if true the points will be registered as found, else
316  * the points will be registered as not found
317  * @return true if the points wher (/not) registered as found,
318  * else false and no data changed
319  */
320  bool registerFound( const cImageStructure * pImageStrFoundPoints,
321  const bool bFound=true );
322 
323  /**
324  * This method registers the given point as overlapped or not overlapped
325  * point.
326  *
327  * @see pImageDataOverlapped
328  * @see isOverlapped()
329  * @see getOverlappedNeighbours()
330  * @param overlappedPoint the point to register (/set) as (/not) overlapped point
331  * @param bOverlapped if true the point will be registered as overlapped,
332  * else the point will be registered as not overlapped
333  * @return true if the point wher (/not) registered as overlapped, else false
334  */
335  bool registerOverlapped( const cVectorPosition & overlappedPoint,
336  const bool bOverlapped=true );
337 
338  /**
339  * This method registers the given points as overlapped or not overlapped points.
340  *
341  * @see pImageDataOverlapped
342  * @see isOverlapped()
343  * @see getOverlappedNeighbours()
344  * @param setOverlappedPoints a set with the points to register (/set) as
345  * (/not) overlapped points
346  * @param bOverlapped if true the points will be registered as overlapped,
347  * else the points will be registered as not overlapped
348  * @return true if the points wher (/not) registered as overlapped,
349  * else false and no data changed
350  */
351  bool registerOverlapped( const set<cVectorPosition> & setOverlappedPoints,
352  const bool bOverlapped=true );
353 
354  /**
355  * This method registers the points of the given image structure as
356  * overlapped or not overlapped points.
357  *
358  * @see pImageDataOverlapped
359  * @see isOverlapped()
360  * @see getOverlappedNeighbours()
361  * @see cImageStructure
362  * @param pImageStrOverlappedPoints the cImageStructure with the points to
363  * register (/set) as (/not) overlapped points
364  * @param bOverlapped if true the points will be registered as overlapped,
365  * else the points will be registered as not overlapped
366  * @return true if the points wher (/not) registered as overlapped,
367  * else false and no data changed
368  */
369  bool registerOverlapped( const cImageStructure * pImageStrOverlappedPoints,
370  const bool bOverlapped=true );
371 
372 
373  /**
374  * Converts all found points to overlapped points.
375  * If you start a new layer, wich is below the layers of the found points,
376  * call this method.
377  */
378  void foundToOverlapped();
379 
380 
381 };//class cImageSearchData
382 
383 
384 };//end namespace nStructureData
385 };//end namespace nImage
386 };//end namespace nConvertToFib
387 };//end namespace algorithms
388 };//end namespace fib
389 
390 
391 #endif //___C_IMAGE_SEARCH_DATA_H__