USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::ImageExporter Class Reference
[High Level Cube I/O]

Export Isis cubes into standard formats. More...

#include <ImageExporter.h>

Inheritance diagram for Isis::ImageExporter:
Inheritance graph
[legend]
Collaboration diagram for Isis::ImageExporter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ImageExporter ()
 Construct the exporter.
virtual ~ImageExporter ()
 Destruct the exporter.
void operator() (vector< Buffer * > &in) const
 The method for writing a line of input image data (with potentially several bands representing color channels) to the output image.
virtual void write (FileName outputName, int quality=100)
 Export the Isis cube channels to the given standard image.
int samples () const
 Number of samples (columns) in the output image.
int lines () const
 Number of lines (rows) in the output image.
int bands () const
 Number of bands (channels) in the output image.
double getInputMinimum (int channel) const
 Returns the input minimum for the given channel.
double getInputMaximum (int channel) const
 Returns the input maximum for the given channel.
void setOutputRange (double min, double max)
 Set the input DN floor and ceiling.
virtual void setGrayscale (ExportDescription &desc)=0
 Pure virtual method for setting up an export to a grayscale image.
virtual void setRgb (ExportDescription &desc)=0
 Pure virtual method for setting up an export to an RGB image.
virtual void setRgba (ExportDescription &desc)=0
 Pure virtual method for setting up an export to an RGBA image.

Static Public Member Functions

static ImageExporterfromFormat (QString format)
 A static (factory) method for constructing an ImageExporter instance from an output format.

Protected Types

typedef void(ImageExporter::* WriteChannels )(vector< Buffer * > &in) const
 Friendly alias for a method used to write a particular color channel.

Protected Member Functions

void setExtension (QString extension)
 Sets the extension for the output image and generates the extension for the world file from it.
CubesetInput (ExportDescription &desc)
 Sets up the export process with the parameters described within the given description.
ProcessExportgetProcess () const
 Get a reference to the process object, useful for subclasses to access and manipulate the process.
virtual int getPixel (double dn) const
 Return the output clamped integer pixel value from the input double-precision DN.
virtual void writeGrayscale (vector< Buffer * > &in) const =0
 Pure virtual method for writing a line of grayscale 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.
virtual void writeRgba (vector< Buffer * > &in) const =0
 Pure virtual method for writing a line of RGBA data to the output image.

Private Member Functions

CubeaddChannel (ExportDescription &desc, int i)
 Add a channel of input data to the process from the export description at the given index.
void createWorldFile (FileName outputName)
 Creates a world file is the input has a map projection.

Private Attributes

ProcessExportm_process
 The object that feeds lines to this instance and handles stretching.
WriteChannels m_writeMethod
 Method pointer to one of the pure virtual write methods.
QString m_extension
 Extension to append to the output image if not already provided.
QString m_world
 Extension to append to the output world file.
int m_samples
 Number of samples (columns) in the output image.
int m_lines
 Number of lines (rows) in the output image.
int m_bands
 Number of bands (channels) in the output image.
double m_dataMin
 Input DN floor, all DNs less than this will be mapped to this.
double m_dataMax
 Input DN ceiling, all DNs greater than this will be mapped to this.

Detailed Description

Export Isis cubes into standard formats.

Abstract base class for a series of image exporters. Each exporter handles a specialized suite of standard image formats, and can be used as a black-box with the write() method, or for finer control, the importer can act as a functor in a ProcessExport routine.

Author:
2012-04-03 Travis Addair

For internal use only.

History:
2012-04-04 Travis Addair - Added documentation.
History:
2012-08-28 Steven Lambright - The world file should no longer overwrite the output image. This is related to #832/#970. References #579.

Definition at line 60 of file ImageExporter.h.


Member Typedef Documentation

typedef void(ImageExporter::* Isis::ImageExporter::WriteChannels)(vector< Buffer * > &in) const [protected]

Friendly alias for a method used to write a particular color channel.

Definition at line 103 of file ImageExporter.h.


Constructor & Destructor Documentation

