55 ProcessImportPds::ProcessImportPds() {
56 p_keepOriginalLabel =
true;
57 p_encodingType = NONE;
59 p_projectionOffsetChange =
false;
60 p_projectionOffsetGroup.setName(
"ProjectionOffsets");
64 p_transDir = (QString) dataDir[
"Base"];
68 ProcessImportPds::~ProcessImportPds() {
75 void ProcessImportPds::EndProcess() {
76 ProcessImportPds::Finalize();
109 p_projection = pdsXlater.
Translate(
"ProjectionName");
112 QString message =
"No projection name in labels";
117 p_targetName = pdsXlater.
Translate(
"TargetName");
120 QString message =
"No target name in labels";
125 str = pdsXlater.
Translate(
"EquatorialRadius");
126 p_equatorialRadius =
toDouble(str) * 1000.0;
129 QString message =
"No equatorial radius name in labels";
134 str = pdsXlater.
Translate(
"PolarRadius");
135 p_polarRadius =
toDouble(str) * 1000.0;
138 QString message =
"No polar radius in labels";
143 p_longitudeDirection = pdsXlater.
Translate(
"LongitudeDirection");
146 p_longitudeDirection = pdsXlater.
Translate(
"LongitudeDirection2");
149 if (p_polarRadius == p_equatorialRadius) {
150 p_latitudeType =
"Planetocentric";
153 p_latitudeType = pdsXlater.
Translate(
"LatitudeType2");
156 p_latitudeType = pdsXlater.
Translate(
"LatitudeType");
160 str = pdsXlater.
Translate(
"MinimumLatitude");
165 p_minimumLatitude = Isis::NULL8;
169 p_minimumLatitude = Isis::NULL8;
173 str = pdsXlater.
Translate(
"MaximumLatitude");
178 p_maximumLatitude = Isis::NULL8;
182 p_maximumLatitude = Isis::NULL8;
187 bool positiveWest =
false;
189 str = pdsXlater.
Translate(
"MinimumLongitude");
195 p_minimumLongitude = Isis::NULL8;
199 str = pdsXlater.
Translate(
"MinimumLongitude2");
204 p_minimumLongitude = Isis::NULL8;
208 p_minimumLongitude = Isis::NULL8;
212 str = pdsXlater.
Translate(
"MaximumLongitude");
218 p_maximumLongitude = Isis::NULL8;
222 str = pdsXlater.
Translate(
"MaximumLongitude2");
227 p_maximumLongitude = Isis::NULL8;
231 p_maximumLongitude = Isis::NULL8;
234 str = pdsXlater.
Translate(
"LongitudeDomain");
235 p_longitudeDomain =
toInt(str);
255 if (positiveWest && (p_longitudeDirection.compare(
"PositiveEast") == 0)) {
256 double tmp = p_minimumLongitude;
257 p_minimumLongitude = p_maximumLongitude;
258 p_maximumLongitude = tmp;
261 if (p_minimumLongitude > p_maximumLongitude) {
263 p_longitudeDomain = 180;
269 if (p_minimumLongitude < 0 || p_maximumLongitude < 0) {
270 p_longitudeDomain = 180;
273 str = pdsXlater.
Translate(
"PixelResolution");
277 if ((str !=
"METERS/PIXEL") && (str !=
"M/PIXEL") && (str !=
"M/PIX")) {
278 p_pixelResolution *= 1000.0;
294 double xoff, yoff, xmult, ymult;
295 GetProjectionOffsetMults(xoff, yoff, xmult, ymult);
298 str = pdsXlater.
Translate(
"LineProjectionOffset");
301 str = pdsXlater.
Translate(
"LineProjectionOffset2");
303 p_lineProjectionOffset =
toDouble(str);
304 p_upperLeftY = ymult * (p_lineProjectionOffset + yoff) * p_pixelResolution;
307 str = pdsXlater.
Translate(
"SampleProjectionOffset");
310 str = pdsXlater.
Translate(
"SampleProjectionOffset2");
312 p_sampleProjectionOffset =
toDouble(str);
313 p_upperLeftX = xmult * (p_sampleProjectionOffset + xoff) * p_pixelResolution;
315 p_projectionOffsetGroup.addKeyword(
PvlKeyword(
"xOffset", QString::number(xoff)));
316 p_projectionOffsetGroup.addKeyword(
PvlKeyword(
"yOffset", QString::number(yoff)));
317 p_projectionOffsetGroup.addKeyword(
PvlKeyword(
"xMultiplier", QString::number(xmult)));
318 p_projectionOffsetGroup.addKeyword(
PvlKeyword(
"yMultiplier", QString::number(ymult)));
328 void ProcessImportPds::Finalize() {
329 if (p_keepOriginalLabel) {
331 for (
unsigned int i = 0; i < OutputCubes.size(); i++) {
332 OutputCubes[i]->write(ol);
342 bool ProcessImportPds::GetProjectionOffsetChange() {
343 return p_projectionOffsetChange;
350 PvlGroup ProcessImportPds::GetProjectionOffsetGroup() {
351 return p_projectionOffsetGroup;
367 void ProcessImportPds::GetProjectionOffsetMults(
double &xoff,
double &yoff,
368 double &xmult,
double &ymult) {
376 Isis::Pvl p(p_transDir +
"/" +
"translations/pdsProjectionLineSampToXY_V2.def");
381 for(
int g = 0; g < projDef.
groups(); g++) {
382 QString key = projDef.
group(g)[
"Keyword"];
383 if (p_pdsLabel.hasKeyword(key)) {
384 QString value = p_pdsLabel[key];
385 QString pattern = projDef.
group(g)[
"Pattern"];
388 if (value.contains(pattern)) {
389 xmult = projDef.
group(g)[
"xMult"];
390 ymult = projDef.
group(g)[
"yMult"];
391 xoff = projDef.
group(g)[
"xOff"];
392 yoff = projDef.
group(g)[
"yOff"];
393 p_projectionOffsetChange =
true;
407 void ProcessImportPds::IdentifySource(
Isis::Pvl &inputLabel) {
411 stringstream trnsStrm;
412 trnsStrm <<
"Group = PdsFile" << endl;
413 trnsStrm <<
" InputPosition = ROOT" << endl;
414 trnsStrm <<
" InputKey = PDS_VERSION_ID" << endl;
415 trnsStrm <<
"EndGroup" << endl;
416 trnsStrm <<
"Group = Isis2File" << endl;
417 trnsStrm <<
" InputPosition = ROOT" << endl;
418 trnsStrm <<
" InputKey = CCSD3ZF0000100000001NJPL3IF0PDS200000001" << endl;
419 trnsStrm <<
"EndGroup" << endl;
444 Table &ProcessImportPds::ImportTable(QString pdsTableName) {
451 int found = isisTableName.lastIndexOf(
"Table");
452 if (found == isisTableName.length() - 5) {
453 isisTableName.remove(found, 5);
457 p_tables.push_back(isisTable);
459 return p_tables.at(p_tables.size() - 1);
471 bool ProcessImportPds::IsIsis2() {
473 if (p_source == ISIS2) {
488 void ProcessImportPds::OmitOriginalLabel() {
489 p_keepOriginalLabel =
false;
500 const bool & calcOffsetOnly) {
504 QString dataFileName;
512 if (dataFilePointer.
size() == 1) {
514 str = pdsXlater.
Translate(
"DataFilePointer");
516 units = dataFilePointer.
unit();
531 else if (dataFilePointer.
size() == 2) {
532 dataFileName = pdsXlater.
Translate(
"DataFilePointer", 0);
534 units = dataFilePointer.
unit(1);
537 else if (dataFilePointer.
size() == 0) {
538 QString msg =
"Data file pointer ^IMAGE or ^QUBE has no value, must" 539 "have either file name or offset or both, in [" +
545 QString msg =
"Improperly formatted data file pointer keyword ^IMAGE or " 546 "^QUBE, in [" + p_labelFile +
"], must contain filename " 547 " or offset or both";
553 if (!calcOffsetOnly) {
558 if (dataFileName.size() != 0 && dataFileName.at(0) ==
'/')
562 dataFile =
FileName(labelFile.
path() +
"/" + dataFileName);
571 dataFileName = dataFileName.toLower();
572 dataFile =
FileName(labelFile.
path() +
"/" + dataFileName);
577 QString msg =
"Unable to find input file [" + tmp +
"] or [" +
585 units = units.trimmed();
586 if (units ==
"BYTES" || units ==
"B") {
587 SetFileHeaderBytes(offset - 1);
590 QString recSize = pdsXlater.
Translate(
"DataFileRecordBytes");
591 SetFileHeaderBytes((offset - 1) *
toInt(recSize));
611 void ProcessImportPds::ProcessLabel(
const QString &pdsDataFile, PdsFileType allowedTypes) {
614 stringstream trnsStrm;
615 trnsStrm <<
"Group = PdsTypeImage" << endl;
616 trnsStrm <<
" InputPosition = ROOT" << endl;
617 trnsStrm <<
" InputPosition = FILE" << endl;
618 trnsStrm <<
" InputPosition = UNCOMPRESSED_FILE" << endl;
619 trnsStrm <<
" InputKey = ^IMAGE" << endl;
620 trnsStrm <<
"EndGroup" << endl;
621 trnsStrm <<
"Group = PdsCombinedSpectrum" << endl;
622 trnsStrm <<
" InputPosition = ROOT" << endl;
623 trnsStrm <<
" InputPosition = FILE" << endl;
624 trnsStrm <<
" InputPosition = UNCOMPRESSED_FILE" << endl;
625 trnsStrm <<
" InputKey = ^COMBINED_SPECTRUM" << endl;
626 trnsStrm <<
"EndGroup" << endl;
627 trnsStrm <<
"Group = PdsTypeL0" << endl;
628 trnsStrm <<
" InputPosition = L0_FILE" << endl;
629 trnsStrm <<
" InputKey = ^L0_IMAGE" << endl;
630 trnsStrm <<
"EndGroup" << endl;
631 trnsStrm <<
"Group = PdsTypeRdn" << endl;
632 trnsStrm <<
" InputPosition = RDN_FILE" << endl;
633 trnsStrm <<
" InputKey = ^RDN_IMAGE" << endl;
634 trnsStrm <<
"EndGroup" << endl;
635 trnsStrm <<
"Group = PdsTypeLoc" << endl;
636 trnsStrm <<
" InputPosition = LOC_FILE" << endl;
637 trnsStrm <<
" InputKey = ^LOC_IMAGE" << endl;
638 trnsStrm <<
"EndGroup" << endl;
639 trnsStrm <<
"Group = PdsTypeObs" << endl;
640 trnsStrm <<
" InputPosition = OBS_FILE" << endl;
641 trnsStrm <<
" InputKey = ^OBS_IMAGE" << endl;
642 trnsStrm <<
"EndGroup" << endl;
643 trnsStrm <<
"Group = PdsTypeQube" << endl;
644 trnsStrm <<
" InputKey = ^QUBE" << endl;
645 trnsStrm <<
"EndGroup" << endl;
646 trnsStrm <<
"Group = PdsTypeSpectralQube" << endl;
647 trnsStrm <<
" InputKey = ^SPECTRAL_QUBE" << endl;
648 trnsStrm <<
"EndGroup" << endl;
649 trnsStrm <<
"Group = PdsEncodingType" << endl;
650 trnsStrm <<
" InputPosition = COMPRESSED_FILE" << endl;
651 trnsStrm <<
" InputKey = ENCODING_TYPE" << endl;
652 trnsStrm <<
" Translation = (*,*)" << endl;
653 trnsStrm <<
"EndGroup" << endl;
654 trnsStrm <<
"Group = PdsCompressedFile" << endl;
655 trnsStrm <<
" InputPosition = COMPRESSED_FILE" << endl;
656 trnsStrm <<
" InputKey = FILE_NAME" << endl;
657 trnsStrm <<
" Translation = (*,*)" << endl;
658 trnsStrm <<
"EndGroup" << endl;
672 if (coreKey[0] ==
"VAX_REAL") {
673 ProcessImport::SetVAXConvert(
true);
684 str = pdsXlater.
Translate(
"PdsEncodingType");
686 p_encodingType = JP2;
687 str = pdsXlater.
Translate(
"PdsCompressedFile");
688 if (pdsDataFile.isEmpty()) {
691 if (ifile.fileExists()) {
695 QString tmp = ifile.expanded();
697 ifile = lfile.
path() +
"/" + str;
698 if (ifile.fileExists()) {
699 p_jp2File = ifile.expanded();
702 QString msg =
"Unable to find input file [" + tmp +
"] or [" +
703 ifile.expanded() +
"]";
710 QString msg =
"Unsupported encoding type in [" + p_labelFile +
"]";
719 ProcessPdsImageLabel(pdsDataFile);
721 else if ((allowedTypes & Qube) == Qube && pdsXlater.
InputHasKeyword(
"PdsTypeQube")) {
723 ProcessPdsQubeLabel(pdsDataFile,
"pdsQube.trn");
725 else if ((allowedTypes & SpectralQube) == SpectralQube &&
728 ProcessPdsQubeLabel(pdsDataFile,
"pdsSpectralQube.trn");
730 else if ((allowedTypes & L0) == L0 && pdsXlater.
InputHasKeyword(
"PdsTypeL0")) {
732 ProcessPdsM3Label(pdsDataFile, L0);
734 else if ((allowedTypes & Rdn) == Rdn && pdsXlater.
InputHasKeyword(
"PdsTypeRdn")) {
736 ProcessPdsM3Label(pdsDataFile, Rdn);
738 else if ((allowedTypes & Loc) == Loc && pdsXlater.
InputHasKeyword(
"PdsTypeLoc")) {
740 ProcessPdsM3Label(pdsDataFile, Loc);
742 else if ((allowedTypes & Obs) == Obs && pdsXlater.
InputHasKeyword(
"PdsTypeObs")) {
744 ProcessPdsM3Label(pdsDataFile, Obs);
746 else if ((allowedTypes & CombinedSpectrum) == CombinedSpectrum &&
749 ProcessPdsCombinedSpectrumLabel(pdsDataFile);
752 QString msg =
"Unknown label type in [" + p_labelFile +
"]. It is possible the label file " 753 +
"does not describe an image product (IMAGE, CUBE, or SPECTRALCUBE).";
759 IdentifySource(p_pdsLabel);
777 void ProcessImportPds::ProcessPdsCombinedSpectrumLabel(
const QString &pdsDataFile) {
778 Isis::FileName transFile(p_transDir +
"/translations/pdsCombinedSpectrum.trn");
783 str = pdsXlater.
Translate(
"CoreLinePrefixBytes");
784 SetDataPrefixBytes(
toInt(str));
786 str = pdsXlater.Translate(
"CoreLineSuffixBytes");
787 SetDataSuffixBytes(
toInt(str));
789 ProcessPixelBitandType(pdsXlater);
791 str = pdsXlater.Translate(
"CoreByteOrder");
792 SetByteOrder(Isis::ByteOrderEnumeration(str));
794 str = pdsXlater.Translate(
"CoreSamples");
796 str = pdsXlater.Translate(
"CoreLines");
798 str = pdsXlater.Translate(
"CoreBands");
801 SetDimensions(ns, nl, nb);
809 if (pdsDataFile.length() > 0) {
810 ProcessDataFilePointer(pdsXlater,
false);
814 else if (p_jp2File.length() > 0) {
815 SetInputFile(p_jp2File);
816 ProcessDataFilePointer(pdsXlater,
true);
822 ProcessDataFilePointer(pdsXlater,
false);
828 str = pdsXlater.Translate(
"CoreBase");
830 str = pdsXlater.Translate(
"CoreMultiplier");
834 str = pdsXlater.Translate(
"CoreOrganization");
836 if (p_encodingType == JP2) {
837 SetOrganization(ProcessImport::JP2);
839 else if (str ==
"BSQ") {
840 SetOrganization(ProcessImport::BSQ);
842 else if (str ==
"BIP") {
843 SetOrganization(ProcessImport::BIP);
845 else if (str ==
"BIL") {
846 SetOrganization(ProcessImport::BIL);
849 QString msg =
"Unsupported axis order [" + str +
"]";
871 void ProcessImportPds::ProcessPdsQubeLabel(
const QString &pdsDataFile,
872 const QString &transFile) {
889 for(
int i = 0; i < val; i++) {
890 str = pdsXlater.Translate(
"CoreOrganization", i);
892 if (str ==
"SAMPLE") {
895 else if (str ==
"LINE") {
898 else if (str ==
"BAND") {
902 QString message =
"Unknown file axis name [" + str +
"]";
907 if (p_encodingType == JP2) {
908 SetOrganization(ProcessImport::JP2);
910 else if (tmp ==
"SAMPLELINEBAND") {
911 SetOrganization(ProcessImport::BSQ);
913 else if (tmp ==
"BANDSAMPLELINE") {
914 SetOrganization(ProcessImport::BIP);
916 else if (tmp ==
"SAMPLEBANDLINE") {
917 SetOrganization(ProcessImport::BIL);
920 PvlKeyword pdsCoreOrg = p_pdsLabel.findKeyword(pdsXlater.
921 InputKeywordName(
"CoreOrganization"), Pvl::Traverse);
923 stringstream pdsCoreOrgStream;
924 pdsCoreOrgStream << pdsCoreOrg;
926 QString msg =
"Unsupported axis order [" + QString(pdsCoreOrgStream.str().c_str()) +
"]";
933 SetDataPrefixBytes(0);
936 str = pdsXlater.Translate(
"SuffixItemSize");
937 int suffix =
toInt(str);
938 str = pdsXlater.Translate(
"AxisSuffixCount", 0);
939 suffix *=
toInt(str);
940 SetDataSuffixBytes(suffix);
942 str = pdsXlater.Translate(
"SuffixItemSize");
945 if (DataTrailerBytes() == 0) {
946 int trailer =
toInt(str);
947 str = pdsXlater.Translate(
"AxisSuffixCount", 1);
948 trailer *=
toInt(str);
949 str = pdsXlater.Translate(
"CoreSamples", samplePos);
950 trailer *=
toInt(str);
952 SetDataTrailerBytes(trailer);
956 if (DataTrailerBytes() != 0) {
960 ProcessPixelBitandType(pdsXlater);
965 str = pdsXlater.Translate(
"CoreByteOrder");
967 SetByteOrder(Isis::ByteOrderEnumeration(str));
979 str = pdsXlater.Translate(
"CoreSamples", samplePos);
981 str = pdsXlater.Translate(
"CoreLines", linePos);
983 str = pdsXlater.Translate(
"CoreBands", bandPos);
985 SetDimensions(ns, nl, nb);
989 ProcessSpecialPixels(pdsXlater,
true);
997 if (pdsDataFile.length() > 0) {
998 SetInputFile(pdsDataFile);
999 ProcessDataFilePointer(pdsXlater,
true);
1003 else if (p_jp2File.length() > 0) {
1004 SetInputFile(p_jp2File);
1005 ProcessDataFilePointer(pdsXlater,
true);
1009 ProcessDataFilePointer(pdsXlater,
false);
1017 if ((pdsXlater.InputHasKeyword(
"BandBase")) &&
1018 (pdsXlater.InputHasKeyword(
"BandMultiplier"))) {
1019 vector<double> bases;
1020 vector<double> mults;
1021 for(
int i = 0; i < pdsXlater.InputKeyword(
"BandBase").size(); i++) {
1022 str = pdsXlater.Translate(
"BandBase", i);
1024 str = pdsXlater.Translate(
"BandMultiplier", i);
1028 SetMultiplier(mults);
1031 str = pdsXlater.Translate(
"CoreBase");
1033 str = pdsXlater.Translate(
"CoreMultiplier");
1050 void ProcessImportPds::ProcessPdsImageLabel(
const QString &pdsDataFile) {
1051 Isis::FileName transFile(p_transDir +
"/translations/pdsImage.trn");
1056 str = pdsXlater.
Translate(
"CoreLinePrefixBytes");
1057 SetDataPrefixBytes(
toInt(str));
1059 str = pdsXlater.Translate(
"CoreLineSuffixBytes");
1060 SetDataSuffixBytes(
toInt(str));
1062 ProcessPixelBitandType(pdsXlater);
1064 str = pdsXlater.Translate(
"CoreByteOrder");
1065 SetByteOrder(Isis::ByteOrderEnumeration(str));
1067 str = pdsXlater.Translate(
"CoreSamples");
1068 int ns =
toInt(str);
1069 str = pdsXlater.Translate(
"CoreLines");
1070 int nl =
toInt(str);
1071 str = pdsXlater.Translate(
"CoreBands");
1072 int nb =
toInt(str);
1074 SetDimensions(ns, nl, nb);
1077 ProcessSpecialPixels(pdsXlater,
false);
1085 if (pdsDataFile.length() > 0) {
1086 SetInputFile(pdsDataFile);
1087 ProcessDataFilePointer(pdsXlater,
true);
1091 else if (p_jp2File.length() > 0) {
1092 SetInputFile(p_jp2File);
1093 ProcessDataFilePointer(pdsXlater,
true);
1099 ProcessDataFilePointer(pdsXlater,
false);
1105 str = pdsXlater.Translate(
"CoreBase");
1107 str = pdsXlater.Translate(
"CoreMultiplier");
1111 str = pdsXlater.Translate(
"CoreOrganization");
1113 if (p_encodingType == JP2) {
1114 SetOrganization(ProcessImport::JP2);
1116 else if (str ==
"BSQ") {
1117 SetOrganization(ProcessImport::BSQ);
1119 else if (str ==
"BIP") {
1120 SetOrganization(ProcessImport::BIP);
1122 else if (str ==
"BIL") {
1123 SetOrganization(ProcessImport::BIL);
1126 QString msg =
"Unsupported axis order [" + str +
"]";
1138 str = pdsXlater.
Translate(
"CoreBitsPerPixel");
1139 int bitsPerPixel =
toInt(str);
1140 str = pdsXlater.
Translate(
"CorePixelType");
1142 if ((str ==
"Real") && (bitsPerPixel == 64)) {
1144 SetPixelType(Isis::Double);
1146 else if ((str ==
"Real") && (bitsPerPixel == 32)) {
1147 SetPixelType(Isis::Real);
1149 else if ((str ==
"Integer") && (bitsPerPixel == 8)) {
1150 SetPixelType(Isis::UnsignedByte);
1152 else if ((str ==
"Integer") && (bitsPerPixel == 16)) {
1153 SetPixelType(Isis::SignedWord);
1155 else if ((str ==
"Integer") && (bitsPerPixel == 32)) {
1156 SetPixelType(Isis::SignedInteger);
1158 else if ((str ==
"Natural") && (bitsPerPixel == 8)) {
1159 SetPixelType(Isis::UnsignedByte);
1161 else if ((str ==
"Natural") && (bitsPerPixel == 16)) {
1162 SetPixelType(Isis::UnsignedWord);
1164 else if ((str ==
"Natural") && (bitsPerPixel == 16)) {
1165 SetPixelType(Isis::SignedWord);
1167 else if ((str ==
"Natural") && (bitsPerPixel == 32)) {
1168 SetPixelType(Isis::UnsignedInteger);
1172 QString msg =
"Invalid PixelType and BitsPerPixel combination [" + str +
1173 ", " +
toString(bitsPerPixel) +
"]";
1190 void ProcessImportPds::ProcessPdsM3Label(
const QString &pdsDataFile, PdsFileType fileType) {
1192 if (fileType == L0) {
1193 transFile = p_transDir +
"/translations/pdsL0.trn";
1195 else if (fileType == Rdn) {
1196 transFile = p_transDir +
"/translations/pdsRdn.trn";
1198 else if (fileType == Loc) {
1199 transFile = p_transDir +
"/translations/pdsLoc.trn";
1201 else if (fileType == Obs) {
1202 transFile = p_transDir +
"/translations/pdsObs.trn";
1205 throw IException(IException::Programmer,
"ProcessImportPds::ProcessPdsM3Label can only be " 1206 "called with file type of L0, Rdn, Loc or Obs.",
_FILEINFO_);
1214 str = pdsXlater.
Translate(
"CoreLinePrefixBytes");
1215 SetDataHeaderBytes(
toInt(str));
1217 str = pdsXlater.Translate(
"CoreLineSuffixBytes");
1218 SetDataSuffixBytes(
toInt(str));
1220 ProcessPixelBitandType(pdsXlater);
1222 str = pdsXlater.Translate(
"CoreByteOrder");
1223 SetByteOrder(Isis::ByteOrderEnumeration(str));
1225 str = pdsXlater.Translate(
"CoreSamples");
1226 int ns =
toInt(str);
1227 str = pdsXlater.Translate(
"CoreLines");
1228 int nl =
toInt(str);
1229 str = pdsXlater.Translate(
"CoreBands");
1230 int nb =
toInt(str);
1231 SetDimensions(ns, nl, nb);
1234 ProcessSpecialPixels(pdsXlater,
false);
1242 if (pdsDataFile.length() > 0) {
1243 SetInputFile(pdsDataFile);
1244 ProcessDataFilePointer(pdsXlater,
true);
1248 else if (p_jp2File.length() > 0) {
1249 SetInputFile(p_jp2File);
1250 ProcessDataFilePointer(pdsXlater,
true);
1256 ProcessDataFilePointer(pdsXlater,
false);
1262 str = pdsXlater.Translate(
"CoreBase");
1264 str = pdsXlater.Translate(
"CoreMultiplier");
1268 str = pdsXlater.Translate(
"CoreOrganization");
1270 if (p_encodingType == JP2) {
1271 SetOrganization(ProcessImport::JP2);
1273 else if (str ==
"BSQ") {
1274 SetOrganization(ProcessImport::BSQ);
1276 else if (str ==
"BIP") {
1277 SetOrganization(ProcessImport::BIP);
1279 else if (str ==
"BIL") {
1280 SetOrganization(ProcessImport::BIL);
1283 QString msg =
"Unsupported axis order [" + str +
"]";
1295 double pdsNull = Isis::NULL8;
1298 if (str !=
"NULL") {
1304 if (str !=
"NULL") {
1312 if (str !=
"NULL") {
1318 if (str !=
"NULL") {
1326 if (str !=
"NULL") {
1332 if (str !=
"NULL") {
1340 if (str !=
"NULL") {
1346 if (str !=
"NULL") {
1354 if (str !=
"NULL") {
1360 if (str !=
"NULL") {
1365 SetSpecialValues(pdsNull, pdsLrs, pdsLis, pdsHrs, pdsHis);
1383 void ProcessImportPds::SetPdsFile(
const Isis::Pvl &pdsLabelPvl,
1384 const QString &pdsDataFile,
1385 PdsFileType allowedTypes) {
1388 p_pdsLabel = pdsLabelPvl;
1389 p_labelFile = pdsDataFile;
1390 ProcessLabel(pdsDataFile, allowedTypes);
1411 void ProcessImportPds::SetPdsFile(
const QString &pdsLabelFile,
1412 const QString &pdsDataFile,
1414 PdsFileType allowedTypes) {
1418 pdsLabel.
read(pdsLabelFile);
1422 QObject::tr(
"This image does not contain a pds label. You will need an " 1423 "image with a PDS label or a detached PDS label for this " 1428 p_pdsLabel = pdsLabel;
1429 p_labelFile = pdsLabelFile;
1430 ProcessLabel(pdsDataFile, allowedTypes);
1437 void ProcessImportPds::StartProcess() {
1438 ProcessImport::StartProcess();
1439 for (
unsigned int i = 0; i < p_tables.size(); i++) {
1440 OutputCubes[0]->write(p_tables[i]);
1457 ProcessImport::StartProcess(funct);
1469 void ProcessImportPds::TranslateIsis2BandBin(
Isis::Pvl &lab) {
1472 QString transDir = (QString) dataDir[
"Base"];
1474 Isis::FileName transFile(transDir +
"/" +
"translations/isis2bandbin.trn");
1478 isis2Xlater.
Auto(lab);
1488 void ProcessImportPds::TranslateIsis2Instrument(
Isis::Pvl &lab) {
1491 QString transDir = (QString) dataDir[
"Base"];
1492 Isis::FileName transFile(transDir +
"/" +
"translations/isis2instrument.trn");
1496 isis2Xlater.
Auto(lab);
1503 QString stime = stkey[0];
1504 stime = stime.remove(QRegExp(
"[Zz]$"));
1517 void ProcessImportPds::TranslateIsis2Labels(
Isis::Pvl &lab) {
1518 TranslateIsis2BandBin(lab);
1519 TranslateIsis2Instrument(lab);
1529 void ProcessImportPds::TranslatePdsArchive(
Isis::Pvl &lab) {
1531 Isis::FileName transFile(p_transDir +
"/" +
"translations/pdsImageArchive.trn");
1535 isis2Xlater.
Auto(lab);
1545 void ProcessImportPds::TranslatePdsBandBin(
Isis::Pvl &lab) {
1547 Isis::FileName transFile(p_transDir +
"/" +
"translations/pdsImageBandBin.trn");
1551 isis2Xlater.
Auto(lab);
1563 TranslatePdsBandBin(lab);
1564 TranslatePdsArchive(lab);
1579 void ProcessImportPds::TranslatePdsProjection(
Isis::Pvl &lab) {
1583 stringstream trnsStrm;
1584 trnsStrm <<
"Group = PdsProjectionTypeImage" << endl;
1585 trnsStrm <<
" InputPosition = IMAGE_MAP_PROJECTION" << endl;
1586 trnsStrm <<
" InputPosition = IMAGE_MAP_PROJECTION_CATALOG" << endl;
1587 trnsStrm <<
" InputKey = MAP_PROJECTION_TYPE" << endl;
1588 trnsStrm <<
"EndGroup" << endl;
1589 trnsStrm <<
"Group = PdsProjectionTypeQube" << endl;
1590 trnsStrm <<
" InputPosition = (QUBE,IMAGE_MAP_PROJECTION)" << endl;
1591 trnsStrm <<
" InputKey = MAP_PROJECTION_TYPE" << endl;
1592 trnsStrm <<
"EndGroup" << endl;
1593 trnsStrm <<
"Group = PdsProjectionTypeSpectralQube" << endl;
1594 trnsStrm <<
" InputPosition = (SPECTRAL_QUBE,IMAGE_MAP_PROJECTION)" << endl;
1595 trnsStrm <<
" InputKey = MAP_PROJECTION_TYPE" << endl;
1596 trnsStrm <<
"EndGroup" << endl;
1603 QString transDir = (QString) dataDir[
"Base"];
1607 transFile = transDir +
"/" +
"translations/pdsImageProjection.trn";
1610 transFile = transDir +
"/" +
"translations/pdsQubeProjection.trn";
1613 transFile = transDir +
"/" +
"translations/pdsSpectralQubeProjection.trn";
1621 ExtractPdsProjection(pdsXlater);
1631 if (p_minimumLatitude != Isis::NULL8) {
1634 if (p_maximumLatitude != Isis::NULL8) {
1637 if (p_minimumLongitude != Isis::NULL8) {
1640 if (p_maximumLongitude != Isis::NULL8) {
1645 if (p_minimumLongitude != Isis::NULL8 && p_maximumLongitude != Isis::NULL8) {
1646 if (p_maximumLongitude <= p_minimumLongitude) {
1647 if (p_longitudeDomain == 180) {
1648 mapGroup[
"MinimumLongitude"] =
toString(-180);
1649 mapGroup[
"MaximumLongitude"] =
toString(180);
1652 mapGroup[
"MinimumLongitude"] =
toString(0);
1653 mapGroup[
"MaximumLongitude"] =
toString(360);
1662 if (p_rotation != 0.0) {
1671 QString projSpecificFileName =
"$base/translations/pdsImport";
1672 projSpecificFileName += p_projection +
".trn";
1676 specificXlater.
Auto(lab);
1678 if (lab.
findGroup(
"Mapping").hasKeyword(
"CenterLongitude")) {
1680 if (p_longitudeDomain == 180)
1681 centerLon =
toString(TProjection::To180Domain((
double)centerLon));
1683 centerLon =
toString(TProjection::To360Domain((
double)centerLon));
1686 if (lab.
findGroup(
"Mapping").hasKeyword(
"PoleLongitude")) {
1688 if (p_longitudeDomain == 180)
1689 poleLon =
toString(TProjection::To180Domain((
double)poleLon));
1691 poleLon =
toString(TProjection::To360Domain((
double)poleLon));
1694 OutputCubes[0]->putGroup(lab.
findGroup(
"Mapping"));
Buffer for reading and writing cube data.
QString path() const
Returns the path of the file name.
Read and store original labels.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
QString unit(const int index=0) const
Returns the units of measurement of the element of the array of values for the object at the specifie...
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
File name manipulation and expansion.
Table importTable(const QString &isisTableName)
Populate a Table object with the PDS table and return it.
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
int toInt(const QString &string)
Global function to convert from a string to an integer.
Namespace for the standard library.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Allows applications to translate simple text files.
double toDouble(const QString &string)
Global function to convert from a string to a double.
const double Lis
Value for an Isis Low Instrument Saturation pixel.
virtual bool InputHasKeyword(const QString translationGroupName)
Indicates if the input keyword corresponding to the output name exists in the label.
int ToInteger(const T &value)
Helper function to convert values to Integers.
int size() const
Returns the number of values stored in this keyword.
static double To180Domain(const double lon)
This method converts a longitude into the -180 to 180 domain.
PvlKeyword & findKeyword(const QString &kname, FindOptions opts)
Finds a keyword in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within this...
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
A single keyword-value pair.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
This represents a cube in a project-based GUI interface.
virtual QString Translate(QString translationGroupName, int findex=0)
Returns a translated value.
Container for cube-like labels.
virtual const PvlKeyword & InputKeyword(const QString translationGroupName) const
Returns the ith input value associated with the output name argument.
PvlGroup & group(const int index)
Return the group at the specified index.
Class for storing Table blobs information.
QString getFormattedName(const QString &colname) const
Converts a column name to a camel-case after it has been cleansed.
Adds specific functionality to C++ strings.
Namespace for ISIS/Bullet specific routines.
void Auto(Pvl &outputLabel)
Automatically translate all the output names found in the translation table If a output name does not...
int groups() const
Returns the number of groups contained.
const double Lrs
Value for an Isis Low Representation Saturation pixel.
Contains Pvl Groups and Pvl Objects.
void read(const QString &file)
Loads PVL information from a stream.
Import a PDS table file with a label description.
bool fileExists() const
Returns true if the file exists; false otherwise.
const double His
Value for an Isis High Instrument Saturation pixel.
const double Hrs
Value for an Isis High Representation Saturation pixel.