Commit 63878abe authored by Jeannie Backer's avatar Jeannie Backer
Browse files

PROG: Updated ProcessMosaic unitTest.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@6398 41f8697f-d340-4b68-9986-7bafba869bb8
parent d4f12b3a
Loading
Loading
Loading
Loading
+89 −86
Original line number Diff line number Diff line
@@ -9,8 +9,8 @@
using namespace Isis;
using namespace std;

void TestIn(int iss, int isl, int isb, int ins = 0, int inl = 0, int inb = 0);
void TestOut(int piSamples, int piLines, int piBands, int piPriority,
void testIn(int iss, int isl, int isb, int ins = 0, int inl = 0, int inb = 0);
void testOut(int piSamples, int piLines, int piBands, int piPriority,
             int originBand);
/**
 * unitTest for ProcessMosaic
@@ -65,69 +65,71 @@ void IsisMain() {
    qDebug() << "a. FAILURE - Track Table does not Exist";
  }
  m1.EndProcess();
  TestIn(1, 1, 1, 5, 5, 1);
  TestOut(2, 2, 1, ProcessMosaic::PlaceImagesOnTop, 2);



  
  testIn(1, 1, 1, 5, 5, 1);
  testOut(2, 2, 1, ProcessMosaic::PlaceImagesOnTop, 2);
  p.SetOutputCube("MOSAIC_LEFT_RIGHT", 5, 5, 2);
  p.EndProcess();
  ProcessMosaic m1b;
  m1b.SetTrackFlag(true);
  m1b.SetCreateFlag(true);
  m1b.SetImageOverlay(ProcessMosaic::PlaceImagesOnTop);
  
  m1b.SetInputCube("INPUT_LEFT", 1, 1, 1, 10, 5, 1);

  Cube *mosaicCube2 = m1b.SetOutputCube("MOSAIC_LEFT_RIGHT");
  
  m1b.StartProcess(5, 2, 1); // This should be overwritten by the next StartProcess call
  m1b.StartProcess(2, 2, 1);

  // Test for Tracking Table "Input Images"
  try {
    Table trackTable(ProcessMosaic::TRACKING_TABLE_NAME);
    mosaicCube2->read(trackTable);
    qDebug();
    qDebug() << "a. SUCCESS - Track Table Exists";
    qDebug() << Table::toString(trackTable, "\t");
  }
  catch (IException&) {
    qDebug();
    qDebug() << "a. FAILURE - Track Table does not Exist";
  }
  m1b.EndProcess();
  m1b.SetTrackFlag(true);
  m1b.SetCreateFlag(false);
  m1b.SetImageOverlay(ProcessMosaic::PlaceImagesOnTop);

  m1b.SetInputCube("INPUT_RIGHT", 1, 1, 1, 10, 5, 1);
  
  Cube *mosaicCube3 = m1b.SetOutputCube("MOSAIC_LEFT_RIGHT");

  m1b.StartProcess(5, 2, 1); // This should be overwritten by the next StartProcess call
  m1b.StartProcess(2, 2, 1);
  
  // Test for Tracking Table "Input Images"
  try {
    Table trackTable(ProcessMosaic::TRACKING_TABLE_NAME);
    cout << 10 << endl;
    mosaicCube3->read(trackTable);
    qDebug();
    qDebug() << "a. SUCCESS - Track Table Exists";
    qDebug() << Table::toString(trackTable, "\t");
  }
  catch (IException&) {
    qDebug();
    qDebug() << "a. FAILURE - Track Table does not Exist";
  }
  m1b.EndProcess();




  
//  // Test for left mosaic
//  ProcessMosaic m1b;
//  m1b.SetTrackFlag(true);
//  m1b.SetCreateFlag(true);
//  m1b.SetImageOverlay(ProcessMosaic::PlaceImagesOnTop);
//  m1b.SetInputCube("INPUT_LEFT", 1, 1, 1, 10, 5, 1);
//
//    qDebug() << 0;
//  Cube *mosaicCube2 = m1b.SetOutputCube("MOSAIC_LEFT_RIGHT");
//  
//    qDebug() << 1;
//  m1b.StartProcess(5, 2, 1); // This should be overwritten by the next StartProcess call
//    qDebug() << 2;
//  m1b.StartProcess(2, 2, 1);
//    qDebug() << 3;
//
//  try {
//    Table trackTable(ProcessMosaic::TRACKING_TABLE_NAME);
//    qDebug() << 4;
//    mosaicCube2->read(trackTable);
//    qDebug() << 5;
//    qDebug();
//    qDebug() << "b. SUCCESS - Left Mosaic Succeeds";
//    qDebug() << Table::toString(trackTable, "\t");
//  }
//  catch (IException&) {
//    qDebug();
//    qDebug() << "b. FAILURE - Left Mosaic Fails";
//  }
//  m1b.EndProcess();
//  testIn(1, 1, 1, 5, 5, 1);
//  testOut(2, 2, 1, ProcessMosaic::PlaceImagesOnTop, 2);
//  p.EndProcess();
//
//  // Test for right mosaic
//  m1b.SetTrackFlag(true);
//  m1b.SetCreateFlag(false);
//  m1b.SetImageOverlay(ProcessMosaic::PlaceImagesOnTop);
//  m1b.SetInputCube("INPUT_RIGHT", 1, 1, 1, 10, 5, 1);
//
//  Cube *mosaicCube3 = m1b.SetOutputCube("MOSAIC_LEFT_RIGHT");
//
//  m1b.StartProcess(5, 2, 1); // This should be overwritten by the next StartProcess call
//  m1b.StartProcess(2, 2, 1);
//  
//  try {
//    Table trackTable(ProcessMosaic::TRACKING_TABLE_NAME);
//    mosaicCube3->read(trackTable);
//    qDebug();
//    qDebug() << "c. SUCCESS - Right Mosaic Succeeds";
//    qDebug() << Table::toString(trackTable, "\t");
//  }
//  catch (IException&) {
//    qDebug();
//    qDebug() << "c. FAILURE - Right Mosaic Fails";
//  }
//  m1b.EndProcess();
//  testIn(1, 1, 1, 5, 5, 1);
//  testOut(2, 2, 1, ProcessMosaic::PlaceImagesOnTop, 2);
//  p.EndProcess();

  remove("isisMosaic_01.cub");
  qDebug() << "***********************************************************************************";
@@ -150,8 +152,8 @@ void IsisMain() {
  m2.StartProcess(4, 4, 2);
  m2.EndProcess();

  TestIn(2, 2, 1, 5, 5, 1);
  TestOut(4, 4, 1, ProcessMosaic::PlaceImagesOnTop, 0);
  testIn(2, 2, 1, 5, 5, 1);
  testOut(4, 4, 1, ProcessMosaic::PlaceImagesOnTop, 0);

  remove("isisMosaic_01.cub");
  qDebug() << "***********************************************************************************";
@@ -173,8 +175,8 @@ void IsisMain() {
  m3.StartProcess(5, 1, 1);
  m3.EndProcess();

  TestIn(3, 3, 1, 5, 5, 1);
  TestOut(5, 1, 1, ProcessMosaic::PlaceImagesBeneath, 2);
  testIn(3, 3, 1, 5, 5, 1);
  testOut(5, 1, 1, ProcessMosaic::PlaceImagesBeneath, 2);

  remove("isisMosaic_01.cub");
  qDebug() << "***********************************************************************************";
@@ -196,8 +198,8 @@ void IsisMain() {
  m4.StartProcess(1, 1, 1);
  m4.EndProcess();

  TestIn(1, 1, 1, 3, 3, 1);
  TestOut(1, 1, 1, ProcessMosaic::PlaceImagesBeneath, 2);
  testIn(1, 1, 1, 3, 3, 1);
  testOut(1, 1, 1, ProcessMosaic::PlaceImagesBeneath, 2);

  qDebug() << "***********************************************************************************";

@@ -213,8 +215,8 @@ void IsisMain() {
  m5.StartProcess(1, 2, 1);
  m5.EndProcess();

  TestIn(1, 1, 1, 5, 5, 1);
  TestOut(1, 2, 1, ProcessMosaic::PlaceImagesBeneath, 2);
  testIn(1, 1, 1, 5, 5, 1);
  testOut(1, 2, 1, ProcessMosaic::PlaceImagesBeneath, 2);

  qDebug() << "***********************************************************************************";

@@ -239,8 +241,8 @@ void IsisMain() {
  m6.StartProcess(1, 1, 1);
  m6.EndProcess();

  TestIn(3, 3, 1, 10, 1, 1);
  TestOut(1, 1, 1, ProcessMosaic::UseBandPlacementCriteria, 2);
  testIn(3, 3, 1, 10, 1, 1);
  testOut(1, 1, 1, ProcessMosaic::UseBandPlacementCriteria, 2);

  qDebug() << "***********************************************************************************";

@@ -262,8 +264,8 @@ void IsisMain() {
  m7.StartProcess(1, 1, 1);
  m7.EndProcess();

  TestIn(1, 1, 1, 10, 1, 1);
  TestOut(1, 1, 1, ProcessMosaic::UseBandPlacementCriteria, 2);
  testIn(1, 1, 1, 10, 1, 1);
  testOut(1, 1, 1, ProcessMosaic::UseBandPlacementCriteria, 2);

  //remove("isisMosaic_01.cub");
  qDebug() << "***********************************************************************************";
@@ -287,8 +289,8 @@ void IsisMain() {
  m8.StartProcess(1, 3, 1);
  m8.EndProcess();

  TestIn(1, 1, 1, 5, 5, 1);
  TestOut(1, 3, 1, ProcessMosaic::UseBandPlacementCriteria, 2);
  testIn(1, 1, 1, 5, 5, 1);
  testOut(1, 3, 1, ProcessMosaic::UseBandPlacementCriteria, 2);

  qDebug() << "***********************************************************************************";

@@ -309,8 +311,8 @@ void IsisMain() {
  m9.StartProcess(1, 2, 1);
  m9.EndProcess();

  TestIn(1, 1, 1, 5, 5, 1);
  TestOut(1, 2, 1, ProcessMosaic::UseBandPlacementCriteria, 2);
  testIn(1, 1, 1, 5, 5, 1);
  testOut(1, 2, 1, ProcessMosaic::UseBandPlacementCriteria, 2);

  //remove("isisMosaic_01.cub");

@@ -331,8 +333,8 @@ void IsisMain() {
  m10.SetOutputCube("TO_AVG");
  m10.StartProcess(1, 1, 1);
  m10.EndProcess();
  TestIn(1, 1, 1, 5, 5, 1);
  TestOut(1, 1, 1, ProcessMosaic::AverageImageWithMosaic, 0);
  testIn(1, 1, 1, 5, 5, 1);
  testOut(1, 1, 1, ProcessMosaic::AverageImageWithMosaic, 0);

  m10.SetInputCube("FROM", 1, 1, 1, 5, 5, 1);
  m10.SetOutputCube("TO_AVG");
@@ -343,7 +345,7 @@ void IsisMain() {
  m10.StartProcess(-1, -1, 1);
  m10.EndProcess();

  TestOut(1, 1, 1, ProcessMosaic::AverageImageWithMosaic, 0);
  testOut(1, 1, 1, ProcessMosaic::AverageImageWithMosaic, 0);
  remove("isisMosaic_02.cub");

  qDebug() << "****** End Average **********************";
@@ -366,8 +368,8 @@ void IsisMain() {
  m11.StartProcess(1, 3, 1);
  m11.EndProcess();

  TestIn(1, 1, 1, 5, 5, 1);
  TestOut(1, 3, 1, ProcessMosaic::UseBandPlacementCriteria, 0);
  testIn(1, 1, 1, 5, 5, 1);
  testOut(1, 3, 1, ProcessMosaic::UseBandPlacementCriteria, 0);

  ProcessMosaic m12;
  m12.SetTrackFlag(false);
@@ -381,7 +383,7 @@ void IsisMain() {
  m12.StartProcess(1, 1, 1);
  m12.EndProcess();

  TestOut(1, 1, 1, ProcessMosaic::UseBandPlacementCriteria, 0);
  testOut(1, 1, 1, ProcessMosaic::UseBandPlacementCriteria, 0);

  qDebug() << "********* Test imagePositions() ********";
  for (int i = 0; i <= m11.imagePositions().groups() - 1; i++) {
@@ -544,7 +546,7 @@ void IsisMain() {
 * @param inl  - input number of lines
 * @param inb  - input number of bands
 */
void TestIn(int iss, int isl, int isb, int ins, int inl, int inb) {
void testIn(int iss, int isl, int isb, int ins, int inl, int inb) {
  Cube cInCube;
  UserInterface &ui = Isis::Application::GetUserInterface();
  QString sFrom = ui.GetFileName("FROM");
@@ -580,6 +582,7 @@ void TestIn(int iss, int isl, int isb, int ins, int inl, int inb) {
  cInCube.close();
}


/**
 * Display the contents of Ouput image and display the sample, line and band
 * stas for which it the mosaic is tested
@@ -590,7 +593,7 @@ void TestIn(int iss, int isl, int isb, int ins, int inl, int inb) {
 * @param isl  - input starting line
 * @param isb  - input starting band
 */
void TestOut(int piSamples, int piLines,
void testOut(int piSamples, int piLines,
             int piBands, int piPriority, int originBand) {
  Cube cOutCube;
  UserInterface &ui = Isis::Application::GetUserInterface();