Isis::ImageExporter::ImageExporter (  ) 

Construct the exporter.

Definition at line 19 of file ImageExporter.cpp.

References m_bands, m_dataMax, m_dataMin, m_extension, m_lines, m_process, m_samples, m_world, and m_writeMethod.

Isis::ImageExporter::~ImageExporter (  )  [virtual]

Destruct the exporter.

Also deletes the process object.

Definition at line 40 of file ImageExporter.cpp.

References m_process.


Member Function Documentation

Cube * Isis::ImageExporter::addChannel ( ExportDescription desc,
int  i 
) [private]

Add a channel of input data to the process from the export description at the given index.

Parameters:
desc The export description
i Index of the channel to add within the export description
Returns:
A cube pointer to the channel added, owned by the process

Definition at line 242 of file ImageExporter.cpp.

References Isis::ExportDescription::ChannelDescription::attributes(), channel, cube, Isis::ExportDescription::ChannelDescription::filename(), Isis::ExportDescription::getChannel(), Isis::ExportDescription::ChannelDescription::getInputMaximum(), Isis::ExportDescription::ChannelDescription::getInputMinimum(), getProcess(), Isis::ExportDescription::ChannelDescription::hasCustomRange(), Isis::Process::SetInputCube(), and Isis::ProcessExport::SetInputRange().

Referenced by setInput().

int Isis::ImageExporter::bands (  )  const

Number of bands (channels) in the output image.

Returns:
The depth of the output

Definition at line 106 of file ImageExporter.cpp.

References m_bands.

Referenced by Isis::TiffExporter::createBuffer(), Isis::JP2Exporter::createBuffer(), Isis::TiffExporter::setBuffer(), Isis::TiffExporter::write(), and Isis::JP2Exporter::write().

void Isis::ImageExporter::createWorldFile ( FileName  outputName  )  [private]

Creates a world file is the input has a map projection.

Parameters:
outputName Name of the world file

Definition at line 261 of file ImageExporter.cpp.

References Isis::ProcessExport::CreateWorldFile(), Isis::Process::EndProcess(), getProcess(), and m_world.

Referenced by write().

ImageExporter * Isis::ImageExporter::fromFormat ( QString  format  )  [static]

A static (factory) method for constructing an ImageExporter instance from an output format.

The specific subclass of the returned instance is determined from the desired output image format provided. Each subclass has knowledge of whether or not it can write a particular format. Because the ability to export an image format is not mutually exclusive amongst exporters, the order of condieration here matters. For example, using a TIFF exporter takes precedence over a Qt exporter for TIFF images, because the former can process cubes greater than 2GB while the latter cannot. It is the caller's responsibility to delete the exporter instance when they are finished with it.

Parameters:
format The format for the output image to be created
Returns:
A pointer to the instantiated exporter owned by the caller

Definition at line 287 of file ImageExporter.cpp.

References _FILEINFO_, Isis::JP2Exporter::canWriteFormat(), Isis::QtExporter::canWriteFormat(), Isis::TiffExporter::canWriteFormat(), and Isis::IException::Programmer.

double Isis::ImageExporter::getInputMaximum ( int  channel  )  const

Returns the input maximum for the given channel.

Any value of max in the input cube will be mapped to the output max of the output channel.

Parameters:
channel Index of the channel within the process
Returns:
The maximum DN in the input mapped to the maximum of the output

Definition at line 132 of file ImageExporter.cpp.

References Isis::ProcessExport::GetInputMaximum(), and m_process.

double Isis::ImageExporter::getInputMinimum ( int  channel  )  const

Returns the input minimum for the given channel.

Any value of min in the input cube will be mapped to the output min of the output channel.

Parameters:
channel Index of the channel within the process
Returns:
The minimum DN in the input mapped to the minimum of the output

Definition at line 119 of file ImageExporter.cpp.

References Isis::ProcessExport::GetInputMinimum(), and m_process.

int Isis::ImageExporter::getPixel ( double  dn  )  const [protected, virtual]

