Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages
celeste/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 enum 00039 { 00040 kChars = 0x01, 00041 kFloats = 0x02, 00042 kRGB = 0x04 00043 }; 00044 00045 class ImageFile 00046 { 00047 public: 00048 00049 ImageFile(); 00050 virtual ~ImageFile(); 00051 00052 // set or get width of image 00053 inline void SetWidth( int w ) { mWidth = w; } 00054 inline int GetWidth() { return mWidth; } 00055 00056 // set or get height of image 00057 inline void SetHeight( int h ){ mHeight = h; } 00058 inline int GetHeight(){ return mHeight; } 00059 00060 // set or get one single pixel 00061 inline void SetPixel( int x, int y, unsigned char p ) { if ( mPixels != NULL ) mPixels[x][y] = p; } 00062 unsigned char GetPixel( int x, int y ); 00063 00064 // set or get pixels 00065 inline int*** GetRGBPixels( void ) { return mRGB; } 00066 void SetPixels( float** ); 00067 float** GetPixels( void ); 00068 00069 // allocate pixelmap 00070 void Allocate( int dataset ); 00071 void Deallocate(); 00072 00073 // read to or write image from file 00074 virtual int Read( char* ) = 0; 00075 virtual void Write( char* ) = 0; 00076 00077 protected: 00078 00079 int*** mRGB; // rgb pixels 00080 unsigned char** mPixels; // pixel storage 00081 float** mFloats; // converted to floats 00082 int mWidth; // image width 00083 int mHeight; // image height 00084 bool mVerbosity; // verbosity level 00085 00086 }; 00087 00088 #endif
1.3.9.1