3 #include <QImageReader>
30 m_inputName =
new FileName(inputName);
81 GetChannelMethod getChannel = getBandChannel(out.
Band());
85 updateRawBuffer(out.
Line(), out.
Band());
90 int l = out.
Line() - 1;
92 out[s] = testSpecial((this->*getChannel)(getPixel(s, l)));
104 return import(outputName, att);
125 Cube *cube = createOutput(outputName, att);
134 else if (bands() == 3 || bands() == 4) {
138 if (bands() == 4) name +=
"Alpha";
142 "Cannot interpret BandBin for [" +
IString(bands()) +
"] band image",
149 PvlGroup mapping = convertProjection();
177 m_outCube->create(outputName.expanded(), att);
187 setBands((isGrayscale()) ? 1 : (isArgb()) ? 4 : 3);
260 "Cannot create an image with [" +
IString(b) +
"] bands",
320 if (pixel <= m_nullMax && pixel >= m_nullMin) {
323 else if (pixel <= m_hrsMax && pixel >= m_hrsMin) {
324 return Isis::HIGH_REPR_SAT8;
326 else if (pixel <= m_lrsMax && pixel >= m_lrsMin) {
327 return Isis::LOW_REPR_SAT8;
350 GetChannelMethod getChannel;
370 "Cannot determine channel for band [" +
IString(band) +
"]",
394 int red = getRed(pixel);
395 int green = getBlue(pixel);
396 int blue = getGreen(pixel);
397 return (red * 11 + green * 16 + blue * 5) / 32;
417 QString format = QImageReader::imageFormat(inputName.expanded());
418 if (format ==
"tiff") {
421 else if (format !=
"" && format !=
"jp2") {
424 else if (JP2Decoder::IsJP2(inputName.expanded().toLatin1().data())) {
429 "Cannot determine image format for [" + inputName.expanded() +
"]",
Buffer for reading and writing cube data.
int Line(const int index=0) const
Returns the line position associated with a shape buffer index.
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...
void ProcessCubeInPlace(const Functor &funct, bool threaded=true)
Same functionality as StartProcess(void funct(Isis::Buffer &inout)) using Functors.
void EndProcess()
End the processing sequence and cleans up by closing cubes, freeing memory, etc.
double testSpecial(double pixel) const
Tests a pixel against the Null, HRS, and LRS ranges defined by the importer's handler.
Isis::Cube * SetInputCube(const QString ¶meter, const int requirements=0)
Opens an input cube specified by the user and verifies requirements are met.
virtual int getGreen(int pixel) const =0
Pure virtual method for retrieving the green component of the given pixel.
File name manipulation and expansion.
ImageImporter(FileName inputName)
Construct the importer.
virtual int convertRgbToGray(int pixel) const
Convert the current pixel, taken from an RGB/A image, and blend its RGB components into a single gray...
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...
void setDefaultBands()
Set the number of bands to be created for the output cube based on the number of color channels in th...
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
void WriteHistory(Cube &cube)
Writes out the History blob to the cube.
int keywords() const
Returns the number of keywords contained in the PvlContainer.
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
virtual int getAlpha(int pixel) const =0
Pure virtual method for retrieving the alpha component of the given pixel.
Imports TIFF images as Isis cubes.
static ImageImporter * fromFileName(FileName inputName)
A static (factory) method for constructing an ImageImporter instance from an input filename...
Imports JPEG 2000 images as Isis cubes.
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 outpu...
This error is for when a programmer made an API call that was illegal.
void setDimensions(int ns, int nl, int nb)
Used prior to the Create method to specify the size of the cube.
FileName filename() const
The filename of the input image this instance was constructed with.
virtual PvlGroup convertProjection() const
Pure virtual method for converting projection information in the file being imported to an ISIS Mappi...
Cube * import(FileName outputName)
Import the image with default output attributes.
int samples() const
The sample dimension (width) of the output image.
int Band(const int index=0) const
Returns the band position associated with a shape buffer index.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
int lines() const
The line dimension (height) of the output image.
void setSamples(int s)
Set the sample dimension (width) of the output image.
Manipulate and parse attributes of output cube filenames.
A single keyword-value pair.
void setLines(int l)
Set the line dimension (height) of the output image.
void setBands(int b)
Set the band dimension (depth) of the output image.
virtual ~ImageImporter()
Destruct the importer.
int bands() const
The band dimension (depth) of the output image.
Container for cube-like labels.
Cube * createOutput(FileName outputName, CubeAttributeOutput &att)
Create the output cube from the given filename and attributes.
Imports a series of standard image formats with Qt facilities.
void operator()(Buffer &out) const
The method for processing the output cube in place, called for each line of the output image...
void SetProcessingDirection(ProcessingDirection direction)
Set the direction the data will be read, either all lines in a single band proceeding to the next ban...
int(ImageImporter::* GetChannelMethod)(int pixel) const
Friendly alias for a method used to get a particular color channel.
Adds specific functionality to C++ strings.
Imports images with standard formats into Isis as cubes.
Contains Pvl Groups and Pvl Objects.
virtual int getRed(int pixel) const =0
Pure virtual method for retrieving the red component of the given pixel.
virtual GetChannelMethod getBandChannel(int band) const
Retrieve the method responsible for fetching the color channel from the input image corresponding to ...
virtual int getGray(int pixel) const =0
Pure virtual method for retrieving the gray component of the given pixel.
int SampleDimension() const
Returns the number of samples in the shape buffer.
virtual int getBlue(int pixel) const =0
Pure virtual method for retrieving the blue component of the given pixel.
IO Handler for Isis Cubes.