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

gllssi2isis Original Label Fix #3226

Merged
merged 13 commits into from
Apr 16, 2019
Merged
Show file tree
Hide file tree
Changes from 11 commits
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
2 changes: 1 addition & 1 deletion isis/src/base/objs/ProcessImport/ProcessImport.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ namespace Isis {
* was made to accomodate Rosetta VIRTIS-m calibrated data files and
* has no impact on other supported BIP files.
* Fixes #5398.
* @history 208-07-19 Tyler Wilson - Added support for 4-byte UnsignedInteger special pixel
* @history 2018-07-19 Tyler Wilson - Added support for 4-byte UnsignedInteger special pixel
* values.
*
*/
Expand Down
52 changes: 16 additions & 36 deletions isis/src/galileo/apps/gllssi2isis/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "IException.h"
#include "iTime.h"
#include "ProcessImportPds.h"
#include "OriginalLabel.h"
#include "UserInterface.h"

#include <cstdio>
Expand All @@ -14,9 +15,6 @@
#include <QFile>





using namespace std;
using namespace Isis;
bool summed;
Expand All @@ -28,25 +26,19 @@ void translateLabels(Pvl &pdsLabel, Cube *ocube);
void fixPvl(QString fileName);

void IsisMain() {

//initialize globals
summed = false;
summedOutput = NULL;
// Grab the file to import
ProcessImportPds p;
UserInterface &ui = Application::GetUserInterface();
FileName inFile = ui.GetFileName("FROM");
FileName out = ui.GetFileName("TO");


FileName outFile = ui.GetFileName("TO");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used anywhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will make a change to use it


// Apply a fix to the gallileo pds labels so they can be read
fixPvl(inFile.toString());




// Make sure it is a Galileo SSI image

Pvl lab(inFile.expanded());

//Checks if in file is rdr
Expand Down Expand Up @@ -102,35 +94,34 @@ void IsisMain() {
Pvl pdsLabel;
p.SetPdsFile(inFile.expanded(), "", pdsLabel);

//Set up the output file
Cube *ocube;

// If summed handle the image similarly to pds2isis
// with an extra translation step
if (!summed) {
ocube = p.SetOutputCube("TO");
Cube *ocube = p.SetOutputCube("TO");
p.StartProcess();
translateLabels(pdsLabel, ocube);
p.EndProcess();
}
else {
// Otherwise the dimensions of the cube need to be cut in half before
// processsing. Since we didn't set the output cube we need to take care
// of writting the original label ourselves
summedOutput = new Cube();
summedOutput->setDimensions(p.Samples() / 2, p.Lines() / 2, p.Bands());
summedOutput->setPixelType(p.PixelType());
summedOutput->create(ui.GetFileName("TO"));
p.StartProcess(translateData);
ocube = summedOutput;
}

translateLabels(pdsLabel, ocube);
p.EndProcess();
p.StartProcess(translateData);
translateLabels(pdsLabel, summedOutput);

if (summed) {
OriginalLabel ol(Pvl(inFile.expanded()));
summedOutput->write(ol);
summedOutput->close();
delete summedOutput;
}
SgStapleton marked this conversation as resolved.
Show resolved Hide resolved

return;
}



/**
* This fixes a problem with some of the Pvl files where a comment
* was left open. If the file has this error, the comment is closed
Expand All @@ -141,9 +132,6 @@ void IsisMain() {
* being checked
*
*/



void fixPvl(QString fileName){

QFile pvlFile;
Expand Down Expand Up @@ -174,15 +162,7 @@ void fixPvl(QString fileName){

}









void translateData(Buffer &inData) {
void translateData(Isis::Buffer &inData) {
summedOutput->write(inData);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be replaced with ocube to get rid of summedOutput altogether?

}

Expand Down