Go to the documentation of this file.00001 #ifndef OPENTISSUE_UTILITY_IMAGE_ANALYSIS_IMAGE_ANALYSIS_COMPUTE_FEATURE_SPACE_LOG_HISTOGRAM_H
00002 #define OPENTISSUE_UTILITY_IMAGE_ANALYSIS_IMAGE_ANALYSIS_COMPUTE_FEATURE_SPACE_LOG_HISTOGRAM_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/core/math/math_is_finite.h>
00013
00014 namespace OpenTissue
00015 {
00016 namespace image_analysis
00017 {
00024 template<
00025 typename histogram_type
00026 , typename log_histogram_type
00027 >
00028 void compute_feature_space_log_histogram(
00029 histogram_type const & histogram
00030 , log_histogram_type & log_histogram
00031 )
00032 {
00033 using std::log;
00034
00035 typedef typename histogram_type::const_index_iterator histogram_iterator;
00036 typedef typename log_histogram_type::index_iterator log_histogram_iterator;
00037 log_histogram.create(histogram.min_coord(),histogram.max_coord(),histogram.I(),histogram.J(),histogram.K());
00038
00039 histogram_iterator hbegin = histogram.begin();
00040 histogram_iterator hend = histogram.end();
00041 histogram_iterator h;
00042
00043 log_histogram_iterator lbegin = log_histogram.begin();
00044 log_histogram_iterator lend = log_histogram.end();
00045 log_histogram_iterator l;
00046
00047 for( h=hbegin,l=lbegin; h!=hend; ++h,++l)
00048 {
00049 (*l) = log( (*h) + 1.0);
00050 assert( is_finite( *l ) || !"compute_feature_space_log_histogram(): NaN ");
00051 }
00052 }
00053 }
00054
00055 }
00056
00057
00058 #endif