Return the output clamped integer pixel value from the input double-precision DN.

Parameters:
dn The input DN
Returns:
The pixel value for the output

Definition at line 228 of file ImageExporter.cpp.

References m_dataMax, and m_dataMin.

Referenced by Isis::StreamExporter::writeGrayscale(), Isis::QtExporter::writeGrayscale(), Isis::StreamExporter::writeRgb(), Isis::QtExporter::writeRgb(), Isis::StreamExporter::writeRgba(), and Isis::QtExporter::writeRgba().

ProcessExport & Isis::ImageExporter::getProcess (  )  const [protected]

Get a reference to the process object, useful for subclasses to access and manipulate the process.

Returns:
A reference to the process object

Definition at line 215 of file ImageExporter.cpp.

References m_process.

Referenced by addChannel(), createWorldFile(), setInput(), Isis::StreamExporter::setType(), and write().

int Isis::ImageExporter::lines (  )  const

Number of lines (rows) in the output image.

Returns:
The height of the output

Definition at line 96 of file ImageExporter.cpp.

References m_lines.

Referenced by Isis::TiffExporter::write(), and Isis::JP2Exporter::write().

void Isis::ImageExporter::operator() ( vector< Buffer * > &  in  )  const

The method for writing a line of input image data (with potentially several bands representing color channels) to the output image.

It is called for each line of data in the input images (provides a vector containing the same line from each single-band input image). Enables the exporter to be used as a functor in a custom ProcessExport routine, bypassing the black-box write() method entirely.

Parameters:
in Vector containing a line of input data from each input channel

Definition at line 56 of file ImageExporter.cpp.

References m_writeMethod.

int Isis::ImageExporter::samples (  )  const

Number of samples (columns) in the output image.

Returns:
The width of the output

Definition at line 86 of file ImageExporter.cpp.

References m_samples.

Referenced by Isis::TiffExporter::createBuffer(), Isis::JP2Exporter::createBuffer(), Isis::TiffExporter::write(), and Isis::JP2Exporter::write().

void Isis::ImageExporter::setExtension ( QString  extension  )  [protected]

Sets the extension for the output image and generates the extension for the world file from it.

Parameters:
extension The extension for the output image

Definition at line 157 of file ImageExporter.cpp.

References m_extension, and m_world.

Referenced by Isis::JP2Exporter::JP2Exporter(), Isis::QtExporter::QtExporter(), and Isis::TiffExporter::TiffExporter().

virtual void Isis::ImageExporter::setGrayscale ( ExportDescription desc  )  [pure virtual]

Pure virtual method for setting up an export to a grayscale image.

Parameters:
desc The description describing the export parameters

Implemented in Isis::QtExporter, and Isis::StreamExporter.

Cube * Isis::ImageExporter::setInput ( ExportDescription desc  )  [protected]

Sets up the export process with the parameters described within the given description.

Opens cubes for retrieving input data, establishes the dimensions of the output image, and determines whether to write the data as grayscale, RGB, or RGBA.

Parameters:
desc The export description
Returns:
A cube pointer to the first channel created, owned by the process

Definition at line 177 of file ImageExporter.cpp.

References _FILEINFO_, addChannel(), Isis::ExportDescription::channelCount(), cube, getProcess(), Isis::Cube::lineCount(), m_bands, m_lines, m_samples, m_writeMethod, Isis::IException::Programmer, Isis::Cube::sampleCount(), Isis::ProcessExport::SetOutputNull(), Isis::ProcessExport::SetOutputRange(), writeGrayscale(), writeRgb(), and writeRgba().

Referenced by Isis::StreamExporter::initialize(), Isis::QtExporter::setGrayscale(), Isis::QtExporter::setRgb(), and Isis::QtExporter::setRgba().

void Isis::ImageExporter::setOutputRange ( double  min,
double  max 
)

Set the input DN floor and ceiling.

All input DNs less than the min will be set to the min in the output. Similarly, all input DNs greater than the max will be set to the max in the output.

Parameters:
min The minimum
max The maximum

