BaseImageTemplate.h
Go to the documentation of this file.
00001 
00009 #ifndef BaseImageTemplate_H
00010 #define BaseImageTemplate_H
00011 
00012 #include "Matrix.h"
00013 #include "Vector.h"
00014 
00015 #include <cstring>
00016 #include <stdio.h>
00017 
00018 namespace puma2
00019 {
00020 
00032 template <class T> class TBaseImg
00033 {
00034   public:
00039     unsigned getHeight() const { return c0.getHeight(); }
00040 
00045     unsigned getWidth() const { return c0.getWidth(); }
00046 
00048     typedef T Pixel;
00049 
00051     const Vector<T> & operator[] ( int i ) const { return c0[i]; }
00052 
00054     Vector<T> & operator[] ( int i ) { return c0[i]; }
00055 
00057     void operator= ( const TBaseImg & o ) {
00058       this->c0 = o.c0;
00059     }
00061     operator T**() { return c0; }
00063     operator const T**() const { return ( const T** ) c0; }
00065     T** unsafeRowPointerArray() { return c0; }
00067     const T** unsafeRowPointerArray() const { return ( const T ** ) c0; }
00068 
00070     void resize ( int width, int height ) { c0.resize ( width, height ); }
00071 
00073     void resize ( int width, int height, TBaseImg* master, int xOffset, int yOffset ) {
00074       c0.resize ( width, height, & ( master->c0 ), xOffset, yOffset );
00075     }
00076 
00078     bool isSubImage() const { return c0.isSubMatrix(); }
00079 
00080     void readFromFile(const char * fileName)
00081     {
00082       char buffer [1024];
00083       sprintf (buffer,"Try to read from %s -- not implemeted for current class", fileName);
00084       throw buffer;
00085     }
00086 
00087     void writeToFile(const char * fileName) const
00088     {
00089       char buffer [1024];
00090       sprintf (buffer,"Try to write to %s -- not implemeted for current class", fileName);
00091       throw buffer;
00092     }
00093 
00094     void setupImageBaseVariables ()
00095     {
00096       mValueRangeMinimum = this->getElementTypeMinimum();
00097       mValueRangeMaximum = this->getElementTypeMaximum();
00098     }
00099 
00107     virtual double getElementTypeMinimum() const { return 0; };
00108 
00114     virtual double getElementTypeMaximum() const { return 0; };
00115 
00118     void setValueRangeMinimum(double value) { mValueRangeMinimum = value; };
00121     void setValueRangeMaximum(double value) { mValueRangeMaximum = value; };
00123     double getValueRangeMinimum() const { return mValueRangeMinimum; };
00125     double getValueRangeMaximum() const { return mValueRangeMaximum; };
00126 
00127     // all constructors are protected!
00128   protected:
00130     Matrix<T> c0;   //< matrix for all image types
00131 
00133     TBaseImg ( int width = 0, int height = 0 )
00134         : c0 ( width, height ) {}
00135 
00137     TBaseImg ( int width, int height, TBaseImg* master, int xOffset, int yOffset )
00138         : c0 ( width, height, & ( master->c0 ), xOffset, yOffset ) {}
00139 
00147     double mValueRangeMinimum;
00148 
00156     double mValueRangeMaximum;
00157 };
00158 
00159 }
00160 
00161 #endif


obj_rec_gui
Author(s): AGAS/agas@uni-koblenz.de
autogenerated on Mon Oct 6 2014 02:53:43