Particle Identification and Tracking
image1.h
Go to the documentation of this file.
1 //Peter J. Lu
2 //Copyright 2008 Peter J. Lu.
3 //http://www.peterlu.org
4 //plu@fas.harvard.edu
5 //
6 //This program is free software; you can redistribute it and/or modify
7 //it under the terms of the GNU General Public License as published by
8 //the Free Software Foundation; either version 3 of the License, or (at
9 //your option) any later version.
10 //
11 //This program is distributed in the hope that it will be useful, but
12 //WITHOUT ANY WARRANTY; without even the implied warranty of
13 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 //General Public License for more details.
15 //
16 //You should have received a copy of the GNU General Public License
17 //along with this program; if not, see <http://www.gnu.org/licenses>.
18 //
19 //Additional permission under GNU GPL version 3 section 7
20 //
21 //If you modify this Program, or any covered work, by linking or
22 //combining it with MATLAB (or a modified version of that library),
23 //containing parts covered by the terms of MATLAB User License, the
24 //licensors of this Program grant you additional permission to convey
25 //the resulting work.
26 //
27 //If you modify this Program, or any covered work, by linking or
28 //combining it with FreeImage (or a modified version of that library),
29 //containing parts covered by the terms of freeimage-license, the
30 //licensors of this Program grant you additional permission to convey
31 //the resulting work. Corresponding Source for a non-source form of
32 //such a combination shall include the source code for the parts of
33 //FreeImage used as well as that of the covered work.
34 //
35 //If you modify this Program, or any covered work, by linking or
36 //combining it with IPP (or a modified version of that library),
37 //containing parts covered by the terms of End User License Agreement
38 //for the Intel(R) Software Development Products, the licensors of
39 //this Program grant you additional permission to convey the resulting
40 //work.
41 
42 //copied form https://plutarc.svn.sourceforge.net/svnroot/plutarc/trunk/matlab_wrapper rev9
43 // Modified by Thomas Caswell tcaswell@uchicago.edu 09/2009-
44 #ifndef IMAGE1_H
45 #define IMAGE1_H
46 
47 #include "ipp.h"
48 // include this here so we get to use the typedefs to pretend that we
49 // will try for cross compatibility
50 
51 //#include "FreeImage.h"
52 #include "image_base.h"
53 #if MATLAB_MEX_FILE
54 #include "mex.h"
55 #endif
56 /*#include <string>*/
57 /*
58  tac 2011-03-02
59  Major over haul of the import/input functions for this class
60 
61  */
62 
63 /* tac 2009-09-17
64  working on making this class behave better, ie not exposing it's private meembers
65  to the world.
66 
67  */
68 
69 /*modified 6/08
70  *Beating this code in to a form that can be compiled in to mex files
71  *tcaswell
72  */
73 
74 
75 
76 
77 /*//This file contains definitions for the Image2D, a container class that carries*/
78 /*//around 32-bit floating point IPP images and other associated data*/
79 /*//functions for importing and exporting data are also included here*/
80 
81 namespace iden
82 {
83 class Image_base;
84 class Image2D
85 {
86 public:
87  Image2D();
88  Image2D(const int image_length, const int image_width);
89  Image2D(const Image2D & other);
90  Image2D(const float * IN_ARRAY2,int DIM1,int DIM2);
91 
92  ~Image2D();
93 
94 
98  int getx(const int index1D);
102  int gety(const int index1D);
106  int get1Dindex(const int x, const int y);
107 
108 #if MATLAB_MEX_FILE
109 
112  void set_data(const mxArray *data);
116  void get_data(mxArray *data)const;
117 #endif
118 
121  void set_data(const Image_base & image);
125  void add_data(const Image_base & image);
126 
130  void set_data(const float * IN_ARRAY2,int DIM1,int DIM2);
134  void add_data(const float * IN_ARRAY2,int DIM1,int DIM2);
135 
136 
141  Ipp32f *get_image2D() const
142  {return imagedata_;}
143  int get_stepsize() const
144  {return stepsize_;}
145  int get_width() const
146  {return width_;}
147  int get_numberofpixels() const
148  {return numberofpixels_;}
149  int get_height() const
150  {return height_;}
151  IppiSize get_ROIfull() const
152  {return ROIfull_;}
153 
157  void display_image() const;
158 
159  void trim_max(float cut_percent);
160 
161 
162 
163 private:
167  Ipp32f *imagedata_;
171  unsigned int stepsize_;
175  unsigned int width_;
179  unsigned int height_;
183  unsigned int numberofpixels_;
187  IppiSize ROIfull_;
188 
189 
193  void proc_data(const Image_base & image,bool add);
194 
195 };
196 
197 // /**
198 // kill this off, functionality merged into object
199 // */
200 // Image2D mat_to_IPP(const mxArray *data);
201 // /**
202 // kill this off, functionality merged into object
203 // */
204 // IppStatus IPP_to_mat(mxArray *data, Image2D &image_out);
205 }
206 
207 #endif