00001 #ifndef __C3CImage__ 00002 #define __C3CImage__ 00003 00004 00005 00024 #include <stdio.h> 00025 #include <math.h> 00026 #include <memory.h> 00027 00028 #include "CImage.hpp" 00029 00030 class C3CImage 00031 { 00032 private: 00033 00034 bool normalisation; // 0..1 range 00035 int width; 00036 int height; 00037 00038 CImage* channel[3]; 00039 00040 double PI; 00041 00042 public: 00043 00044 C3CImage( int w, int h , double value=0); 00045 C3CImage( int w, int h , double c1, double c2, double c3); 00046 C3CImage( int w, int h , const RComplex& value); 00047 C3CImage( AnImage* source ); // RGB 00048 C3CImage( AnImage* source , int achannel ); 00049 C3CImage( AnImage* source, bool normalized ); 00050 C3CImage( C3CImage& im); // copy 00051 00052 ~C3CImage(); 00053 00054 C3CImage* copy(); 00055 00056 int getChannels(){ return 3; } 00057 00058 CImage* getChannel(int i){ return channel[i]; } 00059 void setChannel(int i, CImage* image){ channel[i]= image; } 00060 00061 RComplex* getData(int i){return channel[i]->getData();} 00062 00063 void set(C3CImage& im); 00064 00065 bool isNormalized(){ return normalisation; } 00066 int getWidth(){ return width; } 00067 int getHeight(){ return height; } 00068 int numberOfChannels(){ return 3; } 00069 00070 RComplex get(int ch, int x, int y){ return channel[ch]->get(x,y); } 00071 void set(int ch, int x,int y, double value){ channel[ch]->set(x,y,value); } 00072 void set(int ch, int x,int y, const RComplex& value){ channel[ch]->set(x,y,value); } 00073 00074 // compute simple operations 00075 00076 void operator*=( double value ); 00077 void operator/=( double value ); 00078 void operator+=( double value ); 00079 void operator-=( double value ); 00080 00081 void operator*=( const RComplex& value ); 00082 void operator/=( const RComplex& value ); 00083 void operator+=( const RComplex& value ); 00084 void operator-=( const RComplex& value ); 00085 00086 void operator+=( C3CImage& image ); 00087 void operator-=( C3CImage& image ); 00088 00089 void mult( double rsat ); 00090 00091 void inverse(double biais=0.0000001); 00092 void root(); 00093 void sqr(); 00094 00095 RComplex laplacian(int ch, int x, int y) 00096 { return channel[ch]->laplacian(x, y); } 00097 RComplex isometricLaplacian(int ch, int x, int y) 00098 { return channel[ch]->isometricLaplacian(x, y); } 00099 00100 /* 00101 double g(int ch, int x, int y) 00102 { return channel[ch]->g(x, y); } 00103 00104 double peronaMalikOperator(int ch, int x, int y) 00105 { return channel[ch]->peronaMalikOperator(x, y); } 00106 00107 double meanCurvatureOperator(int ch, int x, int y) 00108 { return channel[ch]->meanCurvatureOperator(x, y); } 00109 00110 double beltramiOperator(int ch, int x, int y) 00111 { return channel[ch]->beltramiOperator(x, y); } 00112 00113 double gradCorrectiveViscosity(int ch, int x, int y) 00114 { return channel[ch]->gradCorrectiveViscosity(x, y); } 00115 */ 00116 00117 // central differences 00118 RComplex dfX_0(int ch, int x, int y){ return channel[ch]->dfX_0(x, y); } 00119 RComplex dfY_0(int ch, int x, int y){ return channel[ch]->dfY_0(x, y); } 00120 00121 RComplex dfX_0_2(int ch, int x, int y){ return channel[ch]->dfX_0_2(x, y); } 00122 RComplex dfY_0_2(int ch, int x, int y){ return channel[ch]->dfY_0_2(x, y); } 00123 00124 // oriented differences 00125 RComplex dfX_p1(int ch, int x, int y){ return channel[ch]->dfX_p1(x, y); } 00126 RComplex dfY_p1(int ch, int x, int y){ return channel[ch]->dfY_p1(x, y); } 00127 RComplex dfX_m1(int ch, int x, int y){ return channel[ch]->dfX_m1(x, y); } 00128 RComplex dfY_m1(int ch, int x, int y){ return channel[ch]->dfY_m1(x, y); } 00129 00130 // second differential 00131 RComplex dfX2(int ch, int x, int y){ return channel[ch]->dfX2(x, y); } 00132 RComplex dfY2(int ch, int x, int y){ return channel[ch]->dfY2(x, y); } 00133 RComplex dfXY(int ch, int x, int y){ return channel[ch]->dfXY(x, y); } 00134 00135 RComplex dfX2_2(int ch, int x, int y){ return channel[ch]->dfX2_2(x, y); } 00136 RComplex dfY2_2(int ch, int x, int y){ return channel[ch]->dfY2_2(x, y); } 00137 RComplex dfXY_2(int ch, int x, int y){ return channel[ch]->dfXY_2(x, y); } 00138 }; 00139 00140 #endif