Isis 3 Developer Reference
ProcessImport.h
Go to the documentation of this file.
1 #ifndef ProcessImport_h
2 #define ProcessImport_h
3 
25 #include <string>
26 
27 #include "Buffer.h"
28 #include "CubeAttribute.h"
29 #include "EndianSwapper.h"
30 #include "JP2Decoder.h"
31 #include "PixelType.h"
32 #include "Process.h"
34 #include "SpecialPixel.h"
35 
36 namespace Isis {
170  class ProcessImport : public Isis::Process {
171  public:
172  enum VAXDataType {
175  };
176 
177 
185  };
186 
187  ProcessImport();
188  virtual ~ProcessImport();
189 
190  using Isis::Process::StartProcess; // make parent functions visable
191  virtual void StartProcess();
192  virtual void StartProcess(void funct(Isis::Buffer &out));
193  void SetInputFile(const QString &file);
194  QString InputFile();
195 
196  // SetOutputCube() is not virtual in the Process class, so the following
197  // definitions for this method are the only ones that are allowed for
198  // ProcessImport objects and child objects
199 
200  using Isis::Process::SetOutputCube; // make parent functions visable
201  Isis::Cube *SetOutputCube(const QString &parameter);
202  virtual Isis::Cube *SetOutputCube(const QString &fname,
204 
205  void SetPixelType(const Isis::PixelType type);
211  return p_pixelType;
212  }
213 
214 
215  void SetDimensions(const int ns, const int nl, const int nb);
216 
221  int Samples() {
222  return p_ns;
223  }
224 
225 
230  int Lines() {
231  return p_nl;
232  }
233 
234 
239  int Bands() {
240  return p_nb;
241  }
242 
243 
244  void SetByteOrder(const Isis::ByteOrder order);
245 
251  return p_byteOrder;
252  }
253 
254  bool IsVAXSpecial(unsigned int *vax, VAXSpecialPixel pix);
255  double VAXConversion(void *ibuf);
256  void SetSuffixOffset(int samples,int lines, int coreBands, int itemBytes);
257  void SetSuffixPixelType(const Isis::PixelType type);
258  void SetVAXConvert(const bool vax_convert);
259 
260  void SetFileHeaderBytes(const int bytes);
261  void SetFileTrailerBytes(const int bytes);
262  void SetDataHeaderBytes(const int bytes);
263  void SetDataTrailerBytes(const int bytes);
264  void SetDataPrefixBytes(const int bytes);
265  void SetDataSuffixBytes(const int bytes);
266  void SaveFileHeader();
267  void SaveFileTrailer();
268  void SaveDataHeader();
269  void SaveDataTrailer();
270  void SaveDataPrefix();
271  void SaveDataSuffix();
272 
273  int FileHeaderBytes() const;
274  int FileTrailerBytes() const;
275  int DataHeaderBytes() const;
276  int DataTrailerBytes() const;
277  int DataPrefixBytes() const;
278  int DataSuffixBytes() const;
279 
280  char *FileHeader();
281  char *FileTrailer();
282  std::vector<char *> DataHeader();
283  std::vector<char *> DataTrailer();
284  std::vector<std::vector<char *> > DataPrefix();
285  std::vector<std::vector<char *> > DataSuffix();
286 
291  enum Interleave {
293  JP2,
294  BSQ,
297  BIL,
305  };
306 
307 
309  Interleave Organization() const;
310 
311  void SetBase(const double base);
312  void SetMultiplier(const double mult);
313  void SetBase(const std::vector<double> base);
314  void SetMultiplier(const std::vector<double> mult);
315 
316  void SetSpecialValues(const double null, const double lrs,
317  const double lis, const double hrs,
318  const double his);
319  void SetNull(const double null_min, const double null_max);
320  void SetLRS(const double lrs_min, const double lrs_max);
321  void SetLIS(const double lis_min, const double lis_max);
322  void SetHRS(const double hrs_min, const double hrs_max);
323  void SetHIS(const double his_min, const double his_max);
324 
325  double TestPixel(const double pixel);
326 
327  void ProcessBsq(void funct(Isis::Buffer &out) = NULL);
328  void ProcessBil(void funct(Isis::Buffer &out) = NULL);
329  void ProcessBip(void funct(Isis::Buffer &out) = NULL);
330  void ProcessJp2(void funct(Isis::Buffer &out) = NULL);
331 
332  void CheckPixelRange(QString pixelName, double min, double max);
333 
334 #if 0
335  void AddImportLabel(Isis::Pvl &importLab);
336  void AddLabel(Isis::Pvl &label);
337 #endif
338 
339 
340  private:
341  QString p_inFile;
342  Isis::PixelType p_pixelType;
343 
344  Isis::PixelType p_suffixPixelType;
345  int p_ns;
346  int p_nl;
347  int p_nb;
348  Isis::ByteOrder p_byteOrder;
349 
350  int p_suffixData;
354  int p_fileHeaderBytes;
358  int p_fileTrailerBytes;
362  int p_dataHeaderBytes;
366  int p_dataTrailerBytes;
370  int p_dataPreBytes;
373  int p_dataPostBytes;
376  bool p_saveFileHeader;
378  bool p_saveDataHeader;
380  bool p_saveDataTrailer;
382  bool p_saveDataPre;
384  bool p_saveDataPost;
386  bool p_saveFileTrailer;
388  char *p_fileHeader;
389  std::vector<char *>p_dataHeader;
390  std::vector<char *>p_dataTrailer;
391  std::vector<std::vector<char *> >p_dataPre;
392  std::vector<std::vector<char *> >p_dataPost;
393  char *p_fileTrailer;
394 
395  bool p_vax_convert;
396 
397  ProcessImport::Interleave p_organization;
404  std::vector<double> p_base;
408  std::vector<double> p_mult;
413  double p_null_min;
417  double p_null_max;
421  double p_hrs_min;
425  double p_hrs_max;
429  double p_his_min;
433  double p_his_max;
437  double p_lrs_min;
441  double p_lrs_max;
445  double p_lis_min;
449  double p_lis_max;
452  };
453 };
454 #endif
Buffer for reading and writing cube data.
Definition: Buffer.h:69
VAXDataType
Definition: ProcessImport.h:172
void SaveDataTrailer()
This method marks the data block trailers to be saved.
Definition: ProcessImport.cpp:631
double TestPixel(const double pixel)
Tests the pixel.
Definition: ProcessImport.cpp:1181
virtual ~ProcessImport()
Destroys the Import object.
Definition: ProcessImport.cpp:92
void SetFileTrailerBytes(const int bytes)
This method sets the number of bytes in the trailer of a file.
Definition: ProcessImport.cpp:393
Definition: ProcessImport.h:180
int DataSuffixBytes() const
This method returns the number of data duffix bytes.
Definition: ProcessImport.cpp:743
int Bands()
Returns the number of bands.
Definition: ProcessImport.h:239
void SetDataHeaderBytes(const int bytes)
This method sets the number of bytes in the header of each datablock of a file.
Definition: ProcessImport.cpp:422
ByteOrder
Tests the current architecture for byte order.
Definition: Endian.h:59
int Samples()
Returns the number of samples.
Definition: ProcessImport.h:221
void ProcessBip(void funct(Isis::Buffer &out)=NULL)
Function to process files stored as Band Interleaved by Pixel.
Definition: ProcessImport.cpp:1860
std::vector< char * > DataHeader()
This method returns a pointer to the data header.
Definition: ProcessImport.cpp:821
void SetDataPrefixBytes(const int bytes)
This method sets the number of bytes at the beginning of each data record of a file.
Definition: ProcessImport.cpp:487
int DataTrailerBytes() const
This method returns the number of data trailer bytes.
Definition: ProcessImport.cpp:727
void SetDataSuffixBytes(const int bytes)
This method sets the number of bytes at the end of each data record of a file.
Definition: ProcessImport.cpp:517
Undefined.
Definition: ProcessImport.h:292
Definition: ProcessImport.h:174
bool IsVAXSpecial(unsigned int *vax, VAXSpecialPixel pix)
Determines if the VAX encoded pixel value is special or not.
Definition: ProcessImport.cpp:132
void SetSuffixOffset(int samples, int lines, int coreBands, int itemBytes)
Definition: ProcessImport.cpp:433
QString InputFile()
Sets the name of the input file to be read in the import StartProcess method and verifies its existan...
Definition: ProcessImport.cpp:2308
void SetDimensions(const int ns, const int nl, const int nb)
Sets the physical size of the input cube.
Definition: ProcessImport.cpp:318
PixelType
Enumerations for Isis Pixel Types.
Definition: PixelType.h:43
std::vector< char * > DataTrailer()
This method returns a pointer to the data trailer.
Definition: ProcessImport.cpp:849
void ProcessBsq(void funct(Isis::Buffer &out)=NULL)
Process the import data as a band sequential file.
Definition: ProcessImport.cpp:1352
Isis::ByteOrder ByteOrder()
Returns the byte order.
Definition: ProcessImport.h:250
Definition: ProcessImport.h:173
virtual void StartProcess(void funct())
In the base class, this method will invoked a user-specified function exactly one time...
Definition: Process.h:228
Definition: ProcessImport.h:181
Definition: ProcessImport.h:182
Jpeg 2000 Format (always band sequential).
Definition: ProcessImport.h:293
Isis::PixelType PixelType()
Returns the pixel type.
Definition: ProcessImport.h:210
void CheckPixelRange(QString pixelName, double min, double max)
Checks the special pixel range of the given against all other special pixel value ranges...
Definition: ProcessImport.cpp:1112
Interleave Organization() const
Gets the organization of the input cube.
Definition: ProcessImport.cpp:942
void SaveDataSuffix()
This method marks the data suffix to be saved.
Definition: ProcessImport.cpp:688
int DataHeaderBytes() const
This method returns the number of data header bytes.
Definition: ProcessImport.cpp:719
void SetHIS(const double his_min, const double his_max)
Sets the range that will be considered Isis::Null.
Definition: ProcessImport.cpp:1096
Manipulate and parse attributes of output cube filenames.
Definition: CubeAttribute.h:489
double VAXConversion(void *ibuf)
Conversion routine which translates VAX_REAL to IEEE_REAL.
Definition: ProcessImport.cpp:185
std::vector< std::vector< char * > > DataPrefix()
This method returns a pointer to the data prefix.
Definition: ProcessImport.cpp:877
Definition: ProcessImport.h:184
void ProcessBil(void funct(Isis::Buffer &out)=NULL)
Function to process files stored as Band Interleaved by Line.
Definition: ProcessImport.cpp:1615
void SaveDataPrefix()
This method marks the data prefix to be saved.
Definition: ProcessImport.cpp:659
virtual void StartProcess()
Process the input file and write it to the output.
Definition: ProcessImport.cpp:1291
Isis::Cube * SetOutputCube(const QString &parameter)
Create the output file.
Definition: ProcessImport.cpp:1213
ProcessImport()
Constructs an Import object.
Definition: ProcessImport.cpp:51
void SetSuffixPixelType(const Isis::PixelType type)
Definition: ProcessImport.cpp:292
void SetDataTrailerBytes(const int bytes)
This method sets the number of bytes in the trailer of each datablock of a file.
Definition: ProcessImport.cpp:457
void SetSpecialValues(const double null, const double lrs, const double lis, const double hrs, const double his)
Sets a mapping of input pixel values to output special pixel values.
Definition: ProcessImport.cpp:1007
void SetPixelType(const Isis::PixelType type)
Sets the pixel type of the input file.
Definition: ProcessImport.cpp:278
Container for cube-like labels.
Definition: Pvl.h:135
void SaveDataHeader()
This method marks the data block headers to be saved.
Definition: ProcessImport.cpp:602
virtual Isis::Cube * SetOutputCube(const QString &parameter)
Allocates a user-specified output cube whose size matches the first input cube.
Definition: Process.cpp:266
void SetOrganization(const ProcessImport::Interleave org)
Sets the organization of the input cube.
Definition: ProcessImport.cpp:921
Interleave
This enum includes how the document should be read: by BSQ, BIL, BIP, JP2, or InterleaveUndefined.
Definition: ProcessImport.h:291
Band Sequential Format (i.e.
Definition: ProcessImport.h:294
void SaveFileTrailer()
This method marks the file trailer to be saved.
Definition: ProcessImport.cpp:573
Band Interleaved By Pixel Format (i.e.
Definition: ProcessImport.h:301
Definition: ProcessImport.h:179
int FileHeaderBytes() const
This method returns the number of file header bytes.
Definition: ProcessImport.cpp:702
void SetLRS(const double lrs_min, const double lrs_max)
Sets the range that will be considered Isis::Null.
Definition: ProcessImport.cpp:1045
int DataPrefixBytes() const
This method returns the number of data prefix bytes.
Definition: ProcessImport.cpp:735
char * FileHeader()
This method returns a pointer to the file header.
Definition: ProcessImport.cpp:767
int Lines()
Returns the number of lines.
Definition: ProcessImport.h:230
char * FileTrailer()
This method returns a pointer to the file trailer.
Definition: ProcessImport.cpp:793
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Byte swapper.
Definition: ProcessImport.h:170
void SetMultiplier(const double mult)
Sets the core multiplier of the input cube.
Definition: ProcessImport.cpp:973
int FileTrailerBytes() const
This method returns the number of file trailer bytes.
Definition: ProcessImport.cpp:711
void ProcessJp2(void funct(Isis::Buffer &out)=NULL)
Function to process files containing compressed JPEG2000 data (which is always BSQ but is processed a...
Definition: ProcessImport.cpp:2112
Definition: ProcessImport.h:183
void SetVAXConvert(const bool vax_convert)
Sets the VAX flag of the input cube.
Definition: ProcessImport.cpp:933
void SetFileHeaderBytes(const int bytes)
This method sets the number of bytes in the header of a file.
Definition: ProcessImport.cpp:363
void SetLIS(const double lis_min, const double lis_max)
Sets the range that will be considered Isis::Null.
Definition: ProcessImport.cpp:1062
VAXSpecialPixel
Definition: ProcessImport.h:178
void SetBase(const double base)
Sets the core base of the input cube.
Definition: ProcessImport.cpp:952
std::vector< std::vector< char * > > DataSuffix()
This method returns a pointer to the data suffix.
Definition: ProcessImport.cpp:905
void SetNull(const double null_min, const double null_max)
Sets the range that will be considered Isis::Null.
Definition: ProcessImport.cpp:1028
void SetInputFile(const QString &file)
Sets the name of the input file to be read in the import StartProcess method and verifies its existan...
Definition: ProcessImport.cpp:2291
Base class for all cube processing derivatives.
Definition: Process.h:158
void SetByteOrder(const Isis::ByteOrder order)
Sets the byte order of the input file.
Definition: ProcessImport.cpp:338
Band Interleaved By Line Format (i.e.
Definition: ProcessImport.h:297
void SetHRS(const double hrs_min, const double hrs_max)
Sets the range that will be considered Isis::Null.
Definition: ProcessImport.cpp:1079
IO Handler for Isis Cubes.
Definition: Cube.h:170
void SaveFileHeader()
This method marks the file header to be saved.
Definition: ProcessImport.cpp:546