USGS

Isis 3.0 Object Programmers' Reference

Home

ImageExporter.h

Go to the documentation of this file.
00001 #ifndef ImageExporter_h
00002 #define ImageExporter_h
00003 
00027 #include <vector>
00028 
00029 #include <QString>
00030 
00031 using std::vector;
00032 
00033 namespace Isis {
00034   class Buffer;
00035   class Cube;
00036   class CubeAttributeOutput;
00037   class ExportDescription;
00038   class FileName;
00039   class ImageExporter;
00040   class ProcessExport;
00041 
00060   class ImageExporter {
00061     public:
00062       ImageExporter();
00063       virtual ~ImageExporter();
00064 
00065       void operator()(vector<Buffer *> &in) const;
00066 
00067       virtual void write(FileName outputName, int quality=100);
00068 
00069       int samples() const;
00070       int lines() const;
00071       int bands() const;
00072 
00073       double getInputMinimum(int channel) const;
00074       double getInputMaximum(int channel) const;
00075 
00076       void setOutputRange(double min, double max);
00077 
00083       virtual void setGrayscale(ExportDescription &desc) = 0;
00084 
00090       virtual void setRgb(ExportDescription &desc) = 0;
00091 
00097       virtual void setRgba(ExportDescription &desc) = 0; 
00098 
00099       static ImageExporter * fromFormat(QString format);
00100 
00101     protected:
00103       typedef void (ImageExporter::*WriteChannels)(vector<Buffer *> &in) const;
00104 
00105       void setExtension(QString extension);
00106       Cube * setInput(ExportDescription &desc);
00107 
00108       ProcessExport & getProcess() const;
00109       virtual int getPixel(double dn) const;
00110 
00117       virtual void writeGrayscale(vector<Buffer *> &in) const = 0;
00118 
00124       virtual void writeRgb(vector<Buffer *> &in) const = 0;
00125 
00132       virtual void writeRgba(vector<Buffer *> &in) const = 0;
00133 
00134     private:
00135       Cube * addChannel(ExportDescription &desc, int i);
00136       void createWorldFile(FileName outputName);
00137 
00138     private:
00140       ProcessExport *m_process;
00141 
00143       WriteChannels m_writeMethod;
00144 
00146       QString m_extension;
00147 
00149       QString m_world;
00150 
00152       int m_samples;
00153 
00155       int m_lines;
00156 
00158       int m_bands;
00159 
00161       double m_dataMin;
00162 
00164       double m_dataMax;
00165   };
00166 };
00167 
00168 
00169 #endif