Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

btom_gauss_cylinder.cxx

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

Generated on Thu Jan 10 14:54:32 2008 for contrib/brl/bmvl/btom by  doxygen 1.4.4