Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxRgbLogMag.h

00001 /*
00002  *  Copyright (c) 2001, University of Amsterdam, The Netherlands.
00003  *  All rights reserved.
00004  *
00005  *  Author(s):
00006  *  Jan-Mark Geusebroek (mark@science.uva.nl)
00007  *
00008  */
00009 
00010 #ifndef HxRgbLogMag_h
00011 #define HxRgbLogMag_h
00012 
00013 #include "HxTagList.h"
00014 #include "HxClassName.h"
00015 #include "HxColConvert.h"
00016 
00017 #include <cmath>
00018 
00024 template<class ValT, class ValDoubleT>
00025 class HxRgbLogMag
00026 {
00027 public:
00029     typedef ValDoubleT ArithTypeDouble;
00030 
00032                         HxRgbLogMag(HxTagList& tags)
00033                             {
00034                                 _lowVal = HxGetTag(tags, "lowVal", double(0));
00035                                 _highVal = HxGetTag(tags, "highVal", double(255));
00036                                 _lowVal -= 1.0;
00037                                 _factor = 255.0/::log(_highVal-_lowVal);
00038                             }
00039 
00041     int                 doIt(const ValT& pixV)
00042                             {
00043                                 double v = ::log(pixV.x()-_lowVal);
00044                                 int x = (int) (v*_factor);
00045                                 return (255 << 24) | (x << 16) | (x << 8) | x;
00046                             }
00047 
00049     int                 doItDouble(const ValDoubleT& pixV)
00050                             {
00051                                 double v = ::log(pixV.x()-_lowVal);
00052                                 int x = (int) (v*_factor);
00053                                 return (255 << 24) | (x << 16) | (x << 8) | x;
00054                             }
00055 
00057     static HxString     className()
00058                             { return HxString("LogMagnitude"); }
00059 
00060 private:
00061     double              _lowVal;
00062     double              _highVal;
00063     double              _factor;
00064 };
00065 
00066 
00067 #endif

Generated on Tue Feb 3 14:18:41 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001