Particle Identification and Tracking
wrapper_i_hdf.h
Go to the documentation of this file.
1 //Copyright 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 WRAPPER_I_HDF
27 #define WRAPPER_I_HDF
28 
29 #include "H5Cpp.h"
30 
31 #include <string>
32 #include <vector>
33 #include <map>
34 
35 #include "wrapper_i.h"
36 #include "data_map.h"
37 #include "part_def.h"
38 
39 namespace utilities{
44 private:
48  std::string file_name_;
49 
50  static std::string format_name(int in);
51 
56  std::set<std::pair<utilities::D_TYPE,int> > data_types_;
61  std::set<utilities::D_TYPE> data_types_set_;
62 
75 
80  std::vector<std::vector<int*> > data_i_;
85  std::vector<std::vector<float*> > data_f_;
90  std::vector<std::vector<std::complex<float>*> > data_c_;
91 
95  std::vector<int> frame_c_;
99  unsigned int frame_count_;
100 
104  unsigned int total_part_count_;
105 
110 
116  std::vector<float> frame_zdata_;
117 
121  unsigned int start_;
122 
126  bool locked_;
127 
128 
132  void clean_data();
133 
137  bool priv_init(int f_count =0);
142  void make_dtype_pairs(int comp_nuber);
147  void make_dtype_set();
148 
149 public:
150  typedef enum DATA_DIMS
151  {
152  TWO_D = 0,
154  } DATA_DIMS;
155 
156 
157 
158  int get_value(int& out,
159  int ind,D_TYPE type, int frame) const ;
160  float get_value(float& out,
161  int ind,D_TYPE type, int frame) const ;
162  std::complex<float> get_value(std::complex<float>& out,
163  int ind,D_TYPE type, int frame) const ;
164 
165 
166  std::set<D_TYPE> get_data_types() const ;
167 
168 
169 
170  int get_num_entries(unsigned int frame) const ;
171  int get_num_entries() const ;
172 
173  int get_num_frames() const ;
174 
175  bool contains_type(D_TYPE type) const ;
176 
177 
178 
179  Tuplef get_dims() const;
180 
181 
182 
183  ~Wrapper_i_hdf();
184 
188  Wrapper_i_hdf();
189 
190 
202  bool initialize(const std::string & fname,
203  const std::set<utilities::D_TYPE>& dtypes,
204  int comp_number,
205  unsigned int start=0,
206  int frames =0);
220  bool initialize(const std::string & fname,
221  const std::set<utilities::D_TYPE> &dtypes,
222  int comp_number,
223  unsigned int start,
224  int f_count,
225  bool two_d_data);
226 
240  bool initialize(const std::string & fname,
241  const std::set<std::pair<utilities::D_TYPE,int > > &dtypes,
242  unsigned int start,
243  int f_count,
244  bool two_d_data);
245 
246 
252  bool initialize(int f_count);
253 
254 
259  float get_xy_scale() const;
260 
266  unsigned int get_start_offset() const {return start_;}
267 
271  bool set_file_name(const std::string & fname);
272 
276  bool add_dtype(utilities::D_TYPE dtype,int comp_key);
277 
278 
282  bool set_twoD(bool twod_data);
283 
284 
285 };
286 
287 }
288 
289 #endif