55 ProcessImportPds::ProcessImportPds() {
56 p_keepOriginalLabel =
true;
57 p_encodingType = NONE;
62 p_transDir = (QString) dataDir[
"Base"];
66 ProcessImportPds::~ProcessImportPds() {
84 void ProcessImportPds::SetPdsFile(
const Isis::Pvl &pdsLabelPvl,
85 const QString &pdsDataFile,
86 PdsFileType allowedTypes) {
89 p_pdsLabel = pdsLabelPvl;
90 p_labelFile = pdsDataFile;
91 ProcessLabel(pdsDataFile, allowedTypes);
112 void ProcessImportPds::SetPdsFile(
const QString &pdsLabelFile,
113 const QString &pdsDataFile,
115 PdsFileType allowedTypes) {
119 pdsLabel.
read(pdsLabelFile);
123 QObject::tr(
"This image does not contain a pds label. You will need an "
124 "image with a PDS label or a detached PDS label for this "
129 p_pdsLabel = pdsLabel;
130 p_labelFile = pdsLabelFile;
131 ProcessLabel(pdsDataFile, allowedTypes);
150 void ProcessImportPds::ProcessLabel(
const QString &pdsDataFile, PdsFileType allowedTypes) {
153 stringstream trnsStrm;
154 trnsStrm <<
"Group = PdsTypeImage" << endl;
155 trnsStrm <<
" InputPosition = ROOT" << endl;
156 trnsStrm <<
" InputPosition = FILE" << endl;
157 trnsStrm <<
" InputPosition = UNCOMPRESSED_FILE" << endl;
158 trnsStrm <<
" InputKey = ^IMAGE" << endl;
159 trnsStrm <<
"EndGroup" << endl;
160 trnsStrm <<
"Group = PdsTypeL0" << endl;
161 trnsStrm <<
" InputPosition = L0_FILE" << endl;
162 trnsStrm <<
" InputKey = ^L0_IMAGE" << endl;
163 trnsStrm <<
"EndGroup" << endl;
164 trnsStrm <<
"Group = PdsTypeRdn" << endl;
165 trnsStrm <<
" InputPosition = RDN_FILE" << endl;
166 trnsStrm <<
" InputKey = ^RDN_IMAGE" << endl;
167 trnsStrm <<
"EndGroup" << endl;
168 trnsStrm <<
"Group = PdsTypeLoc" << endl;
169 trnsStrm <<
" InputPosition = LOC_FILE" << endl;
170 trnsStrm <<
" InputKey = ^LOC_IMAGE" << endl;
171 trnsStrm <<
"EndGroup" << endl;
172 trnsStrm <<
"Group = PdsTypeObs" << endl;
173 trnsStrm <<
" InputPosition = OBS_FILE" << endl;
174 trnsStrm <<
" InputKey = ^OBS_IMAGE" << endl;
175 trnsStrm <<
"EndGroup" << endl;
176 trnsStrm <<
"Group = PdsTypeQube" << endl;
177 trnsStrm <<
" InputKey = ^QUBE" << endl;
178 trnsStrm <<
"EndGroup" << endl;
179 trnsStrm <<
"Group = PdsTypeSpectralQube" << endl;
180 trnsStrm <<
" InputKey = ^SPECTRAL_QUBE" << endl;
181 trnsStrm <<
"EndGroup" << endl;
182 trnsStrm <<
"Group = PdsEncodingType" << endl;
183 trnsStrm <<
" InputPosition = COMPRESSED_FILE" << endl;
184 trnsStrm <<
" InputKey = ENCODING_TYPE" << endl;
185 trnsStrm <<
" Translation = (*,*)" << endl;
186 trnsStrm <<
"EndGroup" << endl;
187 trnsStrm <<
"Group = PdsCompressedFile" << endl;
188 trnsStrm <<
" InputPosition = COMPRESSED_FILE" << endl;
189 trnsStrm <<
" InputKey = FILE_NAME" << endl;
190 trnsStrm <<
" Translation = (*,*)" << endl;
191 trnsStrm <<
"EndGroup" << endl;
206 if (coreKey[0] ==
"VAX_REAL") {
208 ProcessImport::SetVAXConvert(
true);
225 str = pdsXlater.
Translate(
"PdsEncodingType");
227 p_encodingType = JP2;
228 str = pdsXlater.
Translate(
"PdsCompressedFile");
229 if (pdsDataFile.isEmpty()) {
232 if (ifile.fileExists()) {
233 p_jp2File = ifile.expanded();
236 QString tmp = ifile.expanded();
238 ifile = lfile.
path() +
"/" + str;
239 if (ifile.fileExists()) {
240 p_jp2File = ifile.expanded();
243 QString msg =
"Unable to find input file [" + tmp +
"] or [" +
244 ifile.expanded() +
"]";
251 QString msg =
"Unsupported encoding type in [" + p_labelFile +
"]";
262 ProcessPdsImageLabel(pdsDataFile);
264 else if ((allowedTypes & Qube) == Qube && pdsXlater.
InputHasKeyword(
"PdsTypeQube")) {
266 ProcessPdsQubeLabel(pdsDataFile,
"pdsQube.trn");
268 else if ((allowedTypes & SpectralQube) == SpectralQube &&
271 ProcessPdsQubeLabel(pdsDataFile,
"pdsSpectralQube.trn");
273 else if ((allowedTypes & L0) == L0 && pdsXlater.
InputHasKeyword(
"PdsTypeL0")) {
275 ProcessPdsM3Label(pdsDataFile, L0);
277 else if ((allowedTypes & Rdn) == Rdn && pdsXlater.
InputHasKeyword(
"PdsTypeRdn")) {
279 ProcessPdsM3Label(pdsDataFile, Rdn);
281 else if ((allowedTypes & Loc) == Loc && pdsXlater.
InputHasKeyword(
"PdsTypeLoc")) {
283 ProcessPdsM3Label(pdsDataFile, Loc);
285 else if ((allowedTypes & Obs) == Obs && pdsXlater.
InputHasKeyword(
"PdsTypeObs")) {
287 ProcessPdsM3Label(pdsDataFile, Obs);
290 QString msg =
"Unknown label type in [" + p_labelFile +
"]";
297 IdentifySource(p_pdsLabel);
313 const bool & calcOffsetOnly) {
317 QString dataFileName;
325 if (dataFilePointer.
size() == 1) {
327 str = pdsXlater.
Translate(
"DataFilePointer");
329 units = dataFilePointer.
unit();
332 dataFileName =
FileName(p_labelFile).name();
344 else if (dataFilePointer.
size() == 2) {
345 dataFileName = pdsXlater.
Translate(
"DataFilePointer", 0);
347 units = dataFilePointer.
unit(1);
350 else if (dataFilePointer.
size() == 0) {
351 QString msg =
"Data file pointer ^IMAGE or ^QUBE has no value, must"
352 "have either file name or offset or both, in [" +
358 QString msg =
"Improperly formatted data file pointer keyword ^IMAGE or "
359 "^QUBE, in [" + p_labelFile +
"], must contain filename "
360 " or offset or both";
366 if (!calcOffsetOnly) {
371 if (dataFileName.size() != 0 && dataFileName.at(0) ==
'/')
375 dataFile =
FileName(labelFile.
path() +
"/" + dataFileName);
378 if (dataFile.fileExists()) {
379 SetInputFile(dataFile.expanded());
383 QString tmp = dataFile.expanded();
384 dataFileName = dataFileName.toLower();
385 dataFile =
FileName(labelFile.
path() +
"/" + dataFileName);
386 if (dataFile.fileExists()) {
387 SetInputFile(dataFile.expanded());
390 QString msg =
"Unable to find input file [" + tmp +
"] or [" +
391 dataFile.expanded() +
"]";
398 units = units.trimmed();
399 if (units ==
"BYTES" || units ==
"B") {
400 SetFileHeaderBytes(offset - 1);
403 QString recSize = pdsXlater.
Translate(
"DataFileRecordBytes");
404 SetFileHeaderBytes((offset - 1) *
toInt(recSize));
415 str = pdsXlater.
Translate(
"CoreBitsPerPixel");
416 int bitsPerPixel =
toInt(str);
417 str = pdsXlater.
Translate(
"CorePixelType");
419 if ((str ==
"Real") && (bitsPerPixel == 64)) {
421 SetPixelType(Isis::Double);
423 else if ((str ==
"Real") && (bitsPerPixel == 32)) {
424 SetPixelType(Isis::Real);
426 else if ((str ==
"Integer") && (bitsPerPixel == 8)) {
427 SetPixelType(Isis::UnsignedByte);
429 else if ((str ==
"Integer") && (bitsPerPixel == 16)) {
430 SetPixelType(Isis::SignedWord);
432 else if ((str ==
"Integer") && (bitsPerPixel == 32)) {
433 SetPixelType(Isis::SignedInteger);
435 else if ((str ==
"Natural") && (bitsPerPixel == 8)) {
436 SetPixelType(Isis::UnsignedByte);
438 else if ((str ==
"Natural") && (bitsPerPixel == 16)) {
439 SetPixelType(Isis::UnsignedWord);
441 else if ((str ==
"Natural") && (bitsPerPixel == 16)) {
442 SetPixelType(Isis::SignedWord);
444 else if ((str ==
"Natural") && (bitsPerPixel == 32)) {
445 SetPixelType(Isis::UnsignedInteger);
450 QString msg =
"Invalid PixelType and BitsPerPixel combination [" + str +
451 ", " +
toString(bitsPerPixel) +
"]";
463 double pdsNull = Isis::NULL8;
533 SetSpecialValues(pdsNull, pdsLrs, pdsLis, pdsHrs, pdsHis);
548 void ProcessImportPds::ProcessPdsImageLabel(
const QString &pdsDataFile) {
549 Isis::FileName transFile(p_transDir +
"/translations/pdsImage.trn");
554 str = pdsXlater.
Translate(
"CoreLinePrefixBytes");
555 SetDataPrefixBytes(
toInt(str));
557 str = pdsXlater.Translate(
"CoreLineSuffixBytes");
558 SetDataSuffixBytes(
toInt(str));
560 ProcessPixelBitandType(pdsXlater);
562 str = pdsXlater.Translate(
"CoreByteOrder");
563 SetByteOrder(Isis::ByteOrderEnumeration(str));
565 str = pdsXlater.Translate(
"CoreSamples");
567 str = pdsXlater.Translate(
"CoreLines");
569 str = pdsXlater.Translate(
"CoreBands");
572 SetDimensions(ns, nl, nb);
575 ProcessSpecialPixels(pdsXlater,
false);
583 if (pdsDataFile.length() > 0) {
584 SetInputFile(pdsDataFile);
585 ProcessDataFilePointer(pdsXlater,
true);
589 else if (p_jp2File.length() > 0) {
590 SetInputFile(p_jp2File);
591 ProcessDataFilePointer(pdsXlater,
true);
597 ProcessDataFilePointer(pdsXlater,
false);
603 str = pdsXlater.Translate(
"CoreBase");
605 str = pdsXlater.Translate(
"CoreMultiplier");
609 str = pdsXlater.Translate(
"CoreOrganization");
611 if (p_encodingType == JP2) {
612 SetOrganization(ProcessImport::JP2);
614 else if (str ==
"BSQ") {
615 SetOrganization(ProcessImport::BSQ);
617 else if (str ==
"BIP") {
618 SetOrganization(ProcessImport::BIP);
620 else if (str ==
"BIL") {
621 SetOrganization(ProcessImport::BIL);
624 QString msg =
"Unsupported axis order [" + str +
"]";
646 void ProcessImportPds::ProcessPdsQubeLabel(
const QString &pdsDataFile,
647 const QString &transFile) {
664 for(
int i = 0; i < val; i++) {
665 str = pdsXlater.Translate(
"CoreOrganization", i);
667 if (str ==
"SAMPLE") {
670 else if (str ==
"LINE") {
673 else if (str ==
"BAND") {
677 QString message =
"Unknown file axis name [" + str +
"]";
682 if (p_encodingType == JP2) {
683 SetOrganization(ProcessImport::JP2);
685 else if (tmp ==
"SAMPLELINEBAND") {
686 SetOrganization(ProcessImport::BSQ);
688 else if (tmp ==
"BANDSAMPLELINE") {
689 SetOrganization(ProcessImport::BIP);
691 else if (tmp ==
"SAMPLEBANDLINE") {
692 SetOrganization(ProcessImport::BIL);
695 PvlKeyword pdsCoreOrg = p_pdsLabel.findKeyword(pdsXlater.
696 InputKeywordName(
"CoreOrganization"), Pvl::Traverse);
698 stringstream pdsCoreOrgStream;
699 pdsCoreOrgStream << pdsCoreOrg;
701 QString msg =
"Unsupported axis order [" + QString(pdsCoreOrgStream.str().c_str()) +
"]";
708 SetDataPrefixBytes(0);
711 str = pdsXlater.Translate(
"SuffixItemSize");
712 int suffix =
toInt(str);
713 str = pdsXlater.Translate(
"AxisSuffixCount", 0);
714 suffix *=
toInt(str);
715 SetDataSuffixBytes(suffix);
717 str = pdsXlater.Translate(
"SuffixItemSize");
718 int trailer =
toInt(str);
719 str = pdsXlater.Translate(
"AxisSuffixCount", 1);
720 trailer *=
toInt(str);
721 str = pdsXlater.Translate(
"CoreSamples", samplePos);
722 trailer *=
toInt(str);
724 SetDataTrailerBytes(trailer);
726 ProcessPixelBitandType(pdsXlater);
731 str = pdsXlater.Translate(
"CoreByteOrder");
733 SetByteOrder(Isis::ByteOrderEnumeration(str));
745 str = pdsXlater.Translate(
"CoreSamples", samplePos);
747 str = pdsXlater.Translate(
"CoreLines", linePos);
749 str = pdsXlater.Translate(
"CoreBands", bandPos);
751 SetDimensions(ns, nl, nb);
755 ProcessSpecialPixels(pdsXlater,
true);
763 if (pdsDataFile.length() > 0) {
764 SetInputFile(pdsDataFile);
765 ProcessDataFilePointer(pdsXlater,
true);
769 else if (p_jp2File.length() > 0) {
770 SetInputFile(p_jp2File);
771 ProcessDataFilePointer(pdsXlater,
true);
775 ProcessDataFilePointer(pdsXlater,
false);
783 if ((pdsXlater.InputHasKeyword(
"BandBase")) &&
784 (pdsXlater.InputHasKeyword(
"BandMultiplier"))) {
785 vector<double> bases;
786 vector<double> mults;
787 for(
int i = 0; i < pdsXlater.InputKeyword(
"BandBase").size(); i++) {
788 str = pdsXlater.Translate(
"BandBase", i);
790 str = pdsXlater.Translate(
"BandMultiplier", i);
794 SetMultiplier(mults);
797 str = pdsXlater.Translate(
"CoreBase");
799 str = pdsXlater.Translate(
"CoreMultiplier");
816 void ProcessImportPds::ProcessPdsM3Label(
const QString &pdsDataFile, PdsFileType fileType) {
818 if (fileType == L0) {
819 transFile = p_transDir +
"/translations/pdsL0.trn";
821 else if (fileType == Rdn) {
822 transFile = p_transDir +
"/translations/pdsRdn.trn";
824 else if (fileType == Loc) {
825 transFile = p_transDir +
"/translations/pdsLoc.trn";
827 else if (fileType == Obs) {
828 transFile = p_transDir +
"/translations/pdsObs.trn";
831 throw IException(IException::Programmer,
"ProcessImportPds::ProcessPdsM3Label can only be "
832 "called with file type of L0, Rdn, Loc or Obs.",
_FILEINFO_);
840 str = pdsXlater.
Translate(
"CoreLinePrefixBytes");
841 SetDataHeaderBytes(
toInt(str));
843 str = pdsXlater.Translate(
"CoreLineSuffixBytes");
844 SetDataSuffixBytes(
toInt(str));
846 ProcessPixelBitandType(pdsXlater);
848 str = pdsXlater.Translate(
"CoreByteOrder");
849 SetByteOrder(Isis::ByteOrderEnumeration(str));
851 str = pdsXlater.Translate(
"CoreSamples");
853 str = pdsXlater.Translate(
"CoreLines");
855 str = pdsXlater.Translate(
"CoreBands");
857 SetDimensions(ns, nl, nb);
860 ProcessSpecialPixels(pdsXlater,
false);
868 if (pdsDataFile.length() > 0) {
869 SetInputFile(pdsDataFile);
870 ProcessDataFilePointer(pdsXlater,
true);
874 else if (p_jp2File.length() > 0) {
875 SetInputFile(p_jp2File);
876 ProcessDataFilePointer(pdsXlater,
true);
882 ProcessDataFilePointer(pdsXlater,
false);
888 str = pdsXlater.Translate(
"CoreBase");
890 str = pdsXlater.Translate(
"CoreMultiplier");
894 str = pdsXlater.Translate(
"CoreOrganization");
896 if (p_encodingType == JP2) {
897 SetOrganization(ProcessImport::JP2);
899 else if (str ==
"BSQ") {
900 SetOrganization(ProcessImport::BSQ);
902 else if (str ==
"BIP") {
903 SetOrganization(ProcessImport::BIP);
905 else if (str ==
"BIL") {
906 SetOrganization(ProcessImport::BIL);
909 QString msg =
"Unsupported axis order [" + str +
"]";
926 void ProcessImportPds::TranslatePdsProjection(
Isis::Pvl &lab) {
930 stringstream trnsStrm;
931 trnsStrm <<
"Group = PdsProjectionTypeImage" << endl;
932 trnsStrm <<
" InputPosition = IMAGE_MAP_PROJECTION" << endl;
933 trnsStrm <<
" InputPosition = IMAGE_MAP_PROJECTION_CATALOG" << endl;
934 trnsStrm <<
" InputKey = MAP_PROJECTION_TYPE" << endl;
935 trnsStrm <<
"EndGroup" << endl;
936 trnsStrm <<
"Group = PdsProjectionTypeQube" << endl;
937 trnsStrm <<
" InputPosition = (QUBE,IMAGE_MAP_PROJECTION)" << endl;
938 trnsStrm <<
" InputKey = MAP_PROJECTION_TYPE" << endl;
939 trnsStrm <<
"EndGroup" << endl;
940 trnsStrm <<
"Group = PdsProjectionTypeSpectralQube" << endl;
941 trnsStrm <<
" InputPosition = (SPECTRAL_QUBE,IMAGE_MAP_PROJECTION)" << endl;
942 trnsStrm <<
" InputKey = MAP_PROJECTION_TYPE" << endl;
943 trnsStrm <<
"EndGroup" << endl;
950 QString transDir = (QString) dataDir[
"Base"];
954 transFile = transDir +
"/" +
"translations/pdsImageProjection.trn";
957 transFile = transDir +
"/" +
"translations/pdsQubeProjection.trn";
960 transFile = transDir +
"/" +
"translations/pdsSpectralQubeProjection.trn";
968 ExtractPdsProjection(pdsXlater);
978 if (p_minimumLatitude != Isis::NULL8) {
981 if (p_maximumLatitude != Isis::NULL8) {
984 if (p_minimumLongitude != Isis::NULL8) {
987 if (p_maximumLongitude != Isis::NULL8) {
992 if (p_minimumLongitude != Isis::NULL8 && p_maximumLongitude != Isis::NULL8) {
993 if (p_maximumLongitude <= p_minimumLongitude) {
994 if (p_longitudeDomain == 180) {
995 mapGroup[
"MinimumLongitude"] =
toString(-180);
996 mapGroup[
"MaximumLongitude"] =
toString(180);
999 mapGroup[
"MinimumLongitude"] =
toString(0);
1000 mapGroup[
"MaximumLongitude"] =
toString(360);
1009 if (p_rotation != 0.0) {
1018 QString projSpecificFileName =
"$base/translations/pdsImport";
1019 projSpecificFileName += p_projection +
".trn";
1023 specificXlater.Auto(lab);
1025 if (lab.
findGroup(
"Mapping").hasKeyword(
"CenterLongitude")) {
1027 if (p_longitudeDomain == 180)
1028 centerLon =
toString(TProjection::To180Domain((
double)centerLon));
1030 centerLon =
toString(TProjection::To360Domain((
double)centerLon));
1033 if (lab.
findGroup(
"Mapping").hasKeyword(
"PoleLongitude")) {
1035 if (p_longitudeDomain == 180)
1036 poleLon =
toString(TProjection::To180Domain((
double)poleLon));
1038 poleLon =
toString(TProjection::To360Domain((
double)poleLon));
1041 OutputCubes[0]->putGroup(lab.
findGroup(
"Mapping"));
1074 p_projection = pdsXlater.
Translate(
"ProjectionName");
1077 QString message =
"No projection name in labels";
1082 p_targetName = pdsXlater.
Translate(
"TargetName");
1085 QString message =
"No target name in labels";
1090 str = pdsXlater.
Translate(
"EquatorialRadius");
1091 p_equatorialRadius =
toDouble(str) * 1000.0;
1094 QString message =
"No equatorial radius name in labels";
1099 str = pdsXlater.
Translate(
"PolarRadius");
1100 p_polarRadius =
toDouble(str) * 1000.0;
1103 QString message =
"No polar radius in labels";
1108 p_longitudeDirection = pdsXlater.
Translate(
"LongitudeDirection");
1111 p_longitudeDirection = pdsXlater.
Translate(
"LongitudeDirection2");
1114 if (p_polarRadius == p_equatorialRadius) {
1115 p_latitudeType =
"Planetocentric";
1118 p_latitudeType = pdsXlater.
Translate(
"LatitudeType2");
1121 p_latitudeType = pdsXlater.
Translate(
"LatitudeType");
1125 str = pdsXlater.
Translate(
"MinimumLatitude");
1130 p_minimumLatitude = Isis::NULL8;
1134 p_minimumLatitude = Isis::NULL8;
1138 str = pdsXlater.
Translate(
"MaximumLatitude");
1143 p_maximumLatitude = Isis::NULL8;
1147 p_maximumLatitude = Isis::NULL8;
1152 bool positiveWest =
false;
1154 str = pdsXlater.
Translate(
"MinimumLongitude");
1156 positiveWest =
true;
1157 p_minimumLongitude =
toDouble(str);
1160 p_minimumLongitude = Isis::NULL8;
1164 str = pdsXlater.
Translate(
"MinimumLongitude2");
1166 p_minimumLongitude =
toDouble(str);
1169 p_minimumLongitude = Isis::NULL8;
1173 p_minimumLongitude = Isis::NULL8;
1177 str = pdsXlater.
Translate(
"MaximumLongitude");
1179 positiveWest =
true;
1180 p_maximumLongitude =
toDouble(str);
1183 p_maximumLongitude = Isis::NULL8;
1187 str = pdsXlater.
Translate(
"MaximumLongitude2");
1189 p_maximumLongitude =
toDouble(str);
1192 p_maximumLongitude = Isis::NULL8;
1196 p_maximumLongitude = Isis::NULL8;
1199 str = pdsXlater.
Translate(
"LongitudeDomain");
1200 p_longitudeDomain =
toInt(str);
1220 if (positiveWest && (p_longitudeDirection.compare(
"PositiveEast") == 0)) {
1221 double tmp = p_minimumLongitude;
1222 p_minimumLongitude = p_maximumLongitude;
1223 p_maximumLongitude = tmp;
1226 if (p_minimumLongitude > p_maximumLongitude) {
1228 p_longitudeDomain = 180;
1234 if (p_minimumLongitude < 0 || p_maximumLongitude < 0) {
1235 p_longitudeDomain = 180;
1238 str = pdsXlater.
Translate(
"PixelResolution");
1242 if ((str !=
"METERS/PIXEL") && (str !=
"M/PIXEL") && (str !=
"M/PIX")) {
1243 p_pixelResolution *= 1000.0;
1259 double xoff, yoff, xmult, ymult;
1260 GetProjectionOffsetMults(xoff, yoff, xmult, ymult);
1263 str = pdsXlater.
Translate(
"LineProjectionOffset");
1266 str = pdsXlater.
Translate(
"LineProjectionOffset2");
1268 p_lineProjectionOffset =
toDouble(str);
1269 p_upperLeftY = ymult * (p_lineProjectionOffset + yoff) * p_pixelResolution;
1272 str = pdsXlater.
Translate(
"SampleProjectionOffset");
1275 str = pdsXlater.
Translate(
"SampleProjectionOffset2");
1277 p_sampleProjectionOffset =
toDouble(str);
1278 p_upperLeftX = xmult * (p_sampleProjectionOffset + xoff) * p_pixelResolution;
1287 void ProcessImportPds::EndProcess() {
1288 ProcessImportPds::Finalize();
1297 void ProcessImportPds::Finalize() {
1298 if (p_keepOriginalLabel) {
1300 for (
unsigned int i = 0; i < OutputCubes.size(); i++) {
1301 OutputCubes[i]->write(ol);
1304 Process::Finalize();
1312 void ProcessImportPds::OmitOriginalLabel() {
1313 p_keepOriginalLabel =
false;
1323 void ProcessImportPds::IdentifySource(
Isis::Pvl &inputLabel) {
1327 stringstream trnsStrm;
1328 trnsStrm <<
"Group = PdsFile" << endl;
1329 trnsStrm <<
" InputPosition = ROOT" << endl;
1330 trnsStrm <<
" InputKey = PDS_VERSION_ID" << endl;
1331 trnsStrm <<
"EndGroup" << endl;
1332 trnsStrm <<
"Group = Isis2File" << endl;
1333 trnsStrm <<
" InputPosition = ROOT" << endl;
1334 trnsStrm <<
" InputKey = CCSD3ZF0000100000001NJPL3IF0PDS200000001" << endl;
1335 trnsStrm <<
"EndGroup" << endl;
1347 p_source = NOSOURCE;
1361 bool ProcessImportPds::IsIsis2() {
1363 if (p_source == ISIS2) {
1382 void ProcessImportPds::TranslateIsis2Labels(
Isis::Pvl &lab) {
1383 TranslateIsis2BandBin(lab);
1384 TranslateIsis2Instrument(lab);
1396 TranslatePdsBandBin(lab);
1397 TranslatePdsArchive(lab);
1407 void ProcessImportPds::TranslateIsis2BandBin(
Isis::Pvl &lab) {
1410 QString transDir = (QString) dataDir[
"Base"];
1412 Isis::FileName transFile(transDir +
"/" +
"translations/isis2bandbin.trn");
1416 isis2Xlater.Auto(lab);
1426 void ProcessImportPds::TranslateIsis2Instrument(
Isis::Pvl &lab) {
1429 QString transDir = (QString) dataDir[
"Base"];
1430 Isis::FileName transFile(transDir +
"/" +
"translations/isis2instrument.trn");
1434 isis2Xlater.Auto(lab);
1441 QString stime = stkey[0];
1442 stime = stime.remove(QRegExp(
"[Zz]$"));
1454 void ProcessImportPds::TranslatePdsBandBin(
Isis::Pvl &lab) {
1456 Isis::FileName transFile(p_transDir +
"/" +
"translations/pdsImageBandBin.trn");
1460 isis2Xlater.Auto(lab);
1470 void ProcessImportPds::TranslatePdsArchive(
Isis::Pvl &lab) {
1472 Isis::FileName transFile(p_transDir +
"/" +
"translations/pdsImageArchive.trn");
1476 isis2Xlater.Auto(lab);
1492 void ProcessImportPds::GetProjectionOffsetMults(
double &xoff,
double &yoff,
1493 double &xmult,
double &ymult) {
1501 Isis::Pvl p(p_transDir +
"/" +
"translations/pdsProjectionLineSampToXY.def");
1506 for(
int g = 0; g < projDef.
groups(); g++) {
1507 QString key = projDef.
group(g)[
"Keyword"];
1508 if (p_pdsLabel.hasKeyword(key)) {
1509 QString value = p_pdsLabel[key];
1510 QString pattern = projDef.
group(g)[
"Pattern"];
1512 if (value.contains(pattern)) {
1513 xmult = projDef.
group(g)[
"xMult"];
1514 ymult = projDef.
group(g)[
"yMult"];
1515 xoff = projDef.
group(g)[
"xOff"];
1516 yoff = projDef.
group(g)[
"yOff"];
1531 Table &ProcessImportPds::ImportTable(QString pdsTableName) {
1538 int found = isisTableName.lastIndexOf(
"Table");
1539 if (found == isisTableName.length() - 5) {
1540 isisTableName.remove(found, 5);
1544 p_tables.push_back(isisTable);
1546 return p_tables.at(p_tables.size() - 1);
1553 void ProcessImportPds::StartProcess() {
1554 ProcessImport::StartProcess();
1555 for (
unsigned int i = 0; i < p_tables.size(); i++) {
1556 OutputCubes[0]->write(p_tables[i]);
1573 ProcessImport::StartProcess(funct);