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

Normalization.hpp

Go to the documentation of this file.
00001 /* ImLib3D
00002  * Copyright (c) 2001, ULP-IPB Strasbourg.
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or (at
00007  * your option) any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017  */
00021 #ifndef _Normalization_hpp
00022 #define _Normalization_hpp
00023 
00024 #include<ImLib3D/ImageProcessor.hpp>
00025 #include<ImLib3D/ImageStats.hpp>
00026 #include<ImLib3D/Signal1D.hpp>
00027 
00028 namespace IP3D
00029 {
00038     void NormalizeAverage(const Image3Df& src,const Image3Df& ref,Image3Df& res);
00039 };
00040 
00041 namespace IP3D
00042 {
00051         void NormalizeAverageAndVariance(const Image3Df& src,const Image3Df& ref,Image3Df& res);
00052 };
00053 
00054 
00055 
00057 class JointHistogram
00058 {
00059     //FIXME should not be public
00060 public:
00061     int nbSrcBins; // on x-axis
00062     int nbRefBins; // on y-axis
00063     Image3Df histogramImage;
00065     double srcMin;
00067     double srcMax;
00069     double refMin;
00071     double refMax;
00072 
00074 
00075     inline float  SrcBinF(float v)  const   {return nbSrcBins  *(v-srcMin)/(srcMax-srcMin);}
00076     inline float  RefBinF(float v)  const   {return nbRefBins  *(v-refMin)/(refMax-refMin);}
00077     inline int    SrcBin(float v)   const   {return (int)rint(SrcBinF(v));}
00078     inline int    RefBin(float v)   const   {return (int)rint(RefBinF(v));}
00079     inline double SrcVal(int x)     const   {return (srcMin+x*(srcMax-srcMin)/(double)nbSrcBins );}
00080     inline double SrcVal(double x)  const   {return (srcMin+x*(srcMax-srcMin)/(double)nbSrcBins );}
00081     inline double RefVal(int y)     const   {return (refMin+y*(refMax-refMin)/(double)nbRefBins);}
00082     inline double RefVal(double y)  const   {return (refMin+y*(refMax-refMin)/(double)nbRefBins);}
00083     inline int    SSrcBin(float v)  const   {return min(nbSrcBins -1,max(0,SrcBin(v)));}
00084     inline int    SRefBin(float v)  const   {return min(nbRefBins-1 ,max(0,RefBin(v)));}
00086     float SrcLimit(float v) const {return min((float)srcMax,max(v,(float)srcMin));}
00087     float RefLimit(float v) const {return min((float)refMax,max(v,(float)refMin));}
00088 protected:
00090     void ComputeFromIndependentSamples(const Image3Df &src,const Image3Df &ref);
00092     void ComputeFromDirectionalLinearInterpolation(const Image3Df &src,const Image3Df &ref,int dir);
00094     virtual void FindRanges(const Image3Df& src, const Image3Df &ref);
00096     JointHistogram(int _nbSrcBins=100,int _nbRefBins=400) :
00097         nbSrcBins(_nbSrcBins),nbRefBins(_nbRefBins),histogramImage(_nbSrcBins,_nbRefBins,1) {;}
00098 public:
00099     virtual ~JointHistogram(){;}
00100 public:
00102     void AddDisplayGrid();
00104     float GetSrcBinTotalProba(int x) const;
00106     Signal1Df MedianTransferFct() const ;
00108     Signal1Df MaximumProbabilityTransferFct() const;
00110 
00111     Signal1Df BestFitTransferFct(double smoothingCoef=1,bool allowDecreasing=false) const;
00113 
00115     static Signal1Df SmoothAndExtend(const Signal1Df &src,const Signal1Df &weights,double smoothSigma,double outlierSigma);
00117     Signal1Df ConfidenceWeights() const;
00118 
00119 
00120     JointHistogram(const string &filename);
00121     JointHistogram(const Image3Df &src,const Image3Df &ref,int _nbSrcBins=100,int _nbRefBins=400);
00122 };
00123 
00124 namespace IP3D
00125 {
00136     void ComputeJointHistogramImage(const Image3Df& src,const Image3Df& ref,Image3Df& res,int drawTransferFunction=0,int nbSrcBins=100,int nbRefBins=200);
00137 };
00138 
00139 
00140 namespace IP3D
00141 {
00152     void NormalizeJointHistogram(const Image3Df& src,const Image3Df& ref,Image3Df& res,int nbSrcBins=100,int nbRefBins=200);
00153 };
00154 
00155 #endif// _Normalization_hpp

Generated on Fri Jun 17 13:36:06 2005 for ImLib3D by  doxygen 1.4.2