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