Isis Developer Reference
ImageExporter.h
Go to the documentation of this file.
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
17using std::vector;
18
19namespace Isis {
20 class Buffer;
21 class Cube;
22 class CubeAttributeOutput;
23 class UserInterface;
24 class ExportDescription;
25 class FileName;
26 class ProcessExport;
27
56 public:
58 virtual ~ImageExporter();
59
60 void operator()(vector<Buffer *> &in) const;
61
62 virtual void write(FileName outputName, int quality=100,
63 QString compression="none", UserInterface *ui = nullptr);
64
65 int samples() const;
66 int lines() const;
67 int bands() const;
68
69 double inputMinimum(int channel) const;
70 double inputMaximum(int channel) const;
71
72 void setOutputPixelRange(double outputPixelMinimum, double outputPixelMaximum);
73
79 virtual void setGrayscale(ExportDescription &desc) = 0;
80
86 virtual void setRgb(ExportDescription &desc) = 0;
87
93 virtual void setRgba(ExportDescription &desc) = 0;
94
95 static ImageExporter *fromFormat(QString format);
96
97 protected:
99 typedef void (ImageExporter::*WriteChannels)(vector<Buffer *> &in) const;
100
101 virtual void initialize(ExportDescription &desc) = 0;
102
103 // member variable mutators
104 void setExtension(QString extension);
107
108 // member variable accessors for child classes
109 QString extension() const;
111 ProcessExport &process() const;
112 PixelType pixelType() const;
113
114 virtual int outputPixelValue(double dn) const;
115
122 virtual void writeGrayscale(vector<Buffer *> &in) const = 0;
123
129 virtual void writeRgb(vector<Buffer *> &in) const = 0;
130
137 virtual void writeRgba(vector<Buffer *> &in) const = 0;
138
139 private:
140 Cube *addChannel(int i);
141 void createWorldFile(FileName outputName);
142
143 private:
145 ProcessExport *m_process;
146
148 WriteChannels m_writeMethod;
149
151 QString m_extension;
152
154 QString m_worldExtension;
155
157 int m_samples;
158
160 int m_lines;
161
163 int m_bands;
164
167 double m_outputPixelMinimum;
168
171 double m_outputPixelMaximum;
172
176 ExportDescription *m_exportDescription;
177 };
178};
179
180
181#endif
Buffer for reading and writing cube data.
Definition Buffer.h:53
IO Handler for Isis Cubes.
Definition Cube.h:168
Describes how a series of cubes should be exported.
Definition ExportDescription.h:43
File name manipulation and expansion.
Definition FileName.h:100
Export Isis cubes into standard formats.
Definition ImageExporter.h:55
int lines() const
Number of lines (rows) in the output image.
Definition ImageExporter.cpp:137
QString extension() const
Gets the extension for the output image.
Definition ImageExporter.cpp:217
int bands() const
Number of bands (channels) in the output image.
Definition ImageExporter.cpp:147
virtual void write(FileName outputName, int quality=100, QString compression="none", UserInterface *ui=nullptr)
Export the Isis cube channels to the given standard image.
Definition ImageExporter.cpp:103
virtual ~ImageExporter()
Destruct the exporter.
Definition ImageExporter.cpp:67
ExportDescription & exportDescription() const
Gets the description for the output image.
Definition ImageExporter.cpp:235
Cube * initializeProcess()
Sets up the export process with the parameters described within the given description.
Definition ImageExporter.cpp:255
double inputMinimum(int channel) const
Returns the input minimum for the given channel.
Definition ImageExporter.cpp:160
void(ImageExporter::* WriteChannels)(vector< Buffer * > &in) const
Friendly alias for a method used to write a particular color channel.
Definition ImageExporter.h:99
static ImageExporter * fromFormat(QString format)
A static (factory) method for constructing an ImageExporter instance from an output format.
Definition ImageExporter.cpp:399
int samples() const
Number of samples (columns) in the output image.
Definition ImageExporter.cpp:127
ImageExporter()
Construct the exporter.
Definition ImageExporter.cpp:29
PixelType pixelType() const
Returns the pixel type.
Definition ImageExporter.cpp:316
virtual void setRgba(ExportDescription &desc)=0
Pure virtual method for setting up an export to an RGBA image.
virtual void writeGrayscale(vector< Buffer * > &in) const =0
Pure virtual method for writing a line of grayscale data to the output image.
void setOutputPixelRange(double outputPixelMinimum, double outputPixelMaximum)
Set the DN floor and ceiling for the exported image.
Definition ImageExporter.cpp:190
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:85
void setExportDescription(ExportDescription &desc)
Sets the description for the output image.
Definition ImageExporter.cpp:226
virtual void initialize(ExportDescription &desc)=0
Generic initialization with the export description.
Definition ImageExporter.cpp:59
virtual void setGrayscale(ExportDescription &desc)=0
Pure virtual method for setting up an export to a grayscale image.
void setExtension(QString extension)
Sets the extension for the output image and generates the extension for the world file from it.
Definition ImageExporter.cpp:202
ProcessExport & process() const
Get a reference to the process object, useful for subclasses to access and manipulate the process.
Definition ImageExporter.cpp:306
virtual void setRgb(ExportDescription &desc)=0
Pure virtual method for setting up an export to an RGB image.
virtual int outputPixelValue(double dn) const
Return the output clamped integer pixel value from the input double-precision DN.
Definition ImageExporter.cpp:334
virtual void writeRgba(vector< Buffer * > &in) const =0
Pure virtual method for writing a line of RGBA data to the output image.
virtual void writeRgb(vector< Buffer * > &in) const =0
Pure virtual method for writing a line of RGB data to the output image.
double inputMaximum(int channel) const
Returns the input maximum for the given channel.
Definition ImageExporter.cpp:173
Process class for exporting cubes.
Definition ProcessExport.h:111
Command Line and Xml loader, validation, and access.
Definition UserInterface.h:139
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
PixelType
Enumerations for Isis Pixel Types.
Definition PixelType.h:27