Definition at line 145 of file ImageExporter.cpp.

References m_dataMax, and m_dataMin.

Referenced by Isis::StreamExporter::setType().

virtual void Isis::ImageExporter::setRgb ( ExportDescription desc  )  [pure virtual]

Pure virtual method for setting up an export to an RGB image.

Parameters:
desc The description describing the export parameters

Implemented in Isis::QtExporter, and Isis::StreamExporter.

virtual void Isis::ImageExporter::setRgba ( ExportDescription desc  )  [pure virtual]

Pure virtual method for setting up an export to an RGBA image.

Parameters:
desc The description describing the export parameters

Implemented in Isis::QtExporter, and Isis::StreamExporter.

void Isis::ImageExporter::write ( FileName  outputName,
int  quality = 100 
) [virtual]

Export the Isis cube channels to the given standard image.

If supported by the specific exporter child, will also produce an image with the given scaled quality. This will do a black-box export using a ProcessExport routine. After the export is completed, a world file will also be created if a map projection exists.

Parameters:
outputName The filename of the output cube
quality The quality of the output from 0 to 100, defaults to 100

Reimplemented in Isis::JP2Exporter, Isis::QtExporter, and Isis::TiffExporter.

Definition at line 71 of file ImageExporter.cpp.

References createWorldFile(), getProcess(), m_extension, and Isis::ProcessExport::SetInputRange().

virtual void Isis::ImageExporter::writeGrayscale ( vector< Buffer * > &  in  )  const [protected, pure virtual]

Pure virtual method for writing a line of grayscale data to the output image.

Parameters:
in Vector containing a single grayscale input line

Implemented in Isis::QtExporter, and Isis::StreamExporter.

Referenced by setInput().

virtual void Isis::ImageExporter::writeRgb ( vector< Buffer * > &  in  )  const [protected, pure virtual]

Pure virtual method for writing a line of RGB data to the output image.

Parameters:
in Vector containing three input lines (red, green, blue)

Implemented in Isis::QtExporter, and Isis::StreamExporter.

Referenced by setInput().

virtual void Isis::ImageExporter::writeRgba ( vector< Buffer * > &  in  )  const [protected, pure virtual]

Pure virtual method for writing a line of RGBA data to the output image.

Parameters:
in Vector containing four input lines (red, green, blue, alpha)

Implemented in Isis::QtExporter, and Isis::StreamExporter.

Referenced by setInput().


Member Data Documentation

Number of bands (channels) in the output image.

Definition at line 158 of file ImageExporter.h.

Referenced by bands(), ImageExporter(), and setInput().

Input DN ceiling, all DNs greater than this will be mapped to this.

Definition at line 164 of file ImageExporter.h.

Referenced by getPixel(), ImageExporter(), and setOutputRange().

Input DN floor, all DNs less than this will be mapped to this.

Definition at line 161 of file ImageExporter.h.

Referenced by getPixel(), ImageExporter(), and setOutputRange().

Extension to append to the output image if not already provided.

Definition at line 146 of file ImageExporter.h.

Referenced by ImageExporter(), setExtension(), and write().

Number of lines (rows) in the output image.

Definition at line 155 of file ImageExporter.h.

Referenced by ImageExporter(), lines(), and setInput().

The object that feeds lines to this instance and handles stretching.

Definition at line 140 of file ImageExporter.h.

Referenced by getInputMaximum(), getInputMinimum(), getProcess(), ImageExporter(), and ~ImageExporter().

Number of samples (columns) in the output image.

Definition at line 152 of file ImageExporter.h.

Referenced by ImageExporter(), samples(), and setInput().

QString Isis::ImageExporter::m_world [private]

Extension to append to the output world file.

Definition at line 149 of file ImageExporter.h.

Referenced by createWorldFile(), ImageExporter(), and setExtension().

Method pointer to one of the pure virtual write methods.

Definition at line 143 of file ImageExporter.h.

Referenced by ImageExporter(), operator()(), and setInput().


The documentation for this class was generated from the following files: