Loading isis/src/base/apps/ddd2isis/ddd2isis.cpp +29 −24 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ #include "SpecialPixel.h" #include "FileName.h" #include "Pvl.h" #include <QMap> using namespace std; using namespace Isis; Loading Loading @@ -89,18 +90,17 @@ void IsisMain() { // Maps the bit type of the file to the number of bytes of that type // Taken directly from a given python program that reads in ddd data map<int, int> dataTypes = { {1450901768, 1}, {1450902032, 2}, {1450902288, 2}, {1450902560, 4}, {1450902816, 4}, {1450903072, 4}, {1450903360, 8}, {8, 1}, {16, 2}, {48, 2} }; QMap<int, int> dataTypes; dataTypes.insert(1450901768, 1); dataTypes.insert(1450902032, 2); dataTypes.insert(1450902288, 2); dataTypes.insert(1450902560, 4); dataTypes.insert(1450902816, 4); dataTypes.insert(1450903072, 4); dataTypes.insert(1450903360, 8); dataTypes.insert(8, 1); dataTypes.insert(16, 2); dataTypes.insert(48, 2); // Read bytes 16-19 to get the bit type // Map the bit type to the number of bytes of that data type Loading @@ -109,21 +109,26 @@ void IsisMain() { int bitType = (int) readBytes.readLong; int dataTypeBytes; //Old header format has no bit type if (bitType == 0) { dataTypeBytes = dataTypes.find(totalBandBits) -> second; } else { dataTypeBytes = dataTypes.find(bitType) -> second; } int nOffset; // Check for new header format. Taken from the python program. if ( (bitType & 0xfffff000) == 0x567b0000 ) { dataTypeBytes = dataTypes.value(bitType); // Read bytes 20-23 to get offset // New header format may have different offsets fin.read(readBytes.readChars, 4); readBytes.readFloat = swp.Float(readBytes.readChars); int nOffset = (int) readBytes.readLong; nOffset = (int) readBytes.readLong; if (nOffset < 1024) { nOffset = 1024; } } else { // Old header format does not have a bit type // Old header format's offset is always 1024. dataTypeBytes = dataTypes.value(totalBandBits); nOffset = 1024; } fin.close(); Loading Loading
isis/src/base/apps/ddd2isis/ddd2isis.cpp +29 −24 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ #include "SpecialPixel.h" #include "FileName.h" #include "Pvl.h" #include <QMap> using namespace std; using namespace Isis; Loading Loading @@ -89,18 +90,17 @@ void IsisMain() { // Maps the bit type of the file to the number of bytes of that type // Taken directly from a given python program that reads in ddd data map<int, int> dataTypes = { {1450901768, 1}, {1450902032, 2}, {1450902288, 2}, {1450902560, 4}, {1450902816, 4}, {1450903072, 4}, {1450903360, 8}, {8, 1}, {16, 2}, {48, 2} }; QMap<int, int> dataTypes; dataTypes.insert(1450901768, 1); dataTypes.insert(1450902032, 2); dataTypes.insert(1450902288, 2); dataTypes.insert(1450902560, 4); dataTypes.insert(1450902816, 4); dataTypes.insert(1450903072, 4); dataTypes.insert(1450903360, 8); dataTypes.insert(8, 1); dataTypes.insert(16, 2); dataTypes.insert(48, 2); // Read bytes 16-19 to get the bit type // Map the bit type to the number of bytes of that data type Loading @@ -109,21 +109,26 @@ void IsisMain() { int bitType = (int) readBytes.readLong; int dataTypeBytes; //Old header format has no bit type if (bitType == 0) { dataTypeBytes = dataTypes.find(totalBandBits) -> second; } else { dataTypeBytes = dataTypes.find(bitType) -> second; } int nOffset; // Check for new header format. Taken from the python program. if ( (bitType & 0xfffff000) == 0x567b0000 ) { dataTypeBytes = dataTypes.value(bitType); // Read bytes 20-23 to get offset // New header format may have different offsets fin.read(readBytes.readChars, 4); readBytes.readFloat = swp.Float(readBytes.readChars); int nOffset = (int) readBytes.readLong; nOffset = (int) readBytes.readLong; if (nOffset < 1024) { nOffset = 1024; } } else { // Old header format does not have a bit type // Old header format's offset is always 1024. dataTypeBytes = dataTypes.value(totalBandBits); nOffset = 1024; } fin.close(); Loading