Isis 3 Developer Reference
ImageImporter.h
Go to the documentation of this file.
1 #ifndef ImageImporter_h
2 #define ImageImporter_h
3 
27 namespace Isis {
28  class Buffer;
29  class Cube;
30  class CubeAttributeOutput;
31  class FileName;
32  class ImageImporter;
33  class PvlGroup;
34 
55  class ImageImporter {
56  public:
57  ImageImporter(FileName inputName);
58  virtual ~ImageImporter();
59 
60  void operator()(Buffer &out) const;
61 
62  Cube * import(FileName outputName);
63  Cube * import(FileName outputName, CubeAttributeOutput &att);
64 
65  void setNullRange(double min, double max);
66  void setLrsRange(double min, double max);
67  void setHrsRange(double min, double max);
68 
69  void setSamples(int s);
70  void setLines(int l);
71  void setBands(int b);
72 
73  int samples() const;
74  int lines() const;
75  int bands() const;
76 
77  FileName filename() const;
78 
79 
86  virtual PvlGroup convertProjection() const;
87 
93  virtual bool isGrayscale() const = 0;
94 
100  virtual bool isRgb() const = 0;
101 
107  virtual bool isArgb() const = 0;
108 
109  static ImageImporter * fromFileName(FileName inputName);
110 
111  protected:
113  typedef int (ImageImporter::*GetChannelMethod)(int pixel) const;
114 
115  Cube * createOutput(FileName outputName, CubeAttributeOutput &att);
116 
117  void setDefaultBands();
118  double testSpecial(double pixel) const;
119 
120  virtual GetChannelMethod getBandChannel(int band) const;
121  virtual int convertRgbToGray(int pixel) const;
122 
131  virtual void updateRawBuffer(int line, int band) const = 0;
132 
143  virtual int getPixel(int s, int l) const = 0;
144 
153  virtual int getGray(int pixel) const = 0;
154 
163  virtual int getRed(int pixel) const = 0;
164 
173  virtual int getGreen(int pixel) const = 0;
174 
183  virtual int getBlue(int pixel) const = 0;
184 
193  virtual int getAlpha(int pixel) const = 0;
194 
195  private:
197  FileName *m_inputName;
198 
200  Cube *m_outCube;
201 
203  int m_samples;
204 
206  int m_lines;
207 
209  int m_bands;
210 
212  double m_nullMin;
213 
215  double m_nullMax;
216 
218  double m_lrsMin;
219 
221  double m_lrsMax;
222 
224  double m_hrsMin;
225 
227  double m_hrsMax;
228  };
229 };
230 
231 
232 #endif
Buffer for reading and writing cube data.
Definition: Buffer.h:69
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:78
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:393
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:224
virtual bool isGrayscale() const =0
Pure virtual method for returning true if the image is grayscale.
virtual int getGreen(int pixel) const =0
Pure virtual method for retrieving the green 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 ...
Definition: ImageImporter.cpp:348
File name manipulation and expansion.
Definition: FileName.h:116
int samples() const
The sample dimension (width) of the output image.
Definition: ImageImporter.cpp:272
FileName filename() const
The filename of the input image this instance was constructed with.
Definition: ImageImporter.cpp:302
ImageImporter(FileName inputName)
Construct the importer.
Definition: ImageImporter.cpp:26
double testSpecial(double pixel) const
Tests a pixel against the Null, HRS, and LRS ranges defined by the importer's handler.
Definition: ImageImporter.cpp:319
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:211
int(ImageImporter::* GetChannelMethod)(int pixel) const
Friendly alias for a method used to get a particular color channel.
Definition: ImageImporter.h:113
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:186
virtual bool isRgb() const =0
Pure virtual method for returning true if the image is RGB (no alpha).
virtual int getAlpha(int pixel) const =0
Pure virtual method for retrieving the alpha component of the given pixel.
static ImageImporter * fromFileName(FileName inputName)
A static (factory) method for constructing an ImageImporter instance from an input filename...
Definition: ImageImporter.cpp:414
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:198
int lines() const
The line dimension (height) of the output image.
Definition: ImageImporter.cpp:282
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
void setSamples(int s)
Set the sample dimension (width) of the output image.
Definition: ImageImporter.cpp:235
Manipulate and parse attributes of output cube filenames.
Definition: CubeAttribute.h:489
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...
void setLines(int l)
Set the line dimension (height) of the output image.
Definition: ImageImporter.cpp:245
void setBands(int b)
Set the band dimension (depth) of the output image.
Definition: ImageImporter.cpp:257
virtual ~ImageImporter()
Destruct the importer.
Definition: ImageImporter.cpp:45
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...
Cube * createOutput(FileName outputName, CubeAttributeOutput &att)
Create the output cube from the given filename and attributes.
Definition: ImageImporter.cpp:173
virtual bool isArgb() const =0
Pure virtual method for returning true if the image is RGBA.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Imports images with standard formats into Isis as cubes.
Definition: ImageImporter.h:55
virtual int getRed(int pixel) const =0
Pure virtual method for retrieving the red component of the given pixel.
virtual int getGray(int pixel) const =0
Pure virtual method for retrieving the gray component of the given pixel.
int bands() const
The band dimension (depth) of the output image.
Definition: ImageImporter.cpp:292
virtual PvlGroup convertProjection() const
Pure virtual method for converting projection information in the file being imported to an ISIS Mappi...
Definition: ImageImporter.cpp:60
virtual int getBlue(int pixel) const =0
Pure virtual method for retrieving the blue component of the given pixel.
IO Handler for Isis Cubes.
Definition: Cube.h:170