Commit 050c0791 authored by Tracie Sucharski's avatar Tracie Sucharski
Browse files

Merged r8291 through r8323 from trunk into ipce.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@8324 41f8697f-d340-4b68-9986-7bafba869bb8
parent d68a10d6
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -126,7 +126,8 @@ void IsisMain() {
      throw  IException(IException::User, msg, _FILEINFO_);
    }
    
    QString outFile = ui.GetFileName("TO");
    FileName outFile(ui.GetFileName("TO", "img"));
    QString outFileName(outFile.expanded());
    
    if(ui.GetString("STRETCH") == "LINEAR") {
      if(ui.GetString("BITTYPE") != "32BIT")
@@ -183,7 +184,7 @@ void IsisMain() {
    Application::Log(results);

    process.StandardPds4Label();
    process.WritePds4(outFile);
    process.WritePds4(outFileName);
  }

  return;
+26 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>

<application name="isis2pds" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://isis.astrogeology.usgs.gov/Schemas/Application/application.xsd">

  <brief>
    Convert from ISIS3 cube to PDS 3 or PDS 4 format
  </brief>

  <description>
   Program to convert cubes to PDS3 or PDS4 image files.

   For PDS4, If available, Instrument and  Mapping information will be written to the detached output PDS4 formatted xml label file.   
<p>
   Not all values in the generated PDS4 labels can be determined automatically by ISIS3, and some must be updated by the user (by opening up the xml label output by this application and editing it with a text editor) for the generated label to be PDS4 compliant. The values UNK (unknown) and TBD (to be determined) are used as placeholders in the generated label. TBD values must be replaced by the user for the output label to be PDS4 compliant. Some of these TBDs can only be replaced with one of several specific enumerated values to meet compliancy. These possible values can be found in the <a href="https://pds.jpl.nasa.gov/pds4/doc/im/current/index_1900.html">PDS 4 Information Model Specification</a> in the Value/Class column of the table for the associated tag or in the index at the end of the document. Searching this page for the name of the field you need to determine a value for is recommended. 
</p>

<p>
For example: For a cube with map-projected data, ISIS3 will populate planar_coordinate encoding_method with a value on its own, but if it did not and instead had "TBD", we would find at <a href="https://pds.jpl.nasa.gov/pds4/doc/im/current/index_1900.html#attribute_cart_planar_coordinate_information_cart_planar_coordinate_encoding_method">planar_coordinate_coding_method</a> that there are 3 possible values: 'Coordinate Pair', 'Distance and Bearing', 'Row and Column'.
</p>

<p>
Not everything is in the  <a href="https://pds.jpl.nasa.gov/pds4/doc/im/current/index_1900.html">PDS 4 Information Model Specification</a> at this time, so if the information about a tag is not in there, it may be necessary to find the options in the appropriate schematron file (.sch) available at: <a href="https://pds.jpl.nasa.gov/pds4/schema/released/">PDS4 Released Schema</a>. For the previous example, the same information can be found in the <a href="https://pds.jpl.nasa.gov/pds4/cart/v1/PDS4_CART_1700.sch">PDS4 Cartography schematron file </a>.
</p>

<p>
UNK  is used as a placeholder if any value can be used and still be a valid PDS4-formatted xml header. UNKs can, but are not required to be, replaced by the user with
better information. 
</p>

  </description>

  <category>
@@ -33,6 +52,12 @@
    <change name="Jeannie Backer, Mayayla Shepard, and Kristin Berry" date="2017-10-27">
       Added PDS4 output option. Previously, this application converted ISIS3 cubes to PDS3 format only. 
    </change>
    <change name="Jeannie Backer" date="2017-11-13">
       Updated to attach *.img extension to pds4 output data file. 
    </change>
    <change name="Kristin Berry" date="2017-11-26">
       Updated with very basic documentation about the PDS4 output labels. 
    </change>
    </history>

  <groups>
+5 −5
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ namespace Isis {
      }
    }
    else {
      QString msg = "Invalid PDS export type";
      QString msg = "Invalid PDS export type.";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }

