Isis 3 Programmer Reference
ImageExporter.h
1 #ifndef ImageExporter_h
2 #define ImageExporter_h
3 
9 /* SPDX-License-Identifier: CC0-1.0 */
10 
11 #include <vector>
12 
13 #include <QString>
14 
15 #include "PixelType.h"
16 
17 using std::vector;
18 
19 namespace Isis {
20  class Buffer;
21  class Cube;
22  class CubeAttributeOutput;
23  class ExportDescription;
24  class FileName;
25  class ProcessExport;
26 
54  class ImageExporter {
55  public:
56  ImageExporter();
57  virtual ~ImageExporter();
58 
59  void operator()(vector<Buffer *> &in) const;
60 
61  virtual void write(FileName outputName, int quality=100,
62  QString compression="none");
63 
64  int samples() const;
65  int lines() const;
66  int bands() const;
67 
68  double inputMinimum(int channel) const;
69  double inputMaximum(int channel) const;
70 
71  void setOutputPixelRange(double outputPixelMinimum, double outputPixelMaximum);
72 
78  virtual void setGrayscale(ExportDescription &desc) = 0;
79 
85  virtual void setRgb(ExportDescription &desc) = 0;
86 
92  virtual void setRgba(ExportDescription &desc) = 0;
93 
94  static ImageExporter *fromFormat(QString format);
95 
96  protected:
98  typedef void (ImageExporter::*WriteChannels)(vector<Buffer *> &in) const;
99 
100  virtual void initialize(ExportDescription &desc) = 0;
101 
102  // member variable mutators
103  void setExtension(QString extension);
106 
107  // member variable accessors for child classes
108  QString extension() const;
110  ProcessExport &process() const;
111  PixelType pixelType() const;
112 
113  virtual int outputPixelValue(double dn) const;
114 
121  virtual void writeGrayscale(vector<Buffer *> &in) const = 0;
122 
128  virtual void writeRgb(vector<Buffer *> &in) const = 0;
129 
136  virtual void writeRgba(vector<Buffer *> &in) const = 0;
137 
138  private:
139  Cube *addChannel(int i);
140  void createWorldFile(FileName outputName);
141 
142  private:
145 
148 
150  QString m_extension;
151 
154 
157 
159  int m_lines;
160 
162  int m_bands;
163 
167 
171 
176  };
177 };
178 
179 
180 #endif
Isis::ImageExporter::process
ProcessExport & process() const
Get a reference to the process object, useful for subclasses to access and manipulate the process.
Definition: ImageExporter.cpp:297
Isis::ImageExporter::setOutputPixelRange
void setOutputPixelRange(double outputPixelMinimum, double outputPixelMaximum)
Set the DN floor and ceiling for the exported image.
Definition: ImageExporter.cpp:181
Isis::ImageExporter::inputMinimum
double inputMinimum(int channel) const
Returns the input minimum for the given channel.
Definition: ImageExporter.cpp:151
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::ImageExporter::m_bands
int m_bands
Number of bands (channels) in the output image.
Definition: ImageExporter.h:162
Isis::ImageExporter::addChannel
Cube * addChannel(int i)
Add a channel of input data to the process from the export description at the given index.
Definition: ImageExporter.cpp:346
Isis::ImageExporter::m_writeMethod
WriteChannels m_writeMethod
Method pointer to one of the pure virtual write methods.
Definition: ImageExporter.h:147
Isis::ExportDescription
Describes how a series of cubes should be exported.
Definition: ExportDescription.h:43
Isis::ImageExporter::exportDescription
ExportDescription & exportDescription() const
Gets the description for the output image.
Definition: ImageExporter.cpp:226
Isis::ImageExporter::setGrayscale
virtual void setGrayscale(ExportDescription &desc)=0
Pure virtual method for setting up an export to a grayscale image.
Isis::ImageExporter::m_outputPixelMaximum
double m_outputPixelMaximum
! The absolute maximum value for the output pixels.
Definition: ImageExporter.h:170
Isis::ImageExporter::writeGrayscale
virtual void writeGrayscale(vector< Buffer * > &in) const =0
Pure virtual method for writing a line of grayscale data to the output image.
Isis::ImageExporter::m_lines
int m_lines
Number of lines (rows) in the output image.
Definition: ImageExporter.h:159
Isis::ImageExporter::setRgb
virtual void setRgb(ExportDescription &desc)=0
Pure virtual method for setting up an export to an RGB image.
Isis::ImageExporter::m_samples
int m_samples
Number of samples (columns) in the output image.
Definition: ImageExporter.h:156
Isis::ImageExporter::createWorldFile
void createWorldFile(FileName outputName)
Creates a world file is the input has a map projection.
Definition: ImageExporter.cpp:364
Isis::ImageExporter::writeRgba
virtual void writeRgba(vector< Buffer * > &in) const =0
Pure virtual method for writing a line of RGBA data to the output image.
Isis::ImageExporter::initializeProcess
Cube * initializeProcess()
Sets up the export process with the parameters described within the given description.
Definition: ImageExporter.cpp:246
Isis::ImageExporter::m_extension
QString m_extension
Extension to append to the output image if not already provided.
Definition: ImageExporter.h:150
Isis::ImageExporter::write
virtual void write(FileName outputName, int quality=100, QString compression="none")
Export the Isis cube channels to the given standard image.
Definition: ImageExporter.cpp:101
Isis::ImageExporter::m_process
ProcessExport * m_process
The object that feeds lines to this instance and handles stretching.
Definition: ImageExporter.h:144
Isis::ImageExporter::~ImageExporter
virtual ~ImageExporter()
Destruct the exporter.
Definition: ImageExporter.cpp:66
Isis::ImageExporter::fromFormat
static ImageExporter * fromFormat(QString format)
A static (factory) method for constructing an ImageExporter instance from an output format.
Definition: ImageExporter.cpp:390
Isis::ImageExporter::inputMaximum
double inputMaximum(int channel) const
Returns the input maximum for the given channel.
Definition: ImageExporter.cpp:164
Isis::ImageExporter::operator()
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:84
Isis::ImageExporter::writeRgb
virtual void writeRgb(vector< Buffer * > &in) const =0
Pure virtual method for writing a line of RGB data to the output image.
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::ImageExporter::outputPixelValue
virtual int outputPixelValue(double dn) const
Return the output clamped integer pixel value from the input double-precision DN.
Definition: ImageExporter.cpp:325
Isis::ImageExporter::extension
QString extension() const
Gets the extension for the output image.
Definition: ImageExporter.cpp:208
Isis::ImageExporter::ImageExporter
ImageExporter()
Construct the exporter.
Definition: ImageExporter.cpp:28
Isis::ImageExporter
Export Isis cubes into standard formats.
Definition: ImageExporter.h:54
Isis::PixelType
PixelType
Enumerations for Isis Pixel Types.
Definition: PixelType.h:27
Isis::ImageExporter::lines
int lines() const
Number of lines (rows) in the output image.
Definition: ImageExporter.cpp:128
Isis::ImageExporter::bands
int bands() const
Number of bands (channels) in the output image.
Definition: ImageExporter.cpp:138
Isis::ImageExporter::m_outputPixelMinimum
double m_outputPixelMinimum
! The absolute minimum value for the output pixels.
Definition: ImageExporter.h:166
Isis::ImageExporter::m_exportDescription
ExportDescription * m_exportDescription
! The description for the export.
Definition: ImageExporter.h:175
Isis::ImageExporter::pixelType
PixelType pixelType() const
Returns the pixel type.
Definition: ImageExporter.cpp:307
Isis::ImageExporter::setExportDescription
void setExportDescription(ExportDescription &desc)
Sets the description for the output image.
Definition: ImageExporter.cpp:217
Isis::ImageExporter::samples
int samples() const
Number of samples (columns) in the output image.
Definition: ImageExporter.cpp:118
Isis::ImageExporter::m_worldExtension
QString m_worldExtension
Extension to append to the output world file.
Definition: ImageExporter.h:153
Isis::ImageExporter::WriteChannels
void(ImageExporter::* WriteChannels)(vector< Buffer * > &in) const
Friendly alias for a method used to write a particular color channel.
Definition: ImageExporter.h:98
Isis::ImageExporter::setExtension
void setExtension(QString extension)
Sets the extension for the output image and generates the extension for the world file from it.
Definition: ImageExporter.cpp:193
Isis::ImageExporter::initialize
virtual void initialize(ExportDescription &desc)=0
Generic initialization with the export description.
Definition: ImageExporter.cpp:58
Isis::ProcessExport
Process class for exporting cubes.
Definition: ProcessExport.h:111
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::ImageExporter::setRgba
virtual void setRgba(ExportDescription &desc)=0
Pure virtual method for setting up an export to an RGBA image.