Loading isis/src/base/apps/isis2fits/isis2fits.cpp +25 −18 Original line number Diff line number Diff line Loading @@ -19,11 +19,12 @@ using namespace std; using namespace Isis; // Global variables int headerBytes = 0; int g_headerBytes = 0; QString FitsKeyword(QString keyword, bool isVal, QString value, QString unit = ""); QString WritePvl(QString fitsKey, QString group, IString key, Cube *icube, bool isString); QString WritePvl(QString fitsKey, QString group, QString key, Cube *icube, bool isString); // Main program void IsisMain() { Loading Loading @@ -82,9 +83,7 @@ void IsisMain() { } ////////////////////////////////////////// // Write the minimal fits header // ////////////////////////////////////////// // Write the minimal fits header QString header; // specify that this file conforms to simple fits standard Loading Loading @@ -118,7 +117,9 @@ void IsisMain() { // Sky and All cases if (ui.GetString("INFO") == "SKY" || ui.GetString("INFO") == "ALL") { IString msg = "cube has not been skymapped"; //tjw: IString msg changed to QString QString msg = "cube has not been skymapped"; PvlGroup map; if (icube->hasGroup("mapping")) { Loading @@ -129,11 +130,9 @@ void IsisMain() { if (msg == "Sky") { double midRa = 0, midDec = 0; midRa = ((double)map["MaximumLongitude"] + (double)map["MinimumLongitude"]) / 2; midRa = ((double)map["MaximumLongitude"] + (double)map["MinimumLongitude"]) / 2; midDec = ((double)map["MaximumLatitude"] + (double)map["MinimumLatitude"]) / 2; midDec = ((double)map["MaximumLatitude"] + (double)map["MinimumLatitude"]) / 2; header += FitsKeyword("OBJCTRA", true, toString(midRa)); Loading @@ -142,21 +141,28 @@ void IsisMain() { } //tjw: All strings in this block placed inside QString constructors if (ui.GetString("INFO") == "ALL") { header += WritePvl("INSTRUME", "Instrument", "InstrumentId", icube, true); header += WritePvl("OBSERVER", "Instrument", "SpacecraftName", icube, true); header += WritePvl("OBJECT ", "Instrument", "TargetName", icube, true); header += WritePvl(QString("INSTRUME"), QString("Instrument"), QString("InstrumentId"), icube, true); header += WritePvl(QString("OBSERVER"), QString("Instrument"), QString("SpacecraftName"), icube, true); header += WritePvl(QString("OBJECT "), QString("Instrument"), QString("TargetName"), icube, true); // StartTime is sometimes middle of the exposure and somtimes beginning, // so StopTime can't be calculated off of exposure reliably. header += WritePvl("DATE-OBS", "Instrument", "StartTime", icube, true); header += WritePvl(QString("DATE-OBS"), QString("Instrument"), QString("StartTime"), icube, true); // Some cameras don't have StopTime if (icube->hasGroup("Instrument")) { PvlGroup inst = icube->group("Instrument"); if (inst.hasKeyword("StopTime")) { header += WritePvl("TIME_END", "Instrument", "StopTime", icube, true); header += WritePvl(QString("TIME_END"), QString("Instrument"), QString("StopTime"), icube, true); } if (inst.hasKeyword("ExposureDuration")) { header += WritePvl("EXPTIME", "Instrument", "ExposureDuration", icube, false); header += WritePvl(QString("EXPTIME"), QString("Instrument"), QString("ExposureDuration"), icube, false); } } } Loading Loading @@ -230,11 +236,12 @@ QString FitsKeyword(QString key, bool isValue, QString value, QString unit) { } // record the total length of the header headerBytes += key.length(); g_headerBytes += key.length(); return key; } QString WritePvl(QString fitsKey, QString group, IString key, Cube *icube, bool isString) { //tjw: IString key -> QString key QString WritePvl(QString fitsKey, QString group, QString key, Cube *icube, bool isString) { if (icube->hasGroup(group)) { PvlGroup theGroup = icube->group(group); QString name = (QString)theGroup[key]; Loading isis/src/base/apps/isis2fits/tsts/infoAll/Makefile 0 → 100644 +17 −0 Original line number Diff line number Diff line APPNAME = isis2fits # This test is for when the isis2fits paramter INFO is set to "ALL" include $(ISISROOT)/make/isismake.tsts commands: $(APPNAME) FROM=$(INPUT)/skymapTruth.cub \ TO=$(OUTPUT)/truth.fits \ BITTYPE=32BIT \ INFO=ALL; raw2isis FROM=$(OUTPUT)/truth.fits \ TO=$(OUTPUT)/truth.cub \ SAMPLES=90 LINES=14 BANDS=1 \ SKIP=2880 BITTYPE=REAL BYTEORDER=LSB; dd bs=2880 count=1 if=$(OUTPUT)/truth.fits > $(OUTPUT)/labels.txt 2> /dev/null; $(RM) $(OUTPUT)/truth.fits; > /dev/null; isis/src/base/apps/isis2fits/tsts/infoAll/truth/labels.txt 0 → 100644 +1 −0 Original line number Diff line number Diff line SIMPLE = T / BITPIX = -32 / NAXIS = 2 / NAXIS1 = 90 / NAXIS2 = 14 / BZERO = 0.0 / BSCALE = 1.0 / OBJCTRA = 180.0 / OBJCTDEC= -36.553241445319 / INSTRUME= 'MOC-WA' / OBSERVER= 'MARS GLOBAL SURVEYOR' / OBJECT = 'Mars' / DATE-OBS= '1997-10-20T10:58:37.46' / TIME_END= '1997-10-20T11:03:44.66' / END No newline at end of file Loading
isis/src/base/apps/isis2fits/isis2fits.cpp +25 −18 Original line number Diff line number Diff line Loading @@ -19,11 +19,12 @@ using namespace std; using namespace Isis; // Global variables int headerBytes = 0; int g_headerBytes = 0; QString FitsKeyword(QString keyword, bool isVal, QString value, QString unit = ""); QString WritePvl(QString fitsKey, QString group, IString key, Cube *icube, bool isString); QString WritePvl(QString fitsKey, QString group, QString key, Cube *icube, bool isString); // Main program void IsisMain() { Loading Loading @@ -82,9 +83,7 @@ void IsisMain() { } ////////////////////////////////////////// // Write the minimal fits header // ////////////////////////////////////////// // Write the minimal fits header QString header; // specify that this file conforms to simple fits standard Loading Loading @@ -118,7 +117,9 @@ void IsisMain() { // Sky and All cases if (ui.GetString("INFO") == "SKY" || ui.GetString("INFO") == "ALL") { IString msg = "cube has not been skymapped"; //tjw: IString msg changed to QString QString msg = "cube has not been skymapped"; PvlGroup map; if (icube->hasGroup("mapping")) { Loading @@ -129,11 +130,9 @@ void IsisMain() { if (msg == "Sky") { double midRa = 0, midDec = 0; midRa = ((double)map["MaximumLongitude"] + (double)map["MinimumLongitude"]) / 2; midRa = ((double)map["MaximumLongitude"] + (double)map["MinimumLongitude"]) / 2; midDec = ((double)map["MaximumLatitude"] + (double)map["MinimumLatitude"]) / 2; midDec = ((double)map["MaximumLatitude"] + (double)map["MinimumLatitude"]) / 2; header += FitsKeyword("OBJCTRA", true, toString(midRa)); Loading @@ -142,21 +141,28 @@ void IsisMain() { } //tjw: All strings in this block placed inside QString constructors if (ui.GetString("INFO") == "ALL") { header += WritePvl("INSTRUME", "Instrument", "InstrumentId", icube, true); header += WritePvl("OBSERVER", "Instrument", "SpacecraftName", icube, true); header += WritePvl("OBJECT ", "Instrument", "TargetName", icube, true); header += WritePvl(QString("INSTRUME"), QString("Instrument"), QString("InstrumentId"), icube, true); header += WritePvl(QString("OBSERVER"), QString("Instrument"), QString("SpacecraftName"), icube, true); header += WritePvl(QString("OBJECT "), QString("Instrument"), QString("TargetName"), icube, true); // StartTime is sometimes middle of the exposure and somtimes beginning, // so StopTime can't be calculated off of exposure reliably. header += WritePvl("DATE-OBS", "Instrument", "StartTime", icube, true); header += WritePvl(QString("DATE-OBS"), QString("Instrument"), QString("StartTime"), icube, true); // Some cameras don't have StopTime if (icube->hasGroup("Instrument")) { PvlGroup inst = icube->group("Instrument"); if (inst.hasKeyword("StopTime")) { header += WritePvl("TIME_END", "Instrument", "StopTime", icube, true); header += WritePvl(QString("TIME_END"), QString("Instrument"), QString("StopTime"), icube, true); } if (inst.hasKeyword("ExposureDuration")) { header += WritePvl("EXPTIME", "Instrument", "ExposureDuration", icube, false); header += WritePvl(QString("EXPTIME"), QString("Instrument"), QString("ExposureDuration"), icube, false); } } } Loading Loading @@ -230,11 +236,12 @@ QString FitsKeyword(QString key, bool isValue, QString value, QString unit) { } // record the total length of the header headerBytes += key.length(); g_headerBytes += key.length(); return key; } QString WritePvl(QString fitsKey, QString group, IString key, Cube *icube, bool isString) { //tjw: IString key -> QString key QString WritePvl(QString fitsKey, QString group, QString key, Cube *icube, bool isString) { if (icube->hasGroup(group)) { PvlGroup theGroup = icube->group(group); QString name = (QString)theGroup[key]; Loading
isis/src/base/apps/isis2fits/tsts/infoAll/Makefile 0 → 100644 +17 −0 Original line number Diff line number Diff line APPNAME = isis2fits # This test is for when the isis2fits paramter INFO is set to "ALL" include $(ISISROOT)/make/isismake.tsts commands: $(APPNAME) FROM=$(INPUT)/skymapTruth.cub \ TO=$(OUTPUT)/truth.fits \ BITTYPE=32BIT \ INFO=ALL; raw2isis FROM=$(OUTPUT)/truth.fits \ TO=$(OUTPUT)/truth.cub \ SAMPLES=90 LINES=14 BANDS=1 \ SKIP=2880 BITTYPE=REAL BYTEORDER=LSB; dd bs=2880 count=1 if=$(OUTPUT)/truth.fits > $(OUTPUT)/labels.txt 2> /dev/null; $(RM) $(OUTPUT)/truth.fits; > /dev/null;
isis/src/base/apps/isis2fits/tsts/infoAll/truth/labels.txt 0 → 100644 +1 −0 Original line number Diff line number Diff line SIMPLE = T / BITPIX = -32 / NAXIS = 2 / NAXIS1 = 90 / NAXIS2 = 14 / BZERO = 0.0 / BSCALE = 1.0 / OBJCTRA = 180.0 / OBJCTDEC= -36.553241445319 / INSTRUME= 'MOC-WA' / OBSERVER= 'MARS GLOBAL SURVEYOR' / OBJECT = 'Mars' / DATE-OBS= '1997-10-20T10:58:37.46' / TIME_END= '1997-10-20T11:03:44.66' / END No newline at end of file