File failed to load: https://isis.astrogeology.usgs.gov/3.9.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Developer Reference
ProcessExport.h
Go to the documentation of this file.
1 #ifndef ProcessExport_h
2 #define ProcessExport_h
3 
24 #include "Process.h"
25 
26 #include <fstream>
27 #include <iostream>
28 #include <string>
29 
30 #include <QCryptographicHash>
31 #include <QString>
32 
33 #include "Buffer.h"
34 #include "BufferManager.h"
35 #include "Endian.h"
36 #include "EndianSwapper.h"
37 #include "SpecialPixel.h"
38 #include "Stretch.h"
39 
40 namespace Isis {
125  class ProcessExport : public Isis::Process {
126 
127  public:
128 
131  BSQ,
132  BIL,
133  BIP,
135  };
136 
137  ProcessExport();
138  virtual ~ProcessExport();
139  using Isis::Process::StartProcess; // make parents virtual function visable
140  virtual void StartProcess(void funct(Isis::Buffer &in));
141  virtual void StartProcess(void funct(std::vector<Isis::Buffer *> &in));
142  virtual void StartProcess(std::ofstream &fout);
143  void SetOutputRange(const double minimum, const double maximum);
144  void SetOutputNull(const double value);
145  void SetOutputLis(const double value);
146  void SetOutputLrs(const double value);
147  void SetOutputHis(const double value);
148  void SetOutputHrs(const double value);
149  double OutputNull();
150  double OutputLis();
151  double OutputLrs();
152  double OutputHis();
153  double OutputHrs();
154  bool HasInputRange() const;
155  void SetInputRange();
156  void SetInputRange(const double minimum, const double maximum);
157  void SetInputRange(const double minimum, const double maximum, const int index);
158  void SetInputRange(const double minimum, const double middle,
159  const double maximum);
160  void SetInputRange(const double minimum, const double middle,
161  const double maximum, const int index);
162  void CreateWorldFile(const QString &worldFile);
163  void SetOutputEndian(enum ByteOrder endianness);
164  void SetOutputType(Isis::PixelType pixelIn);
165 
166  void setCanGenerateChecksum(bool flag);
167  bool canGenerateChecksum();
168  QString checksum();
169 
170  double GetInputMinimum(unsigned int n=0) const;
171  double GetInputMaximum(unsigned int n=0) const;
172 
174  double GetOutputMinimum() {
175  return (p_outputMinimum);
176  };
178  double GetOutputMaximum() {
179  return (p_outputMaximum);
180  };
181 
183  void setFormat(ExportFormat format) {
184  p_format = format;
185  };
186 
187 
188  template <typename Functor> void ProcessCubes(const Functor & functor) {
189 
190  int samples = InputCubes[0]->sampleCount();
191  int length = 0;
192  if (p_format == BIP) {
193  length = InputCubes[0]->bandCount();
194  }
195  else {
196  length = InputCubes[0]->lineCount();
197  }
198 
199  // Loop and let the app programmer fiddle with the lines
200  std::vector<BufferManager *> imgrs = GetBuffers();
201  for (int k = 1; k <= length; k++) {
202  std::vector<Buffer *> ibufs;
203 
204  for (unsigned int cubeIndex = 0; cubeIndex < InputCubes.size(); cubeIndex++) {
205  // Read a line of data from this cube
206  InputCubes[cubeIndex]->read(*imgrs[cubeIndex]);
207 
208  // Stretch the pixels into the desired range
209  for (int sampleIndex = 0; sampleIndex < samples; sampleIndex++) {
210  (*imgrs[cubeIndex])[sampleIndex] =
211  p_str[cubeIndex]->Map((*imgrs[cubeIndex])[sampleIndex]);
212  }
213 
214  ibufs.push_back(imgrs[cubeIndex]);
215  }
216 
217  // Invoke the user function
218  functor(ibufs);
219 
220  for (unsigned int i = 0; i < imgrs.size(); i++) imgrs[i]->next();
222  }
223  }
224 
225  protected:
226 
229 
230  std::vector<BufferManager *> GetBuffers();
231  std::vector<BufferManager *> GetBuffersBSQ();
232  std::vector<BufferManager *> GetBuffersBIL();
233  std::vector<BufferManager *> GetBuffersBIP();
234 
236  double p_outputMiddle;
239 
240  std::vector<double> p_inputMinimum;
243  std::vector<double> p_inputMiddle;
247  std::vector<double> p_inputMaximum;
253 
256  std::vector<Stretch *> p_str;
260  double p_Null;
261  double p_Lis;
263  double p_Lrs;
265  double p_His;
267  double p_Hrs;
270  bool p_Null_Set;
272  bool p_Lis_Set;
274  bool p_Lrs_Set;
276  bool p_His_Set;
278  bool p_Hrs_Set;
281  QCryptographicHash *m_cryptographicHash;
285  private:
287  void isisOut8(Buffer &in, std::ofstream &fout);
288 
290  void isisOut16s(Buffer &in, std::ofstream &fout);
291 
293  void isisOut16u(Buffer &in, std::ofstream &fout);
294 
297  void isisOut32(Buffer &in, std::ofstream &fout);
298 
301  void isisOut64(Buffer &in, std::ofstream &fout);
302 
306  void InitProcess();
307 
308 
309  };
310 };
311 
312 #endif
bool canGenerateChecksum()
Return if we can generate a checksum
Definition: ProcessExport.cpp:694
Buffer for reading and writing cube data.
Definition: Buffer.h:69
virtual ~ProcessExport()
Destructor.
Definition: ProcessExport.cpp:73
bool m_canGenerateChecksum
Flag to determine if a file checksum will be generated.
Definition: ProcessExport.h:283
void ProcessCubes(const Functor &functor)
Definition: ProcessExport.h:188
void SetOutputLis(const double value)
Set output special pixel value for LIS.
Definition: ProcessExport.cpp:501
bool p_His_Set
Indicates whether p_His has been set (i.e.
Definition: ProcessExport.h:276
Process class for exporting cubes.
Definition: ProcessExport.h:125
void SetOutputHis(const double value)
Set output special pixel value for HIS.
Definition: ProcessExport.cpp:531
void SetOutputNull(const double value)
Set output special pixel value for NULL.
Definition: ProcessExport.cpp:486
std::vector< BufferManager * > GetBuffersBIL()
A single line of input data from each input cube will be passed to the line processing function...
Definition: ProcessExport.cpp:954
ByteOrder
Tests the current architecture for byte order.
Definition: Endian.h:59
ByteOrder p_endianType
The byte order of the output file.
Definition: ProcessExport.h:252
bool p_Null_Set
Indicates whether p_Null has been set (i.e.
Definition: ProcessExport.h:270
ExportFormat p_format
Current storage order.
Definition: ProcessExport.h:228
double p_His
The output value for pixels whose input DNs are High Instrument Saturation values.
Definition: ProcessExport.h:265
std::vector< BufferManager * > GetBuffersBSQ()
A single line of input data from each input cube will be passed to the line processing function...
Definition: ProcessExport.cpp:915
double OutputHis()
Return the output special pixel value for HIS.
Definition: ProcessExport.cpp:579
void setCanGenerateChecksum(bool flag)
Set m_canGenerateChecksum which determines if we can generate a MD5 checksum on the image data...
Definition: ProcessExport.cpp:683
double OutputNull()
Return the output special pixel value for NULL.
Definition: ProcessExport.cpp:555
double GetOutputMaximum()
Get the valid maximum pixel value to be written to the output file.
Definition: ProcessExport.h:178
void CheckStatus()
Checks and updates the status.
Definition: Progress.cpp:121
PixelType
Enumerations for Isis Pixel Types.
Definition: PixelType.h:43
void CreateWorldFile(const QString &worldFile)
Create a standard world file for the input cube.
Definition: ProcessExport.cpp:1265
double OutputLrs()
Return the output special pixel value for LRS.
Definition: ProcessExport.cpp:571
std::vector< double > p_inputMinimum
Minimum pixel value in the input cube to be mapped to the minimum value in the Buffer.
Definition: ProcessExport.h:240
double OutputHrs()
Return the output special pixel value for HRS.
Definition: ProcessExport.cpp:587
void SetOutputRange(const double minimum, const double maximum)
Set output pixel range in Buffer.
Definition: ProcessExport.cpp:464
Compressed JPEG2000.
Definition: ProcessExport.h:134
virtual void StartProcess(void funct())
In the base class, this method will invoked a user-specified function exactly one time...
Definition: Process.h:228
bool p_Lrs_Set
Indicates whether p_Lrs has been set (i.e.
Definition: ProcessExport.h:274
EndianSwapper * p_endianSwap
Object to swap the endianness of the raw output to either MSB or LSB.
Definition: ProcessExport.h:250
double p_Lrs
The output value for pixels whose input DNs are Low Representation Saturation values.
Definition: ProcessExport.h:263
double GetOutputMinimum()
Get the valid minimum pixel value to be written to the output file.
Definition: ProcessExport.h:174
void SetOutputType(Isis::PixelType pixelIn)
Set output pixel bit type in Buffer.
Definition: ProcessExport.cpp:618
double p_Null
The output value for pixels whose input DNs are Null values.
Definition: ProcessExport.h:260
void SetInputRange()
Set input pixel range from user.
Definition: ProcessExport.cpp:374
double p_Hrs
The output value for pixels whose input DNs are High Representation Saturation values.
Definition: ProcessExport.h:267
bool p_Lis_Set
Indicates whether p_Lis has been set (i.e.
Definition: ProcessExport.h:272
double GetInputMinimum(unsigned int n=0) const
Get the valid minimum pixel value for the Nth input cube.
Definition: ProcessExport.cpp:428
std::vector< double > p_inputMaximum
Maximum pixel value in the input cube to be mapped to the maximum value in the Buffer.
Definition: ProcessExport.h:247
void SetOutputHrs(const double value)
Set output special pixel value for HRS.
Definition: ProcessExport.cpp:546
void setFormat(ExportFormat format)
Sets the storage order of the output file.
Definition: ProcessExport.h:183
Byte swapper.
Definition: EndianSwapper.h:55
virtual void StartProcess(void funct(Isis::Buffer &in))
This method invokes the process operation over a single input cube.
Definition: ProcessExport.cpp:800
QString checksum()
Generates a file checksum.
Definition: ProcessExport.cpp:704
double p_outputMinimum
Desired minimum pixel value in the Buffer.
Definition: ProcessExport.h:235
double p_outputMiddle
Middle pixel value (minimum+maximun)/2.0 in the Buffer.
Definition: ProcessExport.h:236
double p_outputMaximum
Desired maximum pixel value in the Buffer.
Definition: ProcessExport.h:238
Band interleaved by pixel.
Definition: ProcessExport.h:133
ProcessExport()
Constructs an Export object.
Definition: ProcessExport.cpp:43
Isis::Progress * p_progress
Pointer to a Progress object.
Definition: Process.h:160
double GetInputMaximum(unsigned int n=0) const
Get the valid maximum pixel value for the Nth input cube.
Definition: ProcessExport.cpp:439
Band interleaved by line.
Definition: ProcessExport.h:132
bool p_Hrs_Set
Indicates whether p_Hrs has been set (i.e.
Definition: ProcessExport.h:278
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
std::vector< BufferManager * > GetBuffers()
Definition: ProcessExport.cpp:880
std::vector< BufferManager * > GetBuffersBIP()
A single band of input data from each input cube will be passed to the band processing function...
Definition: ProcessExport.cpp:992
bool HasInputRange() const
Definition: ProcessExport.cpp:422
std::vector< double > p_inputMiddle
Middle pixel value in the input cube to be mapped to the (minimum+maximum)/2.0 value in the Buffer...
Definition: ProcessExport.h:243
double OutputLis()
Return the output special pixel value for LIS.
Definition: ProcessExport.cpp:563
void SetOutputLrs(const double value)
Set output special pixel value for LRS.
Definition: ProcessExport.cpp:516
ExportFormat
Storage order enumeration.
Definition: ProcessExport.h:130
PixelType p_pixelType
The bits per pixel of the output image.
Definition: ProcessExport.h:254
Base class for all cube processing derivatives.
Definition: Process.h:158
void SetOutputEndian(enum ByteOrder endianness)
Set byte endianness of the output cube.
Definition: ProcessExport.cpp:659
QCryptographicHash * m_cryptographicHash
A cryptographic hash that will generate an MD5 checksum of the image data.
Definition: ProcessExport.h:281
double p_Lis
The output value for pixels whose input DNs are Low Instrument Saturation values. ...
Definition: ProcessExport.h:261
Band sequential.
Definition: ProcessExport.h:131
std::vector< Stretch * > p_str
Stretch object to ensure a reasonable range of pixel values in the output data.
Definition: ProcessExport.h:256
std::vector< Isis::Cube * > InputCubes
A vector of pointers to opened Cube objects.
Definition: Process.h:200

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 USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/12/2023 23:26:55