Isis 3.0
Back | Home
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"
33 #include "PvlTranslationManager.h"
34 #include "SpecialPixel.h"
35 
36 namespace Isis {
155  class ProcessImport : public Isis::Process {
156  public:
157  enum VAXDataType {
160  };
161 
162 
170  };
171 
172  ProcessImport();
173  virtual ~ProcessImport();
174 
175  using Isis::Process::StartProcess; // make parent functions visable
176  virtual void StartProcess();
177  virtual void StartProcess(void funct(Isis::Buffer &out));
178  void SetInputFile(const QString &file);
179  QString InputFile();
180 
181  // SetOutputCube() is not virtual in the Process class, so the following
182  // definitions for this method are the only ones that are allowed for
183  // ProcessImport objects and child objects
184 
185  using Isis::Process::SetOutputCube; // make parent functions visable
186  Isis::Cube *SetOutputCube(const QString &parameter);
187  virtual Isis::Cube *SetOutputCube(const QString &fname,
189 
190  void SetPixelType(const Isis::PixelType type);
196  return p_pixelType;
197  }
198 
199 
200  void SetDimensions(const int ns, const int nl, const int nb);
201 
206  int Samples() {
207  return p_ns;
208  }
209 
210 
215  int Lines() {
216  return p_nl;
217  }
218 
219 
224  int Bands() {
225  return p_nb;
226  }
227 
228 
229  void SetByteOrder(const Isis::ByteOrder order);
230 
236  return p_byteOrder;
237  }
238 
239  bool IsVAXSpecial(unsigned int *vax, VAXSpecialPixel pix);
240  double VAXConversion(void *ibuf);
241  void SetSuffixOffset(int samples,int lines, int coreBands, int itemBytes);
242  void SetSuffixPixelType(const Isis::PixelType type);
243  void SetVAXConvert(const bool vax_convert);
244 
245  void SetFileHeaderBytes(const int bytes);
246  void SetFileTrailerBytes(const int bytes);
247  void SetDataHeaderBytes(const int bytes);
248  void SetDataTrailerBytes(const int bytes);
249  void SetDataPrefixBytes(const int bytes);
250  void SetDataSuffixBytes(const int bytes);
251  void SaveFileHeader();
252  void SaveFileTrailer();
253  void SaveDataHeader();
254  void SaveDataTrailer();
255  void SaveDataPrefix();
256  void SaveDataSuffix();
257 
258  int FileHeaderBytes() const;
259  int FileTrailerBytes() const;
260  int DataHeaderBytes() const;
261  int DataTrailerBytes() const;
262  int DataPrefixBytes() const;
263  int DataSuffixBytes() const;
264 
265  char *FileHeader();
266  char *FileTrailer();
267  std::vector<char *> DataHeader();
268  std::vector<char *> DataTrailer();
269  std::vector<std::vector<char *> > DataPrefix();
270  std::vector<std::vector<char *> > DataSuffix();
271 
276  enum Interleave {
278  JP2,
279  BSQ,
282  BIL,
290  };
291 
292 
294  Interleave Organization() const;
295 
296  void SetBase(const double base);
297  void SetMultiplier(const double mult);
298  void SetBase(const std::vector<double> base);
299  void SetMultiplier(const std::vector<double> mult);
300 
301  void SetSpecialValues(const double null, const double lrs,
302  const double lis, const double hrs,
303  const double his);
304  void SetNull(const double null_min, const double null_max);
305  void SetLRS(const double lrs_min, const double lrs_max);
306  void SetLIS(const double lis_min, const double lis_max);
307  void SetHRS(const double hrs_min, const double hrs_max);
308  void SetHIS(const double his_min, const double his_max);
309 
310  double TestPixel(const double pixel);
311 
312  void ProcessBsq(void funct(Isis::Buffer &out) = NULL);
313  void ProcessBil(void funct(Isis::Buffer &out) = NULL);
314  void ProcessBip(void funct(Isis::Buffer &out) = NULL);
315  void ProcessJp2(void funct(Isis::Buffer &out) = NULL);
316 
317  void CheckPixelRange(QString pixelName, double min, double max);
318 
319 #if 0
320  void AddImportLabel(Isis::Pvl &importLab);
321  void AddLabel(Isis::Pvl &label);
322 #endif
323 
324 
325  private:
326  QString p_inFile;
327  Isis::PixelType p_pixelType;
328 
329  Isis::PixelType p_suffixPixelType;
330  int p_ns;
331  int p_nl;
332  int p_nb;
333  Isis::ByteOrder p_byteOrder;
334 
335  int p_suffixData;
339  int p_fileHeaderBytes;
343  int p_fileTrailerBytes;
347  int p_dataHeaderBytes;
351  int p_dataTrailerBytes;
355  int p_dataPreBytes;
358  int p_dataPostBytes;
361  bool p_saveFileHeader;
363  bool p_saveDataHeader;
365  bool p_saveDataTrailer;
367  bool p_saveDataPre;
369  bool p_saveDataPost;
371  bool p_saveFileTrailer;
373  char *p_fileHeader;
374  std::vector<char *>p_dataHeader;
375  std::vector<char *>p_dataTrailer;
376  std::vector<std::vector<char *> >p_dataPre;
377  std::vector<std::vector<char *> >p_dataPost;
378  char *p_fileTrailer;
379 
380  bool p_vax_convert;
381 
382  ProcessImport::Interleave p_organization;
389  std::vector<double> p_base;
393  std::vector<double> p_mult;
398  double p_null_min;
402  double p_null_max;
406  double p_hrs_min;
410  double p_hrs_max;
414  double p_his_min;
418  double p_his_max;
422  double p_lrs_min;
426  double p_lrs_max;
430  double p_lis_min;
434  double p_lis_max;
437  };
438 };
439 #endif
Buffer for reading and writing cube data.
Definition: Buffer.h:68
VAXDataType
Definition: ProcessImport.h:157
int FileTrailerBytes() const
This method returns the number of file trailer bytes.
Definition: ProcessImport.cpp:711
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:165
int Bands()
Returns the number of bands.
Definition: ProcessImport.h:224
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:206
void ProcessBip(void funct(Isis::Buffer &out)=NULL)
Function to process files stored as Band Interleaved by Pixel.
Definition: ProcessImport.cpp:1851
Interleave Organization() const
Gets the organization of the input cube.
Definition: ProcessImport.cpp:942
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 DataPrefixBytes() const
This method returns the number of data prefix bytes.
Definition: ProcessImport.cpp:735
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:277
Definition: ProcessImport.h:159
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:2297
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:1347
int DataHeaderBytes() const
This method returns the number of data header bytes.
Definition: ProcessImport.cpp:719
Isis::ByteOrder ByteOrder()
Returns the byte order.
Definition: ProcessImport.h:235
Definition: ProcessImport.h:158
virtual void StartProcess(void funct())
In the base class, this method will invoked a user-specified function exactly one time...
Definition: Process.h:227
Definition: ProcessImport.h:166
Definition: ProcessImport.h:167
Jpeg 2000 Format (always band sequential).
Definition: ProcessImport.h:278
Isis::PixelType PixelType()
Returns the pixel type.
Definition: ProcessImport.h:195
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
void SaveDataSuffix()
This method marks the data suffix to be saved.
Definition: ProcessImport.cpp:688
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:485
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:169
void ProcessBil(void funct(Isis::Buffer &out)=NULL)
Function to process files stored as Band Interleaved by Line.
Definition: ProcessImport.cpp:1608
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:1286
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:276
Band Sequential Format (i.e.
Definition: ProcessImport.h:279
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:286
Definition: ProcessImport.h:164
int DataSuffixBytes() const
This method returns the number of data duffix bytes.
Definition: ProcessImport.cpp:743
void SetLRS(const double lrs_min, const double lrs_max)
Sets the range that will be considered Isis::Null.
Definition: ProcessImport.cpp:1045
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:215
char * FileTrailer()
This method returns a pointer to the file trailer.
Definition: ProcessImport.cpp:793
Byte swapper.
Definition: ProcessImport.h:155
void SetMultiplier(const double mult)
Sets the core multiplier of the input cube.
Definition: ProcessImport.cpp:973
int FileHeaderBytes() const
This method returns the number of file header bytes.
Definition: ProcessImport.cpp:702
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:2101
Definition: ProcessImport.h:168
void SetVAXConvert(const bool vax_convert)
Sets the VAX flag of the input cube.
Definition: ProcessImport.cpp:933
int DataTrailerBytes() const
This method returns the number of data trailer bytes.
Definition: ProcessImport.cpp:727
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:163
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:2280
Base class for all cube processing derivatives.
Definition: Process.h:157
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:282
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:158
void SaveFileHeader()
This method marks the file header to be saved.
Definition: ProcessImport.cpp:546

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:26:08