Isis 3.0
Back | Home
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 "Buffer.h"
31 #include "BufferManager.h"
32 #include "Endian.h"
33 #include "EndianSwapper.h"
34 #include "SpecialPixel.h"
35 #include "Stretch.h"
36 
37 namespace Isis {
116  class ProcessExport : public Isis::Process {
117 
118  public:
119 
122  BSQ,
123  BIL,
124  BIP,
126  };
127 
128  ProcessExport();
129  virtual ~ProcessExport();
130  using Isis::Process::StartProcess; // make parents virtual function visable
131  virtual void StartProcess(void funct(Isis::Buffer &in));
132  virtual void StartProcess(void funct(std::vector<Isis::Buffer *> &in));
133  virtual void StartProcess(std::ofstream &fout);
134  void SetOutputRange(const double minimum, const double maximum);
135  void SetOutputNull(const double value);
136  void SetOutputLis(const double value);
137  void SetOutputLrs(const double value);
138  void SetOutputHis(const double value);
139  void SetOutputHrs(const double value);
140  double OutputNull();
141  double OutputLis();
142  double OutputLrs();
143  double OutputHis();
144  double OutputHrs();
145  bool HasInputRange() const;
146  void SetInputRange();
147  void SetInputRange(const double minimum, const double maximum);
148  void SetInputRange(const double minimum, const double maximum, const int index);
149  void SetInputRange(const double minimum, const double middle,
150  const double maximum);
151  void SetInputRange(const double minimum, const double middle,
152  const double maximum, const int index);
153  void CreateWorldFile(const QString &worldFile);
154  void SetOutputEndian(enum ByteOrder endianness);
155  void SetOutputType(Isis::PixelType pixelIn);
156 
157  double GetInputMinimum(unsigned int n=0) const;
158  double GetInputMaximum(unsigned int n=0) const;
159 
161  double GetOutputMinimum() {
162  return (p_outputMinimum);
163  };
165  double GetOutputMaximum() {
166  return (p_outputMaximum);
167  };
168 
170  void setFormat(ExportFormat format) {
171  p_format = format;
172  };
173 
174 
175  template <typename Functor> void ProcessCubes(const Functor & functor) {
176 
177  int samples = InputCubes[0]->sampleCount();
178  int length = 0;
179  if (p_format == BIP) {
180  length = InputCubes[0]->bandCount();
181  }
182  else {
183  length = InputCubes[0]->lineCount();
184  }
185 
186  // Loop and let the app programmer fiddle with the lines
187  std::vector<BufferManager *> imgrs = GetBuffers();
188  for (int k = 1; k <= length; k++) {
189  std::vector<Buffer *> ibufs;
190 
191  for (unsigned int cubeIndex = 0; cubeIndex < InputCubes.size(); cubeIndex++) {
192  // Read a line of data from this cube
193  InputCubes[cubeIndex]->read(*imgrs[cubeIndex]);
194 
195  // Stretch the pixels into the desired range
196  for (int sampleIndex = 0; sampleIndex < samples; sampleIndex++) {
197  (*imgrs[cubeIndex])[sampleIndex] =
198  p_str[cubeIndex]->Map((*imgrs[cubeIndex])[sampleIndex]);
199  }
200 
201  ibufs.push_back(imgrs[cubeIndex]);
202  }
203 
204  // Invoke the user function
205  functor(ibufs);
206 
207  for (unsigned int i = 0; i < imgrs.size(); i++) imgrs[i]->next();
209  }
210  }
211 
212  protected:
213 
216 
217  std::vector<BufferManager *> GetBuffers();
218  std::vector<BufferManager *> GetBuffersBSQ();
219  std::vector<BufferManager *> GetBuffersBIL();
220  std::vector<BufferManager *> GetBuffersBIP();
221 
223  double p_outputMiddle;
226 
227  std::vector<double> p_inputMinimum;
230  std::vector<double> p_inputMiddle;
234  std::vector<double> p_inputMaximum;
240 
243  std::vector<Stretch *> p_str;
247  double p_Null;
248  double p_Lis;
250  double p_Lrs;
252  double p_His;
254  double p_Hrs;
257  bool p_Null_Set;
259  bool p_Lis_Set;
261  bool p_Lrs_Set;
263  bool p_His_Set;
265  bool p_Hrs_Set;
268  private:
270  void isisOut8(Buffer &in, std::ofstream &fout);
271 
273  void isisOut16s(Buffer &in, std::ofstream &fout);
274 
276  void isisOut16u(Buffer &in, std::ofstream &fout);
277 
280  void isisOut32(Buffer &in, std::ofstream &fout);
281 
284  void isisOut64(Buffer &in, std::ofstream &fout);
285 
289  void InitProcess();
290 
291 
292  };
293 };
294 
295 #endif
Buffer for reading and writing cube data.
Definition: Buffer.h:68
virtual ~ProcessExport()
Destructor.
Definition: ProcessExport.cpp:67
void ProcessCubes(const Functor &functor)
Definition: ProcessExport.h:175
void SetOutputLis(const double value)
Set output special pixel value for LIS.
Definition: ProcessExport.cpp:493
bool p_His_Set
Indicates whether p_His has been set (i.e.
Definition: ProcessExport.h:263
Process class for exporting cubes.
Definition: ProcessExport.h:116
void SetOutputHis(const double value)
Set output special pixel value for HIS.
Definition: ProcessExport.cpp:523
double GetInputMaximum(unsigned int n=0) const
Get the valid maximum pixel value for the Nth input cube.
Definition: ProcessExport.cpp:431
void SetOutputNull(const double value)
Set output special pixel value for NULL.
Definition: ProcessExport.cpp:478
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:896
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:239
bool p_Null_Set
Indicates whether p_Null has been set (i.e.
Definition: ProcessExport.h:257
ExportFormat p_format
Current storage order.
Definition: ProcessExport.h:215
double p_His
The output value for pixels whose input DNs are High Instrument Saturation values.
Definition: ProcessExport.h:252
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:857
double OutputHis()
Return the output special pixel value for HIS.
Definition: ProcessExport.cpp:571
double OutputNull()
Return the output special pixel value for NULL.
Definition: ProcessExport.cpp:547
double GetOutputMaximum()
Get the valid maximum pixel value to be written to the output file.
Definition: ProcessExport.h:165
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:1181
double OutputLrs()
Return the output special pixel value for LRS.
Definition: ProcessExport.cpp:563
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:227
double OutputHrs()
Return the output special pixel value for HRS.
Definition: ProcessExport.cpp:579
void SetOutputRange(const double minimum, const double maximum)
Set output pixel range in Buffer.
Definition: ProcessExport.cpp:456
Compressed JPEG2000.
Definition: ProcessExport.h:125
virtual void StartProcess(void funct())
In the base class, this method will invoked a user-specified function exactly one time...
Definition: Process.h:227
bool p_Lrs_Set
Indicates whether p_Lrs has been set (i.e.
Definition: ProcessExport.h:261
EndianSwapper * p_endianSwap
Object to swap the endianness of the raw output to either MSB or LSB.
Definition: ProcessExport.h:237
double p_Lrs
The output value for pixels whose input DNs are Low Representation Saturation values.
Definition: ProcessExport.h:250
double GetOutputMinimum()
Get the valid minimum pixel value to be written to the output file.
Definition: ProcessExport.h:161
void SetOutputType(Isis::PixelType pixelIn)
Set output pixel bit type in Buffer.
Definition: ProcessExport.cpp:610
double p_Null
The output value for pixels whose input DNs are Null values.
Definition: ProcessExport.h:247
void SetInputRange()
Set input pixel range from user.
Definition: ProcessExport.cpp:366
double p_Hrs
The output value for pixels whose input DNs are High Representation Saturation values.
Definition: ProcessExport.h:254
bool p_Lis_Set
Indicates whether p_Lis has been set (i.e.
Definition: ProcessExport.h:259
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:234
void SetOutputHrs(const double value)
Set output special pixel value for HRS.
Definition: ProcessExport.cpp:538
void setFormat(ExportFormat format)
Sets the storage order of the output file.
Definition: ProcessExport.h:170
bool HasInputRange() const
Definition: ProcessExport.cpp:414
Byte swapper.
Definition: EndianSwapper.h:54
virtual void StartProcess(void funct(Isis::Buffer &in))
This method invokes the process operation over a single input cube.
Definition: ProcessExport.cpp:742
double GetInputMinimum(unsigned int n=0) const
Get the valid minimum pixel value for the Nth input cube.
Definition: ProcessExport.cpp:420
double p_outputMinimum
Desired minimum pixel value in the Buffer.
Definition: ProcessExport.h:222
double p_outputMiddle
Middle pixel value (minimum+maximun)/2.0 in the Buffer.
Definition: ProcessExport.h:223
double p_outputMaximum
Desired maximum pixel value in the Buffer.
Definition: ProcessExport.h:225
Band interleaved by pixel.
Definition: ProcessExport.h:124
ProcessExport()
Constructs an Export object.
Definition: ProcessExport.cpp:40
Isis::Progress * p_progress
Pointer to a Progress object.
Definition: Process.h:159
Band interleaved by line.
Definition: ProcessExport.h:123
bool p_Hrs_Set
Indicates whether p_Hrs has been set (i.e.
Definition: ProcessExport.h:265
std::vector< BufferManager * > GetBuffers()
Definition: ProcessExport.cpp:822
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:934
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:230
double OutputLis()
Return the output special pixel value for LIS.
Definition: ProcessExport.cpp:555
void SetOutputLrs(const double value)
Set output special pixel value for LRS.
Definition: ProcessExport.cpp:508
ExportFormat
Storage order enumeration.
Definition: ProcessExport.h:121
PixelType p_pixelType
The bits per pixel of the output image.
Definition: ProcessExport.h:241
Base class for all cube processing derivatives.
Definition: Process.h:157
void SetOutputEndian(enum ByteOrder endianness)
Set byte endianness of the output cube.
Definition: ProcessExport.cpp:651
double p_Lis
The output value for pixels whose input DNs are Low Instrument Saturation values. ...
Definition: ProcessExport.h:248
Band sequential.
Definition: ProcessExport.h:122
std::vector< Stretch * > p_str
Stretch object to ensure a reasonable range of pixel values in the output data.
Definition: ProcessExport.h:243
std::vector< Isis::Cube * > InputCubes
A vector of pointers to opened Cube objects.
Definition: Process.h:199

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:04