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 
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:
144  ProcessExport *m_process;
145 
147  WriteChannels m_writeMethod;
148 
150  QString m_extension;
151 
153  QString m_worldExtension;
154 
156  int m_samples;
157 
159  int m_lines;
160 
162  int m_bands;
163 
166  double m_outputPixelMinimum;
167 
170  double m_outputPixelMaximum;
171 
175  ExportDescription *m_exportDescription;
176  };
177 };
178 
179 
180 #endif
FileName.h
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
Cube.h
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::JP2Exporter
Exports cubes into JPEG 2000 images.
Definition: JP2Exporter.h:34
Isis::QtExporter
Exports cubes into one of several formats with Qt facilities.
Definition: QtExporter.h:47
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
ImageExporter.h
Isis::ProcessExport::SetInputRange
void SetInputRange()
Set input pixel range from user.
Definition: ProcessExport.cpp:359
Isis::ExportDescription::ChannelDescription
Describes how a cube as a single color channel to be exported.
Definition: ExportDescription.h:58
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::ProcessExport::CreateWorldFile
void CreateWorldFile(const QString &worldFile)
Create a standard world file for the input cube.
Definition: ProcessExport.cpp:1255
ProcessExport.h
Isis::ProcessExport::setFormat
void setFormat(ExportFormat format)
Sets the storage order of the output file.
Definition: ProcessExport.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::setRgb
virtual void setRgb(ExportDescription &desc)=0
Pure virtual method for setting up an export to an RGB image.
Isis::ExportDescription::ChannelDescription::filename
FileName filename() const
Returns a copy of the filename associated with this channel.
Definition: ExportDescription.cpp:286
Isis::ExportDescription::ChannelDescription::attributes
CubeAttributeInput attributes() const
Returns a copy of the input attributes associated with this channel.
Definition: ExportDescription.cpp:296
Isis::ProcessExport::SetOutputRange
void SetOutputRange(const double minimum, const double maximum)
Set output pixel range in Buffer.
Definition: ProcessExport.cpp:454
Isis::Process::EndProcess
virtual void EndProcess()
End the processing sequence and cleans up by closing cubes, freeing memory, etc.
Definition: Process.cpp:455
Isis::ProcessExport::SetOutputType
void SetOutputType(Isis::PixelType pixelIn)
Set output pixel bit type in Buffer.
Definition: ProcessExport.cpp:608
JP2Exporter.h
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
Buffer.h
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::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
PixelType.h
Isis::Cube::lineCount
int lineCount() const
Definition: Cube.cpp:1734
Isis::FileName::addExtension
FileName addExtension(const QString &extension) const
Adds a new extension to the file name.
Definition: FileName.cpp:225
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
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
ExportDescription.h
Isis::ExportDescription::ChannelDescription::inputMinimum
double inputMinimum() const
Returns the input minimum for this channel.
Definition: ExportDescription.cpp:323
Isis::ExportDescription::ChannelDescription::hasCustomRange
bool hasCustomRange() const
Returns true if the user of this instance has set a custom input range for this channel.
Definition: ExportDescription.cpp:345
Isis::Process::SetInputCube
virtual Isis::Cube * SetInputCube(const QString &parameter, const int requirements=0)
Opens an input cube specified by the user and verifies requirements are met.
Definition: Process.cpp:136
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::sampleCount
int sampleCount() const
Definition: Cube.cpp:1807
Isis::ProcessExport::BIL
@ BIL
Band interleaved by line.
Definition: ProcessExport.h:118
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::IException
Isis exception class.
Definition: IException.h:91
Isis::TiffExporter
Exports cubes into TIFF images.
Definition: TiffExporter.h:41
Isis::ImageExporter::ImageExporter
ImageExporter()
Construct the exporter.
Definition: ImageExporter.cpp:28
Isis::ImageExporter
Export Isis cubes into standard formats.
Definition: ImageExporter.h:54
Isis::FileName::removeExtension
FileName removeExtension() const
Removes all extensions in the file name.
Definition: FileName.cpp:246
Isis::PixelType
PixelType
Enumerations for Isis Pixel Types.
Definition: PixelType.h:27
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
std
Namespace for the standard library.
Isis::ImageExporter::lines
int lines() const
Number of lines (rows) in the output image.
Definition: ImageExporter.cpp:128
Isis::ExportDescription::ChannelDescription::inputMaximum
double inputMaximum() const
Returns the input maximum for this channel.
Definition: ExportDescription.cpp:334
Isis::ProcessExport::ProcessCubes
void ProcessCubes(const Functor &functor)
Definition: ProcessExport.h:175
Isis::ImageExporter::bands
int bands() const
Number of bands (channels) in the output image.
Definition: ImageExporter.cpp:138
QtExporter.h
Isis::JP2Exporter::canWriteFormat
static bool canWriteFormat(QString format)
Returns true if the format is "jp2".
Definition: JP2Exporter.cpp:126
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::QtExporter::canWriteFormat
static bool canWriteFormat(QString format)
Returns true if the format is supported by QImageWriter.
Definition: QtExporter.cpp:246
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::ProcessExport::HasInputRange
bool HasInputRange() const
Definition: ProcessExport.cpp:412
Isis::TiffExporter::canWriteFormat
static bool canWriteFormat(QString format)
Returns true if the format is "tiff".
Definition: TiffExporter.cpp:169
TiffExporter.h
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::ProcessExport::SetOutputNull
void SetOutputNull(const double value)
Set output special pixel value for NULL.
Definition: ProcessExport.cpp:476
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
CubeAttribute.h
Isis::OneBand
const int OneBand
Definition: Process.h:22
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.
Isis::None
@ None
Definition: PixelType.h:28