Isis Developer Reference
ImageImporter.h
Go to the documentation of this file.
1 #ifndef ImageImporter_h
2 #define ImageImporter_h
3 
9 /* SPDX-License-Identifier: CC0-1.0 */
10 
11 namespace Isis {
12  class Buffer;
13  class Cube;
14  class CubeAttributeOutput;
15  class FileName;
16  class ImageImporter;
17  class PvlGroup;
18 
39  class ImageImporter {
40  public:
41  ImageImporter(FileName inputName);
42  virtual ~ImageImporter();
43 
44  void operator()(Buffer &out) const;
45 
46  Cube * import(FileName outputName);
47  Cube * import(FileName outputName, CubeAttributeOutput &att);
48 
49  void setNullRange(double min, double max);
50  void setLrsRange(double min, double max);
51  void setHrsRange(double min, double max);
52 
53  void setSamples(int s);
54  void setLines(int l);
55  void setBands(int b);
56 
57  int samples() const;
58  int lines() const;
59  int bands() const;
60 
61  FileName filename() const;
62 
63 
70  virtual PvlGroup convertProjection() const;
71 
77  virtual bool isGrayscale() const = 0;
78 
84  virtual bool isRgb() const = 0;
85 
91  virtual bool isArgb() const = 0;
92 
93  static ImageImporter * fromFileName(FileName inputName);
94 
95  protected:
97  typedef int (ImageImporter::*GetChannelMethod)(int pixel) const;
98 
99  Cube * createOutput(FileName outputName, CubeAttributeOutput &att);
100 
101  void setDefaultBands();
102  double testSpecial(double pixel) const;
103 
104  virtual GetChannelMethod getBandChannel(int band) const;
105  virtual int convertRgbToGray(int pixel) const;
106 
115  virtual void updateRawBuffer(int line, int band) const = 0;
116 
127  virtual int getPixel(int s, int l) const = 0;
128 
137  virtual int getGray(int pixel) const = 0;
138 
147  virtual int getRed(int pixel) const = 0;
148 
157  virtual int getGreen(int pixel) const = 0;
158 
167  virtual int getBlue(int pixel) const = 0;
168 
177  virtual int getAlpha(int pixel) const = 0;
178 
179  private:
181  FileName *m_inputName;
182 
184  Cube *m_outCube;
185 
187  int m_samples;
188 
190  int m_lines;
191 
193  int m_bands;
194 
196  double m_nullMin;
197 
199  double m_nullMax;
200 
202  double m_lrsMin;
203 
205  double m_lrsMax;
206 
208  double m_hrsMin;
209 
211  double m_hrsMax;
212  };
213 };
214 
215 
216 #endif
FileName.h
Isis::Buffer::SampleDimension
int SampleDimension() const
Returns the number of samples in the shape buffer.
Definition: Buffer.h:70
Isis::ImageImporter::convertRgbToGray
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...
Definition: ImageImporter.cpp:399
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
Isis::ImageImporter::getPixel
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 br...
Isis::ImageImporter::setSamples
void setSamples(int s)
Set the sample dimension (width) of the output image.
Definition: ImageImporter.cpp:241
Isis::PvlKeyword
A single keyword-value pair.
Definition: PvlKeyword.h:82
Isis::ImageImporter::GetChannelMethod
int(ImageImporter::* GetChannelMethod)(int pixel) const
Friendly alias for a method used to get a particular color channel.
Definition: ImageImporter.h:97
Isis::ImageImporter::isRgb
virtual bool isRgb() const =0
Pure virtual method for returning true if the image is RGB (no alpha).
Isis::Process::WriteHistory
void WriteHistory(Cube &cube)
Writes out the History blob to the cube.
Definition: Process.cpp:789
Isis::ImageImporter::setLrsRange
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...
Definition: ImageImporter.cpp:217
SpecialPixel.h
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
PvlGroup.h
Isis::ImageImporter::isArgb
virtual bool isArgb() const =0
Pure virtual method for returning true if the image is RGBA.
Isis::ImageImporter::getGreen
virtual int getGreen(int pixel) const =0
Pure virtual method for retrieving the green component of the given pixel.
Isis::ImageImporter::updateRawBuffer
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.
Isis::ImageImporter::setNullRange
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...
Definition: ImageImporter.cpp:204
Isis::JP2Importer
Imports JPEG 2000 images as Isis cubes.
Definition: JP2Importer.h:30
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::CubeAttributeOutput
Manipulate and parse attributes of output cube filenames.
Definition: CubeAttribute.h:473
Isis::ImageImporter
Imports images with standard formats into Isis as cubes.
Definition: ImageImporter.h:39
Isis::HIGH_REPR_SAT8
const double HIGH_REPR_SAT8
Definition: SpecialPixel.h:116
QtImporter.h
Isis::ProcessByLine
Process cubes by line.
Definition: ProcessByLine.h:97
Isis::ImageImporter::getBlue
virtual int getBlue(int pixel) const =0
Pure virtual method for retrieving the blue component of the given pixel.
Isis::Buffer
Buffer for reading and writing cube data.
Definition: Buffer.h:53
Isis::ImageImporter::bands
int bands() const
The band dimension (depth) of the output image.
Definition: ImageImporter.cpp:298
Isis::ProcessByLine::ProcessCubeInPlace
void ProcessCubeInPlace(const Functor &funct, bool threaded=true)
Same functionality as StartProcess(void funct(Isis::Buffer &inout)) using Functors.
Definition: ProcessByLine.h:133
Buffer.h
Isis::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
Isis::ImageImporter::setDefaultBands
void setDefaultBands()
Set the number of bands to be created for the output cube based on the number of color channels in th...
Definition: ImageImporter.cpp:192
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::Cube::setDimensions
void setDimensions(int ns, int nl, int nb)
Used prior to the Create method to specify the size of the cube.
Definition: Cube.cpp:1217
Isis::Cube::create
void create(const QString &cfile)
This method will create an isis cube for writing.
Definition: Cube.cpp:414
Isis::ImageImporter::samples
int samples() const
The sample dimension (width) of the output image.
Definition: ImageImporter.cpp:278
Isis::NULL8
const double NULL8
Definition: SpecialPixel.h:94
Isis::ImageImporter::setBands
void setBands(int b)
Set the band dimension (depth) of the output image.
Definition: ImageImporter.cpp:263
Isis::PvlObject::findObject
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:274
Isis::ImageImporter::convertProjection
virtual PvlGroup convertProjection() const
Pure virtual method for converting projection information in the file being imported to an ISIS Mappi...
Definition: ImageImporter.cpp:66
ProcessByLine.h
History.h
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::ImageImporter::getAlpha
virtual int getAlpha(int pixel) const =0
Pure virtual method for retrieving the alpha component of the given pixel.
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::ImageImporter::setLines
void setLines(int l)
Set the line dimension (height) of the output image.
Definition: ImageImporter.cpp:251
Isis::ImageImporter::operator()
void operator()(Buffer &out) const
The method for processing the output cube in place, called for each line of the output image.
Definition: ImageImporter.cpp:84
Isis::ImageImporter::~ImageImporter
virtual ~ImageImporter()
Destruct the importer.
Definition: ImageImporter.cpp:51
Isis::ImageImporter::setHrsRange
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...
Definition: ImageImporter.cpp:230
TiffImporter.h
Isis::ImageImporter::testSpecial
double testSpecial(double pixel) const
Tests a pixel against the Null, HRS, and LRS ranges defined by the importer's handler.
Definition: ImageImporter.cpp:325
Isis::PvlObject::addGroup
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
Definition: PvlObject.h:186
Isis::ImageImporter::lines
int lines() const
The line dimension (height) of the output image.
Definition: ImageImporter.cpp:288
Isis::ImageImporter::isGrayscale
virtual bool isGrayscale() const =0
Pure virtual method for returning true if the image is grayscale.
Isis::Buffer::Band
int Band(const int index=0) const
Returns the band position associated with a shape buffer index.
Definition: Buffer.cpp:162
JP2Importer.h
Isis::ProcessByBrick::BandsFirst
@ BandsFirst
Definition: ProcessByBrick.h:95
Isis::TiffImporter
Imports TIFF images as Isis cubes.
Definition: TiffImporter.h:45
Isis::ImageImporter::import
Cube * import(FileName outputName)
Import the image with default output attributes.
Definition: ImageImporter.cpp:108
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
Isis::ImageImporter::fromFileName
static ImageImporter * fromFileName(FileName inputName)
A static (factory) method for constructing an ImageImporter instance from an input filename.
Definition: ImageImporter.cpp:420
Isis::ImageImporter::filename
FileName filename() const
The filename of the input image this instance was constructed with.
Definition: ImageImporter.cpp:308
Isis::Cube::label
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1701
Isis::ImageImporter::getBandChannel
virtual GetChannelMethod getBandChannel(int band) const
Retrieve the method responsible for fetching the color channel from the input image corresponding to ...
Definition: ImageImporter.cpp:354
Isis::ProcessByBrick::SetProcessingDirection
void SetProcessingDirection(ProcessingDirection direction)
Set the direction the data will be read, either all lines in a single band proceeding to the next ban...
Definition: ProcessByBrick.cpp:380
JP2Decoder.h
Isis::ImageImporter::ImageImporter
ImageImporter(FileName inputName)
Construct the importer.
Definition: ImageImporter.cpp:32
ImageImporter.h
Isis::PvlContainer::keywords
int keywords() const
Returns the number of keywords contained in the PvlContainer.
Definition: PvlContainer.h:86
Isis::QtImporter
Imports a series of standard image formats with Qt facilities.
Definition: QtImporter.h:39
Isis::IString
Adds specific functionality to C++ strings.
Definition: IString.h:165
Isis::LOW_REPR_SAT8
const double LOW_REPR_SAT8
Definition: SpecialPixel.h:98
Isis::JP2Decoder::IsJP2
static bool IsJP2(QString filename)
Definition: JP2Decoder.cpp:228
Isis::ProcessByBrick::EndProcess
void EndProcess()
End the processing sequence and cleans up by closing cubes, freeing memory, etc.
Definition: ProcessByBrick.cpp:669
Isis::ProcessByLine::SetInputCube
Isis::Cube * SetInputCube(const QString &parameter, const int requirements=0)
Opens an input cube specified by the user and verifies requirements are met.
Definition: ProcessByLine.cpp:41
Isis::Buffer::Line
int Line(const int index=0) const
Returns the line position associated with a shape buffer index.
Definition: Buffer.cpp:145
CubeAttribute.h
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::ImageImporter::createOutput
Cube * createOutput(FileName outputName, CubeAttributeOutput &att)
Create the output cube from the given filename and attributes.
Definition: ImageImporter.cpp:179
Isis::ImageImporter::getRed
virtual int getRed(int pixel) const =0
Pure virtual method for retrieving the red component of the given pixel.
Isis::ImageImporter::getGray
virtual int getGray(int pixel) const =0
Pure virtual method for retrieving the gray component of the given pixel.