USGS

Isis 3.0 Object Programmers' Reference

Home

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

Exports cubes into JPEG 2000 images. More...

#include <JP2Exporter.h>

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

List of all members.

Public Member Functions

 JP2Exporter ()
 Construct the JPEG 2000 exporter.
virtual ~JP2Exporter ()
 Destruct the exporter.
virtual void write (FileName outputName, int quality=100)
 Initialize the encoder, open the output file for writing, then let the base ImageExporter handle the generic black-box writing routine.
virtual void setGrayscale (ExportDescription &desc)
 Generic initialization with the export description.
virtual void setRgb (ExportDescription &desc)
 Generic initialization with the export description.
virtual void setRgba (ExportDescription &desc)
 Generic initialization with the export description.
void setType (ExportDescription &desc)
 Set the pixel type from the description and create the buffer.
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 "jp2".
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 createBuffer ()
 Creates the buffer to store a chunk of streamed line data with one or more bands.
virtual void setBuffer (int s, int b, int dn) const
 Set the DN value at the given sample and band of the line buffer.
virtual void writeLine (int l) const
 Writes a line of buffered data to the output image on disk.
virtual void initialize (ExportDescription &desc)
 Generic initialization with the export description.
PixelType getPixelType () const
 Returns the pixel type.
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 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.

Private Attributes

JP2Encoderm_encoder
 Object responsible for writing data to the output image.
char ** m_buffer
 Two dimensional array containing all color channels for a line.

Detailed Description

Exports cubes into JPEG 2000 images.

A streamed exporter for JPEG 2000 images. Can write an arbitrarily large set of single-band Isis cubes to an arbitrarily large JPEG 2000 image with the given pixel type.

Author:
2012-04-03 Travis Addair

For internal use only.

History:
2012-04-04 Travis Addair - Added documentation.

Definition at line 47 of file JP2Exporter.h.


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.

Definition at line 103 of file ImageExporter.h.


Constructor & Destructor Documentation

Isis::JP2Exporter::JP2Exporter (  ) 

Construct the JPEG 2000 exporter.

Definition at line 16 of file JP2Exporter.cpp.

References m_buffer, m_encoder, and Isis::ImageExporter::setExtension().

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

Destruct the exporter.

Definition at line 27 of file JP2Exporter.cpp.

References m_buffer, and m_encoder.


Member Function Documentation

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

Number of bands (channels) in the output image.

Returns:
The depth of the output

Definition at line 106 of file ImageExporter.cpp.

References Isis::ImageExporter::m_bands.

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

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

Returns true if the format is "jp2".

Parameters:
format Lowercase format abbreviation
Returns:
True if "jp2", false otherwise

Definition at line 115 of file JP2Exporter.cpp.

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

void Isis::JP2Exporter::createBuffer (  )  [protected, virtual]

Creates the buffer to store a chunk of streamed line data with one or more bands.

Implements Isis::StreamExporter.

Definition at line 40 of file JP2Exporter.cpp.

References Isis::ImageExporter::bands(), Isis::StreamExporter::getPixelType(), m_buffer, mult, and Isis::ImageExporter::samples().

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

Definition at line 287 of file ImageExporter.cpp.

References _FILEINFO_, canWriteFormat(), Isis::QtExporter::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

Definition at line 132 of file ImageExporter.cpp.

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

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

Definition at line 119 of file ImageExporter.cpp.

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

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

Definition at line 228 of file ImageExporter.cpp.

References Isis::ImageExporter::m_dataMax, and Isis::ImageExporter::m_dataMin.

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

PixelType Isis::StreamExporter::getPixelType (  )  const [protected, inherited]

Returns the pixel type.

Defaults to None if not set by the user.

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

Definition at line 99 of file StreamExporter.cpp.

References Isis::StreamExporter::m_type.

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

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

Definition at line 215 of file ImageExporter.cpp.

References Isis::ImageExporter::m_process.

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

void Isis::StreamExporter::initialize ( ExportDescription desc  )  [protected, virtual, inherited]

Generic initialization with the export description.

Set the input and set the pixel type.

Parameters:
desc Export description containing necessary channel information

Definition at line 68 of file StreamExporter.cpp.

References Isis::ImageExporter::setInput(), and Isis::StreamExporter::setType().

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

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

Number of lines (rows) in the output image.

Returns:
The height of the output

Definition at line 96 of file ImageExporter.cpp.

References Isis::ImageExporter::m_lines.

Referenced by Isis::TiffExporter::write(), and 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

Definition at line 56 of file ImageExporter.cpp.

References Isis::ImageExporter::m_writeMethod.

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

Number of samples (columns) in the output image.

Returns:
The width of the output

Definition at line 86 of file ImageExporter.cpp.

References Isis::ImageExporter::m_samples.

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

void Isis::JP2Exporter::setBuffer ( int  s,
int  b,
int  dn 
) const [protected, virtual]

Set the DN value at the given sample and band of the line buffer.

Parameters:
s The sample index into the buffer
b The band index into the buffer
dn The value to set at the given index

