Isis 3 Developer Reference
Isis::ImageExporter Class Referenceabstract

Export Isis cubes into standard formats. More...

#include <ImageExporter.h>

Inheritance diagram for Isis::ImageExporter:
Inheritance graph
Collaboration diagram for Isis::ImageExporter:
Collaboration graph

Public Member Functions

 ImageExporter ()
 Construct the exporter. More...
 
virtual ~ImageExporter ()
 Destruct the exporter. More...
 
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. More...
 
virtual void write (FileName outputName, int quality=100, QString compression="none")
 Export the Isis cube channels to the given standard image. More...
 
int samples () const
 Number of samples (columns) in the output image. More...
 
int lines () const
 Number of lines (rows) in the output image. More...
 
int bands () const
 Number of bands (channels) in the output image. More...
 
double inputMinimum (int channel) const
 Returns the input minimum for the given channel. More...
 
double inputMaximum (int channel) const
 Returns the input maximum for the given channel. More...
 
void setOutputPixelRange (double outputPixelMinimum, double outputPixelMaximum)
 Set the DN floor and ceiling for the exported image. More...
 
virtual void setGrayscale (ExportDescription &desc)=0
 Pure virtual method for setting up an export to a grayscale image. More...
 
virtual void setRgb (ExportDescription &desc)=0
 Pure virtual method for setting up an export to an RGB image. More...
 
virtual void setRgba (ExportDescription &desc)=0
 Pure virtual method for setting up an export to an RGBA image. More...
 

Static Public Member Functions

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

Protected Types

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

Protected Member Functions

virtual void initialize (ExportDescription &desc)=0
 Generic initialization with the export description. More...
 
void setExtension (QString extension)
 Sets the extension for the output image and generates the extension for the world file from it. More...
 
void setExportDescription (ExportDescription &desc)
 Sets the description for the output image. More...
 
CubeinitializeProcess ()
 Sets up the export process with the parameters described within the given description. More...
 
QString extension () const
 Gets the extension for the output image. More...
 
ExportDescriptionexportDescription () const
 Gets the description for the output image. More...
 
ProcessExportprocess () const
 Get a reference to the process object, useful for subclasses to access and manipulate the process. More...
 
PixelType pixelType () const
 Returns the pixel type. More...
 
virtual int outputPixelValue (double dn) const
 Return the output clamped integer pixel value from the input double-precision DN. More...
 
virtual void writeGrayscale (vector< Buffer *> &in) const =0
 Pure virtual method for writing a line of grayscale data to the output image. More...
 
virtual void writeRgb (vector< Buffer *> &in) const =0
 Pure virtual method for writing a line of RGB data to the output image. More...
 
virtual void writeRgba (vector< Buffer *> &in) const =0
 Pure virtual method for writing a line of RGBA data to the output image. More...
 

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

Member Typedef Documentation

◆ WriteChannels

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

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

Constructor & Destructor Documentation

◆ ImageExporter()

Isis::ImageExporter::ImageExporter ( )

Construct the exporter.

◆ ~ImageExporter()

Isis::ImageExporter::~ImageExporter ( )
virtual

Destruct the exporter.

Also deletes the process object.

Member Function Documentation

◆ bands()

int Isis::ImageExporter::bands ( ) const

◆ exportDescription()

ExportDescription & Isis::ImageExporter::exportDescription ( ) const
protected

Gets the description for the output image.

Returns
The export description

◆ extension()

QString Isis::ImageExporter::extension ( ) const
protected

Gets the extension for the output image.

Returns
The extension for the output image

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

◆ fromFormat()

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
formatThe format for the output image to be created
Returns
A pointer to the instantiated exporter owned by the caller

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

◆ initialize()

void Isis::ImageExporter::initialize ( ExportDescription desc)
protectedpure virtual

Generic initialization with the export description.

Set the export description given the pixel type of the passed in description. Use the number of channels in the export description to determine the write method (i.e. grayscale, rgb, or rgba). This will also set the member variables for the number of samples, lines, and bands.

Parameters
descExport description containing necessary channel information

Implemented in Isis::StreamExporter.

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

◆ initializeProcess()

Cube * Isis::ImageExporter::initializeProcess ( )
protected

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

