Commit 187f99aa authored by Kristin Berry's avatar Kristin Berry
Browse files

Improved the quality of pds4 labels exported from isis2pds (using pdsversion=pds4). Fixes #5240

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@8309 41f8697f-d340-4b68-9986-7bafba869bb8
parent 887b2caf
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;
+3 −0
Original line number Diff line number Diff line
@@ -33,6 +33,9 @@
    <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>
    </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