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 6 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
40 changes: 31 additions & 9 deletions isis/src/base/objs/ProcessImport/ProcessImport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1199,21 +1199,26 @@ namespace Isis {
}
}


/**
* Create the output file. Note that all the appropiate calls to at least
* SetDimensions and SetPixelType should be made prior to calling this method.
* Create the output file. This method will use the cube attribute object
* passed in to populate the pixel type and pass the desired samples, lines,
* and band numbers into the process setOutputCube method.
*
* @param parameter The parameter name that holds the output file name.
*
* @param att The CubeAttributeOutput object with defined attributes
*
* @param ns The number of samples in the output cube
*
* @param nl The number of lines in the output cube
*
* @param nb The number of bands in the output cube
*
* @return @b Isis::Cube Output cube.
*
* @throws Isis::iException::Message "Unsupported pixel type."
*/
Isis::Cube *ProcessImport::SetOutputCube(const QString &parameter) {
CubeAttributeOutput &att =
Application::GetUserInterface().GetOutputAttribute(parameter);

Isis::Cube *ProcessImport::SetOutputCube(const QString &parameter, CubeAttributeOutput &att, const int ns, const int nl, const int nb) {
Copy link
Contributor

@scsides scsides Apr 15, 2019

Choose a reason for hiding this comment

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

Since this call is being passed the user interface parameter name, I don't see the reason to pass in the CubeAttribute. It is part of what the user typed. Also, the original SetOutputCube member parsed the value of the parameter and pulled the attributes off in order to call the parents member. Seems reasonable to continue doing this and not make the application programmer do this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No longer necessary as the change to ProcessImport was unnecessary

jessemapel marked this conversation as resolved.
Show resolved Hide resolved
if (att.propagateMinimumMaximum()) {
double min, max;
if ((p_pixelType == Isis::Double) ||
Expand Down Expand Up @@ -1264,7 +1269,22 @@ namespace Isis {
}
}

return Process::SetOutputCube(Application::GetUserInterface().GetFileName(parameter), att, p_ns, p_nl, p_nb);
return Process::SetOutputCube(Application::GetUserInterface().GetFileName(parameter), att, ns, nl, nb);
}


/**
* Create the output file. Note that all the appropiate calls to at least
* SetDimensions and SetPixelType should be made prior to calling this method.
*
* @param parameter The parameter name that holds the output file name.
*
* @return @b Isis::Cube Output cube.
*/
Isis::Cube *ProcessImport::SetOutputCube(const QString &parameter) {
CubeAttributeOutput &att =
Application::GetUserInterface().GetOutputAttribute(parameter);
return ProcessImport::SetOutputCube(parameter, att, p_ns, p_nl, p_nb);
}


Expand All @@ -1278,6 +1298,7 @@ namespace Isis {
* output cube.
*
* @return @b Isis::Cube Output cube.
*
* @throws Isis::iException::Message "File is not in a supported
* organization."
*/
Expand Down Expand Up @@ -1315,6 +1336,7 @@ namespace Isis {
* @param funct Method that accepts Isis::Buffer as an input
* parameter, processes the image, and has no
* return value.
*
* @throws Isis::iException::Message "File is not a supported
* organization."
*/
Expand Down Expand Up @@ -1977,7 +1999,7 @@ namespace Isis {
break;
case Isis::SignedInteger:
(*out)[samp] = (double)swapper.Int(&in[bufferIndex]);
break;
break;
case Isis::UnsignedInteger:
(*out)[samp] = (double)swapper.Uint32_t(&in[bufferIndex]);
break;
Expand Down
7 changes: 5 additions & 2 deletions isis/src/base/objs/ProcessImport/ProcessImport.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ 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.
*
* @history 2019-04-15 Adam Paquette - Exposed the ns, nl, nb (number of samples, lines, and bands)
* for the setOutputCube function. Updated existing setOutputCube methods
Copy link
Contributor

Choose a reason for hiding this comment

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

Exposed by adding a new SetOutputCube member

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No longer necessary as the change to ProcessImport was unnecessary

* accordingly.
*/
class ProcessImport : public Isis::Process {
public:
Expand Down Expand Up @@ -199,6 +201,7 @@ namespace Isis {

using Isis::Process::SetOutputCube; // make parent functions visable
Isis::Cube *SetOutputCube(const QString &parameter);
Isis::Cube *SetOutputCube(const QString &parameter, CubeAttributeOutput &att, const int ns, const int nl, const int nb);
virtual Isis::Cube *SetOutputCube(const QString &fname,
Isis::CubeAttributeOutput &att);

Expand Down
17 changes: 5 additions & 12 deletions isis/src/galileo/apps/gllssi2isis/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ void translateLabels(Pvl &pdsLabel, Cube *ocube);
void fixPvl(QString fileName);

void IsisMain() {

//initialize globals
summed = false;
summedOutput = NULL;
Expand Down Expand Up @@ -110,22 +109,16 @@ void IsisMain() {
p.StartProcess();
}
else {
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);
Isis::CubeAttributeOutput &att = Application::GetUserInterface().GetOutputAttribute("TO");
att.setPixelType(p.PixelType());
summedOutput = p.SetOutputCube("TO", att, p.Samples() / 2, p.Lines() / 2, p.Bands());
ocube = summedOutput;
p.StartProcess(translateData);
}

translateLabels(pdsLabel, ocube);
p.EndProcess();

if (summed) {
summedOutput->close();
delete summedOutput;
}
SgStapleton marked this conversation as resolved.
Show resolved Hide resolved

return;
}

Expand Down Expand Up @@ -182,7 +175,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