@@ -263,7 +263,7 @@ namespace Isis {
      }
    }
    else {
      QString msg = "Labels must be detached for JP2 files";
      QString msg = "Labels must be detached for JP2 files.";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
    FileName outFile(sImageFile);
@@ -277,7 +277,7 @@ namespace Isis {
    cmpObj += PvlKeyword("UNCOMPRESSED_FILE_NAME", infilename.name());
    int storagebytes = InputCubes[0]->sampleCount() * InputCubes[0]->lineCount();
    if(p_pixelType == Isis::Real) {
      QString msg = "JPEG2000 does not support floating point data";
      QString msg = "JPEG2000 does not support floating point data.";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
    if(p_pixelType == Isis::UnsignedWord || p_pixelType == Isis::SignedWord) {
@@ -354,7 +354,7 @@ namespace Isis {
      }
    }
    else {
      QString msg = "Labels must be detached for JP2 files";
      QString msg = "Labels must be detached for JP2 files.";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
    FileName outFile(sImageFile);
@@ -368,7 +368,7 @@ namespace Isis {
    cmpObj += PvlKeyword("UNCOMPRESSED_FILE_NAME", infilename.name());
    int storagebytes = InputCubes[0]->sampleCount() * InputCubes[0]->lineCount();
    if(p_pixelType == Isis::Real) {
      QString msg = "JPEG2000 does not support floating point data";
      QString msg = "JPEG2000 does not support floating point data.";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
    if(p_pixelType == Isis::UnsignedWord || p_pixelType == Isis::SignedWord) {
+502 −124

File changed.

Preview size limit exceeded, changes collapsed.

+29 −5
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@

#include "ProcessExport.h"
#include <vector>

#include <QString>
#include <QDomDocument>

namespace Isis {
@@ -53,7 +53,21 @@ namespace Isis {
   *                           See #5202.
   *   @history 2017-10-31 Jeannie Backer - Added standardInstrument() and displaySettings()
   *                           translations.
   *  
   *   @history 2017-11-06 Kristin Berry - Added standardBandBin() 
   *   @history 2017-11-07 Jeannie Backer - Added code to search for target in the Mapping group
   *                           if no instrument group is found. Added Identification Area
   *                           tranlations. Added sanity checks to getElement().
   *   @history 2017-11-07 Jeannie Backer - Added code to write data file info into label file.
   *                           Added code to translate time format and add nil tag if empty.
   *   @history 2017-11-15 Jesse Mapel - Added translateUnits method to convert units to PDS4
   *                           standard format.
   *   @history 2017-11-16 Kristin Berry - Updated WritePds4 to put the File information first
   *                           in the output File_Area_Observational.
   *   @history 2017-11-17 Jesse Mapel - Removed empty FixedImageRoot method.
   *   @history 2017-11-20 Jeannie Backer - Updated StandardImageImage() to re-order the
   *                           Array_3D_Image values properly.
   *   @history 2017-11-21 Kristin Berry - Updated the constructor to add the xml version and 
   *                           encoding to the beginning of the XML file. 
   */

  class ProcessExportPds4: public Isis::ProcessExport {
@@ -66,7 +80,6 @@ namespace Isis {
      void StandardAllMapping();

      void CreateImageLabel();
      void FixedImageRoot();
      void StandardImageImage();

      void OutputLabel(std::ofstream &os);
@@ -78,13 +91,24 @@ namespace Isis {
      void StartProcess(std::ofstream &fout);
      QDomDocument &GetLabel();
      void WritePds4(QString outFile);
      QDomElement getElement(QStringList xmlPath, QDomElement parent);
      QDomElement getElement(QStringList xmlPath, QDomElement parent=QDomElement());
      void addHistory(QString description, QString date = "tbd", QString version = "1.0");

    protected:
      static void translateUnits(QDomDocument &label,
                                 QString transMapFile = "$base/translations/pds4ExportUnits.pvl");

    protected:
      void addSchema(QString sch, QString xsd, QString xmlns, QString xmlnsURI) ;
      void identificationArea();
      void standardInstrument();
      void standardBandBin(); 
      void displaySettings();
      QString PDS4PixelType(PixelType pixelType, ByteOrder endianType);
      static QMap<QString, QString> createUnitMap(Pvl configPvl);
      static void translateChildUnits(QDomElement parent, QMap<QString, QString> transMap);

      QDomDocument *m_domDoc;               //!< XML label
      QString m_schemaLocation;             //!< QString with all schema locations required

  };
}
Loading