Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vuPPMReader.h

Go to the documentation of this file.
00001 /*      This is a ppm reader and writer for vuVolume
00002         This will save vuImages into ppm and extract them from
00003         ppm files that are given.
00004 
00005         The info surrounding a ppm is found on the website:
00006 
00007         http://astronomy.swin.edu.au/~pbourke/dataformats/ppm/
00008 
00009         Written by Christopher Steinbach
00010         March 2002
00011 */
00012 
00013 #ifndef vuVolume_PPM_reader_h__
00014 #define vuVolume_PPM_reader_h__
00015 
00016 #include "vuImage.h"
00017 
00018 #include <stdio.h>
00019 #include <stdlib.h>
00020 #include <string.h>
00021 
00022 //using namespace ns_vu1112113;
00023 
00049 class vuPPM
00050 
00051 {
00052         public: // constructors and destructors
00053 
00055                 vuPPM ();
00056 
00058                 virtual ~vuPPM ();
00059 
00060         public: // These functions will load the image from variou sources
00061 
00065                 bool SaveImage (char* fname, vuImage &img);
00066                 
00067                 bool SaveCompressedImage (char* fname, vuImage &img);
00068 
00076                 bool ReadImage (char* fname, vuImage &img, int readtype = 0);
00077 
00086                 bool ReadImageFromBuffer (char* buf, vuImage &img, int readtype = 0);
00087 
00090                 bool SaveImage (char* fname);
00091 
00094                 bool ReadImage (char* fname);
00095 
00099                 bool OpenImage (char* fname, vuImage &img);
00100 
00103                 unsigned int Readnext64KB (vuImage &img);
00104 
00106                 bool CloseImage ();
00107 
00110                 bool set_xy (int x, int y);
00111 
00116                 int get_x ();
00117 
00122                 int get_y ();
00123 
00124         private:        // functions that handle headers.
00125 
00148                 int ReadHeader (vuImage &img, int readtype = 0);
00149 
00150                 bool ReadCompressedImage (char* fname, vuImage &img, int readtype);
00151 
00161                 int ReadHeader (vuImage &img, char* buf, int readtype = 0);
00162 
00169                 bool WriteHeader (vuImage &img);
00170 
00171                 bool WriteCompressedHeader (vuImage &img);
00172 
00173                 int CompressToBuffer (vuImage &img);
00174 
00175         private:
00177                 vuImage m_Image;
00178 
00181                 FILE *fp;
00182 
00184                 int m_x;
00185 
00187                 int m_y;
00188 
00190                 int m_z;
00191                 
00192                 unsigned char* m_buf;
00193                 int m_buf_size;
00194 
00197                 unsigned int counter;
00198 };
00199 
00200 #endif
00201 
00202 
00203 
00204 

Generated on Wed Dec 15 21:20:35 2004 for vuVolume by  doxygen 1.3.9.1