Isis 3 Developer Reference
ImageExporter.h
Go to the documentation of this file.
1 #ifndef ImageExporter_h
2 #define ImageExporter_h
3 
27 #include <vector>
28 
29 #include <QString>
30 
31 #include "PixelType.h"
32 
33 using std::vector;
34 
35 namespace Isis {
36  class Buffer;
37  class Cube;
38  class CubeAttributeOutput;
39  class ExportDescription;
40  class FileName;
41  class ProcessExport;
42 
70  class ImageExporter {
71  public:
72  ImageExporter();
73  virtual ~ImageExporter();
74 
75  void operator()(vector<Buffer *> &in) const;
76 
77  virtual void write(FileName outputName, int quality=100,
78  QString compression="none");
79 
80  int samples() const;
81  int lines() const;
82  int bands() const;
83 
84  double inputMinimum(int channel) const;
85  double inputMaximum(int channel) const;
86 
87  void setOutputPixelRange(double outputPixelMinimum, double outputPixelMaximum);
88 
94  virtual void setGrayscale(ExportDescription &desc) = 0;
95 
101  virtual void setRgb(ExportDescription &desc) = 0;
102 
108  virtual void setRgba(ExportDescription &desc) = 0;
109 
110  static ImageExporter *fromFormat(QString format);
111 
112  protected:
114  typedef void (ImageExporter::*WriteChannels)(vector<Buffer *> &in) const;
115 
116  virtual void initialize(ExportDescription &desc) = 0;
117 
118  // member variable mutators
119  void setExtension(QString extension);
122 
123  // member variable accessors for child classes
124  QString extension() const;
126  ProcessExport &process() const;
127  PixelType pixelType() const;
128 
129  virtual int outputPixelValue(double dn) const;
130 
137  virtual void writeGrayscale(vector<Buffer *> &in) const = 0;
138 
144  virtual void writeRgb(vector<Buffer *> &in) const = 0;
145 
152  virtual void writeRgba(vector<Buffer *> &in) const = 0;
153 
154  private:
155  Cube *addChannel(int i);
156  void createWorldFile(FileName outputName);
157 
158  private:
160  ProcessExport *m_process;
161 
163  WriteChannels m_writeMethod;
164 
166  QString m_extension;
167 
169  QString m_worldExtension;
170 
172  int m_samples;
173 
175  int m_lines;
176 
178  int m_bands;
179 
182  double m_outputPixelMinimum;
183 
186  double m_outputPixelMaximum;
187 
191  ExportDescription *m_exportDescription;
192  };
193 };
194 
195 
196 #endif
QString extension() const
Gets the extension for the output image.
Definition: ImageExporter.cpp:202
File name manipulation and expansion.
Definition: FileName.h:116
int bands() const
Number of bands (channels) in the output image.
Definition: ImageExporter.cpp:132
Cube * initializeProcess()
Sets up the export process with the parameters described within the given description.
Definition: ImageExporter.cpp:240
Process class for exporting cubes.
Definition: ProcessExport.h:125
static ImageExporter * fromFormat(QString format)
A static (factory) method for constructing an ImageExporter instance from an output format...
Definition: ImageExporter.cpp:384
Export Isis cubes into standard formats.
Definition: ImageExporter.h:70
virtual void setGrayscale(ExportDescription &desc)=0
Pure virtual method for setting up an export to a grayscale image.
ImageExporter()
Construct the exporter.
Definition: ImageExporter.cpp:22
int samples() const
Number of samples (columns) in the output image.
Definition: ImageExporter.cpp:112
virtual int outputPixelValue(double dn) const
Return the output clamped integer pixel value from the input double-precision DN. ...
Definition: ImageExporter.cpp:319
PixelType pixelType() const
Returns the pixel type.
Definition: ImageExporter.cpp:301
double inputMinimum(int channel) const
Returns the input minimum for the given channel.
Definition: ImageExporter.cpp:145
ExportDescription & exportDescription() const
Gets the description for the output image.
Definition: ImageExporter.cpp:220
void(ImageExporter::* WriteChannels)(vector< Buffer *> &in) const
Friendly alias for a method used to write a particular color channel.
Definition: ImageExporter.h:114
void setExtension(QString extension)
Sets the extension for the output image and generates the extension for the world file from it...
Definition: ImageExporter.cpp:187
ProcessExport & process() const
Get a reference to the process object, useful for subclasses to access and manipulate the process...
Definition: ImageExporter.cpp:291
PixelType
Enumerations for Isis Pixel Types.
Definition: PixelType.h:43
void setExportDescription(ExportDescription &desc)
Sets the description for the output image.
Definition: ImageExporter.cpp:211
virtual void writeRgba(vector< Buffer *> &in) const =0
Pure virtual method for writing a line of RGBA data to the output image.
virtual void setRgb(ExportDescription &desc)=0
Pure virtual method for setting up an export to an RGB image.
Describes how a series of cubes should be exported.
Definition: ExportDescription.h:59
int lines() const
Number of lines (rows) in the output image.
Definition: ImageExporter.cpp:122
virtual void setRgba(ExportDescription &desc)=0
Pure virtual method for setting up an export to an RGBA image.
virtual void initialize(ExportDescription &desc)=0
Generic initialization with the export description.
Definition: ImageExporter.cpp:52
void setOutputPixelRange(double outputPixelMinimum, double outputPixelMaximum)
Set the DN floor and ceiling for the exported image.
Definition: ImageExporter.cpp:175
virtual void writeGrayscale(vector< Buffer *> &in) const =0
Pure virtual method for writing a line of grayscale data to the output image.
void operator()(vector< Buffer *> &in) const
The method for writing a line of input image data (with potentially several bands representing color ...
Definition: ImageExporter.cpp:78
virtual void write(FileName outputName, int quality=100, QString compression="none")
Export the Isis cube channels to the given standard image.
Definition: ImageExporter.cpp:95
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
double inputMaximum(int channel) const
Returns the input maximum for the given channel.
Definition: ImageExporter.cpp:158
virtual ~ImageExporter()
Destruct the exporter.
Definition: ImageExporter.cpp:60
virtual void writeRgb(vector< Buffer *> &in) const =0
Pure virtual method for writing a line of RGB data to the output image.
IO Handler for Isis Cubes.
Definition: Cube.h:170