00001 #ifndef CIMG_TOOLS_H
00002 #define CIMG_TOOLS_H
00003
00004 #include "misc_tools.h"
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "CImg.h"
00020
00021
00022
00023
00024
00025 namespace cimg_library {
00026 namespace cimg{
00027 template<> struct superset<double, std::complex<double> > { typedef complex<double> type; };
00028 }
00029 }
00030
00031 using namespace cimg_library;
00032
00033
00034
00035 const double red[3]={255,0,0};
00036 const double green[3]={0,255,0};
00037 const double blue[3]={0,0,255};
00038 const double yellow[3]={255,255,0};
00039 const double magenta[3]={255,0,255};
00040 const double cyan[3]={0,255,255};
00041 const double orange[3]={255,128,0};
00042 const double black[3]={0,0,0};
00043 const double white[3]={255,255,255};
00044 const double purple[3]={128,0,128};
00045 const double * const colorSerie(int i);
00046
00047
00048
00049
00050 #include "cimg_signal_drawer.h"
00051
00052
00053
00054 void drawPix_interpol ( CImg<double> & img , double val , int x , int y=0 , int z=0 , int v=0 ) ;
00055
00056
00057 void drawRealCircle(CImg<double> & img, const int x0, const int y0, float r, float width, const double* color, const float opacity=0.99);
00058
00059
00060
00061
00062 CImg<double> build_Gaussian(double sigma);
00063 CImg<double> build_DOG(double sigma1,double sigma2);
00064 CImg<double> build_Gabor(double sigma, double orient, double freq, double phi);
00065
00066
00067 double applyfilter_interpol(CImg<double> & image, CImg<double> & filter, double centerfilter_x, double centerfilter_y);
00068
00069
00070 void add_image_centered(CImg<double> &basic, const CImg<double> & added, double centerx, double centery, int z=0);
00071
00072
00073
00074
00075
00076
00077
00078
00079 struct CImgReader
00080 {
00081 CImg<double>* targets;
00082 const CImg<double>* const_targets;
00083
00084 CImgReader(void){targets=0; const_targets=0;}
00085 ~CImgReader(void){}
00086
00087 void checktarget(bool constTar) const
00088 {
00089 if (!(constTar||targets)) cerr<<"error in CImgReader::read() : targets is not initialized."<<endl;
00090 if (constTar & !const_targets) cerr<<"error in CImgReader::read() : const_targets is not initialized."<<endl;
00091 }
00092
00093 const CImg<double>& read(bool constTargets=false, int n=0) const
00094 {
00095 bool constTar = constTargets || !targets;
00096 checktarget(constTar);
00097 if(constTar) return const_targets[n];
00098 else return targets[n];
00099 }
00100 };
00101
00102 #endif
00103
00104
00105