-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ckwriter App and Test Update (#4126)
* Convert ckwriter to new app format * Updated ckwriter tests to gtest and fixed angular velocities in the ThreeImageNetwork fixture * Removed old/unnecessary includes * Removed old ckwriter test makefiles
- Loading branch information
1 parent
7552d12
commit ca28b9c
Showing
14 changed files
with
325 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#include <cmath> | ||
|
||
#include "ckwriter.h" | ||
|
||
#include "Cube.h" | ||
#include "FileList.h" | ||
#include "Process.h" | ||
#include "Pvl.h" | ||
#include "SpiceKernel.h" | ||
|
||
using namespace std; | ||
|
||
namespace Isis { | ||
void ckwriter(UserInterface &ui, Pvl *log) { | ||
Process p; | ||
|
||
// Get the list of names of input CCD cubes to stitch together | ||
FileList flist; | ||
if (ui.WasEntered("FROM")) flist.push_back(FileName(ui.GetFileName("FROM"))); | ||
if (ui.WasEntered("FROMLIST")) flist.read(FileName(ui.GetFileName("FROMLIST"))); | ||
if (flist.size() < 1) { | ||
QString msg = "Files must be specified in FROM and/or FROMLIST - none found!"; | ||
throw IException(IException::User,msg,_FILEINFO_); | ||
} | ||
|
||
bool overlap_is_error = ( "ERROR" == ui.GetString("OVERLAP") ) ? true : false; | ||
|
||
SpiceKernel kernel; | ||
Progress prog; | ||
prog.SetMaximumSteps(flist.size()); | ||
prog.CheckStatus(); | ||
|
||
for (int i = 0 ; i < flist.size() ; i++) { | ||
// Add and process each image | ||
kernel.add(flist[i].toString()); | ||
prog.CheckStatus(); | ||
} | ||
|
||
try { | ||
kernel.validate(); | ||
} | ||
catch ( IException &ie ) { | ||
|
||
// Check for user preference in treatment overlaps | ||
if ( overlap_is_error ) { throw; } | ||
|
||
// Log it to file | ||
Pvl overrors = ie.toPvl(); | ||
for(int i = 0; i < overrors.groups(); i++) { | ||
PvlGroup overlap = overrors.group(i); | ||
overlap.setName("Overlaps"); | ||
overlap.addKeyword(PvlKeyword("Class", "WARNING"), PvlContainer::Replace); | ||
if (log) { | ||
log->addGroup(overlap); | ||
} | ||
} | ||
} | ||
|
||
|
||
// Get comment file | ||
QString comfile(""); | ||
if (ui.WasEntered("COMFILE")) comfile = ui.GetFileName("COMFILE"); | ||
|
||
// Write the output file if requested | ||
if (ui.WasEntered("TO")) { | ||
int cktype = ui.GetInteger("CKTYPE"); | ||
kernel.write(ui.GetFileName("TO"), comfile, cktype); | ||
} | ||
|
||
// Write a summary of the documentation | ||
if (ui.WasEntered("SUMMARY")) { | ||
QString fFile = FileName(ui.GetFileName("SUMMARY")).expanded(); | ||
ofstream os; | ||
os.open(fFile.toLatin1().data(),ios::out); | ||
if (!os) { | ||
QString mess = "Cannot create SUMMARY output file " + fFile; | ||
throw IException(IException::User, mess, _FILEINFO_); | ||
} | ||
os << kernel.getSummary(comfile); | ||
os.close(); | ||
} | ||
|
||
p.EndProcess(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef ckwriter_h | ||
#define ckwriter_h | ||
|
||
#include "Pvl.h" | ||
#include "UserInterface.h" | ||
|
||
namespace Isis{ | ||
void ckwriter(UserInterface &ui, Pvl *log=nullptr); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,27 @@ | ||
#include <cmath> | ||
|
||
#include "Isis.h" | ||
#include "FileList.h" | ||
#include "Cube.h" | ||
#include "Process.h" | ||
|
||
#include "ckwriter.h" | ||
|
||
#include "Application.h" | ||
#include "Pvl.h" | ||
#include "SpiceKernel.h" | ||
#include "CkSpiceSegment.h" | ||
|
||
using namespace std; | ||
using namespace Isis; | ||
|
||
void IsisMain() { | ||
Process p; | ||
|
||
// Get the list of names of input CCD cubes to stitch together | ||
FileList flist; | ||
UserInterface &ui = Application::GetUserInterface(); | ||
if (ui.WasEntered("FROM")) flist.push_back(FileName(ui.GetFileName("FROM"))); | ||
if (ui.WasEntered("FROMLIST")) flist.read(FileName(ui.GetFileName("FROMLIST"))); | ||
if (flist.size() < 1) { | ||
QString msg = "Files must be specified in FROM and/or FROMLIST - none found!"; | ||
throw IException(IException::User,msg,_FILEINFO_); | ||
} | ||
|
||
bool overlap_is_error = ( "ERROR" == ui.GetString("OVERLAP") ) ? true : false; | ||
|
||
SpiceKernel kernel; | ||
Progress prog; | ||
prog.SetMaximumSteps(flist.size()); | ||
prog.CheckStatus(); | ||
|
||
for (int i = 0 ; i < flist.size() ; i++) { | ||
// Add and process each image | ||
kernel.add(flist[i].toString()); | ||
prog.CheckStatus(); | ||
} | ||
|
||
Pvl appLog; | ||
try { | ||
kernel.validate(); | ||
ckwriter(ui, &appLog); | ||
} | ||
catch ( IException &ie ) { | ||
|
||
// Check for user preference in treatment overlaps | ||
if ( overlap_is_error ) { throw; } | ||
|
||
// Log it to file | ||
Pvl overrors = ie.toPvl(); | ||
for(int i = 0; i < overrors.groups(); i++) { | ||
PvlGroup overlap = overrors.group(i); | ||
overlap.setName("Overlaps"); | ||
overlap.addKeyword(PvlKeyword("Class", "WARNING"), PvlContainer::Replace); | ||
Application::Log(overlap); | ||
catch (...) { | ||
for (auto grpIt = appLog.beginGroup(); grpIt!= appLog.endGroup(); grpIt++) { | ||
Application::Log(*grpIt); | ||
} | ||
throw; | ||
} | ||
|
||
|
||
// Get comment file | ||
QString comfile(""); | ||
if (ui.WasEntered("COMFILE")) comfile = ui.GetFileName("COMFILE"); | ||
|
||
// Write the output file if requested | ||
if (ui.WasEntered("TO")) { | ||
int cktype = ui.GetInteger("CKTYPE"); | ||
kernel.write(ui.GetFileName("TO"), comfile, cktype); | ||
for (auto grpIt = appLog.beginGroup(); grpIt!= appLog.endGroup(); grpIt++) { | ||
Application::Log(*grpIt); | ||
} | ||
|
||
// Write a summary of the documentation | ||
if (ui.WasEntered("SUMMARY")) { | ||
QString fFile = FileName(ui.GetFileName("SUMMARY")).expanded(); | ||
ofstream os; | ||
os.open(fFile.toLatin1().data(),ios::out); | ||
if (!os) { | ||
QString mess = "Cannot create SUMMARY output file " + fFile; | ||
throw IException(IException::User, mess, _FILEINFO_); | ||
} | ||
os << kernel.getSummary(comfile); | ||
os.close(); | ||
} | ||
|
||
p.EndProcess(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.