USGS

Isis 3.0 Developer's Reference (API)

Home

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

Exports cubes into one of several formats with Qt facilities. More...

#include <QtExporter.h>

Inherits Isis::ImageExporter.

List of all members.

Public Member Functions

 QtExporter (QString format)
 Construct the Qt exporter.
virtual ~QtExporter ()
 Destruct the exporter.
virtual void setGrayscale (ExportDescription &desc)
 Set the input with the description generically, check the data size for a single-band image with the established dimensions, initialize the image with the Indexed8 format, and setup the color table from 0 to 256.
virtual void setRgb (ExportDescription &desc)
 Set the input with the description generically, check the data size for a three-band image with the established dimensions, and initialize the image with the RGB32 format.
virtual void setRgba (ExportDescription &desc)
 Set the input with the description generically, check the data size for a four-band image with the established dimensions, and initialize the image with the ARGB32 format.
virtual void write (FileName outputName, int quality=100)
 Let the base ImageExporter handle the generic black-box writing routine, then save the image to disk.
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.
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.

Static Public Member Functions

static bool canWriteFormat (QString format)
 Returns true if the format is supported by QImageWriter.
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

virtual void writeGrayscale (vector< Buffer * > &in) const
 Write a line of grayscale data to the output image.
virtual void writeRgb (vector< Buffer * > &in) const
 Write a line of RGB data to the output image.
virtual void writeRgba (vector< Buffer * > &in) const
 Write a line of RGBA data to the output image.
void checkDataSize (BigInt samples, BigInt lines, int bands)
 Checks that the data size for an image of the desired dimensions will be less than 2GB.
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.

Detailed Description

Exports cubes into one of several formats with Qt facilities.

Takes a series of single-banded Isis cubes and exports them into one of several possible standard image formats using Qt's QImage structure to handle reading the data into memory and setting individual pixel values. Set Qt's documentation on QImageWriter for a complete list of supported formats:

http://qt-project.org/doc/qt-4.8/qimagewriter.html#supportedImageFormats

While Qt can be used to export Isis cubes to TIFF images, it is generally recommended to use the TiffExporter class instead, which uses LibTIFF version 4 to import big TIFFs. Qt, as of version 4.8, can only import images <2GB in size.

Author:
2012-04-03 Travis Addair

Member Typedef Documentation

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

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


Constructor & Destructor Documentation

Isis::QtExporter::QtExporter ( QString  format  ) 

Construct the Qt exporter.

Parameters:
format The format to export to

References Isis::ImageExporter::setExtension().

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

Destruct the exporter.


Member Function Documentation

int Isis::ImageExporter::bands (  )  const [inherited]

Number of bands (channels) in the output image.

Returns:
The depth of the output

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

bool Isis::QtExporter::canWriteFormat ( QString  format  )  [static]

Returns true if the format is supported by QImageWriter.

Parameters:
format Lowercase format abbreviation
Returns:
True if supported in Qt, false otherwise

Referenced by Isis::ImageExporter::fromFormat().

void Isis::QtExporter::checkDataSize ( BigInt  samples,
BigInt  lines,
int  bands 
) [protected]

Checks that the data size for an image of the desired dimensions will be less than 2GB.

Parameters:
samples Number of samples in the output
lines Number of lines in the output
bands Number of bands in the output

References _FILEINFO_, size, Isis::toString(), and Isis::IException::User.

Referenced by setGrayscale(), setRgb(), and setRgba().

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

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

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

double Isis::ImageExporter::getInputMaximum ( int  channel  )  const [inherited]

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

References Isis::ProcessExport::GetInputMaximum().

double Isis::ImageExporter::getInputMinimum ( int  channel  )  const [inherited]

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

References Isis::ProcessExport::GetInputMinimum().

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

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

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

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

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

Returns:
A reference to the process object

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

int Isis::ImageExporter::lines (  )  const [inherited]

Number of lines (rows) in the output image.

Returns:
The height of the output

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

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

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
int Isis::ImageExporter::samples (  )  const [inherited]

Number of samples (columns) in the output image.

Returns:
The width of the output

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

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

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

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

void Isis::QtExporter::setGrayscale ( ExportDescription desc  )  [virtual]

Set the input with the description generically, check the data size for a single-band image with the established dimensions, initialize the image with the Indexed8 format, and setup the color table from 0 to 256.

Parameters:
desc Export description containing necessary channel information

Implements Isis::ImageExporter.

References checkDataSize(), cube, Isis::Cube::lineCount(), Isis::Cube::sampleCount(), and Isis::ImageExporter::setInput().

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

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

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

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

void Isis::ImageExporter::setOutputRange ( double  min,
double  max 
) [inherited]

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

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

void Isis::QtExporter::setRgb ( ExportDescription desc  )  [virtual]

Set the input with the description generically, check the data size for a three-band image with the established dimensions, and initialize the image with the RGB32 format.

Parameters:
desc Export description containing necessary channel information

Implements Isis::ImageExporter.

References checkDataSize(), cube, Isis::Cube::lineCount(), Isis::Cube::sampleCount(), and Isis::ImageExporter::setInput().

void Isis::QtExporter::setRgba ( ExportDescription desc  )  [virtual]

Set the input with the description generically, check the data size for a four-band image with the established dimensions, and initialize the image with the ARGB32 format.

Parameters:
desc Export description containing necessary channel information

Implements Isis::ImageExporter.

References checkDataSize(), cube, Isis::Cube::lineCount(), Isis::Cube::sampleCount(), and Isis::ImageExporter::setInput().

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

Let the base ImageExporter handle the generic black-box writing routine, then save the image to disk.

Parameters:
outputName The filename of the output cube
quality The quality of the output, not used for TIFF

Reimplemented from Isis::ImageExporter.

References _FILEINFO_, Isis::FileName::expanded(), and Isis::IException::Programmer.

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

Write a line of grayscale data to the output image.

Parameters:
in Vector containing a single grayscale input line

Implements Isis::ImageExporter.

References _FILEINFO_, dn, Isis::ImageExporter::getPixel(), Isis::Buffer::Line(), Isis::Buffer::SampleDimension(), and Isis::IException::User.

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

Write a line of RGB data to the output image.

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

Implements Isis::ImageExporter.

References Isis::ImageExporter::getPixel(), Isis::Buffer::Line(), line, and Isis::Buffer::SampleDimension().

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

Write a line of RGBA data to the output image.

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

Implements Isis::ImageExporter.

References Isis::ImageExporter::getPixel(), Isis::Buffer::Line(), line, and Isis::Buffer::SampleDimension().


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