Skip to content

Commit

Permalink
final updates
Browse files Browse the repository at this point in the history
  • Loading branch information
amystamile-usgs committed Sep 18, 2024
1 parent f49f123 commit 4704e2d
Show file tree
Hide file tree
Showing 220 changed files with 1,809 additions and 1,810 deletions.
34 changes: 17 additions & 17 deletions isis/src/near/apps/msi2isis/msi2isis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ namespace Isis {
void msi2isis( UserInterface &ui, Pvl *log ) {

// get the label for the input image
FileName from = ui.GetFileName("FROM");
if (from.extension().toUpper() != "LBL") {
FileName from = ui.GetFileName("FROM").toStdString();
if (IString(from.extension()).UpCase() != "LBL") {
from = from.setExtension("lbl");
if (!from.fileExists()) {
from = from.setExtension("LBL");
}
if (!from.fileExists()) {
throw IException(IException::Io,
"Unable to find PDS label file for ["
+ ui.GetFileName("FROM") + "].",
+ ui.GetFileName("FROM").toStdString() + "].",
_FILEINFO_);
}
}
Expand All @@ -63,15 +63,15 @@ namespace Isis {
ProcessImportPds importPds;
Pvl inputLabelPvl;

importPds.SetPdsFile(from.expanded(), "", inputLabelPvl);
importPds.SetPdsFile(QString::fromStdString(from.expanded()), "", inputLabelPvl);


// from the pds label, verfify that the image is valid before continuing
if(inputLabelPvl["INSTRUMENT_ID"][0] != "MSI") {
throw IException(IException::Io,
"The input label [" + from.expanded() + "] has an invalid "
"value for INSTRUMENT_ID = ["
+ QString::fromStdString(inputLabelPvl["INSTRUMENT_ID"][0])
+ inputLabelPvl["INSTRUMENT_ID"][0]
+ "]. The msi2isis program requires INSTRUMENT_ID = [MSI].",
_FILEINFO_);
}
Expand All @@ -81,22 +81,22 @@ namespace Isis {
std::string msg = "The given file [" + from.expanded() + "] does not contain "
"a full MSI image. Full NEAR Shoemaker MSI images have "
"dimension 537 samples x 244 (or 412) lines. The given image is ["
+ QString(toString(samples)) + "] samples by ["
+ QString(toString(lines)) + "] lines.";
+ toString(samples) + "] samples by ["
+ toString(lines) + "] lines.";
throw IException(IException::Io, msg, _FILEINFO_);
}
if (inputLabelPvl["SAMPLE_DISPLAY_DIRECTION"][0] != "RIGHT") {
std::string msg = "The input label [" + from.expanded() + "] has an invalid "
"value for SAMPLE_DISPLAY_DIRECTION = ["
+ QString::fromStdString(inputLabelPvl["SAMPLE_DISPLAY_DIRECTION"][0])
+ inputLabelPvl["SAMPLE_DISPLAY_DIRECTION"][0]
+ "]. The msi2isis program requires "
"SAMPLE_DISPLAY_DIRECTION = [RIGHT].";
throw IException(IException::Io, msg, _FILEINFO_);
}
if (inputLabelPvl["LINE_DISPLAY_DIRECTION"][0] != "UP") {
std::string msg = "The input label [" + from.expanded() + "] has an invalid "
"value for LINE_DISPLAY_DIRECTION = ["
+ QString::fromStdString(inputLabelPvl["LINE_DISPLAY_DIRECTION"][0])
+ inputLabelPvl["LINE_DISPLAY_DIRECTION"][0]
+ "]. The msi2isis program requires "
"LINE_DISPLAY_DIRECTION = [UP].";
throw IException(IException::Io, msg, _FILEINFO_);
Expand All @@ -113,7 +113,7 @@ namespace Isis {
// the given input file appears to be valid, continue with the import process
FileName importProcessOutCube = FileName::createTempFile("$Temporary/" + from.baseName() + ".import.tmp.cub");
CubeAttributeOutput outatt = CubeAttributeOutput("+Real");
importPds.SetOutputCube(importProcessOutCube.expanded(), outatt);
importPds.SetOutputCube(QString::fromStdString(importProcessOutCube.expanded()), outatt);
importPds.StartProcess();
importPds.Finalize();
importPds.ClearCubes();
Expand All @@ -124,8 +124,8 @@ namespace Isis {
if ( 412 != lines ) {
// The second process will enlarge the imported cube from 537x244 to 537x412
ProcessRubberSheet enlargeProcess;
Cube *cube = enlargeProcess.SetInputCube(importProcessOutCube.expanded(), inatt);
enlargeProcess.SetOutputCube(enlargeProcessOutCube.expanded(), outatt, 537, 412, 1);
Cube *cube = enlargeProcess.SetInputCube(QString::fromStdString(importProcessOutCube.expanded()), inatt);
enlargeProcess.SetOutputCube(QString::fromStdString(enlargeProcessOutCube.expanded()), outatt, 537, 412, 1);

// Set up the interpolator
QScopedPointer<Interpolator> interp;
Expand Down Expand Up @@ -155,7 +155,7 @@ namespace Isis {
// The third (last) process will flip the image lines and set the 33 pixels
// along each border (top, bottom, left, and right) to null.
ProcessBySample processSamps;
processSamps.SetInputCube(enlargeProcessOutCube.expanded(), inatt);
processSamps.SetInputCube(QString::fromStdString(enlargeProcessOutCube.expanded()), inatt);

QString fname = ui.GetCubeName("TO");
CubeAttributeOutput &atts = ui.GetOutputAttribute("TO");
Expand Down Expand Up @@ -189,8 +189,8 @@ namespace Isis {
translateMsiLabels(inputLabelPvl, isisLabelPvl);
}
catch ( IException &e) {
remove(importProcessOutCube.expanded().toLatin1());
remove(enlargeProcessOutCube.expanded().toLatin1());
remove(importProcessOutCube.expanded().c_str());
remove(enlargeProcessOutCube.expanded().c_str());
std::string msg = "Unable to translate the labels from [" + from.expanded()
+ "] to ISIS format using msi2isis.";
throw IException(e, IException::Unknown, msg, _FILEINFO_);
Expand Down Expand Up @@ -245,8 +245,8 @@ namespace Isis {


// clean up temp files and "new" pointers
remove(importProcessOutCube.expanded().toLatin1());
remove(enlargeProcessOutCube.expanded().toLatin1());
remove(importProcessOutCube.expanded().c_str());
remove(enlargeProcessOutCube.expanded().c_str());
}


Expand Down
6 changes: 3 additions & 3 deletions isis/src/near/objs/MsiCamera/MsiCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ namespace Isis {
CameraFocalPlaneMap *focalMap = new CameraFocalPlaneMap(this, naifIkCode());

// Make sure to grab lines and samples in the correct order.
double line = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_LINE");
double sample = Spice::getDouble("INS" + toString(naifIkCode()) + "_BORESIGHT_SAMPLE");
double line = Spice::getDouble("INS" + QString::number(naifIkCode()) + "_BORESIGHT_LINE");
double sample = Spice::getDouble("INS" + QString::number(naifIkCode()) + "_BORESIGHT_SAMPLE");
focalMap->SetDetectorOrigin(sample, line);

// Setup distortion map
double k1 = Spice::getDouble("INS" + toString(naifIkCode()) + "_K1");
double k1 = Spice::getDouble("INS" + QString::number(naifIkCode()) + "_K1");
new RadialDistortionMap(this, k1, 1);

// Setup the ground and sky map
Expand Down
40 changes: 20 additions & 20 deletions isis/src/newhorizons/apps/leisa2isis/leisa2isis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ namespace Isis {
void leisa2isis(UserInterface &ui, Pvl *log) {
ProcessImportFits importFits;

importFits.setFitsFile(FileName(ui.GetFileName("FROM")));
importFits.setFitsFile(FileName(ui.GetFileName("FROM").toStdString()));
PvlGroup mainLabel;
mainLabel = importFits.fitsImageLabel(0);

// Get the first label and make sure this is a New Horizons LEISA file
if (!mainLabel.hasKeyword("MISSION") || !mainLabel.hasKeyword("INSTRU")) {
std::string msg = QObject::tr("Input file [%1] does not appear to be a New Horizons LEISA FITS "
QString msg = QObject::tr("Input file [%1] does not appear to be a New Horizons LEISA FITS "
"file. Input file label key MISSION or INSTRU is missing").
arg(ui.GetFileName("FROM"));
throw IException(IException::User, msg, _FILEINFO_);
throw IException(IException::User, msg.toStdString(), _FILEINFO_);
}
else if (mainLabel["MISSION"][0] != "New Horizons" || mainLabel["INSTRU"][0] != "lei") {
std::string msg = QObject::tr("Input file [%1] does not appear to be a New Horizons LEISA FITS "
QString msg = QObject::tr("Input file [%1] does not appear to be a New Horizons LEISA FITS "
"file. Input file label value for MISSION is [%2], INSTRU is [%3]").
arg(ui.GetFileName("FROM")).arg(QString::fromStdString(mainLabel["MISSION"][0])).
arg(QString::fromStdString(mainLabel["INSTRU"][0]));
throw IException(IException::User, msg, _FILEINFO_);
throw IException(IException::User, msg.toStdString(), _FILEINFO_);
}

bool replace = ui.GetBoolean("REPLACE");
Expand Down Expand Up @@ -81,8 +81,8 @@ namespace Isis {
} **/
}
catch (IException &e) {
std::string msg = QObject::tr("Unable to find errormap extension in [%1]").arg(ui.GetFileName("FROM"));
throw IException(e, IException::Unknown, msg, _FILEINFO_);
QString msg = QObject::tr("Unable to find errormap extension in [%1]").arg(ui.GetFileName("FROM"));
throw IException(e, IException::Unknown, msg.toStdString(), _FILEINFO_);
}

}
Expand Down Expand Up @@ -113,8 +113,8 @@ namespace Isis {
} **/
}
catch (IException &e) {
std::string msg = QObject::tr("Unable to find quality extension in [%1]").arg(ui.GetFileName("FROM"));
throw IException(e, IException::Unknown, msg, _FILEINFO_);
QString msg = QObject::tr("Unable to find quality extension in [%1]").arg(ui.GetFileName("FROM"));
throw IException(e, IException::Unknown, msg.toStdString(), _FILEINFO_);
}
}

Expand All @@ -130,7 +130,7 @@ namespace Isis {
if (replace){
outputFile = FileName::createTempFile(FileName("$TEMPORARY/dn.cub"));
importFits.SetPixelType(Isis::Real);
output = importFits.SetOutputCube(outputFile.toString(), att);
output = importFits.SetOutputCube(QString::fromStdString(outputFile.toString()), att);
}
else {
if (importFits.PixelType() == Isis::None) {
Expand All @@ -141,7 +141,7 @@ namespace Isis {
}

// Get the path where the New Horizons translation tables are.
QString transDir = "$ISISROOT/appdata/translations/";
std::string transDir = "$ISISROOT/appdata/translations/";

// Temp storage of translated labels
Pvl outLabel;
Expand All @@ -151,7 +151,7 @@ namespace Isis {
fitsLabel.addGroup(importFits.fitsImageLabel(0));
// Create an Instrument group
FileName insTransFile(transDir + "NewHorizonsLeisaInstrument_fit.trn");
PvlToPvlTranslationManager insXlater(fitsLabel, insTransFile.expanded());
PvlToPvlTranslationManager insXlater(fitsLabel, QString::fromStdString(insTransFile.expanded()));
insXlater.Auto(outLabel);

// Modify/add Instument group keywords not handled by the translater
Expand All @@ -165,19 +165,19 @@ namespace Isis {

// Create an Archive group
FileName archiveTransFile(transDir + "NewHorizonsLeisaArchive_fit.trn");
PvlToPvlTranslationManager archiveXlater(fitsLabel, archiveTransFile.expanded());
PvlToPvlTranslationManager archiveXlater(fitsLabel, QString::fromStdString(archiveTransFile.expanded()));
archiveXlater.Auto(outLabel);
output->putGroup(outLabel.findGroup("Archive", Pvl::Traverse));

//Create a Band Bin Group
FileName bandTransFile(transDir + "NewHorizonsLeisaBandBin_fit.trn");
PvlToPvlTranslationManager bandBinXlater(fitsLabel, bandTransFile.expanded());
PvlToPvlTranslationManager bandBinXlater(fitsLabel, QString::fromStdString(bandTransFile.expanded()));
bandBinXlater.Auto(outLabel);
output->putGroup(outLabel.findGroup("BandBin", Pvl::Traverse));

// Create a Kernels group
FileName kernelsTransFile(transDir + "NewHorizonsLeisaKernels_fit.trn");
PvlToPvlTranslationManager kernelsXlater(fitsLabel, kernelsTransFile.expanded());
PvlToPvlTranslationManager kernelsXlater(fitsLabel, QString::fromStdString(kernelsTransFile.expanded()));
kernelsXlater.Auto(outLabel);
output->putGroup(outLabel.findGroup("Kernels", Pvl::Traverse));

Expand Down Expand Up @@ -232,7 +232,7 @@ namespace Isis {
cao.setPixelType(Isis::Real);
}

outputCubeForLeisa2Isis = importFits.SetOutputCube(qualityFile.toString(), cao);
outputCubeForLeisa2Isis = importFits.SetOutputCube(QString::fromStdString(qualityFile.toString()), cao);

importFits.Progress()->SetText("Preparing quality image for comparing against LEISA pixels");
importFits.StartProcess(processFunc);
Expand All @@ -242,15 +242,15 @@ namespace Isis {
// Now we have the temp cube and want to use fx to add it to the DN cube
// fx f1=temp_quality.cub f2=temp_dn.cub to=output_name.cub equation="f1 + f2"
QString parameters;
parameters += " F1= " + outputFile.toString();
parameters += " F2= " + qualityFile.toString();
parameters += " F1= " + QString::fromStdString(outputFile.toString());
parameters += " F2= " + QString::fromStdString(qualityFile.toString());
parameters += " TO= " + ui.GetCubeName("TO");
parameters += " EQUATION=" + QString("\"f1+f2\"");
ProgramLauncher::RunIsisProgram("fx", parameters);

// Cleanup by removing temporary cubes
remove(qualityFile.toString().toStdString().c_str());
remove(outputFile.toString().toStdString().c_str());
remove(qualityFile.toString().c_str());
remove(outputFile.toString().c_str());
}

// Import the ERRORMAP image. It is the 6th image in the FITS file (i.e., 5th extension)
Expand Down
24 changes: 12 additions & 12 deletions isis/src/newhorizons/apps/lorri2isis/lorri2isis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@ namespace Isis {

ProcessImportFits importFits;

importFits.setFitsFile(FileName(ui.GetFileName("FROM")));
importFits.setFitsFile(FileName(ui.GetFileName("FROM").toStdString()));

// Get the first label and make sure this is a New Horizons LORRI file
PvlGroup mainLabel = importFits.fitsImageLabel(0);
if (mainLabel["MISSION"][0] != "New Horizons" || mainLabel["INSTRU"][0] != "lor") {
std::string msg = QObject::tr("Input file [%1] does not appear to be a New Horizons LORRI FITS "
QString msg = QObject::tr("Input file [%1] does not appear to be a New Horizons LORRI FITS "
"file. Input file label value for MISSION is [%2] and INSTRU is [%3]").
arg(ui.GetFileName("FROM")).arg(QString::fromStdString(mainLabel["MISSION"][0])).arg(QString::fromStdString(mainLabel["INSTRU"][0]));
throw IException(IException::User, msg, _FILEINFO_);
throw IException(IException::User, msg.toStdString(), _FILEINFO_);
}

// Get the label of extension #1 and make sure this is a New Horizons LORRI Error image
if (ui.WasEntered("ERROR")) {
PvlGroup errorLabel = importFits.fitsImageLabel(1);
if (errorLabel["XTENSION"][0] != "IMAGE" || errorLabel["EXTNAME"][0] != "LORRI Error image") {
std::string msg = QObject::tr("Input file [%1] does not appear to contain a LORRI Error image. "
QString msg = QObject::tr("Input file [%1] does not appear to contain a LORRI Error image. "
"Input file label value for EXTNAME is [%2] and XTENSION is [%3]").
arg(ui.GetFileName("FROM")).arg(QString::fromStdString(errorLabel["EXTNAME"][0])).arg(QString::fromStdString(errorLabel["XTENSION"][0]));
throw IException(IException::User, msg, _FILEINFO_);
throw IException(IException::User, msg.toStdString(), _FILEINFO_);
}
}

Expand All @@ -57,10 +57,10 @@ namespace Isis {
PvlGroup qualityLabel = importFits.fitsImageLabel(2);
if (qualityLabel["XTENSION"][0] != "IMAGE" ||
qualityLabel["EXTNAME"][0] != "LORRI Quality flag image") {
std::string msg = QObject::tr("Input file [%1] does not appear to contain a LORRI Quality image. "
QString msg = QObject::tr("Input file [%1] does not appear to contain a LORRI Quality image. "
"Input file label value for EXTNAME is [%2] and XTENSION is [%3]").
arg(ui.GetFileName("FROM")).arg(QString::fromStdString(qualityLabel["EXTNAME"][0])).arg(QString::fromStdString(qualityLabel["XTENSION"][0]));
throw IException(IException::User, msg, _FILEINFO_);
throw IException(IException::User, msg.toStdString(), _FILEINFO_);
}
}

Expand All @@ -70,7 +70,7 @@ namespace Isis {
Cube *output = importFits.SetOutputCube(ui.GetCubeName("TO"), att);

// Get the path where the New Horizons translation tables are.
QString transDir = "$ISISROOT/appdata/translations/";
std::string transDir = "$ISISROOT/appdata/translations/";

// Temp storage of translated labels
Pvl outLabel;
Expand All @@ -81,7 +81,7 @@ namespace Isis {

// Create an Instrument group
FileName insTransFile(transDir + "NewHorizonsLorriInstrument_fit.trn");
PvlToPvlTranslationManager insXlater(fitsLabel, insTransFile.expanded());
PvlToPvlTranslationManager insXlater(fitsLabel, QString::fromStdString(insTransFile.expanded()));
insXlater.Auto(outLabel);

// Modify/add Instument group keywords not handled by the translater
Expand All @@ -95,19 +95,19 @@ namespace Isis {

// Create a Band Bin group
FileName bandTransFile(transDir + "NewHorizonsLorriBandBin_fit.trn");
PvlToPvlTranslationManager bandBinXlater(fitsLabel, bandTransFile.expanded());
PvlToPvlTranslationManager bandBinXlater(fitsLabel, QString::fromStdString(bandTransFile.expanded()));
bandBinXlater.Auto(outLabel);
output->putGroup(outLabel.findGroup("BandBin", Pvl::Traverse));

// Create an Archive group
FileName archiveTransFile(transDir + "NewHorizonsLorriArchive_fit.trn");
PvlToPvlTranslationManager archiveXlater(fitsLabel, archiveTransFile.expanded());
PvlToPvlTranslationManager archiveXlater(fitsLabel, QString::fromStdString(archiveTransFile.expanded()));
archiveXlater.Auto(outLabel);
output->putGroup(outLabel.findGroup("Archive", Pvl::Traverse));

// Create a Kernels group
FileName kernelsTransFile(transDir + "NewHorizonsLorriKernels_fit.trn");
PvlToPvlTranslationManager kernelsXlater(fitsLabel, kernelsTransFile.expanded());
PvlToPvlTranslationManager kernelsXlater(fitsLabel, QString::fromStdString(kernelsTransFile.expanded()));
kernelsXlater.Auto(outLabel);
output->putGroup(outLabel.findGroup("Kernels", Pvl::Traverse));

Expand Down
Loading

0 comments on commit 4704e2d

Please sign in to comment.