This method determines determines whether to write the data as grayscale, RGB, or RGBA. It then opens a cube for retrieving the input data and establishing the dimensions of the output image. Next, the ProcessExport format is set to BIL and the ProcessExport output pixel type, output valid data range, and output null are set based on the given export description. Last, the absolute output pixel range is set based on the given description (this is the smallest and largest allowed pixel values in the output, including "special" pixel values).

Returns
A cube pointer to the first channel created, owned by the process

References _FILEINFO_, Isis::ProcessExport::BIL, Isis::Cube::lineCount(), Isis::IException::Programmer, Isis::Cube::sampleCount(), Isis::ProcessExport::setFormat(), Isis::ProcessExport::SetOutputNull(), Isis::ProcessExport::SetOutputRange(), Isis::ProcessExport::SetOutputType(), writeGrayscale(), writeRgb(), and writeRgba().

◆ inputMaximum()

double Isis::ImageExporter::inputMaximum ( 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
channelIndex of the channel within the process
Returns
The maximum DN in the input mapped to the maximum of the output

◆ inputMinimum()

double Isis::ImageExporter::inputMinimum ( 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
channelIndex of the channel within the process
Returns
The minimum DN in the input mapped to the minimum of the output

◆ lines()

int Isis::ImageExporter::lines ( ) const

◆ operator()()

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
inVector containing a line of input data from each input channel

◆ outputPixelValue()

int Isis::ImageExporter::outputPixelValue ( double  dn) const
protectedvirtual

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

Parameters
dnThe input DN
Returns
The pixel value for the output

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

◆ pixelType()

PixelType Isis::ImageExporter::pixelType ( ) const
protected

Returns the pixel type.

Defaults to None if not set by the user.

Returns
The pixel type: {None, UnsignedByte, SignedWord, UnsignedWord}

References Isis::None.

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

◆ process()

ProcessExport & Isis::ImageExporter::process ( ) 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

◆ samples()

◆ setExportDescription()

void Isis::ImageExporter::setExportDescription ( ExportDescription desc)
protected

Sets the description for the output image.

Parameters
descThe export description

◆ setExtension()

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
extensionThe extension for the output image

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

◆ setGrayscale()

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

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

Parameters
descThe description describing the export parameters

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

◆ setOutputPixelRange()

void Isis::ImageExporter::setOutputPixelRange ( double  outputPixelMinimum,
double  outputPixelMaximum 
)

Set the DN floor and ceiling for the exported image.

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

Note: These values may be "special". For example, if Null pixels are exported to 0.0 and the minimum valid pixels are exported to 2.0, then 0.0 should be passed in for the value of the min parameter.

Parameters
minThe absolute minimum output DN value.
maxThe absolute maximum output DN value.

◆ setRgb()

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

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

Parameters
descThe description describing the export parameters

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

◆ setRgba()

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

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

Parameters
descThe description describing the export parameters

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

◆ write()

void Isis::ImageExporter::write ( FileName  outputName,
int  quality = 100,
QString  compression = "none" 
)
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. Will also use the selected compression algorithm if supported by the image format. 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
outputNameThe filename of the output cube
qualityThe quality of the output from 0 to 100, defaults to 100
compressionThe compression algorithm used. Image format specific.

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

References Isis::FileName::addExtension(), Isis::ProcessExport::HasInputRange(), Isis::ProcessExport::ProcessCubes(), and Isis::ProcessExport::SetInputRange().

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

◆ writeGrayscale()

virtual void Isis::ImageExporter::writeGrayscale ( vector< Buffer *> &  in) const
protectedpure virtual

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

Parameters
inVector containing a single grayscale input line

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

Referenced by initializeProcess().

◆ writeRgb()

virtual void Isis::ImageExporter::writeRgb ( vector< Buffer *> &  in) const
protectedpure virtual

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

Parameters
inVector containing three input lines (red, green, blue)

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

Referenced by initializeProcess().

◆ writeRgba()

virtual void Isis::ImageExporter::writeRgba ( vector< Buffer *> &  in) const
protectedpure virtual

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

Parameters
inVector containing four input lines (red, green, blue, alpha)

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

Referenced by initializeProcess().


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