ImageFile.h

Go to the documentation of this file.
00001 /* Import from Gabor API
00002 
00003 Copyright (c) 2002-3 Adriaan Tijsseling
00004 
00005 
00006                              All Rights Reserved
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with this program. If not, see <http://www.gnu.org/licenses/>.
00020 */
00021 
00022 /*
00023         Description:            Abstract class for reading and storing images
00024         Original Author:        Mickael Pic
00025         Modifications by:       Adriaan Tijsseling (AGT)
00026 */
00027 
00028 #ifndef __IMAGE_FILE_CLASS__
00029 #define __IMAGE_FILE_CLASS__
00030 
00031 #include        <iostream>
00032 #include        <fstream>
00033 #include        <string>
00034 #include        <math.h>
00035 #include        <stdio.h>
00036 #include        <stdlib.h>
00037 
00038 namespace celeste
00039 {
00040 enum
00041 {
00042         kChars = 0x01,
00043         kFloats = 0x02,
00044         kRGB = 0x04
00045 };
00046 
00047 class ImageFile
00048 { 
00049 public:
00050 
00051         ImageFile();
00052         virtual ~ImageFile();
00053 
00054         // set or get width of image
00055         inline void             SetWidth( int w ) { mWidth = w; }
00056         inline int              GetWidth() { return mWidth; }
00057 
00058         // set or get height of image
00059         inline void             SetHeight( int h ){ mHeight = h; }
00060         inline int              GetHeight(){ return mHeight; }
00061 
00062         // set or get one single pixel
00063         inline void     SetPixel( int x, int y, unsigned char p ) { if ( mPixels != NULL ) mPixels[x][y] = p; }
00064         unsigned char   GetPixel( int x, int y );
00065 
00066         // set or get pixels
00067         inline int***   GetRGBPixels( void ) { return mRGB; }
00068         void                    SetPixels( float** );
00069         float**                 GetPixels( void );
00070 
00071         // allocate pixelmap
00072         void                    Allocate( int dataset );
00073         void                    Deallocate();
00074 
00075         // read to or write image from file
00076         virtual int             Read( char* ) = 0;
00077         virtual void    Write( char* ) = 0;
00078 
00079 protected:
00080         
00081         int***                  mRGB;           // rgb pixels
00082         unsigned char** mPixels;        // pixel storage
00083         float**                 mFloats;        // converted to floats
00084         int                     mWidth;         // image width
00085         int                     mHeight;        // image height
00086         bool                    mVerbosity;     // verbosity level
00087 
00088  };
00089 }//namespace
00090 #endif

Generated on Sat Aug 30 01:25:30 2014 for Hugintrunk by  doxygen 1.3.9.1