Commit 3ef5aebc authored by Kaitlyn Lee's avatar Kaitlyn Lee Committed by Stuart Sides
Browse files

Fixed error when trying to export a compressed image using pds2hideal. Fixes #5525. (#2059)

* Added capability to export a compressed image with tables missing RECORD_BYTES keyword. Added test for compressed image.

* Changed names of test output cubes.
parent ee65fb7a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -465,9 +465,18 @@ namespace Isis {
    }
    //  Get some pertinent information from the label
    PvlObject &tabObj = label.findObject(tableName);
    // The table description contains the actual "RECORD_BYTES"
    if (tabObj.hasKeyword("RECORD_BYTES")) {
      m_recordBytes = (int) tabObj.findKeyword("RECORD_BYTES");
    }
    // The table description has "ROW_BYTES" and "ROW_SUFFIX_BYTES". These summed is the 
    // record length. Can be for detached and attached labels
    else if (tabObj.hasKeyword("ROW_BYTES") && tabObj.hasKeyword("ROW_SUFFIX_BYTES")) {
      m_recordBytes = (int) tabObj.findKeyword("ROW_BYTES") +
                      (int) tabObj.findKeyword("ROW_SUFFIX_BYTES");
    }
    // The table record length is defined by the file record
    // length (i.e., table is in with the image)
    else {
      m_recordBytes = (int) label.findKeyword("RECORD_BYTES");
    }
+2 −0
Original line number Diff line number Diff line
@@ -103,6 +103,8 @@ namespace Isis {
   *   @history 2016-02-24 Ian Humphrey - Updated documentation and unit test. Added edrindex.lbl
   *                           and edrindex.tab files to data directory (for tests). Fixes #2397.
   *   @history 2016-03-10 Jeannie Backer - Removed non-UTF8 character. References #2397.
   *   @history 2018-02-12 Stuart Sides - Added detached table capabilities for label files
   *                                      without a "RECORD_BYTES" keyword. References #5525.
   *  
   *  
   * @todo The binary table import methods were written after the ascii table 
+17 −0
Original line number Diff line number Diff line
# This tests the following conditions:
#
# -- We can export a compressed image.
# -- The tables in the compressed image do not have the keyword RECORD_BYTES.
# -- When exported, the compressed and uncompressed input data produce the same output.
APPNAME = pds2hideal

include $(ISISROOT)/make/isismake.tsts

commands:
	$(APPNAME) FROM=$(INPUT)/PSP_009492_1280_RED.NOPROJ.lbl \
	  to=$(OUTPUT)/uncompressed_lbl.cub > /dev/null;
	$(APPNAME) FROM=$(INPUT)/PSP_009492_1280_RED_COMPRESSED.NOPROJ.IMG \
	  to=$(OUTPUT)/compressed_img.cub > /dev/null;
	cubediff from=$(OUTPUT)/uncompressed_lbl.cub from2=$(OUTPUT)/compressed_img.cub \
	  to=$(OUTPUT)/comparisonTruth.txt > /dev/null;