contrib/mul/vil3d/algo/vil3d_make_edt_filter.cxx
Go to the documentation of this file.
00001 //:
00002 // \file
00003 //  \brief Compute filter for an exp. distance transform.
00004 // \author Tim Cootes
00005 
00006 #include "vil3d_make_edt_filter.h"
00007 #include "vil3d_make_distance_filter.h"
00008 #include <vcl_cmath.h>
00009 
00010 //: Compute filter for an exp. distance transform.
00011 // width_i gives the width at half maxima (in voxels) for the
00012 // exponential filter along i.
00013 void vil3d_make_edt_filter(double width_i, 
00014                            double width_j, 
00015                            double width_k,
00016                            int r,
00017                            vil3d_structuring_element& se,
00018                            vcl_vector<double>& f)
00019 {
00020   vil3d_make_distance_filter(1.0/width_i,1.0/width_j,1.0/width_k,r,se,f);
00021   for (unsigned a=0;a<f.size();++a)
00022     f[a]=vcl_exp(vcl_log(0.5)*f[a]);
00023 }