Go to the documentation of this file.00001 #ifndef OPENTISSUE_CORE_CONTAINERS_GRID_UTIL_GRID_APPROXIMATE_GAUSSIAN_FILTER_H
00002 #define OPENTISSUE_CORE_CONTAINERS_GRID_UTIL_GRID_APPROXIMATE_GAUSSIAN_FILTER_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/core/containers/grid/util/grid_box_filter.h>
00013 #include <OpenTissue/core/containers/grid/util/grid_translate.h>
00014
00015 namespace OpenTissue
00016 {
00017 namespace grid
00018 {
00030 template <class grid_type>
00031 inline void approximate_gaussian_filter(grid_type const& src, size_t order, size_t size, grid_type& dst)
00032 {
00033 typedef typename grid_type::index_vector index_vector;
00034 dst=src;
00035 for(size_t i=0; i<order; ++i)
00036 {
00037 box_filter(dst,size,dst);
00038
00039 if (i>0 && (i%2) && !(size%2))
00040 {
00041 std::cout << "--calling translate()" << std::endl;
00042 translate(dst, index_vector(1,1,1), dst);
00043 }
00044 }
00045 }
00046
00057 template <class grid_type>
00058 inline void approximate_gaussian_filter_border_correct(grid_type const& src, size_t order, size_t size, grid_type &dst)
00059 {
00060 grid_type lowFreq=src;
00061
00062
00063 approximate_gaussian_filter(lowFreq, order, size, lowFreq);
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 dst=lowFreq;
00080 }
00081
00082 }
00083 }
00084
00085
00086 #endif