27#ifndef __imCenterRadon_hpp__
28#define __imCenterRadon_hpp__
50template <
typename transformT>
54 typedef typename transformT::arithT realT;
94 const int lbuff = transformT::lbuff;
95 const int width = transformT::width;
103 realT startX, startY;
107 for(
int i = 0; i < N; ++i )
110 for(
int j = 0; j < N; ++j )
117 int Nang = 360. / dang + 1;
120#ifdef MX_IMPROC_IMCENTERRADON_OMP
121#pragma omp parallel for
123 for(
int iang = 0; iang < Nang; ++iang )
125 realT ang = iang * dang;
128 kern.resize( width, width );
130 realT cosang = cos( ang * 3.14159 / 180. );
131 realT sinang = sin( ang * 3.14159 / 180. );
135 realT xx = startX + rad * cosang;
136 realT yy = startY + rad * sinang;
143 trans( kern, dx, dy );
144 lineint += ( im.block( i0 - lbuff, j0 - lbuff, width, width ) * kern ).sum();
173 realT
mx, mn, gx, gy;
175 mx = grid.maxCoeff( &gx, &gy );
176 mn = grid.minCoeff();
181 m_fit.setArray( grid.data(), grid.rows(), grid.cols() );
199 template <
typename iosT,
char comment = '#'>
202 char c[] = { comment,
'\0' };
204 ios << c <<
"--------------------------------------\n";
205 ios << c <<
"mx::improc::imCenterRadon Results \n";
206 ios << c <<
"--------------------------------------\n";
209 ios << c <<
"Cost half-width: "
213 ios << c <<
"--------------------------------------\n";
214 ios << c <<
"Setup:\n";
215 ios << c <<
"--------------------------------------\n";
216 ios << c <<
"maxPix: " <<
m_maxPix <<
"\n";
217 ios << c <<
"dPix: " <<
m_dPix <<
"\n";
218 ios << c <<
"minRad: " <<
m_minRad <<
"\n";
219 ios << c <<
"maxRad: " <<
m_maxRad <<
"\n";
220 ios << c <<
"dRad: " <<
m_dRad <<
"\n";
223 ios << c <<
"--------------------------------------\n";
224 ios << c <<
"Fit results:\n";
225 m_fit.dumpReport( ios );
226 ios << c <<
"--------------------------------------\n";
236 template <
char comment = '#'>
Tools for using the eigen library for image processing.
Tools for fitting Gaussians to data.
Eigen::Array< scalarT, -1, -1 > eigenImage
Definition of the eigenImage type, which is an alias for Eigen::Array.
fitGaussian2D< mx::math::fit::gaussian2D_gen_fitter< realT > > fitGaussian2Dgen
Alias for the fitGaussian2D type fitting the general elliptical gaussian.
floatT sigma2fwhm(floatT sig)
Convert from Gaussian width parameter to FWHM.
realT rtod(realT q)
Convert from radians to degrees.
Image filters (smoothing, radial profiles, etc.).
A class to find the location of a peak using interpolation.
int center(realT &x, realT &y, eigenImage< realT > &im, realT x0, realT y0)
Peform the grid search and fit.
realT m_x0
Internal storage of the guess center position.
realT m_peakTol
The tolerance for the peak finding. This is multiplicative with m_dPix.
int fitGrid(realT &x, realT &y, eigenImage< realT > grid)
Fit the transform grid.
iosT & dumpResults(iosT &ios)
Output the results to a stream.
realT m_dRad
The spacing of the radii. Default: 0.1.
realT m_maxRad
The maximum radius to include in the transform. Default: 10.0.
realT m_dPix
The spacing of the points in the grid search. Default: 0.1.
mx::math::fit::fitGaussian2Dgen< realT > m_fit
The fitter for finding the centroid of the grid. You can use this to inspect the details of the fit i...
realT m_minRad
The minimum radius to include in the transform. Default: 1.0.
realT m_angTolPix
The angle tolerance in pixels at the maximum radius, sets the angular step size. Default is 1....
realT m_maxPix
The maximum range of the grid search, the grid will be +/- maxPix. Default: 5.0.
eigenImage< realT > m_grid
The cost grid.
realT m_y0
Internal storage of the guess center position.
std::ostream & dumpResults()
Output the results to std::cout.
Find the peak of an image using interpolation.
Header for the std::vector utilities.