Loading isis/src/tgo/apps/tgocassis2isis/tgocassis2isis.cpp +61 −10 Original line number Diff line number Diff line Loading @@ -5,19 +5,21 @@ #include "AlphaCube.h" #include "Cube.h" #include "FileName.h" #include "IException.h" #include "iTime.h" #include "LineManager.h" #include "OriginalXmlLabel.h" #include "Preference.h" #include "ProcessImport.h" #include "UserInterface.h" #include "XmlToPvlTranslationManager.h" #include "iTime.h" using namespace std; using namespace Isis; void translateCoreInfo(FileName &inputLabel, ProcessImport &importer); void translateLabels(FileName &inputLabel, Cube *outputCube); void translateCoreInfo(XmlToPvlTranslationManager labelXlater, ProcessImport &importer); void translateLabels(FileName &inputLabel, Cube *outputCube, QString transFile); void IsisMain() { Loading @@ -41,7 +43,37 @@ void IsisMain() { } Cube *outputCube = importer.SetOutputCube("TO"); translateLabels(xmlFileName, outputCube); QString transRawFile = "/translations/tgoCassisInstrument.trn"; QString transExportFile = "/translations/tgoCassisExportedInstrument.trn"; try { translateLabels(xmlFileName, outputCube, transRawFile); } catch (IException &e) { translateLabels(xmlFileName, outputCube, transExportFile); // Try to translate a mapping group try { PvlGroup &dataDir = Preference::Preferences().findGroup("DataDirectory"); QString missionDir = (QString) dataDir["Tgo"]; FileName mapTransFile(missionDir + "/translations/tgoCassisMapping.trn"); // Get the translation manager ready for translating the mapping label XmlToPvlTranslationManager labelXlater(xmlFileName, mapTransFile.expanded()); // Pvl output label Pvl *outputLabel = outputCube->label(); labelXlater.Auto(*(outputLabel)); } catch (IException &e) { Pvl *outputLabel = outputCube->label(); if(outputLabel->hasGroup("Mapping")) { outputLabel->deleteGroup("Mapping"); } } } FileName outputCubeFileName(ui.GetFileName("TO")); Loading Loading @@ -82,11 +114,31 @@ void translateCoreInfo(FileName &inputLabel, ProcessImport &importer) { QString missionDir = (QString) dataDir["Tgo"]; // Get the translation manager ready FileName transFile(missionDir + "/translations/tgoCassis.trn"); FileName transFile; try { transFile = FileName(missionDir + "/translations/tgoCassis.trn"); XmlToPvlTranslationManager labelXlater(inputLabel, transFile.expanded()); translateCoreInfo(labelXlater, importer); } catch (IException &e) { // if exported, use this! transFile = FileName(missionDir + "/translations/tgoCassisExported.trn"); XmlToPvlTranslationManager labelXlater(inputLabel, transFile.expanded()); translateCoreInfo(labelXlater, importer); } } QString str; /** * Translate core info from labels and set ProcessImport object with * these values. * * @param labelXlater Reference to the XmlToPvlTranslationManager objcet to use for the translation. * @param importer Reference to the ProcessImport object to which core info will * be set. */ void translateCoreInfo(XmlToPvlTranslationManager labelXlater, ProcessImport &importer) { // Set up the ProcessImport QString str; str = labelXlater.Translate("CoreSamples"); int ns = toInt(str); str = labelXlater.Translate("CoreLines"); Loading @@ -109,7 +161,6 @@ void translateCoreInfo(FileName &inputLabel, ProcessImport &importer) { importer.SetMultiplier(toDouble(str)); } /** * Translate instrument, bandbin, and archive info from xml label into ISIS3 * label and add kernels group. Loading @@ -122,11 +173,11 @@ void translateCoreInfo(FileName &inputLabel, ProcessImport &importer) { * @history 2017-01-20 Jeannie Backer - Original Version * @history 2017-01-23 Kristin Berry - Added support for bandBin group and archive group */ void translateLabels(FileName &inputLabel, Cube *outputCube) { void translateLabels(FileName &inputLabel, Cube *outputCube, QString instTransFile) { // Get the directory where the Tgo translation tables are PvlGroup &dataDir = Preference::Preferences().findGroup("DataDirectory"); QString missionDir = (QString) dataDir["Tgo"]; FileName transFile(missionDir + "/translations/tgoCassisInstrument.trn"); FileName transFile(missionDir + instTransFile); // Get the translation manager ready for translating the instrument label XmlToPvlTranslationManager labelXlater(inputLabel, transFile.expanded()); Loading isis/src/tgo/apps/tgocassis2isis/tgocassis2isis.xml +7 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,13 @@ Added check to verify input input xml file corresponds to valid filter image. </change> <change name="Summer Stapleton" date="2018-02-16"> Added handling for image file extesnions of either .dat or .img. Fixs #5334. Added handling for image file extesnions of either .dat or .img. Fixes #5334. </change> <change name="Kristin Berry and Makayla Shepherd" date="2018-05-15"> Updated to ingest images which have been exported using tgocassisrdrgen. Fixes #5418. </change> <change name="Kristin Berry and Makayla Shepherd" date="2018-05-15"> Updated to ingest Mapping groups from images have been exported using tgocassisrdrgen. Fixes #5418. </change> </history> Loading isis/src/tgo/apps/tgocassis2isis/tsts/exportedFile/Makefile 0 → 100644 +23 −0 Original line number Diff line number Diff line # This test checks to see if images exported from tgocassisrdrgen can be # re-imported using tgocassis2isis. # # history 2018-05-16 Kristin Berry - Original version. References # ???? APPNAME = tgocassis2isis include $(ISISROOT)/make/isismake.tsts commands: $(APPNAME) from=$(INPUT)/CAS-MCO-2016-11-26T22.50.30.181-RED-01012-B1_rdrgen.xml \ to=$(OUTPUT)/reingested_unproj.cub > /dev/null; catlab from=$(OUTPUT)/reingested_unproj.cub \ to=$(OUTPUT)/reingested_unproj.pvl > /dev/null; # projected $(APPNAME) from=$(INPUT)/CAS-MCO-2016-11-26T22.50.30.181-RED-01012-B1_proj_rdrgen.xml \ to=$(OUTPUT)/reingested_proj.cub > /dev/null; catlab from=$(OUTPUT)/reingested_proj.cub \ to=$(OUTPUT)/reingested_proj.pvl > /dev/null; # do mosaic later. Loading
isis/src/tgo/apps/tgocassis2isis/tgocassis2isis.cpp +61 −10 Original line number Diff line number Diff line Loading @@ -5,19 +5,21 @@ #include "AlphaCube.h" #include "Cube.h" #include "FileName.h" #include "IException.h" #include "iTime.h" #include "LineManager.h" #include "OriginalXmlLabel.h" #include "Preference.h" #include "ProcessImport.h" #include "UserInterface.h" #include "XmlToPvlTranslationManager.h" #include "iTime.h" using namespace std; using namespace Isis; void translateCoreInfo(FileName &inputLabel, ProcessImport &importer); void translateLabels(FileName &inputLabel, Cube *outputCube); void translateCoreInfo(XmlToPvlTranslationManager labelXlater, ProcessImport &importer); void translateLabels(FileName &inputLabel, Cube *outputCube, QString transFile); void IsisMain() { Loading @@ -41,7 +43,37 @@ void IsisMain() { } Cube *outputCube = importer.SetOutputCube("TO"); translateLabels(xmlFileName, outputCube); QString transRawFile = "/translations/tgoCassisInstrument.trn"; QString transExportFile = "/translations/tgoCassisExportedInstrument.trn"; try { translateLabels(xmlFileName, outputCube, transRawFile); } catch (IException &e) { translateLabels(xmlFileName, outputCube, transExportFile); // Try to translate a mapping group try { PvlGroup &dataDir = Preference::Preferences().findGroup("DataDirectory"); QString missionDir = (QString) dataDir["Tgo"]; FileName mapTransFile(missionDir + "/translations/tgoCassisMapping.trn"); // Get the translation manager ready for translating the mapping label XmlToPvlTranslationManager labelXlater(xmlFileName, mapTransFile.expanded()); // Pvl output label Pvl *outputLabel = outputCube->label(); labelXlater.Auto(*(outputLabel)); } catch (IException &e) { Pvl *outputLabel = outputCube->label(); if(outputLabel->hasGroup("Mapping")) { outputLabel->deleteGroup("Mapping"); } } } FileName outputCubeFileName(ui.GetFileName("TO")); Loading Loading @@ -82,11 +114,31 @@ void translateCoreInfo(FileName &inputLabel, ProcessImport &importer) { QString missionDir = (QString) dataDir["Tgo"]; // Get the translation manager ready FileName transFile(missionDir + "/translations/tgoCassis.trn"); FileName transFile; try { transFile = FileName(missionDir + "/translations/tgoCassis.trn"); XmlToPvlTranslationManager labelXlater(inputLabel, transFile.expanded()); translateCoreInfo(labelXlater, importer); } catch (IException &e) { // if exported, use this! transFile = FileName(missionDir + "/translations/tgoCassisExported.trn"); XmlToPvlTranslationManager labelXlater(inputLabel, transFile.expanded()); translateCoreInfo(labelXlater, importer); } } QString str; /** * Translate core info from labels and set ProcessImport object with * these values. * * @param labelXlater Reference to the XmlToPvlTranslationManager objcet to use for the translation. * @param importer Reference to the ProcessImport object to which core info will * be set. */ void translateCoreInfo(XmlToPvlTranslationManager labelXlater, ProcessImport &importer) { // Set up the ProcessImport QString str; str = labelXlater.Translate("CoreSamples"); int ns = toInt(str); str = labelXlater.Translate("CoreLines"); Loading @@ -109,7 +161,6 @@ void translateCoreInfo(FileName &inputLabel, ProcessImport &importer) { importer.SetMultiplier(toDouble(str)); } /** * Translate instrument, bandbin, and archive info from xml label into ISIS3 * label and add kernels group. Loading @@ -122,11 +173,11 @@ void translateCoreInfo(FileName &inputLabel, ProcessImport &importer) { * @history 2017-01-20 Jeannie Backer - Original Version * @history 2017-01-23 Kristin Berry - Added support for bandBin group and archive group */ void translateLabels(FileName &inputLabel, Cube *outputCube) { void translateLabels(FileName &inputLabel, Cube *outputCube, QString instTransFile) { // Get the directory where the Tgo translation tables are PvlGroup &dataDir = Preference::Preferences().findGroup("DataDirectory"); QString missionDir = (QString) dataDir["Tgo"]; FileName transFile(missionDir + "/translations/tgoCassisInstrument.trn"); FileName transFile(missionDir + instTransFile); // Get the translation manager ready for translating the instrument label XmlToPvlTranslationManager labelXlater(inputLabel, transFile.expanded()); Loading
isis/src/tgo/apps/tgocassis2isis/tgocassis2isis.xml +7 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,13 @@ Added check to verify input input xml file corresponds to valid filter image. </change> <change name="Summer Stapleton" date="2018-02-16"> Added handling for image file extesnions of either .dat or .img. Fixs #5334. Added handling for image file extesnions of either .dat or .img. Fixes #5334. </change> <change name="Kristin Berry and Makayla Shepherd" date="2018-05-15"> Updated to ingest images which have been exported using tgocassisrdrgen. Fixes #5418. </change> <change name="Kristin Berry and Makayla Shepherd" date="2018-05-15"> Updated to ingest Mapping groups from images have been exported using tgocassisrdrgen. Fixes #5418. </change> </history> Loading
isis/src/tgo/apps/tgocassis2isis/tsts/exportedFile/Makefile 0 → 100644 +23 −0 Original line number Diff line number Diff line # This test checks to see if images exported from tgocassisrdrgen can be # re-imported using tgocassis2isis. # # history 2018-05-16 Kristin Berry - Original version. References # ???? APPNAME = tgocassis2isis include $(ISISROOT)/make/isismake.tsts commands: $(APPNAME) from=$(INPUT)/CAS-MCO-2016-11-26T22.50.30.181-RED-01012-B1_rdrgen.xml \ to=$(OUTPUT)/reingested_unproj.cub > /dev/null; catlab from=$(OUTPUT)/reingested_unproj.cub \ to=$(OUTPUT)/reingested_unproj.pvl > /dev/null; # projected $(APPNAME) from=$(INPUT)/CAS-MCO-2016-11-26T22.50.30.181-RED-01012-B1_proj_rdrgen.xml \ to=$(OUTPUT)/reingested_proj.cub > /dev/null; catlab from=$(OUTPUT)/reingested_proj.cub \ to=$(OUTPUT)/reingested_proj.pvl > /dev/null; # do mosaic later.