53 ProcessImportPds::ProcessImportPds() {
54 p_keepOriginalLabel =
true;
55 p_encodingType = NONE;
60 p_transDir = (QString) dataDir[
"Base"];
64 ProcessImportPds::~ProcessImportPds() {
82 void ProcessImportPds::SetPdsFile(
const Isis::Pvl &pdsLabelPvl,
83 const QString &pdsDataFile,
84 PdsFileType allowedTypes) {
87 p_pdsLabel = pdsLabelPvl;
88 p_labelFile = pdsDataFile;
89 ProcessLabel(pdsDataFile, allowedTypes);
110 void ProcessImportPds::SetPdsFile(
const QString &pdsLabelFile,
111 const QString &pdsDataFile,
113 PdsFileType allowedTypes) {
117 pdsLabel.
read(pdsLabelFile);
121 QObject::tr(
"This image does not contain a pds label. You will need an "
122 "image with a PDS label or a detached PDS label for this "
127 p_pdsLabel = pdsLabel;
128 p_labelFile = pdsLabelFile;
129 ProcessLabel(pdsDataFile, allowedTypes);
148 void ProcessImportPds::ProcessLabel(
const QString &pdsDataFile, PdsFileType allowedTypes) {
151 stringstream trnsStrm;
152 trnsStrm <<
"Group = PdsTypeImage" << endl;
153 trnsStrm <<
" InputPosition = ROOT" << endl;
154 trnsStrm <<
" InputPosition = FILE" << endl;
155 trnsStrm <<
" InputPosition = UNCOMPRESSED_FILE" << endl;
156 trnsStrm <<
" InputKey = ^IMAGE" << endl;
157 trnsStrm <<
"EndGroup" << endl;
158 trnsStrm <<
"Group = PdsTypeL0" << endl;
159 trnsStrm <<
" InputPosition = L0_FILE" << endl;
160 trnsStrm <<
" InputKey = ^L0_IMAGE" << endl;
161 trnsStrm <<
"EndGroup" << endl;
162 trnsStrm <<
"Group = PdsTypeRdn" << endl;
163 trnsStrm <<
" InputPosition = RDN_FILE" << endl;
164 trnsStrm <<
" InputKey = ^RDN_IMAGE" << endl;
165 trnsStrm <<
"EndGroup" << endl;
166 trnsStrm <<
"Group = PdsTypeLoc" << endl;
167 trnsStrm <<
" InputPosition = LOC_FILE" << endl;
168 trnsStrm <<
" InputKey = ^LOC_IMAGE" << endl;
169 trnsStrm <<
"EndGroup" << endl;
170 trnsStrm <<
"Group = PdsTypeObs" << endl;
171 trnsStrm <<
" InputPosition = OBS_FILE" << endl;
172 trnsStrm <<
" InputKey = ^OBS_IMAGE" << endl;
173 trnsStrm <<
"EndGroup" << endl;
174 trnsStrm <<
"Group = PdsTypeQube" << endl;
175 trnsStrm <<
" InputKey = ^QUBE" << endl;
176 trnsStrm <<
"EndGroup" << endl;
177 trnsStrm <<
"Group = PdsTypeSpectralQube" << endl;
178 trnsStrm <<
" InputKey = ^SPECTRAL_QUBE" << endl;
179 trnsStrm <<
"EndGroup" << endl;
180 trnsStrm <<
"Group = PdsEncodingType" << endl;
181 trnsStrm <<
" InputPosition = COMPRESSED_FILE" << endl;
182 trnsStrm <<
" InputKey = ENCODING_TYPE" << endl;
183 trnsStrm <<
" Translation = (*,*)" << endl;
184 trnsStrm <<
"EndGroup" << endl;
185 trnsStrm <<
"Group = PdsCompressedFile" << endl;
186 trnsStrm <<
" InputPosition = COMPRESSED_FILE" << endl;
187 trnsStrm <<
" InputKey = FILE_NAME" << endl;
188 trnsStrm <<
" Translation = (*,*)" << endl;
189 trnsStrm <<
"EndGroup" << endl;
197 str = pdsXlater.
Translate(
"PdsEncodingType");
199 p_encodingType = JP2;
200 str = pdsXlater.
Translate(
"PdsCompressedFile");
201 if (pdsDataFile.isEmpty()) {
204 if (ifile.fileExists()) {
205 p_jp2File = ifile.expanded();
208 QString tmp = ifile.expanded();
210 ifile = lfile.
path() +
"/" + str;
211 if (ifile.fileExists()) {
212 p_jp2File = ifile.expanded();
215 QString msg =
"Unable to find input file [" + tmp +
"] or [" +
216 ifile.expanded() +
"]";
223 QString msg =
"Unsupported encoding type in [" + p_labelFile +
"]";
230 ProcessPdsImageLabel(pdsDataFile);
232 else if ((allowedTypes & Qube) == Qube && pdsXlater.
InputHasKeyword(
"PdsTypeQube")) {
233 ProcessPdsQubeLabel(pdsDataFile,
"pdsQube.trn");
235 else if ((allowedTypes & SpectralQube) == SpectralQube &&
237 ProcessPdsQubeLabel(pdsDataFile,
"pdsSpectralQube.trn");
239 else if ((allowedTypes & L0) == L0 && pdsXlater.
InputHasKeyword(
"PdsTypeL0")) {
240 ProcessPdsM3Label(pdsDataFile, L0);
242 else if ((allowedTypes & Rdn) == Rdn && pdsXlater.
InputHasKeyword(
"PdsTypeRdn")) {
243 ProcessPdsM3Label(pdsDataFile, Rdn);
245 else if ((allowedTypes & Loc) == Loc && pdsXlater.
InputHasKeyword(
"PdsTypeLoc")) {
246 ProcessPdsM3Label(pdsDataFile, Loc);
248 else if ((allowedTypes & Obs) == Obs && pdsXlater.
InputHasKeyword(
"PdsTypeObs")) {
249 ProcessPdsM3Label(pdsDataFile, Obs);
252 QString msg =
"Unknown label type in [" + p_labelFile +
"]";
257 IdentifySource(p_pdsLabel);
272 QString dataFileName;
280 if (dataFilePointer.
size() == 1) {
282 str = pdsXlater.
Translate(
"DataFilePointer");
284 units = dataFilePointer.
unit();
287 dataFileName =
FileName(p_labelFile).name();
299 else if (dataFilePointer.
size() == 2) {
300 dataFileName = pdsXlater.
Translate(
"DataFilePointer", 0);
302 units = dataFilePointer.
unit(1);
305 else if (dataFilePointer.
size() == 0) {
306 QString msg =
"Data file pointer ^IMAGE or ^QUBE has no value, must"
307 "have either file name or offset or both, in [" +
313 QString msg =
"Improperly formatted data file pointer keyword ^IMAGE or "
314 "^QUBE, in [" + p_labelFile +
"], must contain filename "
315 " or offset or both";
321 if (!calcOffsetOnly) {
326 if (dataFileName.size() != 0 && dataFileName.at(0) ==
'/')
330 dataFile =
FileName(labelFile.
path() +
"/" + dataFileName);
333 if (dataFile.fileExists()) {
334 SetInputFile(dataFile.expanded());
338 QString tmp = dataFile.expanded();
339 dataFileName = dataFileName.toLower();
340 dataFile =
FileName(labelFile.
path() +
"/" + dataFileName);
341 if (dataFile.fileExists()) {
342 SetInputFile(dataFile.expanded());
345 QString msg =
"Unable to find input file [" + tmp +
"] or [" +
346 dataFile.expanded() +
"]";
353 units = units.trimmed();
354 if (units ==
"BYTES" || units ==
"B") {
355 SetFileHeaderBytes(offset - 1);
358 QString recSize = pdsXlater.
Translate(
"DataFileRecordBytes");
359 SetFileHeaderBytes((offset - 1) *
toInt(recSize));
370 str = pdsXlater.
Translate(
"CoreBitsPerPixel");
371 int bitsPerPixel =
toInt(str);
372 str = pdsXlater.
Translate(
"CorePixelType");
373 if ((str ==
"Real") && (bitsPerPixel == 64)) {
374 SetPixelType(Isis::Double);
376 else if ((str ==
"Real") && (bitsPerPixel == 32)) {
377 SetPixelType(Isis::Real);
379 else if ((str ==
"Integer") && (bitsPerPixel == 8)) {
380 SetPixelType(Isis::UnsignedByte);
382 else if ((str ==
"Integer") && (bitsPerPixel == 16)) {
383 SetPixelType(Isis::SignedWord);
385 else if ((str ==
"Integer") && (bitsPerPixel == 32)) {
386 SetPixelType(Isis::SignedInteger);
388 else if ((str ==
"Natural") && (bitsPerPixel == 8)) {
389 SetPixelType(Isis::UnsignedByte);
391 else if ((str ==
"Natural") && (bitsPerPixel == 16)) {
392 SetPixelType(Isis::UnsignedWord);
394 else if ((str ==
"Natural") && (bitsPerPixel == 16)) {
395 SetPixelType(Isis::SignedWord);
397 else if ((str ==
"Natural") && (bitsPerPixel == 32)) {
398 SetPixelType(Isis::UnsignedInteger);
401 QString msg =
"Invalid PixelType and BitsPerPixel combination [" + str +
402 ", " +
toString(bitsPerPixel) +
"]";
414 double pdsNull = Isis::NULL8;
484 SetSpecialValues(pdsNull, pdsLrs, pdsLis, pdsHrs, pdsHis);
499 void ProcessImportPds::ProcessPdsImageLabel(
const QString &pdsDataFile) {
500 Isis::FileName transFile(p_transDir +
"/translations/pdsImage.trn");
505 str = pdsXlater.
Translate(
"CoreLinePrefixBytes");
506 SetDataPrefixBytes(
toInt(str));
508 str = pdsXlater.Translate(
"CoreLineSuffixBytes");
509 SetDataSuffixBytes(
toInt(str));
511 ProcessPixelBitandType(pdsXlater);
513 str = pdsXlater.Translate(
"CoreByteOrder");
514 SetByteOrder(Isis::ByteOrderEnumeration(str));
516 str = pdsXlater.Translate(
"CoreSamples");
518 str = pdsXlater.Translate(
"CoreLines");
520 str = pdsXlater.Translate(
"CoreBands");
522 SetDimensions(ns, nl, nb);
525 ProcessSpecialPixels(pdsXlater,
false);
533 if (pdsDataFile.length() > 0) {
534 SetInputFile(pdsDataFile);
535 ProcessDataFilePointer(pdsXlater,
true);
539 else if (p_jp2File.length() > 0) {
540 SetInputFile(p_jp2File);
541 ProcessDataFilePointer(pdsXlater,
true);
547 ProcessDataFilePointer(pdsXlater,
false);
553 str = pdsXlater.Translate(
"CoreBase");
555 str = pdsXlater.Translate(
"CoreMultiplier");
559 str = pdsXlater.Translate(
"CoreOrganization");
561 if (p_encodingType == JP2) {
562 SetOrganization(ProcessImport::JP2);
564 else if (str ==
"BSQ") {
565 SetOrganization(ProcessImport::BSQ);
567 else if (str ==
"BIP") {
568 SetOrganization(ProcessImport::BIP);
570 else if (str ==
"BIL") {
571 SetOrganization(ProcessImport::BIL);
574 QString msg =
"Unsupported axis order [" + str +
"]";
596 void ProcessImportPds::ProcessPdsQubeLabel(
const QString &pdsDataFile,
597 const QString &transFile) {
612 for(
int i = 0; i < val; i++) {
613 str = pdsXlater.Translate(
"CoreOrganization", i);
615 if (str ==
"SAMPLE") {
618 else if (str ==
"LINE") {
621 else if (str ==
"BAND") {
625 QString message =
"Unknown file axis name [" + str +
"]";
630 if (p_encodingType == JP2) {
631 SetOrganization(ProcessImport::JP2);
633 else if (tmp ==
"SAMPLELINEBAND") {
634 SetOrganization(ProcessImport::BSQ);
636 else if (tmp ==
"BANDSAMPLELINE") {
637 SetOrganization(ProcessImport::BIP);
639 else if (tmp ==
"SAMPLEBANDLINE") {
640 SetOrganization(ProcessImport::BIL);
643 PvlKeyword pdsCoreOrg = p_pdsLabel.findKeyword(pdsXlater.
644 InputKeywordName(
"CoreOrganization"), Pvl::Traverse);
646 stringstream pdsCoreOrgStream;
647 pdsCoreOrgStream << pdsCoreOrg;
649 QString msg =
"Unsupported axis order [" + QString(pdsCoreOrgStream.str().c_str()) +
"]";
656 SetDataPrefixBytes(0);
659 str = pdsXlater.Translate(
"SuffixItemSize");
660 int suffix =
toInt(str);
661 str = pdsXlater.Translate(
"AxisSuffixCount", 0);
662 suffix *=
toInt(str);
663 SetDataSuffixBytes(suffix);
665 str = pdsXlater.Translate(
"SuffixItemSize");
666 int trailer =
toInt(str);
667 str = pdsXlater.Translate(
"AxisSuffixCount", 1);
668 trailer *=
toInt(str);
669 str = pdsXlater.Translate(
"CoreSamples", samplePos);
670 trailer *=
toInt(str);
672 SetDataTrailerBytes(trailer);
674 ProcessPixelBitandType(pdsXlater);
677 str = pdsXlater.Translate(
"CoreByteOrder");
678 SetByteOrder(Isis::ByteOrderEnumeration(str));
681 str = pdsXlater.Translate(
"CoreSamples", samplePos);
683 str = pdsXlater.Translate(
"CoreLines", linePos);
685 str = pdsXlater.Translate(
"CoreBands", bandPos);
687 SetDimensions(ns, nl, nb);
690 ProcessSpecialPixels(pdsXlater,
true);
698 if (pdsDataFile.length() > 0) {
699 SetInputFile(pdsDataFile);
700 ProcessDataFilePointer(pdsXlater,
true);
704 else if (p_jp2File.length() > 0) {
705 SetInputFile(p_jp2File);
706 ProcessDataFilePointer(pdsXlater,
true);
710 ProcessDataFilePointer(pdsXlater,
false);
718 if ((pdsXlater.InputHasKeyword(
"BandBase")) &&
719 (pdsXlater.InputHasKeyword(
"BandMultiplier"))) {
720 vector<double> bases;
721 vector<double> mults;
722 for(
int i = 0; i < pdsXlater.InputKeyword(
"BandBase").size(); i++) {
723 str = pdsXlater.Translate(
"BandBase", i);
725 str = pdsXlater.Translate(
"BandMultiplier", i);
729 SetMultiplier(mults);
732 str = pdsXlater.Translate(
"CoreBase");
734 str = pdsXlater.Translate(
"CoreMultiplier");
751 void ProcessImportPds::ProcessPdsM3Label(
const QString &pdsDataFile, PdsFileType fileType) {
753 if (fileType == L0) {
754 transFile = p_transDir +
"/translations/pdsL0.trn";
756 else if (fileType == Rdn) {
757 transFile = p_transDir +
"/translations/pdsRdn.trn";
759 else if (fileType == Loc) {
760 transFile = p_transDir +
"/translations/pdsLoc.trn";
762 else if (fileType == Obs) {
763 transFile = p_transDir +
"/translations/pdsObs.trn";
766 throw IException(IException::Programmer,
"ProcessImportPds::ProcessPdsM3Label can only be "
767 "called with file type of L0, Rdn, Loc or Obs.",
_FILEINFO_);
775 str = pdsXlater.
Translate(
"CoreLinePrefixBytes");
776 SetDataHeaderBytes(
toInt(str));
778 str = pdsXlater.Translate(
"CoreLineSuffixBytes");
779 SetDataSuffixBytes(
toInt(str));
781 ProcessPixelBitandType(pdsXlater);
783 str = pdsXlater.Translate(
"CoreByteOrder");
784 SetByteOrder(Isis::ByteOrderEnumeration(str));
786 str = pdsXlater.Translate(
"CoreSamples");
788 str = pdsXlater.Translate(
"CoreLines");
790 str = pdsXlater.Translate(
"CoreBands");
792 SetDimensions(ns, nl, nb);
795 ProcessSpecialPixels(pdsXlater,
false);
803 if (pdsDataFile.length() > 0) {
804 SetInputFile(pdsDataFile);
805 ProcessDataFilePointer(pdsXlater,
true);
809 else if (p_jp2File.length() > 0) {
810 SetInputFile(p_jp2File);
811 ProcessDataFilePointer(pdsXlater,
true);
817 ProcessDataFilePointer(pdsXlater,
false);
823 str = pdsXlater.Translate(
"CoreBase");
825 str = pdsXlater.Translate(
"CoreMultiplier");
829 str = pdsXlater.Translate(
"CoreOrganization");
831 if (p_encodingType == JP2) {
832 SetOrganization(ProcessImport::JP2);
834 else if (str ==
"BSQ") {
835 SetOrganization(ProcessImport::BSQ);
837 else if (str ==
"BIP") {
838 SetOrganization(ProcessImport::BIP);
840 else if (str ==
"BIL") {
841 SetOrganization(ProcessImport::BIL);
844 QString msg =
"Unsupported axis order [" + str +
"]";
861 void ProcessImportPds::TranslatePdsProjection(
Isis::Pvl &lab) {
865 stringstream trnsStrm;
866 trnsStrm <<
"Group = PdsProjectionTypeImage" << endl;
867 trnsStrm <<
" InputPosition = IMAGE_MAP_PROJECTION" << endl;
868 trnsStrm <<
" InputPosition = IMAGE_MAP_PROJECTION_CATALOG" << endl;
869 trnsStrm <<
" InputKey = MAP_PROJECTION_TYPE" << endl;
870 trnsStrm <<
"EndGroup" << endl;
871 trnsStrm <<
"Group = PdsProjectionTypeQube" << endl;
872 trnsStrm <<
" InputPosition = (QUBE,IMAGE_MAP_PROJECTION)" << endl;
873 trnsStrm <<
" InputKey = MAP_PROJECTION_TYPE" << endl;
874 trnsStrm <<
"EndGroup" << endl;
875 trnsStrm <<
"Group = PdsProjectionTypeSpectralQube" << endl;
876 trnsStrm <<
" InputPosition = (SPECTRAL_QUBE,IMAGE_MAP_PROJECTION)" << endl;
877 trnsStrm <<
" InputKey = MAP_PROJECTION_TYPE" << endl;
878 trnsStrm <<
"EndGroup" << endl;
885 QString transDir = (QString) dataDir[
"Base"];
889 transFile = transDir +
"/" +
"translations/pdsImageProjection.trn";
892 transFile = transDir +
"/" +
"translations/pdsQubeProjection.trn";
895 transFile = transDir +
"/" +
"translations/pdsSpectralQubeProjection.trn";
903 ExtractPdsProjection(pdsXlater);
913 if (p_minimumLatitude != Isis::NULL8) {
916 if (p_maximumLatitude != Isis::NULL8) {
919 if (p_minimumLongitude != Isis::NULL8) {
922 if (p_maximumLongitude != Isis::NULL8) {
927 if (p_minimumLongitude != Isis::NULL8 && p_maximumLongitude != Isis::NULL8) {
928 if (p_maximumLongitude <= p_minimumLongitude) {
929 if (p_longitudeDomain == 180) {
930 mapGroup[
"MinimumLongitude"] =
toString(-180);
931 mapGroup[
"MaximumLongitude"] =
toString(180);
934 mapGroup[
"MinimumLongitude"] =
toString(0);
935 mapGroup[
"MaximumLongitude"] =
toString(360);
944 if (p_rotation != 0.0) {
953 QString projSpecificFileName =
"$base/translations/pdsImport";
954 projSpecificFileName += p_projection +
".trn";
958 specificXlater.Auto(lab);
960 if (lab.
findGroup(
"Mapping").hasKeyword(
"CenterLongitude")) {
962 if (p_longitudeDomain == 180)
963 centerLon =
toString(TProjection::To180Domain((
double)centerLon));
965 centerLon =
toString(TProjection::To360Domain((
double)centerLon));
968 if (lab.
findGroup(
"Mapping").hasKeyword(
"PoleLongitude")) {
970 if (p_longitudeDomain == 180)
971 poleLon =
toString(TProjection::To180Domain((
double)poleLon));
973 poleLon =
toString(TProjection::To360Domain((
double)poleLon));
976 OutputCubes[0]->putGroup(lab.
findGroup(
"Mapping"));
1009 p_projection = pdsXlater.
Translate(
"ProjectionName");
1012 QString message =
"No projection name in labels";
1017 p_targetName = pdsXlater.
Translate(
"TargetName");
1020 QString message =
"No target name in labels";
1025 str = pdsXlater.
Translate(
"EquatorialRadius");
1026 p_equatorialRadius =
toDouble(str) * 1000.0;
1029 QString message =
"No equatorial radius name in labels";
1034 str = pdsXlater.
Translate(
"PolarRadius");
1035 p_polarRadius =
toDouble(str) * 1000.0;
1038 QString message =
"No polar radius in labels";
1043 p_longitudeDirection = pdsXlater.
Translate(
"LongitudeDirection");
1046 p_longitudeDirection = pdsXlater.
Translate(
"LongitudeDirection2");
1049 if (p_polarRadius == p_equatorialRadius) {
1050 p_latitudeType =
"Planetocentric";
1053 p_latitudeType = pdsXlater.
Translate(
"LatitudeType2");
1056 p_latitudeType = pdsXlater.
Translate(
"LatitudeType");
1060 str = pdsXlater.
Translate(
"MinimumLatitude");
1065 p_minimumLatitude = Isis::NULL8;
1069 p_minimumLatitude = Isis::NULL8;
1073 str = pdsXlater.
Translate(
"MaximumLatitude");
1078 p_maximumLatitude = Isis::NULL8;
1082 p_maximumLatitude = Isis::NULL8;
1087 bool positiveWest =
false;
1089 str = pdsXlater.
Translate(
"MinimumLongitude");
1091 positiveWest =
true;
1092 p_minimumLongitude =
toDouble(str);
1095 p_minimumLongitude = Isis::NULL8;
1099 str = pdsXlater.
Translate(
"MinimumLongitude2");
1101 p_minimumLongitude =
toDouble(str);
1104 p_minimumLongitude = Isis::NULL8;
1108 p_minimumLongitude = Isis::NULL8;
1112 str = pdsXlater.
Translate(
"MaximumLongitude");
1114 positiveWest =
true;
1115 p_maximumLongitude =
toDouble(str);
1118 p_maximumLongitude = Isis::NULL8;
1122 str = pdsXlater.
Translate(
"MaximumLongitude2");
1124 p_maximumLongitude =
toDouble(str);
1127 p_maximumLongitude = Isis::NULL8;
1131 p_maximumLongitude = Isis::NULL8;
1134 str = pdsXlater.
Translate(
"LongitudeDomain");
1135 p_longitudeDomain =
toInt(str);
1155 if (positiveWest && (p_longitudeDirection.compare(
"PositiveEast") == 0)) {
1156 double tmp = p_minimumLongitude;
1157 p_minimumLongitude = p_maximumLongitude;
1158 p_maximumLongitude = tmp;
1161 if (p_minimumLongitude > p_maximumLongitude) {
1163 p_longitudeDomain = 180;
1169 if (p_minimumLongitude < 0 || p_maximumLongitude < 0) {
1170 p_longitudeDomain = 180;
1173 str = pdsXlater.
Translate(
"PixelResolution");
1177 if ((str !=
"METERS/PIXEL") && (str !=
"M/PIXEL") && (str !=
"M/PIX")) {
1178 p_pixelResolution *= 1000.0;
1194 double xoff, yoff, xmult, ymult;
1195 GetProjectionOffsetMults(xoff, yoff, xmult, ymult);
1198 str = pdsXlater.
Translate(
"LineProjectionOffset");
1201 str = pdsXlater.
Translate(
"LineProjectionOffset2");
1203 p_lineProjectionOffset =
toDouble(str);
1204 p_upperLeftY = ymult * (p_lineProjectionOffset + yoff) * p_pixelResolution;
1207 str = pdsXlater.
Translate(
"SampleProjectionOffset");
1210 str = pdsXlater.
Translate(
"SampleProjectionOffset2");
1212 p_sampleProjectionOffset =
toDouble(str);
1213 p_upperLeftX = xmult * (p_sampleProjectionOffset + xoff) * p_pixelResolution;
1222 void ProcessImportPds::EndProcess() {
1223 ProcessImportPds::Finalize();
1232 void ProcessImportPds::Finalize() {
1233 if (p_keepOriginalLabel) {
1235 for (
unsigned int i = 0; i < OutputCubes.size(); i++) {
1236 OutputCubes[i]->write(ol);
1239 Process::Finalize();
1247 void ProcessImportPds::OmitOriginalLabel() {
1248 p_keepOriginalLabel =
false;
1258 void ProcessImportPds::IdentifySource(
Isis::Pvl &inputLabel) {
1262 stringstream trnsStrm;
1263 trnsStrm <<
"Group = PdsFile" << endl;
1264 trnsStrm <<
" InputPosition = ROOT" << endl;
1265 trnsStrm <<
" InputKey = PDS_VERSION_ID" << endl;
1266 trnsStrm <<
"EndGroup" << endl;
1267 trnsStrm <<
"Group = Isis2File" << endl;
1268 trnsStrm <<
" InputPosition = ROOT" << endl;
1269 trnsStrm <<
" InputKey = CCSD3ZF0000100000001NJPL3IF0PDS200000001" << endl;
1270 trnsStrm <<
"EndGroup" << endl;
1282 p_source = NOSOURCE;
1296 bool ProcessImportPds::IsIsis2() {
1298 if (p_source == ISIS2) {
1314 void ProcessImportPds::TranslateIsis2Labels(
Isis::Pvl &lab) {
1315 TranslateIsis2BandBin(lab);
1316 TranslateIsis2Instrument(lab);
1328 TranslatePdsBandBin(lab);
1329 TranslatePdsArchive(lab);
1339 void ProcessImportPds::TranslateIsis2BandBin(
Isis::Pvl &lab) {
1342 QString transDir = (QString) dataDir[
"Base"];
1344 Isis::FileName transFile(transDir +
"/" +
"translations/isis2bandbin.trn");
1348 isis2Xlater.Auto(lab);
1358 void ProcessImportPds::TranslateIsis2Instrument(
Isis::Pvl &lab) {
1361 QString transDir = (QString) dataDir[
"Base"];
1362 Isis::FileName transFile(transDir +
"/" +
"translations/isis2instrument.trn");
1366 isis2Xlater.Auto(lab);
1373 QString stime = stkey[0];
1374 stime = stime.remove(QRegExp(
"[Zz]$"));
1386 void ProcessImportPds::TranslatePdsBandBin(
Isis::Pvl &lab) {
1388 Isis::FileName transFile(p_transDir +
"/" +
"translations/pdsImageBandBin.trn");
1392 isis2Xlater.Auto(lab);
1402 void ProcessImportPds::TranslatePdsArchive(
Isis::Pvl &lab) {
1404 Isis::FileName transFile(p_transDir +
"/" +
"translations/pdsImageArchive.trn");
1408 isis2Xlater.Auto(lab);
1424 void ProcessImportPds::GetProjectionOffsetMults(
double &xoff,
double &yoff,
1425 double &xmult,
double &ymult) {
1433 Isis::Pvl p(p_transDir +
"/" +
"translations/pdsProjectionLineSampToXY.def");
1438 for(
int g = 0; g < projDef.
groups(); g++) {
1439 QString key = projDef.
group(g)[
"Keyword"];
1440 if (p_pdsLabel.hasKeyword(key)) {
1441 QString value = p_pdsLabel[key];
1442 QString pattern = projDef.
group(g)[
"Pattern"];
1444 if (value.contains(pattern)) {
1445 xmult = projDef.
group(g)[
"xMult"];
1446 ymult = projDef.
group(g)[
"yMult"];
1447 xoff = projDef.
group(g)[
"xOff"];
1448 yoff = projDef.
group(g)[
"yOff"];
1463 Table &ProcessImportPds::ImportTable(QString pdsTableName) {
1470 int found = isisTableName.lastIndexOf(
"Table");
1471 if (found == isisTableName.length() - 5) {
1472 isisTableName.remove(found, 5);
1476 p_tables.push_back(isisTable);
1478 return p_tables.at(p_tables.size() - 1);
1485 void ProcessImportPds::StartProcess() {
1486 ProcessImport::StartProcess();
1487 for (
unsigned int i = 0; i < p_tables.size(); i++) {
1488 OutputCubes[0]->write(p_tables[i]);
1505 ProcessImport::StartProcess(funct);