Implements Isis::StreamExporter.

Definition at line 74 of file JP2Exporter.cpp.

References _FILEINFO_, Isis::StreamExporter::getPixelType(), m_buffer, Isis::IException::Programmer, and Isis::toString().

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

Definition at line 157 of file ImageExporter.cpp.

References Isis::ImageExporter::m_extension, and Isis::ImageExporter::m_world.

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

void Isis::StreamExporter::setGrayscale ( ExportDescription desc  )  [virtual, inherited]

Generic initialization with the export description.

Stream exporters do not do anything special to export a grayscale image beyond setting up the appropriate number of color channels.

Parameters:
desc Export description containing necessary channel information

Implements Isis::ImageExporter.

Definition at line 33 of file StreamExporter.cpp.

References Isis::StreamExporter::initialize().

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

Definition at line 177 of file ImageExporter.cpp.

References _FILEINFO_, Isis::ImageExporter::addChannel(), Isis::ExportDescription::channelCount(), cube, Isis::ImageExporter::getProcess(), Isis::Cube::lineCount(), Isis::ImageExporter::m_bands, Isis::ImageExporter::m_lines, Isis::ImageExporter::m_samples, Isis::ImageExporter::m_writeMethod, 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(), Isis::QtExporter::setGrayscale(), Isis::QtExporter::setRgb(), and Isis::QtExporter::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

Definition at line 145 of file ImageExporter.cpp.

References Isis::ImageExporter::m_dataMax, and Isis::ImageExporter::m_dataMin.

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

void Isis::StreamExporter::setRgb ( ExportDescription desc  )  [virtual, inherited]

Generic initialization with the export description.

Stream exporters do not do anything special to export an RGB image beyond setting up the appropriate number of color channels.

Parameters:
desc Export description containing necessary channel information

Implements Isis::ImageExporter.

Definition at line 45 of file StreamExporter.cpp.

References Isis::StreamExporter::initialize().

void Isis::StreamExporter::setRgba ( ExportDescription desc  )  [virtual, inherited]

Generic initialization with the export description.

Stream exporters do not do anything special to export an RGBA image beyond setting up the appropriate number of color channels.

Parameters:
desc Export description containing necessary channel information

Implements Isis::ImageExporter.

Definition at line 57 of file StreamExporter.cpp.

References Isis::StreamExporter::initialize().

void Isis::StreamExporter::setType ( ExportDescription desc  )  [inherited]
void Isis::JP2Exporter::write ( FileName  outputName,
int  quality = 100 
) [virtual]

Initialize the encoder, open the output file for writing, then let the base ImageExporter handle the generic black-box writing routine.

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

Reimplemented from Isis::ImageExporter.

Definition at line 57 of file JP2Exporter.cpp.

References Isis::ImageExporter::bands(), Isis::StreamExporter::getPixelType(), Isis::ImageExporter::lines(), m_encoder, Isis::JP2Encoder::OpenFile(), and Isis::ImageExporter::samples().

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

Write a line of grayscale data to the output image.

Parameters:
in Vector containing a single grayscale input line

Implements Isis::ImageExporter.

Definition at line 109 of file StreamExporter.cpp.

References dn, Isis::ImageExporter::getPixel(), Isis::Buffer::Line(), Isis::Buffer::SampleDimension(), Isis::StreamExporter::setBuffer(), and Isis::StreamExporter::writeLine().

void Isis::JP2Exporter::writeLine ( int  l  )  const [protected, virtual]

Writes a line of buffered data to the output image on disk.

Parameters:
l The line of the output image, unused for JPEG 2000

Implements Isis::StreamExporter.

Definition at line 99 of file JP2Exporter.cpp.

References Isis::StreamExporter::getPixelType(), m_buffer, m_encoder, and Isis::JP2Encoder::Write().

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

Write a line of RGB data to the output image.

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

Implements Isis::ImageExporter.

Definition at line 126 of file StreamExporter.cpp.

References Isis::ImageExporter::getPixel(), Isis::Buffer::Line(), Isis::Buffer::SampleDimension(), Isis::StreamExporter::setBuffer(), and Isis::StreamExporter::writeLine().

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

Write a line of RGBA data to the output image.

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

Implements Isis::ImageExporter.

Definition at line 150 of file StreamExporter.cpp.

References Isis::ImageExporter::getPixel(), Isis::Buffer::Line(), Isis::Buffer::SampleDimension(), Isis::StreamExporter::setBuffer(), and Isis::StreamExporter::writeLine().


Member Data Documentation

char** Isis::JP2Exporter::m_buffer [private]

Two dimensional array containing all color channels for a line.

Definition at line 67 of file JP2Exporter.h.

Referenced by createBuffer(), JP2Exporter(), setBuffer(), writeLine(), and ~JP2Exporter().

Object responsible for writing data to the output image.

Definition at line 64 of file JP2Exporter.h.

Referenced by JP2Exporter(), write(), writeLine(), and ~JP2Exporter().


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