Commit 64830a1e authored by Amy Stamile's avatar Amy Stamile
Browse files

more pvl updates

parent 1ebd1b0c
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ void IsisMain() {

  apollo = new Apollo(filename);

  utcTime = (QString)pdsLabel["START_TIME"];
  utcTime = QString::fromStdString(pdsLabel["START_TIME"]);

  // Setup the output cube attributes for a 16-bit unsigned tiff
  Isis::CubeAttributeOutput cao;
@@ -231,9 +231,9 @@ void TranslateApolloLabels (IString filename, Cube *opack) {
  PvlGroup kern("Kernels");
  PvlGroup codeGroup("Code");

  inst += PvlKeyword("SpacecraftName", apollo->SpacecraftName());
  inst += PvlKeyword("InstrumentId", apollo->InstrumentId());
  inst += PvlKeyword("TargetName", apollo->TargetName());
  inst += PvlKeyword("SpacecraftName", apollo->SpacecraftName().toStdString());
  inst += PvlKeyword("InstrumentId", apollo->InstrumentId().toStdString());
  inst += PvlKeyword("TargetName", apollo->TargetName().toStdString());

  if ( !IsValidCode() ){
    PvlGroup error("ERROR");
@@ -249,12 +249,12 @@ void TranslateApolloLabels (IString filename, Cube *opack) {
    Application::Log(error);
  }
  else {
    codeGroup += PvlKeyword("StartTime", FrameTime());
    codeGroup += PvlKeyword("StartTime", FrameTime().toStdString());
    codeGroup += PvlKeyword("SpacecraftAltitude", std::to_string(Altitude()),"meters");

    if (apollo->IsMetric()){
      codeGroup += PvlKeyword("ExposureDuration", std::to_string(ShutterInterval()), "milliseconds");
      codeGroup += PvlKeyword("ForwardMotionCompensation", FMC());
      codeGroup += PvlKeyword("ForwardMotionCompensation", FMC().toStdString());
    }

    for (int i=0; i<4; i++) {
@@ -272,20 +272,20 @@ void TranslateApolloLabels (IString filename, Cube *opack) {
  bandBin += PvlKeyword("FilterName", "CLEAR");
  bandBin += PvlKeyword("FilterId", "1");

  kern += PvlKeyword("NaifFrameCode", apollo->NaifFrameCode());
  kern += PvlKeyword("NaifFrameCode", apollo->NaifFrameCode().toStdString());

  // Set up the nominal reseaus group
  Isis::PvlGroup &dataDir = Isis::Preference::Preferences().findGroup("DataDirectory");
  Process p;
  PvlTranslationTable tTable("$ISISROOT/appdata/translations/MissionName2DataDir.trn");
  QString missionDir = dataDir[tTable.Translate("MissionName", apollo->SpacecraftName())][0];
  Pvl resTemplate(missionDir + "/reseaus/" + apollo->InstrumentId() + "_NOMINAL.pvl");
  QString missionDir = dataDir[tTable.Translate("MissionName", QString::fromStdString(apollo->SpacecraftName()))][0];
  Pvl resTemplate(missionDir.toStdString() + "/reseaus/" + apollo->InstrumentId().toStdString() + "_NOMINAL.pvl");
  PvlGroup *reseaus = &resTemplate.findGroup("Reseaus");

  // Update reseau locations based on refined code location
  for (int i=0; i<(reseaus->findKeyword("Type")).size(); i++) {
    double x = toDouble(reseaus->findKeyword("Sample")[i]) + sampleTranslation + 2278,
           y = toDouble(reseaus->findKeyword("Line")[i]) + lineTranslation - 20231;
    double x = std::stod(reseaus->findKeyword("Sample")[i]) + sampleTranslation + 2278,
           y = std::stod(reseaus->findKeyword("Line")[i]) + lineTranslation - 20231;

    if (apollo->IsApollo17()) {
        x += 50;
@@ -297,7 +297,7 @@ void TranslateApolloLabels (IString filename, Cube *opack) {
    reseaus->findKeyword("Line")[i] = std::to_string(
        sin(rotation)*(x-sampleTranslation) + cos(rotation)*(y-lineTranslation) + lineTranslation);
  }
  inst += PvlKeyword("StartTime", utcTime);
  inst += PvlKeyword("StartTime", utcTime.toStdString());

  opack->putGroup(inst);
  opack->putGroup(bandBin);
+4 −3
Original line number Diff line number Diff line
@@ -39,10 +39,11 @@ namespace Isis {
    PvlGroup &dataDir =
        Preference::Preferences().findGroup("DataDirectory");
    PvlTranslationTable tTable("$ISISROOT/appdata/translations/MissionName2DataDir.trn");
    QString missionDir = dataDir[tTable.Translate("MissionName",
        (inCube->group("Instrument")).findKeyword("SpacecraftName")[0])][0];
    QString missionDir = QString::fromStdString(
      dataDir[tTable.Translate("MissionName", QString::fromStdString(
        (inCube->group("Instrument")).findKeyword("SpacecraftName")[0])).toStdString()][0]);
    QString camera =
        (inCube->group("Instrument")).findKeyword("InstrumentId")[0];
        QString::fromStdString((inCube->group("Instrument")).findKeyword("InstrumentId")[0]);

    CubeAttributeInput cai;
    p.SetInputCube(missionDir + "/calibration/" + camera + "_flatfield.cub", cai);
+25 −25
Original line number Diff line number Diff line
@@ -54,8 +54,8 @@ namespace Isis {
        MAX_DISPY = ui.GetInteger("DELTAY");

        PvlGroup &reseaus = cube->label()->findGroup("Reseaus",Pvl::Traverse);
        QString mission = (cube->label()->findGroup("Instrument",Pvl::Traverse))["SpacecraftName"];
        QString instrument = (cube->label()->findGroup("Instrument",Pvl::Traverse))["InstrumentId"];
        QString mission = QString::fromStdString((cube->label()->findGroup("Instrument",Pvl::Traverse))["SpacecraftName"]);
        QString instrument = QString::fromStdString((cube->label()->findGroup("Instrument",Pvl::Traverse))["InstrumentId"]);
        Apollo apollo(mission, instrument);
        if (mission.mid(0,6) != "APOLLO") {
            std::string msg = "This application is for use with Apollo spacecrafts only.";
@@ -65,21 +65,21 @@ namespace Isis {
        // If the Keyword sizes don't match up, throw errors.
        int nres = reseaus["Line"].size();
        if (nres != reseaus["Sample"].size()) {
            QString msg = "Sample size incorrect [Sample size " +
                            toString(reseaus["Sample"].size()) + " != " + " Line size " +
                            toString(reseaus["Line"].size()) + "]";
            std::string msg = "Sample size incorrect [Sample size " +
                            std::to_string(reseaus["Sample"].size()) + " != " + " Line size " +
                            std::to_string(reseaus["Line"].size()) + "]";
            throw IException(IException::Unknown, msg, _FILEINFO_);
        }
        if (nres != reseaus["Type"].size()) {
            QString msg = "Type size incorrect [Type size " +
                            toString(reseaus["Type"].size()) + " != " + " Line size " +
                            toString(reseaus["Line"].size()) + "]";
            std::string msg = "Type size incorrect [Type size " +
                            std::to_string(reseaus["Type"].size()) + " != " + " Line size " +
                            std::to_string(reseaus["Line"].size()) + "]";
            throw IException(IException::Unknown, msg, _FILEINFO_);
        }
        if (nres != reseaus["Valid"].size()) {
            QString msg = "Valid size incorrect [Valid size " +
                            toString(reseaus["Valid"].size()) + " != " + " Line size " +
                            toString(reseaus["Line"].size()) + "]";
            std::string msg = "Valid size incorrect [Valid size " +
                            std::to_string(reseaus["Valid"].size()) + " != " + " Line size " +
                            std::to_string(reseaus["Line"].size()) + "]";
            throw IException(IException::Unknown, msg, _FILEINFO_);
        }

@@ -106,8 +106,8 @@ namespace Isis {
        int validReseaus = 0;
        // for (int res=0; res<nres; res++)
        for (int res=0; res<nres; res++) {
            currentLine = (int)(toDouble(reseaus["Line"][res])+0.5);
            currentSample = (int)(toDouble(reseaus["Sample"][res])+0.5);
            currentLine = (int)(std::stod(reseaus["Line"][res])+0.5);
            currentSample = (int)(std::stod(reseaus["Sample"][res])+0.5);

            // Output chips
            chip.SetSize(patternSize + 2*ds , patternSize + 2*dl);
@@ -117,13 +117,13 @@ namespace Isis {
            if  (Walk() ) {
                double dx = 0,
                            dy = 0;
                if (res%dim > 0 && reseaus["Valid"][res-1] == "1") dy = currentLine - patternSize/2 - dl + bestLine-1 - toDouble(reseaus["Line"][res]);
                if (res/dim > 0 && reseaus["Valid"][res - dim] == "1") dx = currentSample - patternSize/2 - ds + bestSample-1 - toDouble(reseaus["Sample"][res]);
                double horizontalShift = currentSample - patternSize/2 - ds + bestSample-1 - toDouble(reseaus["Sample"][res]) - dx,
                            verticalShift = currentLine - patternSize/2 - dl + bestLine-1 - toDouble(reseaus["Line"][res]) - dy;
                if (res%dim > 0 && reseaus["Valid"][res-1] == "1") dy = currentLine - patternSize/2 - dl + bestLine-1 - std::stod(reseaus["Line"][res]);
                if (res/dim > 0 && reseaus["Valid"][res - dim] == "1") dx = currentSample - patternSize/2 - ds + bestSample-1 - std::stod(reseaus["Sample"][res]);
                double horizontalShift = currentSample - patternSize/2 - ds + bestSample-1 - std::stod(reseaus["Sample"][res]) - dx,
                            verticalShift = currentLine - patternSize/2 - dl + bestLine-1 - std::stod(reseaus["Line"][res]) - dy;
                for (int i=res; i<nres; i++) {
                    reseaus["Sample"][i] = toString(toDouble(reseaus["Sample"][i]) + horizontalShift + ((i/dim) - (res/dim) + 1)*dx);
                    reseaus["Line"][i] = toString(toDouble(reseaus["Line"][i]) + verticalShift + ((i%dim) - (res%dim) + 1)*dy);
                    reseaus["Sample"][i] = std::to_string(std::stod(reseaus["Sample"][i]) + horizontalShift + ((i/dim) - (res/dim) + 1)*dx);
                    reseaus["Line"][i] = std::to_string(std::stod(reseaus["Line"][i]) + verticalShift + ((i%dim) - (res%dim) + 1)*dy);
                }
                reseaus["Valid"][res] = "1";
                validReseaus++;
@@ -131,8 +131,8 @@ namespace Isis {
                std::vector< double > xy;
                xy.push_back(res%(int)sqrt(nres));
                xy.push_back(res/(int)sqrt(nres));
                sampFunc.AddKnown(xy, toDouble(reseaus["Sample"][res]));
                lineFunc.AddKnown(xy, toDouble(reseaus["Line"][res]));
                sampFunc.AddKnown(xy, std::stod(reseaus["Sample"][res]));
                lineFunc.AddKnown(xy, std::stod(reseaus["Line"][res]));

                ds = (int)(MIN_DISP+ abs(dx) + abs(horizontalShift));
                dl = (int)(MIN_DISP + abs(dy) + abs(verticalShift));
@@ -150,12 +150,12 @@ namespace Isis {

            // for invalid reseaus, refine the estimated locations
            for (int res=0; res<nres; res++) {
                if (toInt(reseaus["Valid"][res])==0) {
                if (std::stoi(reseaus["Valid"][res])==0) {
                    std::vector< double > xy;
                    xy.push_back(res%(int)sqrt(nres));
                    xy.push_back(res/(int)sqrt(nres));
                    reseaus["Sample"][res] = toString(sampFunc.Evaluate(xy));
                    reseaus["Line"][res] = toString(lineFunc.Evaluate(xy));
                    reseaus["Sample"][res] = std::to_string(sampFunc.Evaluate(xy));
                    reseaus["Line"][res] = std::to_string(lineFunc.Evaluate(xy));
                }
            }

@@ -170,7 +170,7 @@ namespace Isis {

        if (cube->label()->hasObject("History")) {
            // Record apollofindrx history to the cube
            QString histName = (QString)cube->label()->findObject("History")["Name"];
            QString histName = QString::fromStdString(cube->label()->findObject("History")["Name"]);
            // create a History Blob with value found in the History PvlObject's Name keyword
            // read cube's History PvlObject data into the History Blob
            History hist = cube->readHistory(histName);
+1 −1
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ namespace Isis {
    //parameters for maximum correlation autoregestration
    // see: ///usgs/pkgs/isis3nightly2011-09-21/isis/doc/documents/patternSMatch/patternSMatch.html#DistanceTolerance
    FileName fiducialPvl("$ISISROOT/appdata/templates/apollo/PanFiducialFinder.def");
    pvl.read(fiducialPvl.expanded());  //read in the autoreg parameters
    pvl.read(fiducialPvl.expanded().toStdString());  //read in the autoreg parameters
    AutoReg *arS = AutoRegFactory::Create(pvl);

    *arS->PatternChip() = patternS;  //patternS chip is constant
+7 −7
Original line number Diff line number Diff line
@@ -47,8 +47,8 @@ namespace Isis {
    PvlKeyword &status = info->group("RESEAUS")["STATUS"];
    QString in = info->fileName();

    QString spacecraft = (info->group("Instrument")["SpacecraftName"]);
    QString instrument = (info->group("Instrument")["InstrumentId"]);
    QString spacecraft = QString::fromStdString(info->group("Instrument")["SpacecraftName"]);
    QString instrument = QString::fromStdString(info->group("Instrument")["InstrumentId"]);
    if (spacecraft.mid(0,6) != "APOLLO") {
      std::string msg = "This application is for use with Apollo spacecrafts only. ";
      throw IException(IException::Unknown, msg, _FILEINFO_);
@@ -56,12 +56,12 @@ namespace Isis {
    Apollo apollo(spacecraft, instrument);

    // Check reseau status and make sure it is not nominal or removed
    if ((QString)status == "Nominal") {
    if ((std::string)status == "Nominal") {
      QString msg = "Input file [" + in +
            "] appears to have nominal reseau status. You must run findrx first.";
      throw IException(IException::User,msg, _FILEINFO_);
    }
    if ((QString)status == "Removed") {
    if ((std::string)status == "Removed") {
      QString msg = "Input file [" + in +
            "] appears to already have reseaus removed.";
      throw IException(IException::User,msg, _FILEINFO_);
@@ -99,9 +99,9 @@ namespace Isis {
    Brick brick(dim,dim,1,cube.pixelType());
    int width = ui.GetInteger("WIDTH");
    for (int res=0; res<numres; res++) {
      if ((resvalid == 0 || toInt(valid[res]) == 1)) {
        int baseSamp = (int)(toDouble(samps[res])+0.5) - (dim/2);
        int baseLine = (int)(toDouble(lines[res])+0.5) - (dim/2);
      if ((resvalid == 0 || std::stoi(valid[res]) == 1)) {
        int baseSamp = (int)(std::stod(samps[res])+0.5) - (dim/2);
        int baseLine = (int)(std::stod(lines[res])+0.5) - (dim/2);
        brick.SetBasePosition(baseSamp,baseLine,1);
        cube.read(brick);
        if (action == "NULL") {
Loading