contrib/brl/bmvl/btom/btom_gauss_cylinder.cxx

Go to the documentation of this file.
00001 #include "btom_gauss_cylinder.h"
00002 //:
00003 // \file
00004 #include <vnl/vnl_math.h>
00005 #include <vcl_cmath.h>
00006 #include <vcl_iostream.h>
00007 
00008 //--------------------------------------------------------------
00009 //
00010 // Constructor and Destructor Functions
00011 //
00012 //--------------------------------------------------------------
00013 
00014 //: Constructor
00015 btom_gauss_cylinder::btom_gauss_cylinder(float xy_sigma, float z_sigma,
00016                                          float length_sigma, float density,
00017                                          float x_origin, float y_origin,
00018                                          float z_position,
00019                                          float elevation, float azimuth)
00020 {
00021   xy_sigma_=xy_sigma;
00022   z_sigma_=z_sigma;
00023   length_sigma_=length_sigma;
00024   density_=density;
00025   x_origin_=x_origin;
00026   y_origin_=y_origin;
00027   z_position_=z_position;
00028   elevation_=elevation;
00029   azimuth_=azimuth;
00030 }
00031 
00032 //: Destructor
00033 btom_gauss_cylinder::~btom_gauss_cylinder()
00034 {
00035 }
00036 
00037 //-------------------------------------------------------------------------
00038 //: compute the cylinder intensity at a given location
00039 //
00040 float btom_gauss_cylinder::cylinder_intensity(float x, float y)
00041 {
00042   //  cout << *this << endl;
00043   double theta = (90-elevation_)*vnl_math::pi/180.;
00044   double phi = azimuth_*vnl_math::pi/180.;
00045   double cth = vcl_cos(theta);
00046   double cths = cth*cth;
00047   double tth = vcl_tan(theta);
00048   double tths = tth*tth;
00049   double sph = vcl_sin(phi);
00050   double cph = vcl_cos(phi);
00051   double xyss = 1.0/(xy_sigma_*xy_sigma_);
00052   double zss = 1.0/(z_sigma_*z_sigma_);
00053   double wss = 1.0/(length_sigma_*length_sigma_);
00054   double D = (xyss+ tths*zss + wss/cths);
00055   double Dinv = 1.0/D;
00056   double Dinv2 = Dinv*tth/(xy_sigma_*z_sigma_);
00057   double xd = 1-xyss*Dinv;
00058   double zd = 1-zss*tths*Dinv;
00059   double z = z_position_;
00060   double az = z/z_sigma_;
00061   double azs = az*az;
00062   double xp = x - x_origin_;
00063   double yp = y - y_origin_;
00064   double xr = cph*xp - sph*yp;
00065   double yr = sph*xp + cph*yp;
00066   double ax = xr/xy_sigma_;
00067   double ay = yr/xy_sigma_;
00068   double axs = ax*ax;
00069   double ays = ay*ay;
00070   double ty = vcl_exp(-ays);
00071   double tx = vcl_exp(-axs*xd);
00072   double tz = vcl_exp(-azs*zd);
00073   double tz1 = vcl_exp(-2*ax*az*Dinv2);
00074   float pix = float(density_*tx*ty*tz*tz1);
00075   return pix;
00076 }
00077 
00078 //-------------------------------------------------------------------------
00079 //: compute the radon transform of a vertical gaussian cylinder.
00080 //  theta is in degrees on the range [0, 360]
00081 //
00082 float btom_gauss_cylinder::radon_transform(float theta, float t)
00083 {
00084   double th_rad = theta*vnl_math::pi/180.;
00085   double neu = vcl_sin(th_rad)*x_origin_ +vcl_cos(th_rad)*y_origin_ -t;
00086   double neusq = neu*neu;
00087   double arg = neusq/(xy_sigma_*xy_sigma_);
00088   double radon = xy_sigma_*vcl_exp(-arg);
00089   return (float)radon;
00090 }
00091 
00092 vcl_ostream& operator<< (vcl_ostream& os, const btom_gauss_cylinder& gc)
00093 {
00094   os << "btom_gauss_cylinder:\n[---\n"
00095      << "xy_sigma " << gc.xy_sigma_ << '\n'
00096      << "z_sigma " << gc.z_sigma_ << '\n'
00097      << "length_sigma " << gc.length_sigma_ << '\n'
00098      << "density " << gc.density_ << '\n'
00099      << "x_origin " << gc.x_origin_ << '\n'
00100      << "y_origin " << gc.y_origin_ << '\n'
00101      << "z_position " << gc.z_position_ << '\n'
00102      << "elevation " << gc.elevation_ << '\n'
00103      << "azimuth " << gc.azimuth_ << '\n'
00104      << "---]\n";
00105   return os;
00106 }
00107 

Generated on Fri Nov 21 05:24:41 2008 for contrib/brl/bmvl/btom by  doxygen 1.5.1