Isis 3 Developer Reference
|
Imports images with standard formats into Isis as cubes. More...
#include <ImageImporter.h>
Public Member Functions | |
ImageImporter (FileName inputName) | |
Construct the importer. More... | |
virtual | ~ImageImporter () |
Destruct the importer. More... | |
void | operator() (Buffer &out) const |
The method for processing the output cube in place, called for each line of the output image. More... | |
Cube * | import (FileName outputName) |
Import the image with default output attributes. More... | |
Cube * | import (FileName outputName, CubeAttributeOutput &att) |
Import the input image this instance was constructed with into the given output Isis cube with the given output attributes. More... | |
void | setNullRange (double min, double max) |
Set the range of DN values within which a pixel from the input image will be set to Null in the output. More... | |
void | setLrsRange (double min, double max) |
Set the range of DN values within which a pixel from the input image will be set to LRS in the output. More... | |
void | setHrsRange (double min, double max) |
Set the range of DN values within which a pixel from the input image will be set to HRS in the output. More... | |
void | setSamples (int s) |
Set the sample dimension (width) of the output image. More... | |
void | setLines (int l) |
Set the line dimension (height) of the output image. More... | |
void | setBands (int b) |
Set the band dimension (depth) of the output image. More... | |
int | samples () const |
The sample dimension (width) of the output image. More... | |
int | lines () const |
The line dimension (height) of the output image. More... | |
int | bands () const |
The band dimension (depth) of the output image. More... | |
FileName | filename () const |
The filename of the input image this instance was constructed with. More... | |
virtual PvlGroup | convertProjection () const |
Pure virtual method for converting projection information in the file being imported to an ISIS Mapping group. More... | |
virtual bool | isGrayscale () const =0 |
Pure virtual method for returning true if the image is grayscale. More... | |
virtual bool | isRgb () const =0 |
Pure virtual method for returning true if the image is RGB (no alpha). More... | |
virtual bool | isArgb () const =0 |
Pure virtual method for returning true if the image is RGBA. More... | |
Static Public Member Functions | |
static ImageImporter * | fromFileName (FileName inputName) |
A static (factory) method for constructing an ImageImporter instance from an input filename. More... | |
Protected Types | |
typedef int(ImageImporter::* | GetChannelMethod) (int pixel) const |
Friendly alias for a method used to get a particular color channel. More... | |
Protected Member Functions | |
Cube * | createOutput (FileName outputName, CubeAttributeOutput &att) |
Create the output cube from the given filename and attributes. More... | |
void | setDefaultBands () |
Set the number of bands to be created for the output cube based on the number of color channels in the input image. More... | |
double | testSpecial (double pixel) const |
Tests a pixel against the Null, HRS, and LRS ranges defined by the importer's handler. More... | |
virtual GetChannelMethod | getBandChannel (int band) const |
Retrieve the method responsible for fetching the color channel from the input image corresponding to the current band out of output being filled. More... | |
virtual int | convertRgbToGray (int pixel) const |
Convert the current pixel, taken from an RGB/A image, and blend its RGB components into a single grayscale DN. More... | |
virtual void | updateRawBuffer (int line, int band) const =0 |
Pure virtual method that updates the buffer used to store chunks of the input data at a time. More... | |
virtual int | getPixel (int s, int l) const =0 |
Pure virtual method that returns a representation of a pixel for the input format that can then be broken down into specific gray or RGB/A components. More... | |
virtual int | getGray (int pixel) const =0 |
Pure virtual method for retrieving the gray component of the given pixel. More... | |
virtual int | getRed (int pixel) const =0 |
Pure virtual method for retrieving the red component of the given pixel. More... | |
virtual int | getGreen (int pixel) const =0 |
Pure virtual method for retrieving the green component of the given pixel. More... | |
virtual int | getBlue (int pixel) const =0 |
Pure virtual method for retrieving the blue component of the given pixel. More... | |
virtual int | getAlpha (int pixel) const =0 |
Pure virtual method for retrieving the alpha component of the given pixel. More... | |
Imports images with standard formats into Isis as cubes.
Abstract base class for a series of image importers. Each importer handles a specialized suite of standard image formats, and can be used as a black-box with the import() method, or for finer control, the importer can act as a functor in a ProcessByLine routine.
|
protected |
Friendly alias for a method used to get a particular color channel.
Isis::ImageImporter::ImageImporter | ( | FileName | inputName | ) |
Construct the importer.
inputName | The name of the input image |
|
virtual |
Destruct the importer.
Also deletes the output cube handle.
int Isis::ImageImporter::bands | ( | ) | const |
The band dimension (depth) of the output image.
Referenced by createOutput(), getBandChannel(), import(), and Isis::JP2Importer::JP2Importer().
|
virtual |
Pure virtual method for converting projection information in the file being imported to an ISIS Mapping group.
Reimplemented in Isis::TiffImporter.
Referenced by import().
|
protectedvirtual |
Convert the current pixel, taken from an RGB/A image, and blend its RGB components into a single grayscale DN.
The three color components are weighted by the following formula:
gray = (red * 11 + green * 16 + blue * 5) / 32
This formula was taken from the Qt documentation on converting an RGB value to grayscale: http://qt-project.org/doc/qt-4.8/qcolor.html#qGray-2
pixel | The pixel value to be broken up into RGB components and converted to grayscale |
References getBlue(), getGreen(), and getRed().
Referenced by Isis::JP2Importer::getGray(), and Isis::TiffImporter::getGray().
|
protected |
Create the output cube from the given filename and attributes.
Set its dimensions based on those encapsulated by the importer.
outputName | The filename of the output cube |
att | The attributes for writing the output cube |
References bands(), Isis::Cube::create(), Isis::FileName::expanded(), lines(), samples(), and Isis::Cube::setDimensions().
Referenced by import().
FileName Isis::ImageImporter::filename | ( | ) | const |
The filename of the input image this instance was constructed with.
Referenced by Isis::JP2Importer::JP2Importer().
|
static |
A static (factory) method for constructing an ImageImporter instance from an input filename.
The specific subclass of the returned instance is determined from the interpreted image format of the input image. Such tests are done by reading a minimal amount of the input data necessary to determine the format. It is the caller's responsibility to delete the importer instance when they are finished with it. Note that deleting the importer will also delete the cube handle returned by the import() method.
inputName | The filename of the input image to be imported |
References _FILEINFO_, Isis::FileName::expanded(), Isis::JP2Decoder::IsJP2(), and Isis::IException::Programmer.
|
protectedpure virtual |
Pure virtual method for retrieving the alpha component of the given pixel.
pixel | Representation of a pixel for the input format |
Implemented in Isis::TiffImporter, Isis::QtImporter, and Isis::JP2Importer.
Referenced by getBandChannel().
|
protectedvirtual |
Retrieve the method responsible for fetching the color channel from the input image corresponding to the current band out of output being filled.
This will always be the getGray() method for single band output images. For RGB/A images, band 1 will be red, band 2 green, band 3 blue, and band 4 alpha.
band | The current band of the output image |
References _FILEINFO_, bands(), getAlpha(), getBlue(), getGray(), getGreen(), getRed(), and Isis::IException::Programmer.
Referenced by operator()().
|
protectedpure virtual |
Pure virtual method for retrieving the blue component of the given pixel.
pixel | Representation of a pixel for the input format |
Implemented in Isis::TiffImporter, Isis::QtImporter, and Isis::JP2Importer.
Referenced by convertRgbToGray(), and getBandChannel().
|
protectedpure virtual |
Pure virtual method for retrieving the gray component of the given pixel.
pixel | Representation of a pixel for the input format |
Implemented in Isis::TiffImporter, Isis::QtImporter, and Isis::JP2Importer.
Referenced by getBandChannel().
|
protectedpure virtual |
Pure virtual method for retrieving the green component of the given pixel.
pixel | Representation of a pixel for the input format |
Implemented in Isis::TiffImporter, Isis::QtImporter, and Isis::JP2Importer.
Referenced by convertRgbToGray(), and getBandChannel().
|
protectedpure virtual |
Pure virtual method that returns a representation of a pixel for the input format that can then be broken down into specific gray or RGB/A components.
s | The sample of the desired pixel |
l | The line of the desired pixel |
Implemented in Isis::TiffImporter, Isis::QtImporter, and Isis::JP2Importer.
Referenced by operator()().
|
protectedpure virtual |
Pure virtual method for retrieving the red component of the given pixel.
pixel | Representation of a pixel for the input format |
Implemented in Isis::TiffImporter, Isis::QtImporter, and Isis::JP2Importer.
Referenced by convertRgbToGray(), and getBandChannel().
Import the image with default output attributes.
outputName | The filename of the output cube |
Cube * Isis::ImageImporter::import | ( | FileName | outputName, |
CubeAttributeOutput & | att | ||
) |
Import the input image this instance was constructed with into the given output Isis cube with the given output attributes.
This will do a black-box import using a ProcessByLine routine. The BandBin group will be updated in the output cube with the names of the color channels included. The output cube will be returned on completion of the import process so the caller can continue to modify the labels. The importer instance will retain ownership of this cube, such that the cube handle will be deallocated upon destruction of the importer.
outputName | The filename of the output cube |
att | The attributes for writing the output cube |
References _FILEINFO_, Isis::PvlObject::addGroup(), bands(), Isis::ProcessByBrick::BandsFirst, convertProjection(), createOutput(), Isis::ProcessByBrick::EndProcess(), Isis::PvlObject::findObject(), Isis::PvlContainer::keywords(), Isis::Cube::label(), Isis::ProcessByLine::ProcessCubeInPlace(), Isis::IException::Programmer, Isis::ProcessByLine::SetInputCube(), Isis::ProcessByBrick::SetProcessingDirection(), and Isis::Process::WriteHistory().
|
pure virtual |
Pure virtual method for returning true if the image is RGBA.
Implemented in Isis::TiffImporter, Isis::QtImporter, and Isis::JP2Importer.
Referenced by setDefaultBands().
|
pure virtual |
Pure virtual method for returning true if the image is grayscale.
Implemented in Isis::TiffImporter, Isis::QtImporter, and Isis::JP2Importer.
Referenced by setDefaultBands().
|
pure virtual |
Pure virtual method for returning true if the image is RGB (no alpha).
Implemented in Isis::TiffImporter, Isis::QtImporter, and Isis::JP2Importer.
int Isis::ImageImporter::lines | ( | ) | const |
The line dimension (height) of the output image.
Referenced by createOutput(), Isis::TiffImporter::getPixel(), and Isis::TiffImporter::TiffImporter().
void Isis::ImageImporter::operator() | ( | Buffer & | out | ) | const |
The method for processing the output cube in place, called for each line of the output image.
Enables the importer to be used as a functor in a custom ProcessByLine routine, bypassing the black-box import() method entirely. Care should be taken, however, to observe the requirements placed on the structure of such a processing routine by this method. For example, the JP2Importer child requires that the processing proceed in the direction of bands before lines, because its input data is structured in a BIL (band interlaced by line) format.
out | A reference to a line of output data to be written to |
References Isis::Buffer::Band(), getBandChannel(), getPixel(), Isis::Buffer::Line(), Isis::Buffer::SampleDimension(), testSpecial(), and updateRawBuffer().
int Isis::ImageImporter::samples | ( | ) | const |
The sample dimension (width) of the output image.
Referenced by createOutput(), Isis::TiffImporter::getPixel(), Isis::JP2Importer::JP2Importer(), and Isis::TiffImporter::TiffImporter().
void Isis::ImageImporter::setBands | ( | int | b | ) |
Set the band dimension (depth) of the output image.
Because this importer only works on Grayscale, RGB, and RGBA images, possible values are 1, 3, and 4 for the respective color modes.
b | The new band dimension |
References _FILEINFO_, and Isis::IException::Programmer.
Referenced by Isis::JP2Importer::JP2Importer(), and setDefaultBands().
|
protected |
Set the number of bands to be created for the output cube based on the number of color channels in the input image.
References isArgb(), isGrayscale(), and setBands().
Referenced by Isis::QtImporter::QtImporter(), and Isis::TiffImporter::TiffImporter().
void Isis::ImageImporter::setHrsRange | ( | double | min, |
double | max | ||
) |
Set the range of DN values within which a pixel from the input image will be set to HRS in the output.
min | Any DN less than this value will not be set to HRS. |
max | Any DN greater than this value will not be set to HRS. |
void Isis::ImageImporter::setLines | ( | int | l | ) |
Set the line dimension (height) of the output image.
l | The new line dimension |
Referenced by Isis::JP2Importer::JP2Importer(), Isis::QtImporter::QtImporter(), and Isis::TiffImporter::TiffImporter().
void Isis::ImageImporter::setLrsRange | ( | double | min, |
double | max | ||
) |
Set the range of DN values within which a pixel from the input image will be set to LRS in the output.
min | Any DN less than this value will not be set to LRS. |
max | Any DN greater than this value will not be set to LRS. |
void Isis::ImageImporter::setNullRange | ( | double | min, |
double | max | ||
) |
Set the range of DN values within which a pixel from the input image will be set to Null in the output.
min | Any DN less than this value will not be set to Null. |
max | Any DN greater than this value will not be set to Null. |
void Isis::ImageImporter::setSamples | ( | int | s | ) |
Set the sample dimension (width) of the output image.
s | The new sample dimension |
Referenced by Isis::JP2Importer::JP2Importer(), Isis::QtImporter::QtImporter(), and Isis::TiffImporter::TiffImporter().
|
protected |
Tests a pixel against the Null, HRS, and LRS ranges defined by the importer's handler.
Any pixel value falling within one of these ranges will be converted into the given type of special pixel. In case of overlapping ranges, these tests will be performed in the order mentioned at the start of this description. By default, these ranges are set such that all incoming pixels will retain their original values.
pixel | The DN value to be tested |
References Isis::HIGH_REPR_SAT8, Isis::LOW_REPR_SAT8, and Isis::NULL8.
Referenced by operator()().
|
protectedpure virtual |
Pure virtual method that updates the buffer used to store chunks of the input data at a time.
Does nothing for classes that read the entire input image into memory.
line | Current line of the output buffer |
band | Current band of the output buffer |
Implemented in Isis::TiffImporter, Isis::QtImporter, and Isis::JP2Importer.
Referenced by operator()().