Skip to content

Commit

Permalink
gllssi2isis Original Label Fix (#3226)
Browse files Browse the repository at this point in the history
* Allowed writting of residuals when value is zero to controlnet pvl

* Updated ControlNetVersioner unit test

* Fixed pvl labels original pvl labels not being written to the resulting cube.

* Updated docstrings and history for updated methods

* Removed the need to set the output cube pixel type

* Reverted proceeimport changes

* Set the dimensions in the process before processing

* Added missing 1 in a history record

* Reverted and applied a more appropriate fix

* Used outfile obtained at the beginning of the program

* Added history comment to app xml
  • Loading branch information
acpaquette authored and scsides committed Apr 16, 2019
1 parent 8a24f8f commit babbf69
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 61 deletions.
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
50 changes: 27 additions & 23 deletions isis/src/galileo/apps/gllssi2isis/gllssi2isis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@

<description>
Converts a PDS formatted Galileo solid state imager (SSI) image EDR
into an Isis Cube. The required instrument labels will be propagated
into the instrument group. The user must choose an input image label,
output cube name, and frame mode, or summing mode. Galileo SSI images have
a summing mode of FULL (800 x 800 pixels) or SUMMED (400 x 400 pixels).
into an Isis Cube. The required instrument labels will be propagated
into the instrument group. The user must choose an input image label,
output cube name, and frame mode, or summing mode. Galileo SSI images have
a summing mode of FULL (800 x 800 pixels) or SUMMED (400 x 400 pixels).
<p>
<strong> Note: </strong> For the I24 encounter (found in volume go_0022),
many Galileo SSI images of Io were originally "garbled". These images
were reconstructed and released with the filename ####s where ####r is the
name of the original garbled file and #### is the last four digits of the
SPACECRAFT_CLOCK_START_COUNT. These images will have Most of the original
images were 400 x 400 (i.e. SUMMED). However, the reconstructed files are
800 x 800 and must be imported as FULL to get the entire image. If the
user imports a reconstructed image with FRAMEMODE = AUTO, it will be
<strong> Note: </strong> For the I24 encounter (found in volume go_0022),
many Galileo SSI images of Io were originally "garbled". These images
were reconstructed and released with the filename ####s where ####r is the
name of the original garbled file and #### is the last four digits of the
SPACECRAFT_CLOCK_START_COUNT. These images will have Most of the original
images were 400 x 400 (i.e. SUMMED). However, the reconstructed files are
800 x 800 and must be imported as FULL to get the entire image. If the
user imports a reconstructed image with FRAMEMODE = AUTO, it will be
treated as a FULL image, even if the original was SUMMED.
</p>
</description>
Expand All @@ -33,15 +33,15 @@
Converted to Isis 3.0
</change>
<change name="Steven Koechle" date="2007-10-30">
Added Summing Keyword. Moved most hardcoded translations into a
translation table. Modified tests to check the lables. Removed ImageID
Added Summing Keyword. Moved most hardcoded translations into a
translation table. Modified tests to check the lables. Removed ImageID
keyword.
</change>
<change name="Steven Lambright" date="2007-12-31">
Removed the hard coded Instrument Mode ID keyword translation.
</change>
<change name="Steven Lambright" date="2007-01-08">
Added summing options. Output summed images will now only be a quarter of
Added summing options. Output summed images will now only be a quarter of
the size for calibration (the upper-left data in the input is preserved).
</change>
<change name="Christopher Austin" date="2008-03-18">
Expand All @@ -52,7 +52,7 @@
</change>
<change name="Jeannie Walldren" date="2009-06-08">
Added valid DATA_SET_ID value for reconstructed images (i.e. value
contains "SSI-4-REDR-V1.0"). Modified code to set as FULL summing
contains "SSI-4-REDR-V1.0"). Modified code to set as FULL summing
mode if FRAMEMODE=AUTO and the image is reconstructed.
</change>
<change name="Tyler Wilson" date="2015-10-02">
Expand All @@ -64,6 +64,10 @@
Changed documentation to have the correct link to the Planetary Science Data
Dictionary Document. Fixes #3867
</change>
<change name="Adam Paquette", date="2019-04-16">
Fixed original label not being written to cubes ingested using the summed
option. Fixes #3207
</change>


</history>
Expand Down Expand Up @@ -129,7 +133,7 @@
<parameter name="FRAMEMODE">
<type>string</type>
<brief>Summing mode of the input image</brief>
<description>Summing mode of the input image. The user
<description>Summing mode of the input image. The user
may specify the summing mode or choose to allow the program to
determine this.
</description>
Expand All @@ -138,15 +142,15 @@
<option value="AUTO">
<brief>Automatically Detect</brief>
<description>
This will attempt to automatically detect the summing mode of the
input image based on the DATA_SET_ID and/or FRAME_DURATION keyword
This will attempt to automatically detect the summing mode of the
input image based on the DATA_SET_ID and/or FRAME_DURATION keyword
values from the input image labels.
</description>
</option>
<option value="SUMMED">
<brief>The image is summed</brief>
<description>
This will treat the input image as if it has a summing mode of 2
This will treat the input image as if it has a summing mode of 2
in both the sample and line direction.
</description>
</option>
Expand Down Expand Up @@ -182,8 +186,8 @@
Example GUI
</brief>
<description>
Screenshot of GUI with parameters filled in to perform the
gllssi2isis application. Input label and output cubes are always
Screenshot of GUI with parameters filled in to perform the
gllssi2isis application. Input label and output cubes are always
required. The FRAMEMODE radio button AUTO is chosen as default.
</description>
<thumbnail width="200" height="177" caption="Gllssi2isis GUI using defaults." src="assets/thumbs/gllssi2isisGuiAutoThumb.jpg"/>
Expand Down Expand Up @@ -214,7 +218,7 @@
<thumbnail width="187" height="200" caption="Output cube imported with defaults" src="assets/thumbs/gllssi2isisOutputAutoThumb.jpg" />
<parameterName>
TO
</parameterName>
</parameterName>
</image>
</outputImages>
</example>
Expand Down
54 changes: 17 additions & 37 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");

// 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;
}
summedOutput->create(outFile.expanded());

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;
}

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);
}

Expand Down

0 comments on commit babbf69

Please sign in to comment.