48 ProcessImport::ProcessImport() : Isis::
Process() {
100 for(
unsigned int j = 0; j <
p_dataPre.size(); j++) {
102 for(
unsigned int i = 0; i < temp.size(); i++)
delete [] temp[i];
105 for(
unsigned int j = 0; j <
p_dataPost.size(); j++) {
107 for(
unsigned int i = 0; i < temp.size(); i++)
delete [] temp[i];
126 if ((type == Isis::Double) || (type == Isis::Real) || (type == Isis::SignedWord) ||
127 (type == Isis::UnsignedWord) || (type == Isis::UnsignedByte)) {
131 QString msg =
"Unsupported pixel type [" +
151 if (ns > 0 && nl > 0 && nb > 0) {
157 QString msg =
"Illegal dimension [" +
toString(ns) +
", " +
200 QString msg =
"Illegal file header size [" +
toString(bytes) +
"]";
230 QString msg =
"Illegal file trailer size [" +
toString(bytes) +
"]";
259 QString msg =
"Illegal data header size [" +
toString(bytes) +
"]";
290 QString msg =
"Illegal data trailer size [" +
toString(bytes) +
"]";
320 QString msg =
"Illegal data prefix size [" +
toString(bytes) +
"]";
350 QString msg =
"Illegal data suffix size [" +
toString(bytes) +
"]";
375 QString msg =
"File header bytes equals 0. There is nothing to save. "
376 "Use SetFileHeaderBytes() first.";
402 QString msg =
"File trailer bytes equals 0. There is nothing to save. "
403 "Use SetFileTrailerBytes() first.";
431 QString msg =
"Data header bytes equals 0. There is nothing to save. "
432 "Use SetDataHeaderBytes() first.";
460 QString msg =
"Data trailer bytes equals 0. There is nothing to save. "
461 "Use SetDataTrailerBytes() first.";
488 QString msg =
"Data prefix bytes equals 0. There is nothing to save. "
489 "Use SetDataPrefixBytes() first.";
517 QString msg =
"Data suffix bytes equals 0. There is nothing to save. "
518 "Use SetDataSuffixBytes() first.";
596 QString msg =
"File header was not saved. Use SaveFileHeader().";
622 QString msg =
"File trailer was not saved. Use SaveFileTrailer()";
650 QString msg =
"Data header was not saved. Use SaveDataHeader()";
678 QString msg =
"Data trailer was not saved. Use SaveDataTrailer()";
706 QString msg =
"Data prefix was not saved. Use SaveDataPrefix()";
734 QString msg =
"Data suffix was not saved. Use SaveDataSuffix()";
821 const double lis,
const double hrs,
927 if (pixelMin == DBL_MAX || pixelMax == -DBL_MAX)
return;
932 (pixelMin < p_null_min && pixelMax >
p_null_max))) {
934 QString msg =
"The " + pixelName +
" range [" +
toString(pixelMin) +
935 "," +
toString(pixelMax) +
"] overlaps the NULL range [" +
943 (pixelMin < p_lrs_min && pixelMax >
p_lrs_max))) {
944 QString msg =
"The " + pixelName +
" range [" +
toString(pixelMin) +
945 "," +
toString(pixelMax) +
"] overlaps the LRS range [" +
953 (pixelMin < p_lis_min && pixelMax >
p_lis_max))) {
954 QString msg =
"The " + pixelName +
" range [" +
toString(pixelMin) +
955 "," +
toString(pixelMax) +
"] overlaps the LIS range [" +
963 (pixelMin < p_hrs_min && pixelMax >
p_hrs_max))) {
964 QString msg =
"The " + pixelName +
" range [" +
toString(pixelMin) +
965 "," +
toString(pixelMax) +
"] overlaps the HRS range [" +
973 (pixelMin < p_his_min && pixelMax >
p_his_max))) {
974 QString msg =
"The " + pixelName +
" range [" +
toString(pixelMin) +
975 "," +
toString(pixelMax) +
"] overlaps the HIS range [" +
995 if (pixel <= p_null_max && pixel >=
p_null_min) {
998 else if (pixel <= p_hrs_max && pixel >=
p_hrs_min) {
999 return Isis::HIGH_REPR_SAT8;
1001 else if (pixel <= p_lrs_max && pixel >=
p_lrs_min) {
1002 return Isis::LOW_REPR_SAT8;
1004 else if (pixel <= p_his_max && pixel >=
p_his_min) {
1005 return Isis::HIGH_INSTR_SAT8;
1007 else if (pixel <= p_lis_max && pixel >=
p_lis_min) {
1008 return Isis::LOW_INSTR_SAT8;
1035 min = Isis::VALID_MIN4;
1036 max = Isis::VALID_MAX4;
1040 max = Isis::VALID_MAX2 *
p_mult[0] + p_base[0];
1044 max = Isis::VALID_MAXU2 *
p_mult[0] + p_base[0];
1048 max = Isis::VALID_MAX1 *
p_mult[0] + p_base[0];
1051 QString msg =
"Unsupported pixel type [" +
1110 +
"] is not in a supported organization.";
1139 QString msg =
"File [" +
p_inFile +
"] is not in a supported organization.";
1159 readBytes = readBytes *
p_ns;
1160 char *in =
new char [readBytes];
1164 tok = tok.toUpper();
1170 QString inFileName(inFile.expanded());
1171 fin.open(inFileName.toAscii().data(), ios::in | ios::binary);
1172 if (!fin.is_open()) {
1173 QString msg =
"Cannot open input file [" +
p_inFile +
"]";
1178 streampos pos = fin.tellg();
1189 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1190 toString((
int)pos) +
"]. Byte count [" +
1198 if (funct != NULL) {
1210 for(
int band = 0; band <
p_nb; band++) {
1234 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1235 toString((
int)pos) +
"]. Byte count [" +
1241 vector<char *> tempPre, tempPost;
1244 for(
int line = 0; line <
p_nl; line++) {
1258 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1259 toString((
int)pos) +
"]. Byte count [" +
1267 fin.read(in, readBytes);
1269 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1270 toString((
int)pos) +
"]. Byte count [" +
1277 for(
int samp = 0; samp <
p_ns; samp++) {
1279 case Isis::UnsignedByte:
1280 (*out)[samp] = (double)((
unsigned char *)in)[samp];
1282 case Isis::UnsignedWord:
1286 case Isis::SignedWord:
1287 (*out)[samp] = (double)swapper.
ShortInt((
short int *)in+samp);
1290 (*out)[samp] = (double)swapper.
Float((
float *)in+samp);
1293 (*out)[samp] = (double)swapper.
Double((
double *)in+samp);
1303 (*out)[samp] = mult * ((*out)[samp]) + base;
1307 if (funct == NULL) {
1333 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1334 toString((
int)pos) +
"]. Byte count [" +
1364 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1365 toString((
int)pos) +
"]. Byte count [" +
1375 fin.seekg(0, ios_base::end);
1376 streampos e = fin.tellg();
1384 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1385 toString((
int)pos) +
"]. Byte count [" +
1412 readBytes = readBytes *
p_ns;
1413 char *in =
new char [readBytes];
1417 tok = tok.toUpper();
1423 QString inFileName(inFile.expanded());
1424 fin.open(inFileName.toAscii().data(), ios::in | ios::binary);
1425 if (!fin.is_open()) {
1426 QString msg =
"Cannot open input file [" +
p_inFile +
"]";
1431 streampos pos = fin.tellg();
1442 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1443 toString((
int)pos) +
"]. Byte count [" +
1451 if (funct != NULL) {
1465 for(
int line = 0; line <
p_nl; line++) {
1467 for(
int band = 0; band <
p_nb; band++) {
1481 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1482 toString((
int)pos) +
"]. Byte count [" +
1488 vector<char *> tempPre, tempPost;
1503 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1504 toString((
int)pos) +
"]. Byte count [" +
1512 fin.read(in, readBytes);
1514 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1515 toString((
int)pos) +
"]. Byte count [" +
1522 for(
int samp = 0; samp <
p_ns; samp++) {
1524 case Isis::UnsignedByte:
1525 (*out)[samp] = (double)((
unsigned char *)in)[samp];
1527 case Isis::UnsignedWord:
1531 case Isis::SignedWord:
1532 (*out)[samp] = (double)swapper.
ShortInt((
short int *)in+samp);
1535 (*out)[samp] = (double)swapper.
Float((
float *)in+samp);
1538 (*out)[samp] = (double)swapper.
Double((
double *)in+samp);
1548 (*out)[samp] = mult * ((*out)[samp]) + base;
1552 if (funct == NULL) {
1575 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1576 toString((
int)pos) +
"]. Byte count [" +
1596 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1597 toString((
int)pos) +
"]. Byte count [" +
1609 fin.seekg(0, ios_base::end);
1610 streampos e = fin.tellg();
1618 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1619 toString((
int)pos) +
"]. Byte count [" +
1647 readBytes = readBytes *
p_ns *
p_nb;
1648 char *in =
new char [readBytes];
1652 tok = tok.toUpper();
1658 QString inFileName(inFile.expanded());
1659 fin.open(inFileName.toAscii().data(), ios::in | ios::binary);
1660 if (!fin.is_open()) {
1661 QString msg =
"Cannot open input file [" +
p_inFile +
"]";
1666 streampos pos = fin.tellg();
1677 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1678 toString((
int)pos) +
"]. Byte count [" +
1688 if (funct != NULL) {
1700 for(
int line = 0; line <
p_nl; line++) {
1703 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1704 toString((
int)pos) +
"]. Byte count [" +
1710 vector<char *> tempPre, tempPost;
1725 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1726 toString((
int)pos) +
"]. Byte count [" +
1733 fin.read(in, readBytes);
1735 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1736 toString((
int)pos) +
"]. Byte count [" +
1742 for(
int band = 0; band <
p_nb; band++) {
1757 for(
int samp = band; samp <
p_ns *
p_nb; samp +=
p_nb) {
1759 case Isis::UnsignedByte:
1760 (*out)[osamp] = (double)((
unsigned char *)in)[samp];
1762 case Isis::UnsignedWord:
1766 case Isis::SignedWord:
1767 (*out)[osamp] = (double)swapper.
ShortInt((
short int *)in+samp);
1770 (*out)[osamp] = (double)swapper.
Float((
float *)in+samp);
1773 (*out)[samp] = (double)swapper.
Double((
double *)in+samp);
1780 (*out)[osamp] =
TestPixel((*out)[osamp]);
1783 (*out)[osamp] = mult * ((*out)[osamp]) + base;
1788 if (funct == NULL) {
1809 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1810 toString((
int)pos) +
"]. Byte count [" +
1830 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1831 toString((
int)pos) +
"]. Byte count [" +
1845 fin.seekg(0, ios_base::end);
1846 streampos e = fin.tellg();
1854 QString msg =
"Cannot read file [" +
p_inFile +
"]. Position [" +
1855 toString((
int)pos) +
"]. Byte count [" +
1894 p_ns = JP2_decoder->GetSampleDimension();
1895 p_nl = JP2_decoder->GetLineDimension();
1896 p_nb = JP2_decoder->GetBandDimension();
1902 int endsamp = startsamp +
p_ns;
1903 int readBytes = sizeofpixel * p_ns *
p_nb
1905 char **in =
new char* [
p_nb];
1906 for(
int i = 0; i <
p_nb; i++) {
1907 in[i] =
new char [readBytes];
1913 if (funct != NULL) {
1925 for(
int line = 0; line <
p_nl; line++) {
1927 JP2_decoder->
Read((
unsigned char **)in);
1930 JP2_decoder->
Read((
short int **)in);
1933 for(
int band = 0; band <
p_nb; band++) {
1946 vector<char *> tempPre, tempPost;
1952 memcpy(&tempPre[0], in[band], p_dataPreBytes);
1957 for(
int samp = startsamp; samp < endsamp; samp++) {
1959 case Isis::UnsignedByte:
1960 (*out)[samp] = (double)((
unsigned char *)in[band])[samp];
1962 case Isis::UnsignedWord:
1963 (*out)[samp] = (double)((
unsigned short int *)in[band])[samp];
1965 case Isis::SignedWord:
1966 (*out)[samp] = (double)((
short int *)in[band])[samp];
1976 (*out)[samp] = mult * ((*out)[samp]) + base;
1980 if (funct == NULL) {
1993 tempPost.push_back(
new char[p_dataPostBytes]);
2028 void ProcessImport::AddLabel(
Isis::Pvl &label) {
2033 output->Find(
"IsisCube");
2034 output->Insert(label);
2043 void ProcessImport::AddImportLabel(
Isis::Pvl &importLab) {
2048 output->Find(
"IsisCube");
2050 output->Insert(importLab);
2066 QString msg =
"File [" + file +
"] does not exist";
2082 QString msg =
"No input file has been set";