40 ProcessExport::ProcessExport() : Isis::
Process() {
71 for(
unsigned int i = 0; i <
p_str.size(); i++) {
101 double middle = (minimum + maximum) / 2.0;
130 double middle = (minimum + maximum) / 2.0;
161 const double maximum) {
162 if(minimum >= middle) {
164 "minimum must be less than the middle [ProcessExport::SetInputRange]";
167 if(middle >= maximum) {
169 "middle must be less than the maximum [ProcessExport::SetInputRange]";
209 const double maximum,
const int index) {
210 if(minimum >= middle) {
212 "minimum must be less than the middle [ProcessExport::SetInputRange]";
215 if(middle >= maximum) {
217 "middle must be less than the maximum [ProcessExport::SetInputRange]";
220 if(index >= (
int)
InputCubes.size() || index < 0) {
222 "index out of bounds";
371 for(
unsigned int i = 0; i <
InputCubes.size(); i++) {
374 if(strType ==
"MANUAL") {
382 else if(strType !=
"NONE") {
394 if(strType ==
"PIECEWISE") {
414 bool ProcessExport::HasInputRange()
const {
423 "There is no input minimum for channel " +
IString((
int) n),
434 "There is no input maximum for channel " +
IString((
int) n),
457 if(minimum >= maximum) {
459 "minimum must be less than the maximum [ProcessExport::SetOutputRange]";
613 if(p_format < 0 || p_format > 3) {
615 "Format of the output file must be set prior to calling this method [ProcessExport::SetOutputType]";
618 if(pixelIn == Isis::UnsignedByte)
620 else if(pixelIn == Isis::UnsignedWord)
622 else if(pixelIn == Isis::SignedWord)
624 else if(pixelIn == Isis::Real)
627 "Unsupported bit type for JP2 formatted files [ProcessExport::SetOutputType]";
635 "Unsupported bit type [ProcessExport::SetOutputType]";
656 if(byteOrderIn == Isis::NoByteOrder) {
659 else if(byteOrderIn == Isis::Lsb) {
662 else if(byteOrderIn == Isis::Msb) {
680 string m =
"You have not specified any input cubes";
700 for(
unsigned int i = 0; i <
InputCubes.size(); i++) {
756 string m =
"Invalid storage order.";
765 for(
int i = 0; i < buff->
size(); i++) {
766 (*buff)[i] =
p_str[0]->Map((*buff)[i]);
798 vector<BufferManager *> imgrs = GetBuffers();
799 for (
int k = 1; k <= length; k++) {
800 vector<Buffer *> ibufs;
802 for (
unsigned int j = 0; j <
InputCubes.size(); j++) {
807 for (
int i = 0; i <
InputCubes[0]->sampleCount(); i++)
808 (*imgrs[j])[i] =
p_str[j]->Map((*imgrs[j])[i]);
810 ibufs.push_back(imgrs[j]);
816 for (
unsigned int i = 0; i < imgrs.size(); i++) imgrs[i]->next();
822 vector<BufferManager *> ProcessExport::GetBuffers() {
824 vector<BufferManager *> imgrs;
835 string m =
"Invalid storage order.";
861 vector<BufferManager *> imgrs;
862 for (
unsigned int i = 0; i <
InputCubes.size(); i++) {
863 if((
InputCubes[i]->sampleCount() == samples) &&
868 imgrs.push_back(iline);
871 string m =
"All input cubes must have the same dimensions";
900 vector<BufferManager *> imgrs;
901 for (
unsigned int i = 0; i <
InputCubes.size(); i++) {
902 if ((
InputCubes[i]->sampleCount() == samples) &&
907 imgrs.push_back(iline);
910 string m =
"All input cubes must have the same dimensions";
938 vector<BufferManager *> imgrs;
939 for(
unsigned int i = 0; i <
InputCubes.size(); i++) {
943 imgrs.push_back(iband);
946 string m =
"All input cubes must have the same dimensions";
983 string m =
"Output stream cannot be generated for requested storage order type.";
992 for(
int i = 0; i < buff->
size(); i++) {
993 (*buff)[i] =
p_str[0]->Map((*buff)[i]);
1027 char *out8 =
new char[in.
size()];
1028 for(
int samp = 0; samp < in.
size(); samp++) {
1029 double pixel = in[samp];
1033 else if(pixel >= 255.0) {
1037 out8[samp] = (char)(in[samp] + 0.5);
1040 fout.write(out8, in.
size());
1064 short *out16s =
new short[in.
size()];
1065 for(
int samp = 0; samp < in.
size(); samp++) {
1066 double pixel = in[samp];
1068 if(pixel <= -32768.0) {
1069 tempShort = -(short)32768;
1071 else if(pixel >= 32767.0) {
1072 tempShort = (short)32767;
1076 if(in[samp] < 0.0) {
1077 tempShort = (short)(in[samp] - 0.5);
1080 tempShort = (short)(in[samp] + 0.5);
1083 void *p_swap = &tempShort;
1086 fout.write((
char *)out16s, in.
size() * 2);
1110 unsigned short *out16u =
new unsigned short[in.
size()];
1111 for(
int samp = 0; samp < in.
size(); samp++) {
1112 double pixel = in[samp];
1113 unsigned short tempShort;
1117 else if(pixel >= 65535.0) {
1121 tempShort = (
unsigned short)(in[samp] + 0.5);
1123 unsigned short *p_swap = &tempShort;
1127 fout.write((
char *)out16u, in.
size() * 2);
1150 int *out32 =
new int[in.
size()];
1151 for(
int samp = 0; samp < in.
size(); samp++) {
1152 double pixel = in[samp];
1154 if(pixel <= -((
double)FLT_MAX)) {
1155 tempFloat = -((double)FLT_MAX);
1157 else if(pixel >= (
double)FLT_MAX) {
1158 tempFloat = (double)FLT_MAX;
1161 tempFloat = (double)in[samp];
1163 void *p_swap = &tempFloat;
1166 fout.write((
char *)out32, in.
size() * 4);
1186 os.open(worldFile.toLatin1().data(), ios::out);
1189 os << std::fixed << setprecision(15)
1196 os << std::fixed << setprecision(15)
1200 os << std::fixed << setprecision(15)
1201 << proj->
XCoord() << endl;
1204 os << std::fixed << setprecision(15)
1205 << proj->
YCoord() << endl;
Buffer for reading and writing cube data.
virtual ~ProcessExport()
Destructor.
void SetMaximumSteps(const int steps)
This sets the maximum number of steps in the process.
void isisOut16s(Buffer &in, std::ofstream &fout)
Method for writing 16-bit signed pixel data to a file stream.
bool end() const
Returns true if the shape buffer has accessed the end of the cube.
static UserInterface & GetUserInterface()
Returns the UserInterface object.
void SetOutputLis(const double value)
Set output special pixel value for LIS.
bool p_His_Set
Indicates whether p_His has been set (i.e.
void SetOutputHis(const double value)
Set output special pixel value for HIS.
double Percent(const double percent) const
Computes and returns the value at X percent of the histogram.
double GetInputMaximum(unsigned int n=0) const
Get the valid maximum pixel value for the Nth input cube.
void SetOutputNull(const double value)
Set output special pixel value for NULL.
std::vector< BufferManager * > GetBuffersBIL()
A single line of input data from each input cube will be passed to the line processing function...
double XCoord() const
This returns the projection X provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
ByteOrder
Tests the current architecture for byte order.
ByteOrder p_endianType
The byte order of the output file.
bool p_Null_Set
Indicates whether p_Null has been set (i.e.
unsigned short int UnsignedShortInt(void *buf)
Swaps an unsigned short integer value.
ExportFormat p_format
Current storage order.
double p_His
The output value for pixels whose input DNs are High Instrument Saturation values.
std::vector< BufferManager * > GetBuffersBSQ()
A single line of input data from each input cube will be passed to the line processing function...
double OutputHis()
Return the output special pixel value for HIS.
bool IsValidPixel(const double d)
Returns if the input pixel is valid.
double OutputNull()
Return the output special pixel value for NULL.
void isisOut8(Buffer &in, std::ofstream &fout)
Method for writing 8-bit unsigned pixel data to a file stream.
This error is for when a programmer made an API call that was illegal.
void CheckStatus()
Checks and updates the status.
PixelType
Enumerations for Isis Pixel Types.
void CreateWorldFile(const QString &worldFile)
Create a standard world file for the input cube.
double OutputLrs()
Return the output special pixel value for LRS.
std::vector< double > p_inputMinimum
Minimum pixel value in the input cube to be mapped to the minimum value in the Buffer.
bool begin()
Moves the shape buffer to the first position.
double OutputHrs()
Return the output special pixel value for HRS.
Buffer manager, for moving through a cube in lines.
void SetOutputRange(const double minimum, const double maximum)
Set output pixel range in Buffer.
Base class for Map Projections.
double GetDouble(const QString ¶mName) const
Allows the retrieval of a value for a parameter of type "double".
bool p_Lrs_Set
Indicates whether p_Lrs has been set (i.e.
EndianSwapper * p_endianSwap
Object to swap the endianness of the raw output to either MSB or LSB.
double p_Lrs
The output value for pixels whose input DNs are Low Representation Saturation values.
void SetOutputType(Isis::PixelType pixelIn)
Set output pixel bit type in Buffer.
double p_Null
The output value for pixels whose input DNs are Null values.
Container of a cube histogram.
void SetText(const QString &text)
Changes the value of the text string reported just before 0% processed.
Manages a Buffer over a cube.
void SetInputRange()
Set input pixel range from user.
double Resolution() const
This method returns the resolution for mapping world coordinates into projection coordinates.
double p_Hrs
The output value for pixels whose input DNs are High Representation Saturation values.
bool p_Lis_Set
Indicates whether p_Lis has been set (i.e.
std::vector< double > p_inputMaximum
Maximum pixel value in the input cube to be mapped to the maximum value in the Buffer.
#define _FILEINFO_
Macro for the filename and line number.
void SetOutputHrs(const double value)
Set output special pixel value for HRS.
bool next()
Moves the shape buffer to the next position.
void setFormat(ExportFormat format)
Sets the storage order of the output file.
bool IsLsb()
Return true if this host is an LSB first machine and false if it is not.
void isisOut32(Buffer &in, std::ofstream &fout)
Method for writing 32-bit signed floating point pixels data to a file stream.
virtual void StartProcess(void funct(Isis::Buffer &in))
This method invokes the process operation over a single input cube.
void InitProcess()
Convenience method that checks to make sure the user is only using valid input to the StartProcess m...
double GetInputMinimum(unsigned int n=0) const
Get the valid minimum pixel value for the Nth input cube.
void Clear(const QString ¶mName)
Clears the value(s) in the named parameter.
double p_outputMinimum
Desired minimum pixel value in the Buffer.
Buffer manager, for moving through a cube in bands.
double p_outputMiddle
Middle pixel value (minimum+maximun)/2.0 in the Buffer.
double p_outputMaximum
Desired maximum pixel value in the Buffer.
Band interleaved by pixel.
double YCoord() const
This returns the projection Y provided SetGround, SetCoordinate, SetUniversalGround, or SetWorld returned with success.
bool SetWorld(const double x, const double y)
This method is used to set a world coordinate.
int size() const
Returns the total number of pixels in the shape buffer.
Isis::Progress * p_progress
Pointer to a Progress object.
QString GetString(const QString ¶mName) const
Allows the retrieval of a value for a parameter of type "string".
Band interleaved by line.
Adds specific functionality to C++ strings.
bool p_Hrs_Set
Indicates whether p_Hrs has been set (i.e.
int ExportFloat(void *buf)
Swaps a floating point value for Exporting.
short int ShortInt(void *buf)
Swaps a short integer value.
std::vector< BufferManager * > GetBuffersBIP()
A single band of input data from each input cube will be passed to the band processing function...
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...
double OutputLis()
Return the output special pixel value for LIS.
void SetOutputLrs(const double value)
Set output special pixel value for LRS.
double Median() const
Returns the median.
void isisOut16u(Buffer &in, std::ofstream &fout)
Method for writing 16-bit unsigned pixel data to a file stream.
PixelType p_pixelType
The bits per pixel of the output image.
Base class for all cube processing derivatives.
void SetOutputEndian(enum ByteOrder endianness)
Set byte endianness of the output cube.
void PutDouble(const QString ¶mName, const double &value)
Allows the insertion of a value for a parameter of type "double".
double p_Lis
The output value for pixels whose input DNs are Low Instrument Saturation values. ...
std::vector< Stretch * > p_str
Stretch object to ensure a reasonable range of pixel values in the output data.
std::vector< Isis::Cube * > InputCubes
A vector of pointers to opened Cube objects.