Particle Identification and Tracking
hash_shelf.h
Go to the documentation of this file.
1 //Copyright 2008,2009 Thomas A Caswell
2 //tcaswell@uchicago.edu
3 //http://jfi.uchicago.edu/~tcaswell
4 //
5 //This program is free software; you can redistribute it and/or modify
6 //it under the terms of the GNU General Public License as published by
7 //the Free Software Foundation; either version 3 of the License, or (at
8 //your option) any later version.
9 //
10 //This program is distributed in the hope that it will be useful, but
11 //WITHOUT ANY WARRANTY; without even the implied warranty of
12 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 //General Public License for more details.
14 //
15 //You should have received a copy of the GNU General Public License
16 //along with this program; if not, see <http://www.gnu.org/licenses>.
17 //
18 //Additional permission under GNU GPL version 3 section 7
19 //
20 //If you modify this Program, or any covered work, by linking or
21 //combining it with MATLAB (or a modified version of that library),
22 //containing parts covered by the terms of MATLAB User License, the
23 //licensors of this Program grant you additional permission to convey
24 //the resulting work.
25 
26 #ifndef HASH_SHELF
27 #define HASH_SHELF
28 
29 
30 #include <vector>
31 #include <list>
32 #include <vector>
33 
34 
35 
36 
37 #include "part_def.h"
38 
39 namespace utilities{
40 
41 class Counted_vector;
42 class Array;
43 class Histogram2D;
44 class Wrapper_out;
45 class Md_store;
46 
47 
48 
49 }
50 
51 namespace tracking{
52 class hash_box;
53 class Master_box;
54 
55 class Corr;
56 class Accumulator;
57 
63 class Hash_shelf{
64 public:
65 
70  {
72  }
73 
74 
79  void push(particle * p);
80 
83  virtual unsigned int hash_function(const particle* p) const;
84 
85 
89  Hash_shelf(utilities::Tuplef imgsz, float upb,int i_frame,bool own_part, int max_part_indx_=0, float z_offset = 0);
90 
91 
92 
94  virtual ~Hash_shelf();
95 
97  virtual void print() const;
98 
99 
100 
101 
102 
110 
117  void get_region_px( int n, std::vector<const particle*> & out ,
118  float range_in_units) const;
119 
128  void get_region( int n,hash_box* box, int range) const ;
138  void get_region( particle* n,hash_box* box, int range) const ;
139 
147  void get_region( int n,std::list<particle*>& out_list, int range) const ;
148 
157  void get_region( int n,std::vector<const particle*> & out_vector,int range) const ;
159 
162  int get_plane_num() const
163  {
164  return plane_number_;
165  }
166 
167 
171  void shelf_to_list(std::list<const particle*> &tmp) const;
172 
176  void shelf_to_list(std::list<particle*> &tmp) const;
177 
189  return mean_forward_disp_;
190  }
196  return cumulative_disp_;
197  }
198 
199 
203  void set_next_shelf(Hash_shelf* next);
204 
205 
206 
207 
213  bool step_forwards(int n,const Hash_shelf* & next)const;
214 
218  void fill_in_neighborhood();
219 
224  void pass_fun_to_part(void(particle::*fun)());
225 
226 
231  void pass_fun_to_part(void(particle::*fun)()const)const;
232 
236  virtual void output_to_wrapper(utilities::Wrapper_out & wrapper) const;
237 
238 
242  void compute_corr(tracking::Corr &) const ;
243 
247  void compute_accum(Accumulator & in)const;
248 
249 
253  void test() ;
254 
255 
260  std::list<particle_track*> * shelf_to_list() const;
261 
267 
268 
269 private:
273  std::vector<hash_box*> hash_;
274 
277 
283 
288 
293 
298  unsigned int particle_count_;
299 
305 
314 
319 
320 
321 
325  float upb_;
326 
330  float z_offset_;
331 
332 
338  bool own_part_;
339 
340 
344  int tuple_to_indx(const utilities::Tuplei& cord)const;
345 
349  utilities::Tuplei indx_to_tuple(int indx) const;
350 
354  utilities::Tuplei range_indx_to_tuple(int indx,const utilities::Tuplei& side) const;
355 
359  void priv_init();
360 
364  void make_region_corners(const utilities::Tuplei & center,
365  utilities::Tuplei & bottom_corner,
366  utilities::Tuplei & top_corner,
367  utilities::Tuplei & region_sides,
368  const int range)const;
369 
370 
371 
372 };
373 
374 
375 }
376 #endif