Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noproj Test Fixes #4808

Merged
merged 2 commits into from
Feb 24, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions isis/src/base/apps/noproj/noproj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,13 @@ namespace Isis {

// Can we do a regular label? Didn't work on 12-15-2006
cao.setLabelAttachment(Isis::DetachedLabel);
FileName matchCubeFile = FileName::createTempFile("./match.cub");
acpaquette marked this conversation as resolved.
Show resolved Hide resolved
QString matchCubeFileNoExt = matchCubeFile.path() + "/" + matchCubeFile.baseName();

// Determine the output image size from
// 1) the idealInstrument pvl if there or
// 2) the input size expanded by user specified percentage
Cube *ocube = p.SetOutputCube("match.cub", cao, 1, 1, 1);
Cube *ocube = p.SetOutputCube(matchCubeFile.expanded(), cao, 1, 1, 1);
// Extract the times and the target from the instrument group
QString startTime = inst["StartTime"];
QString stopTime;
Expand Down Expand Up @@ -350,32 +352,32 @@ namespace Isis {
// Now adjust the label to fake the true size of the image to match without
// taking all the space it would require for the image data
Pvl label;
label.read("match.lbl");
label.read(matchCubeFileNoExt + ".lbl");
PvlGroup &dims = label.findGroup("Dimensions", Pvl::Traverse);
dims["Lines"] = toString(numberLines);
dims["Samples"] = toString(detectorSamples);
dims["Bands"] = toString(numberBands);
label.write("match.lbl");
label.write(matchCubeFileNoExt + ".lbl");

// And run cam2cam to apply the transformation
QVector<QString> args = {"to=" + ui.GetFileName("TO"), "INTERP=" + ui.GetString("INTERP")};
UserInterface cam2camUI(FileName("$ISISROOT/bin/xml/cam2cam.xml").expanded(), args);
Cube matchCube;
matchCube.open("match.cub", "rw");
matchCube.open(matchCubeFile.expanded(), "rw");
cam2cam(icube, &matchCube, cam2camUI);

// Cleanup by deleting the match files
remove("match.History.IsisCube");
remove("match.lbl");
remove("match.cub");
remove("match.OriginalLabel.IsisCube");
remove("match.Table.BodyRotation");
remove("match.Table.HiRISE Ancillary");
remove("match.Table.HiRISE Calibration Ancillary");
remove("match.Table.HiRISE Calibration Image");
remove("match.Table.InstrumentPointing");
remove("match.Table.InstrumentPosition");
remove("match.Table.SunPosition");
remove((matchCubeFileNoExt + ".History.IsisCube").toStdString().c_str());
remove((matchCubeFileNoExt + ".lbl").toStdString().c_str());
remove(matchCubeFile.expanded().toStdString().c_str());
remove((matchCubeFileNoExt + ".OriginalLabel.IsisCube").toStdString().c_str());
remove((matchCubeFileNoExt + ".Table.BodyRotation").toStdString().c_str());
remove((matchCubeFileNoExt + ".Table.HiRISE Ancillary").toStdString().c_str());
remove((matchCubeFileNoExt + ".Table.HiRISE Calibration Ancillary").toStdString().c_str());
remove((matchCubeFileNoExt + ".Table.HiRISE Calibration Image").toStdString().c_str());
remove((matchCubeFileNoExt + ".Table.InstrumentPointing").toStdString().c_str());
remove((matchCubeFileNoExt + ".Table.InstrumentPosition").toStdString().c_str());
remove((matchCubeFileNoExt + ".Table.SunPosition").toStdString().c_str());

// Finally finish by adding the OriginalInstrument group to the TO cube
Cube toCube;
Expand Down