Isis 3 Programmer Reference
ProcessImport.h
1#ifndef ProcessImport_h
2#define ProcessImport_h
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"
17#include "PvlToPvlTranslationManager.h"
18#include "SpecialPixel.h"
19#include "UserInterface.h"
20
21namespace Isis {
156 public:
157 enum VAXDataType {
158 VAX_REAL,
159 VAX_INT
160 };
161
162
163 enum VAXSpecialPixel {
164 VAX_MIN4,
165 VAX_NULL4,
166 VAX_LRS4,
167 VAX_LIS4,
168 VAX_HIS4,
169 VAX_HRS4
170 };
171
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 Isis::Cube *SetOutputCube(const QString &parameter, UserInterface &ui);
188 virtual Isis::Cube *SetOutputCube(const QString &fname,
190
192 void SetPixelType(const Isis::PixelType type);
198 return p_pixelType;
199 }
200
201
202 void SetDimensions(const int ns, const int nl, const int nb);
203
208 int Samples() {
209 return p_ns;
210 }
211
212
217 int Lines() {
218 return p_nl;
219 }
220
221
226 int Bands() {
227 return p_nb;
228 }
229
230
231 void SetByteOrder(const Isis::ByteOrder order);
232
238 return p_byteOrder;
239 }
240
241 bool IsVAXSpecial(unsigned int *vax, VAXSpecialPixel pix);
242 double VAXConversion(void *ibuf);
243 void SetSuffixOffset(int samples,int lines, int coreBands, int itemBytes);
244 void SetSuffixPixelType(const Isis::PixelType type);
245 void SetVAXConvert(const bool vax_convert);
246
247 void SetFileHeaderBytes(const int bytes);
248 void SetFileTrailerBytes(const int bytes);
249 void SetDataHeaderBytes(const int bytes);
250 void SetDataTrailerBytes(const int bytes);
251 void SetDataPrefixBytes(const int bytes);
252 void SetDataSuffixBytes(const int bytes);
253 void SaveFileHeader();
254 void SaveFileTrailer();
255 void SaveDataHeader();
256 void SaveDataTrailer();
257 void SaveDataPrefix();
258 void SaveDataSuffix();
259
260 int FileHeaderBytes() const;
261 int FileTrailerBytes() const;
262 int DataHeaderBytes() const;
263 int DataTrailerBytes() const;
264 int DataPrefixBytes() const;
265 int DataSuffixBytes() const;
266
267 char *FileHeader();
268 char *FileTrailer();
269 std::vector<char *> DataHeader();
270 std::vector<char *> DataTrailer();
271 std::vector<std::vector<char *> > DataPrefix();
272 std::vector<std::vector<char *> > DataSuffix();
273
293
294
296 Interleave Organization() const;
297
298 void SetBase(const double base);
299 void SetMultiplier(const double mult);
300 void SetBase(const std::vector<double> base);
301 void SetMultiplier(const std::vector<double> mult);
302
303 void SetSpecialValues(const double null, const double lrs,
304 const double lis, const double hrs,
305 const double his);
306 void SetNull(const double null_min, const double null_max);
307 void SetLRS(const double lrs_min, const double lrs_max);
308 void SetLIS(const double lis_min, const double lis_max);
309 void SetHRS(const double hrs_min, const double hrs_max);
310 void SetHIS(const double his_min, const double his_max);
311
312 double TestPixel(const double pixel);
313
314 void ProcessBsq(void funct(Isis::Buffer &out) = NULL);
315 void ProcessBil(void funct(Isis::Buffer &out) = NULL);
316 void ProcessBip(void funct(Isis::Buffer &out) = NULL);
317 void ProcessJp2(void funct(Isis::Buffer &out) = NULL);
318
319 void CheckPixelRange(QString pixelName, double min, double max);
320
321#if 0
322 void AddImportLabel(Isis::Pvl &importLab);
323 void AddLabel(Isis::Pvl &label);
324#endif
325
326
327 private:
328 QString p_inFile;
330
332 int p_ns;
333 int p_nl;
334 int p_nb;
336
376 std::vector<char *>p_dataHeader;
377 std::vector<char *>p_dataTrailer;
378 std::vector<std::vector<char *> >p_dataPre;
379 std::vector<std::vector<char *> >p_dataPost;
381
382 bool p_vax_convert;
383
391 std::vector<double> p_base;
395 std::vector<double> p_mult;
400 double p_null_min;
404 double p_null_max;
408 double p_hrs_min;
412 double p_hrs_max;
416 double p_his_min;
420 double p_his_max;
424 double p_lrs_min;
428 double p_lrs_max;
432 double p_lis_min;
436 double p_lis_max;
439 };
440};
441#endif
Buffer for reading and writing cube data.
Definition Buffer.h:53
Manipulate and parse attributes of output cube filenames.
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.
virtual void StartProcess()
Process the input file and write it to the output.
char * p_fileHeader
The file header.
ProcessImport::Interleave p_organization
The format of the input file.
double p_lis_min
The pixel value which is the lower bound of LIS data.
bool p_saveDataPost
Flag indicating whether to save the data suffix or not.
bool p_saveDataTrailer
Flag indicating whether to save the data trailer or not.
Isis::PixelType p_pixelType
Pixel type of input data.
void SetPixelType(const Isis::PixelType type)
Sets the pixel type of the input file.
void SetFileHeaderBytes(const int bytes)
This method sets the number of bytes in the header of a file.
Isis::PixelType PixelType()
Returns the pixel type.
bool p_saveDataPre
Flag indicating whether to save the data prefix or not.
std::vector< char * > DataTrailer()
This method returns a pointer to the data trailer.
double p_null_max
The pixel value which is the upper bound of NULL data.
ProcessImport()
Constructs an Import object.
void SaveDataPrefix()
This method marks the data prefix to be saved.
void SaveDataTrailer()
This method marks the data block trailers to be saved.
int FileHeaderBytes() const
This method returns the number of file header bytes.
void SetOrganization(const ProcessImport::Interleave org)
Sets the organization of the input cube.
char * FileTrailer()
This method returns a pointer to the file trailer.
void SetDataPrefixBytes(const int bytes)
This method sets the number of bytes at the beginning of each data record of a file.
int DataTrailerBytes() const
This method returns the number of data trailer bytes.
std::vector< double > p_base
An array containing the core base for each band.
QString p_inFile
Input file name.
void SetLIS(const double lis_min, const double lis_max)
Sets the range that will be considered Isis::Null.
int p_ns
Number of samples.
void SetHRS(const double hrs_min, const double hrs_max)
Sets the range that will be considered Isis::Null.
int p_suffixData
The number of bytes past the file header bytes where the suffix data bands are stored.
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.
std::vector< std::vector< char * > > p_dataPost
The data suffix.
void SetNull(const double null_min, const double null_max)
Sets the range that will be considered Isis::Null.
void SetInputFile(const QString &file)
Sets the name of the input file to be read in the import StartProcess method and verifies its existan...
void SetMultiplier(const double mult)
Sets the core multiplier of the input cube.
void SetDataHeaderBytes(const int bytes)
This method sets the number of bytes in the header of each datablock of a file.
std::vector< double > p_mult
An array containing the core multiplier for each band.
std::vector< char * > p_dataTrailer
The data trailer.
void ProcessBip(void funct(Isis::Buffer &out)=NULL)
Function to process files stored as Band Interleaved by Pixel.
double p_his_min
The pixel value which is the lower bound of HIS data.
double p_lis_max
The pixel value which is the upper bound of LIS data.
Isis::Cube * SetOutputCube(const QString &parameter)
Create the output file.
void SaveFileTrailer()
This method marks the file trailer to be saved.
bool p_saveDataHeader
Flag indicating whether to save the data header or not.
bool p_saveFileHeader
Flag indicating whether to save the file header or not.
int FileTrailerBytes() const
This method returns the number of file trailer bytes.
double p_lrs_max
The pixel value which is the upper bound of LRS data.
void CheckPixelRange(QString pixelName, double min, double max)
Checks the special pixel range of the given against all other special pixel value ranges,...
double p_hrs_max
The pixel value which is the upper bound of HRS data.
Isis::ByteOrder ByteOrder()
Returns the byte order.
int Lines()
Returns the number of lines.
void ProcessJp2(void funct(Isis::Buffer &out)=NULL)
Function to process files containing compressed JPEG2000 data (which is always BSQ but is processed a...
int p_dataTrailerBytes
Number of bytes of non-image data after the image data of each data block, such as band trailer data ...
void SetLRS(const double lrs_min, const double lrs_max)
Sets the range that will be considered Isis::Null.
std::vector< std::vector< char * > > p_dataPre
The data prefix.
double p_lrs_min
The pixel value which is the lower bound of LRS data.
int DataPrefixBytes() const
This method returns the number of data prefix bytes.
double p_null_min
The pixel value which is the lower bound of NULL data.
double p_hrs_min
The pixel value which is the lower bound of HRS data.
int p_fileTrailerBytes
The number of bytes of non-image data at the end of a file.
Isis::PixelType p_suffixPixelType
The pixel type of the suffix data.
bool p_saveFileTrailer
Flag indicating whether to save the file trailer or not.
Interleave Organization() const
Gets the organization of the input cube.
double VAXConversion(void *ibuf)
Conversion routine which translates VAX_REAL to IEEE_REAL.
int p_nl
Number of lines.
void SetFileTrailerBytes(const int bytes)
This method sets the number of bytes in the trailer of a file.
int Samples()
Returns the number of samples.
void SetDataTrailerBytes(const int bytes)
This method sets the number of bytes in the trailer of each datablock of a file.
std::vector< std::vector< char * > > DataSuffix()
This method returns a pointer to the data suffix.
QString InputFile()
Sets the name of the input file to be read in the import StartProcess method and verifies its existan...
std::vector< char * > p_dataHeader
The data header.
int p_nb
Number of bands.
int DataSuffixBytes() const
This method returns the number of data duffix bytes.
void SaveDataHeader()
This method marks the data block headers to be saved.
void SetByteOrder(const Isis::ByteOrder order)
Sets the byte order of the input file.
void ProcessBil(void funct(Isis::Buffer &out)=NULL)
Function to process files stored as Band Interleaved by Line.
double p_his_max
The pixel value which is the upper bound of HIS data.
virtual ~ProcessImport()
Destroys the Import object.
std::vector< std::vector< char * > > DataPrefix()
This method returns a pointer to the data prefix.
void ProcessBsq(void funct(Isis::Buffer &out)=NULL)
Process the import data as a band sequential file.
void SetHIS(const double his_min, const double his_max)
Sets the range that will be considered Isis::Null.
Interleave
This enum includes how the document should be read: by BSQ, BIL, BIP, JP2, or InterleaveUndefined.
@ InterleaveUndefined
Undefined.
@ BIL
Band Interleaved By Line Format (i.e.
@ BIP
Band Interleaved By Pixel Format (i.e.
@ JP2
Jpeg 2000 Format (always band sequential).
@ BSQ
Band Sequential Format (i.e.
std::vector< char * > DataHeader()
This method returns a pointer to the data header.
void SetDataSuffixBytes(const int bytes)
This method sets the number of bytes at the end of each data record of a file.
char * FileHeader()
This method returns a pointer to the file header.
void SetBase(const double base)
Sets the core base of the input cube.
double TestPixel(const double pixel)
Tests the pixel.
int Bands()
Returns the number of bands.
Isis::ByteOrder p_byteOrder
Byte order of data.
void SetAttributes(CubeAttributeOutput &att)
Given a CubeAttributeOutput object, set min/max to propagate if propagating min/max attributes was re...
int p_dataPreBytes
Number of bytes of non-image data preceding each data record, such as line prefix data in a band sequ...
int p_dataPostBytes
Number of bytes of non-image data following each data record, such as line suffix data in a band sequ...
char * p_fileTrailer
The file trailer.
void SaveFileHeader()
This method marks the file header to be saved.
void SaveDataSuffix()
This method marks the data suffix to be saved.
int p_dataHeaderBytes
Number of bytes of non-image data after the file header and before the image data of each data block,...
void SetDimensions(const int ns, const int nl, const int nb)
Sets the physical size of the input cube.
int DataHeaderBytes() const
This method returns the number of data header bytes.
int p_fileHeaderBytes
The number of bytes of non-image data at the beginning of a file.
bool IsVAXSpecial(unsigned int *vax, VAXSpecialPixel pix)
Determines if the VAX encoded pixel value is special or not.
Container for cube-like labels.
Definition Pvl.h:119
Command Line and Xml loader, validation, and access.
ByteOrder
Tests the current architecture for byte order.
Definition Endian.h:42
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
PixelType
Enumerations for Isis Pixel Types.
Definition PixelType.h:27