Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis Developer Reference
ProcessImport.h
Go to the documentation of this file.
1#ifndef ProcessImport_h
2#define ProcessImport_h
7
8/* SPDX-License-Identifier: CC0-1.0 */
9#include <string>
10
11#include "Buffer.h"
12#include "CubeAttribute.h"
13#include "EndianSwapper.h"
14#include "JP2Decoder.h"
15#include "PixelType.h"
16#include "Process.h"
18#include "SpecialPixel.h"
19#include "UserInterface.h"
20
21#include "cpl_vsi.h"
22
23
24namespace Isis {
159 public:
164
165
174
176 virtual ~ProcessImport();
177
178 using Isis::Process::StartProcess; // make parent functions visable
179 virtual void StartProcess();
180 virtual void StartProcess(void funct(Isis::Buffer &out));
181 void SetInputFile(const QString &file);
182 QString InputFile();
183 void CheckVsiIo(size_t bytesRead, size_t expectedBytes, vsi_l_offset pos);
184
185 // SetOutputCube() is not virtual in the Process class, so the following
186 // definitions for this method are the only ones that are allowed for
187 // ProcessImport objects and child objects
188
189 using Isis::Process::SetOutputCube; // make parent functions visable
190 Isis::Cube *SetOutputCube(const QString &parameter);
191 Isis::Cube *SetOutputCube(const QString &parameter, UserInterface &ui);
192 virtual Isis::Cube *SetOutputCube(const QString &fname,
194
196 void SetPixelType(const Isis::PixelType type);
201 Isis::PixelType PixelType() {
202 return p_pixelType;
203 }
204
205
206 void SetDimensions(const int ns, const int nl, const int nb);
207
212 int Samples() {
213 return p_ns;
214 }
215
216
221 int Lines() {
222 return p_nl;
223 }
224
225
230 int Bands() {
231 return p_nb;
232 }
233
234
235 void SetByteOrder(const Isis::ByteOrder order);
236
241 Isis::ByteOrder ByteOrder() {
242 return p_byteOrder;
243 }
244
245 bool IsVAXSpecial(unsigned int *vax, VAXSpecialPixel pix);
246 double VAXConversion(void *ibuf);
247 void SetSuffixOffset(int samples,int lines, int coreBands, int itemBytes);
248 void SetSuffixPixelType(const Isis::PixelType type);
249 void SetVAXConvert(const bool vax_convert);
250
251 void SetFileHeaderBytes(const int bytes);
252 void SetFileTrailerBytes(const int bytes);
253 void SetDataHeaderBytes(const int bytes);
254 void SetDataTrailerBytes(const int bytes);
255 void SetDataPrefixBytes(const int bytes);
256 void SetDataSuffixBytes(const int bytes);
257 void SaveFileHeader();
258 void SaveFileTrailer();
259 void SaveDataHeader();
260 void SaveDataTrailer();
261 void SaveDataPrefix();
262 void SaveDataSuffix();
263
264 int FileHeaderBytes() const;
265 int FileTrailerBytes() const;
266 int DataHeaderBytes() const;
267 int DataTrailerBytes() const;
268 int DataPrefixBytes() const;
269 int DataSuffixBytes() const;
270
271 char *FileHeader();
272 char *FileTrailer();
273 std::vector<char *> DataHeader();
274 std::vector<char *> DataTrailer();
275 std::vector<std::vector<char *> > DataPrefix();
276 std::vector<std::vector<char *> > DataSuffix();
277
297
298
300 Interleave Organization() const;
301
302 void SetBase(const double base);
303 void SetMultiplier(const double mult);
304 void SetBase(const std::vector<double> base);
305 void SetMultiplier(const std::vector<double> mult);
306
307 void SetSpecialValues(const double null, const double lrs,
308 const double lis, const double hrs,
309 const double his);
310 void SetNull(const double null_min, const double null_max);
311 void SetLRS(const double lrs_min, const double lrs_max);
312 void SetLIS(const double lis_min, const double lis_max);
313 void SetHRS(const double hrs_min, const double hrs_max);
314 void SetHIS(const double his_min, const double his_max);
315
316 double TestPixel(const double pixel);
317
318 void ProcessBsq(void funct(Isis::Buffer &out) = NULL);
319 void ProcessBil(void funct(Isis::Buffer &out) = NULL);
320 void ProcessBip(void funct(Isis::Buffer &out) = NULL);
321 void ProcessJp2(void funct(Isis::Buffer &out) = NULL);
322
323 void CheckPixelRange(QString pixelName, double min, double max);
324
325#if 0
326 void AddImportLabel(Isis::Pvl &importLab);
327 void AddLabel(Isis::Pvl &label);
328#endif
329
330
331 private:
332 QString p_inFile;
333 Isis::PixelType p_pixelType;
334
335 Isis::PixelType p_suffixPixelType;
336 int p_ns;
337 int p_nl;
338 int p_nb;
339 Isis::ByteOrder p_byteOrder;
340
341 int p_suffixData;
343
344
345 int p_fileHeaderBytes;
349 int p_fileTrailerBytes;
353 int p_dataHeaderBytes;
357 int p_dataTrailerBytes;
361 int p_dataPreBytes;
364 int p_dataPostBytes;
367 bool p_saveFileHeader;
369 bool p_saveDataHeader;
371 bool p_saveDataTrailer;
373 bool p_saveDataPre;
375 bool p_saveDataPost;
377 bool p_saveFileTrailer;
379 char *p_fileHeader;
380 std::vector<char *>p_dataHeader;
381 std::vector<char *>p_dataTrailer;
382 std::vector<std::vector<char *> >p_dataPre;
383 std::vector<std::vector<char *> >p_dataPost;
384 char *p_fileTrailer;
385
386 bool p_vax_convert;
387
388 ProcessImport::Interleave p_organization;
394
395 std::vector<double> p_base;
399 std::vector<double> p_mult;
403
404 double p_null_min;
408 double p_null_max;
412 double p_hrs_min;
416 double p_hrs_max;
420 double p_his_min;
424 double p_his_max;
428 double p_lrs_min;
432 double p_lrs_max;
436 double p_lis_min;
440 double p_lis_max;
443 };
444};
445#endif
Buffer for reading and writing cube data.
Definition Buffer.h:53
Manipulate and parse attributes of output cube filenames.
Definition CubeAttribute.h:452
IO Handler for Isis Cubes.
Definition Cube.h:168
Base class for all cube processing derivatives.
Definition Process.h:143
virtual void StartProcess(void funct())
In the base class, this method will invoked a user-specified function exactly one time.
Definition Process.h:213
virtual Isis::Cube * SetOutputCube(const QString &parameter)
Allocates a user-specified output cube whose size matches the first input cube.
Definition Process.cpp:163
void SetVAXConvert(const bool vax_convert)
Sets the VAX flag of the input cube.
Definition ProcessImport.cpp:920
virtual void StartProcess()
Process the input file and write it to the output.
Definition ProcessImport.cpp:1303
void SetPixelType(const Isis::PixelType type)
Sets the pixel type of the input file.
Definition ProcessImport.cpp:265
void SetFileHeaderBytes(const int bytes)
This method sets the number of bytes in the header of a file.
Definition ProcessImport.cpp:350
Isis::PixelType PixelType()
Returns the pixel type.
Definition ProcessImport.h:201
std::vector< char * > DataTrailer()
This method returns a pointer to the data trailer.
Definition ProcessImport.cpp:836
void CheckVsiIo(size_t bytesRead, size_t expectedBytes, vsi_l_offset pos)
Definition ProcessImport.cpp:2187
ProcessImport()
Constructs an Import object.
Definition ProcessImport.cpp:38
void SaveDataPrefix()
This method marks the data prefix to be saved.
Definition ProcessImport.cpp:646
void SaveDataTrailer()
This method marks the data block trailers to be saved.
Definition ProcessImport.cpp:618
int FileHeaderBytes() const
This method returns the number of file header bytes.
Definition ProcessImport.cpp:689
void SetOrganization(const ProcessImport::Interleave org)
Sets the organization of the input cube.
Definition ProcessImport.cpp:908
char * FileTrailer()
This method returns a pointer to the file trailer.
Definition ProcessImport.cpp:780
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:474
int DataTrailerBytes() const
This method returns the number of data trailer bytes.
Definition ProcessImport.cpp:714
void SetLIS(const double lis_min, const double lis_max)
Sets the range that will be considered Isis::Null.
Definition ProcessImport.cpp:1049
void SetSuffixOffset(int samples, int lines, int coreBands, int itemBytes)
Definition ProcessImport.cpp:420
void SetHRS(const double hrs_min, const double hrs_max)
Sets the range that will be considered Isis::Null.
Definition ProcessImport.cpp:1066
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:994
void SetNull(const double null_min, const double null_max)
Sets the range that will be considered Isis::Null.
Definition ProcessImport.cpp:1015
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:2162
void SetMultiplier(const double mult)
Sets the core multiplier of the input cube.
Definition ProcessImport.cpp:960
void SetDataHeaderBytes(const int bytes)
This method sets the number of bytes in the header of each datablock of a file.
Definition ProcessImport.cpp:409
void ProcessBip(void funct(Isis::Buffer &out)=NULL)
Function to process files stored as Band Interleaved by Pixel.
Definition ProcessImport.cpp:1778
Isis::Cube * SetOutputCube(const QString &parameter)
Create the output file.
Definition ProcessImport.cpp:1262
void SaveFileTrailer()
This method marks the file trailer to be saved.
Definition ProcessImport.cpp:560
int FileTrailerBytes() const
This method returns the number of file trailer bytes.
Definition ProcessImport.cpp:698
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:1099
Isis::ByteOrder ByteOrder()
Returns the byte order.
Definition ProcessImport.h:241
int Lines()
Returns the number of lines.
Definition ProcessImport.h:221
VAXDataType
Definition ProcessImport.h:160
@ VAX_INT
Definition ProcessImport.h:162
@ VAX_REAL
Definition ProcessImport.h:161
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:1983
void SetLRS(const double lrs_min, const double lrs_max)
Sets the range that will be considered Isis::Null.
Definition ProcessImport.cpp:1032
int DataPrefixBytes() const
This method returns the number of data prefix bytes.
Definition ProcessImport.cpp:722
Interleave Organization() const
Gets the organization of the input cube.
Definition ProcessImport.cpp:929
double VAXConversion(void *ibuf)
Conversion routine which translates VAX_REAL to IEEE_REAL.
Definition ProcessImport.cpp:172
void SetFileTrailerBytes(const int bytes)
This method sets the number of bytes in the trailer of a file.
Definition ProcessImport.cpp:380
int Samples()
Returns the number of samples.
Definition ProcessImport.h:212
void SetDataTrailerBytes(const int bytes)
This method sets the number of bytes in the trailer of each datablock of a file.
Definition ProcessImport.cpp:444
std::vector< std::vector< char * > > DataSuffix()
This method returns a pointer to the data suffix.
Definition ProcessImport.cpp:892
QString InputFile()
Sets the name of the input file to be read in the import StartProcess method and verifies its existan...
Definition ProcessImport.cpp:2179
int DataSuffixBytes() const
This method returns the number of data duffix bytes.
Definition ProcessImport.cpp:730
void SaveDataHeader()
This method marks the data block headers to be saved.
Definition ProcessImport.cpp:589
void SetByteOrder(const Isis::ByteOrder order)
Sets the byte order of the input file.
Definition ProcessImport.cpp:325
void ProcessBil(void funct(Isis::Buffer &out)=NULL)
Function to process files stored as Band Interleaved by Line.
Definition ProcessImport.cpp:1582
virtual ~ProcessImport()
Destroys the Import object.
Definition ProcessImport.cpp:79
std::vector< std::vector< char * > > DataPrefix()
This method returns a pointer to the data prefix.
Definition ProcessImport.cpp:864
void ProcessBsq(void funct(Isis::Buffer &out)=NULL)
Process the import data as a band sequential file.
Definition ProcessImport.cpp:1364
void SetHIS(const double his_min, const double his_max)
Sets the range that will be considered Isis::Null.
Definition ProcessImport.cpp:1083
Interleave
This enum includes how the document should be read: by BSQ, BIL, BIP, JP2, or InterleaveUndefined.
Definition ProcessImport.h:282
@ InterleaveUndefined
Undefined.
Definition ProcessImport.h:283
@ BIL
Band Interleaved By Line Format (i.e.
Definition ProcessImport.h:288
@ BIP
Band Interleaved By Pixel Format (i.e.
Definition ProcessImport.h:292
@ JP2
Jpeg 2000 Format (always band sequential).
Definition ProcessImport.h:284
@ BSQ
Band Sequential Format (i.e.
Definition ProcessImport.h:285
std::vector< char * > DataHeader()
This method returns a pointer to the data header.
Definition ProcessImport.cpp:808
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:504
char * FileHeader()
This method returns a pointer to the file header.
Definition ProcessImport.cpp:754
void SetBase(const double base)
Sets the core base of the input cube.
Definition ProcessImport.cpp:939
double TestPixel(const double pixel)
Tests the pixel.
Definition ProcessImport.cpp:1168
void SetSuffixPixelType(const Isis::PixelType type)
Definition ProcessImport.cpp:279
int Bands()
Returns the number of bands.
Definition ProcessImport.h:230
void SetAttributes(CubeAttributeOutput &att)
Given a CubeAttributeOutput object, set min/max to propagate if propagating min/max attributes was re...
Definition ProcessImport.cpp:1199
void SaveFileHeader()
This method marks the file header to be saved.
Definition ProcessImport.cpp:533
void SaveDataSuffix()
This method marks the data suffix to be saved.
Definition ProcessImport.cpp:675
void SetDimensions(const int ns, const int nl, const int nb)
Sets the physical size of the input cube.
Definition ProcessImport.cpp:305
VAXSpecialPixel
Definition ProcessImport.h:166
@ VAX_NULL4
Definition ProcessImport.h:168
@ VAX_LRS4
Definition ProcessImport.h:169
@ VAX_HRS4
Definition ProcessImport.h:172
@ VAX_HIS4
Definition ProcessImport.h:171
@ VAX_MIN4
Definition ProcessImport.h:167
@ VAX_LIS4
Definition ProcessImport.h:170
int DataHeaderBytes() const
This method returns the number of data header bytes.
Definition ProcessImport.cpp:706
bool IsVAXSpecial(unsigned int *vax, VAXSpecialPixel pix)
Determines if the VAX encoded pixel value is special or not.
Definition ProcessImport.cpp:119
Command Line and Xml loader, validation, and access.
Definition UserInterface.h:138
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16