Particle Identification and Tracking
kernel1.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 KERNEL1_H
45 #define KERNEL1_H
46 
47 #include "ipp.h"
48 
49 
50 /*//This file contains the code for creating the different kernels*/
51 
52 /* modified 7/2008 by Thomas Caswell to add computation of 'eccentricity'
53  */
54 namespace iden
55 {
56 
57 void Print2DKernel8u(const int diameter, const Ipp8u *kernel);
58 void Print2DKernel32f(const int diameter, const Ipp32f *kernel);
59 
61 {
62 public:
63  Tophat_Kernel();
64  Tophat_Kernel(const int radius, const int tif_width, const int tif_length);
66 
67  IppiSize get_ROI_size() const
68  {return ROI_size;}
69  IppiSize get_mask_size() const
70  {return mask_size;}
71  IppiPoint get_anchor_point() const
72  {return anchor_point;}
73  int get_offset() const
74  {return offset;}
75 
76 private:
77  IppiSize ROI_size;
78  IppiSize mask_size;
79  IppiPoint anchor_point;
80  int offset;
81 
82 };
83 
85 {
86 public:
88  Gaussian_Kernel(const int radius, const float hwhm, const int tif_width, const int tif_length);
90 
91  Ipp32f *get_gaussian_kernel() const
92  {return kernel;}
93  int get_anchor_point() const
94  {return anchor_point;}
95  IppiSize get_ROI_size() const
96  {return ROI_size;}
97  int get_offset() const
98  {return offset;}
99  int get_kernel_length() const
100  {return kernel_length;}
101 
102 private:
103  Ipp32f *kernel;
106  IppiSize ROI_size;
107  int offset;
108 };
109 
111 {
112 public:
113  Dilation_Kernel();
114  Dilation_Kernel(const int radius, const int tif_width, const int tif_length);
116 
117  Ipp8u *get_dilation_kernel() const
118  {return dilation_kernel;}
119 
120  IppiSize get_ROI_size() const
121  {return ROI_size;}
122  IppiSize get_mask_size() const
123  {return mask_size;}
124  IppiPoint get_anchor_point() const
125  {return anchor_point;}
126  int get_offset() const
127  {return offset;}
128 
129 private:
130  Ipp8u *dilation_kernel; /*//1 inside radius; 0 otherwise; for dilation*/
131  IppiSize ROI_size;
132  IppiSize mask_size;
133  IppiPoint anchor_point;
134  int offset; /*//offset for starting point ROI in image*/
135 };
136 
138 {
139 public:
141  Convolution_Kernel(const int radius, const int tif_width, const int tif_length);
143 
144  Ipp32f *get_circle_kernel() const
145  {return circle_kernel;}
146  Ipp32f *get_r2_kernel() const
147  {return r2_kernel;}
148  Ipp32f *get_ramp_x_kernel() const
149  {return ramp_x_kernel;}
150  Ipp32f *get_ramp_y_kernel() const
151  {return ramp_y_kernel;}
152 
153  //tac 7/08
154  Ipp32f *get_sin_kernel() const
155  {return sin_kernel;}
156  Ipp32f *get_cos_kernel() const
157  {return cos_kernel;}
158 
159 
160 
161  IppiSize get_kernel_size() const
162  {return kernel_size;}
163  int get_kernel_step() const
164  {return kernel_step;}
165  IppiSize get_ROI_size() const
166  {return ROI_size;}
167  int get_offset() const
168  {return offset;}
169 
170 private:
171  Ipp32f *circle_kernel; /*//1 inside radius; 0 otherwise*/
172  Ipp32f *r2_kernel; /*//r^2 inside radius; 0 otherwise*/
173  Ipp32f *ramp_x_kernel; /*//linear gradient in x inside radius; 0 otherwise*/
174  Ipp32f *ramp_y_kernel; /*//linear gradient in y inside radius; 0 otherwise*/
175 
176  //tac7/08
177  Ipp32f *sin_kernel; //sin function based on angle
178  Ipp32f *cos_kernel; //cos function based on angle
179 
180  IppiSize kernel_size;
181  IppiSize ROI_size;
183  int offset; /*//offset for starting point ROI in image*/
184  int constantoffset; /*//constant offset to be added to ramp masks for calculating position*/
185 };
186 }
187 
188 
189 
190 #endif