Loading isis/src/kaguya/apps/kaguyatc2isis/kaguyatc2isis.cpp +71 −47 Original line number Original line Diff line number Diff line Loading @@ -3,37 +3,48 @@ #include <cstdio> #include <cstdio> #include <string> #include <string> #include "FileName.h" #include "ProcessImportPds.h" #include "ProcessImportPds.h" #include "UserInterface.h" #include "UserInterface.h" #include "FileName.h" using namespace std; using namespace std; using namespace Isis; using namespace Isis; void IsisMain() { void IsisMain() { ProcessImportPds p; ProcessImportPds importPds; UserInterface &ui = Application::GetUserInterface(); UserInterface &ui = Application::GetUserInterface(); QString labelFile = ui.GetFileName("FROM"); FileName inFile = ui.GetFileName("FROM"); FileName inFile = ui.GetFileName("FROM"); QString id; QString labelFile = inFile.expanded(); Pvl label(inFile.expanded()); Pvl label(labelFile); QString dataFile = ""; if ( inFile.extension().toLower() == "lbl" ) { dataFile = inFile.path() + (QString) label.findKeyword("FILE_NAME"); } else { dataFile = labelFile; } QString id = ""; try { try { id = (QString) label.findKeyword("DATA_SET_ID"); id = (QString) label.findKeyword("DATA_SET_ID"); } } catch(IException &e) { catch(IException &e) { QString msg = "Unable to read [DATA_SET_ID] from input file [" + QString msg = "Unable to read [DATA_SET_ID] from label file [" inFile.expanded() + "]"; + labelFile + "]"; throw IException(e, IException::Unknown, msg, _FILEINFO_); throw IException(e, IException::Unknown, msg, _FILEINFO_); } } id = id.simplified().trimmed(); id = id.simplified().trimmed(); if(id != "TC_MAP" && id != "TCO_MAP") { if (id != "TC_MAP" QString msg = "Input file [" + inFile.expanded() + "] does not appear to be " + && id != "TCO_MAP" "in Kaguya Terrain Camera level 2 format. " + && id != "TC1_Level2B" "DATA_SET_ID is [" + id + "]"; && id != "TC2_Level2B") { QString msg = "Input file [" + labelFile + "] does not appear to be " + "a supported Kaguya Terrain Camera format. " + "DATA_SET_ID is [" + id + "]" + "Valid formats include [TC_MAP, TCO_MAP, TC1_Level2B]"; throw IException(IException::Unknown, msg, _FILEINFO_); throw IException(IException::Unknown, msg, _FILEINFO_); } } Loading @@ -41,74 +52,87 @@ void IsisMain() { label.addKeyword(PvlKeyword("TARGET_NAME", "MOON"), Pvl::Replace); label.addKeyword(PvlKeyword("TARGET_NAME", "MOON"), Pvl::Replace); } } p.SetPdsFile(label, labelFile); importPds.SetPdsFile(label, dataFile); Cube *outcube = p.SetOutputCube("TO"); Cube *outcube = importPds.SetOutputCube("TO"); // Get user entered special pixel ranges // Get user entered special pixel ranges if (ui.GetBoolean("SETNULLRANGE")) { if (ui.GetBoolean("SETNULLRANGE")) { p.SetNull(ui.GetDouble("NULLMIN"), ui.GetDouble("NULLMAX")); importPds.SetNull(ui.GetDouble("NULLMIN"), ui.GetDouble("NULLMAX")); } } if (ui.GetBoolean("SETHRSRANGE")) { if (ui.GetBoolean("SETHRSRANGE")) { p.SetHRS(ui.GetDouble("HRSMIN"), ui.GetDouble("HRSMAX")); importPds.SetHRS(ui.GetDouble("HRSMIN"), ui.GetDouble("HRSMAX")); } } if (ui.GetBoolean("SETHISRANGE")) { if (ui.GetBoolean("SETHISRANGE")) { p.SetHIS(ui.GetDouble("HISMIN"), ui.GetDouble("HISMAX")); importPds.SetHIS(ui.GetDouble("HISMIN"), ui.GetDouble("HISMAX")); } } if (ui.GetBoolean("SETLRSRANGE")) { if (ui.GetBoolean("SETLRSRANGE")) { p.SetLRS(ui.GetDouble("LRSMIN"), ui.GetDouble("LRSMAX")); importPds.SetLRS(ui.GetDouble("LRSMIN"), ui.GetDouble("LRSMAX")); } } if (ui.GetBoolean("SETLISRANGE")) { if (ui.GetBoolean("SETLISRANGE")) { p.SetLIS(ui.GetDouble("LISMIN"), ui.GetDouble("LISMAX")); importPds.SetLIS(ui.GetDouble("LISMIN"), ui.GetDouble("LISMAX")); } } p.SetOrganization(Isis::ProcessImport::BSQ); importPds.SetOrganization(Isis::ProcessImport::BSQ); p.StartProcess(); importPds.StartProcess(); // Get the mapping labels // Get the mapping labels Pvl otherLabels; Pvl otherLabels; p.TranslatePdsProjection(otherLabels); importPds.TranslatePdsProjection(otherLabels); // Translate the remaining MI MAP labels // Translate the remaining MI MAP labels PvlGroup dataDir(Preference::Preferences().findGroup("DataDirectory")); PvlGroup dataDir(Preference::Preferences().findGroup("DataDirectory")); QString transDir = (QString) dataDir["Kaguya"] + "/translations/"; QString transDir = (QString) dataDir["Kaguya"] + "/translations/"; FileName transFile(transDir + "tcmapBandBin.trn"); FileName transFile(transDir + "kaguyaTcBandBin.trn"); PvlToPvlTranslationManager bandBinXlater(label, transFile.expanded()); PvlToPvlTranslationManager bandBinXlater(label, transFile.expanded()); bandBinXlater.Auto(otherLabels); bandBinXlater.Auto(otherLabels); transFile = transDir + "tcmapInstrument.trn"; transFile = transDir + "kaguyaTcInstrument.trn"; PvlToPvlTranslationManager instXlater(label, transFile.expanded()); PvlToPvlTranslationManager instXlater(label, transFile.expanded()); instXlater.Auto(otherLabels); instXlater.Auto(otherLabels); transFile = transDir + "tcmapArchive.trn"; transFile = transDir + "kaguyaTcArchive.trn"; PvlToPvlTranslationManager archiveXlater(label, transFile.expanded()); PvlToPvlTranslationManager archiveXlater(label, transFile.expanded()); archiveXlater.Auto(otherLabels); archiveXlater.Auto(otherLabels); if(otherLabels.hasGroup("Mapping") && if ( otherLabels.hasGroup("Mapping") (otherLabels.findGroup("Mapping").keywords() > 0)) { && otherLabels.findGroup("Mapping").keywords() > 0 ) { outcube->putGroup(otherLabels.findGroup("Mapping")); outcube->putGroup(otherLabels.findGroup("Mapping")); } } if(otherLabels.hasGroup("Instrument") && if ( otherLabels.hasGroup("Instrument") (otherLabels.findGroup("Instrument").keywords() > 0)) { && otherLabels.findGroup("Instrument").keywords() > 0 ) { outcube->putGroup(otherLabels.findGroup("Instrument")); outcube->putGroup(otherLabels.findGroup("Instrument")); } } if(otherLabels.hasGroup("BandBin") && if ( otherLabels.hasGroup("BandBin") (otherLabels.findGroup("BandBin").keywords() > 0)) { && otherLabels.findGroup("BandBin").keywords() > 0 ) { outcube->putGroup(otherLabels.findGroup("BandBin")); PvlGroup &bandBinGroup = otherLabels.findGroup("BandBin"); if (!bandBinGroup.hasKeyword("FilterName")) { bandBinGroup += PvlKeyword("FilterName", "BroadBand"); } } if(otherLabels.hasGroup("Archive") && if (!bandBinGroup.hasKeyword("Center")) { (otherLabels.findGroup("Archive").keywords() > 0)) { bandBinGroup += PvlKeyword("Center", "640", "nanometers"); outcube->putGroup(otherLabels.findGroup("Archive")); } } if (!bandBinGroup.hasKeyword("Width")) { bandBinGroup += PvlKeyword("Width", "420", "nanometers"); } outcube->putGroup(bandBinGroup); } else { // Add the BandBin group // Add the BandBin group PvlGroup bbin("BandBin"); PvlGroup bandBinGroup("BandBin"); bbin += PvlKeyword("FilterName", "BroadBand"); bandBinGroup += PvlKeyword("FilterName", "BroadBand"); bbin += PvlKeyword("Center", "640nm"); bandBinGroup += PvlKeyword("Center", "640nm"); bbin += PvlKeyword("Width", "420nm"); bandBinGroup += PvlKeyword("Width", "420nm"); outcube->putGroup(bbin); outcube->putGroup(bandBinGroup); } if ( otherLabels.hasGroup("Archive") && otherLabels.findGroup("Archive").keywords() > 0 ) { outcube->putGroup(otherLabels.findGroup("Archive")); } p.EndProcess(); importPds.EndProcess(); } } isis/src/kaguya/apps/kaguyatc2isis/kaguyatc2isis.xml +13 −3 Original line number Original line Diff line number Diff line Loading @@ -2,11 +2,18 @@ <application name="kaguyatc2isis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://isis.astrogeology.usgs.gov/Schemas/Application/application.xsd"> <application name="kaguyatc2isis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://isis.astrogeology.usgs.gov/Schemas/Application/application.xsd"> <brief>Import PDS formatted Kaguya Terrain Camera level 2 image cube into Isis format cube</brief> <brief> Import L2B0 or L2B2 Kaguya TC image to ISIS3 cube. </brief> <description> <description> This program will import a PDS formatted Kaguya Terrain Camera (TC) level 2 This program will import a Kaguya Terrain Camera (TC) image into an Isis cube. file from a PDS3 formatted image to an ISIS3 formatted cube. Note that not all TC images may be supported by this program. Supported input images include radiometrically corrected unprojected images, TC maps, or TC Ortho maps. To verify, input image labels must have DATA_SET_ID matching TC1_Level2B, TC2_Level2B, TC_MAP or TCO_MAP. </description> </description> <history> <history> Loading @@ -24,6 +31,9 @@ <change name="Janet Barrett" date="2014-02-11"> <change name="Janet Barrett" date="2014-02-11"> Added check for TARGET_NAME keyword. Fixes #2036. Added check for TARGET_NAME keyword. Fixes #2036. </change> </change> <change name="Jeannie Backer" date="2018-10-02"> Added support for Kaguya L2B0 (TC1_Level2B and TC2_Level2B) files. </change> </history> </history> <category> <category> Loading isis/src/kaguya/apps/kaguyatc2isis/tsts/tc1_s_l2b0/Makefile 0 → 100644 +12 −0 Original line number Original line Diff line number Diff line # Tests import of Kaguya TC1 L2B0 image. # # history 2018-10-02 Jeannie Backer - Original version. APPNAME = kaguyatc2isis include $(ISISROOT)/make/isismake.tsts commands: $(APPNAME) from=$(INPUT)/TC1W2B0_01_00296N081E2387.img \ to=$(OUTPUT)/TC1W2B0_01_00296N081E2387.cub > /dev/null; catlab from=$(OUTPUT)/TC1W2B0_01_00296N081E2387.cub \ to=$(OUTPUT)/TC1W2B0_01_00296N081E2387.pvl > /dev/null; isis/src/kaguya/apps/kaguyatc2isis/tsts/tc2_w_l2b0/Makefile 0 → 100644 +12 −0 Original line number Original line Diff line number Diff line # Tests import of Kaguya TC2 L2B0 image. # # history 2018-10-02 Jeannie Backer - Original version. APPNAME = kaguyatc2isis include $(ISISROOT)/make/isismake.tsts commands: $(APPNAME) from=$(INPUT)/TC2W2B0_01_02735N583E3115.img \ to=$(OUTPUT)/TC2W2B0_01_02735N583E3115.cub > /dev/null; catlab from=$(OUTPUT)/TC2W2B0_01_02735N583E3115.cub \ to=$(OUTPUT)/TC2W2B0_01_02735N583E3115.pvl > /dev/null; Loading
isis/src/kaguya/apps/kaguyatc2isis/kaguyatc2isis.cpp +71 −47 Original line number Original line Diff line number Diff line Loading @@ -3,37 +3,48 @@ #include <cstdio> #include <cstdio> #include <string> #include <string> #include "FileName.h" #include "ProcessImportPds.h" #include "ProcessImportPds.h" #include "UserInterface.h" #include "UserInterface.h" #include "FileName.h" using namespace std; using namespace std; using namespace Isis; using namespace Isis; void IsisMain() { void IsisMain() { ProcessImportPds p; ProcessImportPds importPds; UserInterface &ui = Application::GetUserInterface(); UserInterface &ui = Application::GetUserInterface(); QString labelFile = ui.GetFileName("FROM"); FileName inFile = ui.GetFileName("FROM"); FileName inFile = ui.GetFileName("FROM"); QString id; QString labelFile = inFile.expanded(); Pvl label(inFile.expanded()); Pvl label(labelFile); QString dataFile = ""; if ( inFile.extension().toLower() == "lbl" ) { dataFile = inFile.path() + (QString) label.findKeyword("FILE_NAME"); } else { dataFile = labelFile; } QString id = ""; try { try { id = (QString) label.findKeyword("DATA_SET_ID"); id = (QString) label.findKeyword("DATA_SET_ID"); } } catch(IException &e) { catch(IException &e) { QString msg = "Unable to read [DATA_SET_ID] from input file [" + QString msg = "Unable to read [DATA_SET_ID] from label file [" inFile.expanded() + "]"; + labelFile + "]"; throw IException(e, IException::Unknown, msg, _FILEINFO_); throw IException(e, IException::Unknown, msg, _FILEINFO_); } } id = id.simplified().trimmed(); id = id.simplified().trimmed(); if(id != "TC_MAP" && id != "TCO_MAP") { if (id != "TC_MAP" QString msg = "Input file [" + inFile.expanded() + "] does not appear to be " + && id != "TCO_MAP" "in Kaguya Terrain Camera level 2 format. " + && id != "TC1_Level2B" "DATA_SET_ID is [" + id + "]"; && id != "TC2_Level2B") { QString msg = "Input file [" + labelFile + "] does not appear to be " + "a supported Kaguya Terrain Camera format. " + "DATA_SET_ID is [" + id + "]" + "Valid formats include [TC_MAP, TCO_MAP, TC1_Level2B]"; throw IException(IException::Unknown, msg, _FILEINFO_); throw IException(IException::Unknown, msg, _FILEINFO_); } } Loading @@ -41,74 +52,87 @@ void IsisMain() { label.addKeyword(PvlKeyword("TARGET_NAME", "MOON"), Pvl::Replace); label.addKeyword(PvlKeyword("TARGET_NAME", "MOON"), Pvl::Replace); } } p.SetPdsFile(label, labelFile); importPds.SetPdsFile(label, dataFile); Cube *outcube = p.SetOutputCube("TO"); Cube *outcube = importPds.SetOutputCube("TO"); // Get user entered special pixel ranges // Get user entered special pixel ranges if (ui.GetBoolean("SETNULLRANGE")) { if (ui.GetBoolean("SETNULLRANGE")) { p.SetNull(ui.GetDouble("NULLMIN"), ui.GetDouble("NULLMAX")); importPds.SetNull(ui.GetDouble("NULLMIN"), ui.GetDouble("NULLMAX")); } } if (ui.GetBoolean("SETHRSRANGE")) { if (ui.GetBoolean("SETHRSRANGE")) { p.SetHRS(ui.GetDouble("HRSMIN"), ui.GetDouble("HRSMAX")); importPds.SetHRS(ui.GetDouble("HRSMIN"), ui.GetDouble("HRSMAX")); } } if (ui.GetBoolean("SETHISRANGE")) { if (ui.GetBoolean("SETHISRANGE")) { p.SetHIS(ui.GetDouble("HISMIN"), ui.GetDouble("HISMAX")); importPds.SetHIS(ui.GetDouble("HISMIN"), ui.GetDouble("HISMAX")); } } if (ui.GetBoolean("SETLRSRANGE")) { if (ui.GetBoolean("SETLRSRANGE")) { p.SetLRS(ui.GetDouble("LRSMIN"), ui.GetDouble("LRSMAX")); importPds.SetLRS(ui.GetDouble("LRSMIN"), ui.GetDouble("LRSMAX")); } } if (ui.GetBoolean("SETLISRANGE")) { if (ui.GetBoolean("SETLISRANGE")) { p.SetLIS(ui.GetDouble("LISMIN"), ui.GetDouble("LISMAX")); importPds.SetLIS(ui.GetDouble("LISMIN"), ui.GetDouble("LISMAX")); } } p.SetOrganization(Isis::ProcessImport::BSQ); importPds.SetOrganization(Isis::ProcessImport::BSQ); p.StartProcess(); importPds.StartProcess(); // Get the mapping labels // Get the mapping labels Pvl otherLabels; Pvl otherLabels; p.TranslatePdsProjection(otherLabels); importPds.TranslatePdsProjection(otherLabels); // Translate the remaining MI MAP labels // Translate the remaining MI MAP labels PvlGroup dataDir(Preference::Preferences().findGroup("DataDirectory")); PvlGroup dataDir(Preference::Preferences().findGroup("DataDirectory")); QString transDir = (QString) dataDir["Kaguya"] + "/translations/"; QString transDir = (QString) dataDir["Kaguya"] + "/translations/"; FileName transFile(transDir + "tcmapBandBin.trn"); FileName transFile(transDir + "kaguyaTcBandBin.trn"); PvlToPvlTranslationManager bandBinXlater(label, transFile.expanded()); PvlToPvlTranslationManager bandBinXlater(label, transFile.expanded()); bandBinXlater.Auto(otherLabels); bandBinXlater.Auto(otherLabels); transFile = transDir + "tcmapInstrument.trn"; transFile = transDir + "kaguyaTcInstrument.trn"; PvlToPvlTranslationManager instXlater(label, transFile.expanded()); PvlToPvlTranslationManager instXlater(label, transFile.expanded()); instXlater.Auto(otherLabels); instXlater.Auto(otherLabels); transFile = transDir + "tcmapArchive.trn"; transFile = transDir + "kaguyaTcArchive.trn"; PvlToPvlTranslationManager archiveXlater(label, transFile.expanded()); PvlToPvlTranslationManager archiveXlater(label, transFile.expanded()); archiveXlater.Auto(otherLabels); archiveXlater.Auto(otherLabels); if(otherLabels.hasGroup("Mapping") && if ( otherLabels.hasGroup("Mapping") (otherLabels.findGroup("Mapping").keywords() > 0)) { && otherLabels.findGroup("Mapping").keywords() > 0 ) { outcube->putGroup(otherLabels.findGroup("Mapping")); outcube->putGroup(otherLabels.findGroup("Mapping")); } } if(otherLabels.hasGroup("Instrument") && if ( otherLabels.hasGroup("Instrument") (otherLabels.findGroup("Instrument").keywords() > 0)) { && otherLabels.findGroup("Instrument").keywords() > 0 ) { outcube->putGroup(otherLabels.findGroup("Instrument")); outcube->putGroup(otherLabels.findGroup("Instrument")); } } if(otherLabels.hasGroup("BandBin") && if ( otherLabels.hasGroup("BandBin") (otherLabels.findGroup("BandBin").keywords() > 0)) { && otherLabels.findGroup("BandBin").keywords() > 0 ) { outcube->putGroup(otherLabels.findGroup("BandBin")); PvlGroup &bandBinGroup = otherLabels.findGroup("BandBin"); if (!bandBinGroup.hasKeyword("FilterName")) { bandBinGroup += PvlKeyword("FilterName", "BroadBand"); } } if(otherLabels.hasGroup("Archive") && if (!bandBinGroup.hasKeyword("Center")) { (otherLabels.findGroup("Archive").keywords() > 0)) { bandBinGroup += PvlKeyword("Center", "640", "nanometers"); outcube->putGroup(otherLabels.findGroup("Archive")); } } if (!bandBinGroup.hasKeyword("Width")) { bandBinGroup += PvlKeyword("Width", "420", "nanometers"); } outcube->putGroup(bandBinGroup); } else { // Add the BandBin group // Add the BandBin group PvlGroup bbin("BandBin"); PvlGroup bandBinGroup("BandBin"); bbin += PvlKeyword("FilterName", "BroadBand"); bandBinGroup += PvlKeyword("FilterName", "BroadBand"); bbin += PvlKeyword("Center", "640nm"); bandBinGroup += PvlKeyword("Center", "640nm"); bbin += PvlKeyword("Width", "420nm"); bandBinGroup += PvlKeyword("Width", "420nm"); outcube->putGroup(bbin); outcube->putGroup(bandBinGroup); } if ( otherLabels.hasGroup("Archive") && otherLabels.findGroup("Archive").keywords() > 0 ) { outcube->putGroup(otherLabels.findGroup("Archive")); } p.EndProcess(); importPds.EndProcess(); } }
isis/src/kaguya/apps/kaguyatc2isis/kaguyatc2isis.xml +13 −3 Original line number Original line Diff line number Diff line Loading @@ -2,11 +2,18 @@ <application name="kaguyatc2isis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://isis.astrogeology.usgs.gov/Schemas/Application/application.xsd"> <application name="kaguyatc2isis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://isis.astrogeology.usgs.gov/Schemas/Application/application.xsd"> <brief>Import PDS formatted Kaguya Terrain Camera level 2 image cube into Isis format cube</brief> <brief> Import L2B0 or L2B2 Kaguya TC image to ISIS3 cube. </brief> <description> <description> This program will import a PDS formatted Kaguya Terrain Camera (TC) level 2 This program will import a Kaguya Terrain Camera (TC) image into an Isis cube. file from a PDS3 formatted image to an ISIS3 formatted cube. Note that not all TC images may be supported by this program. Supported input images include radiometrically corrected unprojected images, TC maps, or TC Ortho maps. To verify, input image labels must have DATA_SET_ID matching TC1_Level2B, TC2_Level2B, TC_MAP or TCO_MAP. </description> </description> <history> <history> Loading @@ -24,6 +31,9 @@ <change name="Janet Barrett" date="2014-02-11"> <change name="Janet Barrett" date="2014-02-11"> Added check for TARGET_NAME keyword. Fixes #2036. Added check for TARGET_NAME keyword. Fixes #2036. </change> </change> <change name="Jeannie Backer" date="2018-10-02"> Added support for Kaguya L2B0 (TC1_Level2B and TC2_Level2B) files. </change> </history> </history> <category> <category> Loading
isis/src/kaguya/apps/kaguyatc2isis/tsts/tc1_s_l2b0/Makefile 0 → 100644 +12 −0 Original line number Original line Diff line number Diff line # Tests import of Kaguya TC1 L2B0 image. # # history 2018-10-02 Jeannie Backer - Original version. APPNAME = kaguyatc2isis include $(ISISROOT)/make/isismake.tsts commands: $(APPNAME) from=$(INPUT)/TC1W2B0_01_00296N081E2387.img \ to=$(OUTPUT)/TC1W2B0_01_00296N081E2387.cub > /dev/null; catlab from=$(OUTPUT)/TC1W2B0_01_00296N081E2387.cub \ to=$(OUTPUT)/TC1W2B0_01_00296N081E2387.pvl > /dev/null;
isis/src/kaguya/apps/kaguyatc2isis/tsts/tc2_w_l2b0/Makefile 0 → 100644 +12 −0 Original line number Original line Diff line number Diff line # Tests import of Kaguya TC2 L2B0 image. # # history 2018-10-02 Jeannie Backer - Original version. APPNAME = kaguyatc2isis include $(ISISROOT)/make/isismake.tsts commands: $(APPNAME) from=$(INPUT)/TC2W2B0_01_02735N583E3115.img \ to=$(OUTPUT)/TC2W2B0_01_02735N583E3115.cub > /dev/null; catlab from=$(OUTPUT)/TC2W2B0_01_02735N583E3115.cub \ to=$(OUTPUT)/TC2W2B0_01_02735N583E3115.pvl > /dev/null;