Skip to content

Commit

Permalink
Std2isis gtests (#4172)
Browse files Browse the repository at this point in the history
* added std2isis tests

* removed old tests

* added unittests

* removed image importer unittest

* addressed comments
  • Loading branch information
Kelvin Rodriguez authored Dec 9, 2020
1 parent 65aa14f commit 5622f85
Show file tree
Hide file tree
Showing 21 changed files with 397 additions and 134 deletions.
32 changes: 4 additions & 28 deletions isis/src/base/apps/std2isis/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,11 @@
#include "ImageImporter.h"
#include "UserInterface.h"

using namespace Isis;
#include "std2isis.h"

using namespace Isis;

void IsisMain() {
UserInterface &ui = Application::GetUserInterface();

FileName inputName = ui.GetFileName("FROM");
ImageImporter *importer = ImageImporter::fromFileName(inputName);

// Explicitly set band dimension if a specific color mode is desired
IString mode = ui.GetString("MODE");
if (mode != "AUTO") {
int bands = mode == "GRAYSCALE" ? 1 : mode == "ARGB" ? 4 : 3;
importer->setBands(bands);
}

// Set special pixel ranges
if (ui.GetBoolean("SETNULLRANGE"))
importer->setNullRange(ui.GetDouble("NULLMIN"), ui.GetDouble("NULLMAX"));
if (ui.GetBoolean("SETHRSRANGE"))
importer->setHrsRange(ui.GetDouble("HRSMIN"), ui.GetDouble("HRSMAX"));
if (ui.GetBoolean("SETLRSRANGE"))
importer->setLrsRange(ui.GetDouble("LRSMIN"), ui.GetDouble("LRSMAX"));

// Import the image
FileName outputName = ui.GetFileName("TO");
CubeAttributeOutput &att = ui.GetOutputAttribute("TO");
importer->import(outputName, att);

delete importer;
}

std2isis(ui);
}
36 changes: 36 additions & 0 deletions isis/src/base/apps/std2isis/std2isis.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <QString>

#include "ImageImporter.h"
#include "UserInterface.h"

#include "std2isis.h"

namespace Isis {
void std2isis(UserInterface &ui) {
FileName inputName = ui.GetFileName("FROM");
ImageImporter *importer = ImageImporter::fromFileName(inputName);

// Explicitly set band dimension if a specific color mode is desired
IString mode = ui.GetString("MODE");
if (mode != "AUTO") {
int bands = mode == "GRAYSCALE" ? 1 : mode == "ARGB" ? 4 : 3;
importer->setBands(bands);
}

// Set special pixel ranges
if (ui.GetBoolean("SETNULLRANGE"))
importer->setNullRange(ui.GetDouble("NULLMIN"), ui.GetDouble("NULLMAX"));
if (ui.GetBoolean("SETHRSRANGE"))
importer->setHrsRange(ui.GetDouble("HRSMIN"), ui.GetDouble("HRSMAX"));
if (ui.GetBoolean("SETLRSRANGE"))
importer->setLrsRange(ui.GetDouble("LRSMIN"), ui.GetDouble("LRSMAX"));

// Import the image
FileName outputName = ui.GetFileName("TO");
CubeAttributeOutput &att = ui.GetOutputAttribute("TO");
importer->import(outputName, att);

delete importer;
}

}
10 changes: 10 additions & 0 deletions isis/src/base/apps/std2isis/std2isis.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef std2isis_h
#define std2isis_h

#include "UserInterface.h"

namespace Isis {
extern void std2isis(UserInterface &ui);
}

#endif
4 changes: 0 additions & 4 deletions isis/src/base/apps/std2isis/tsts/Makefile

This file was deleted.

8 changes: 0 additions & 8 deletions isis/src/base/apps/std2isis/tsts/argb/Makefile

This file was deleted.

8 changes: 0 additions & 8 deletions isis/src/base/apps/std2isis/tsts/default/Makefile

This file was deleted.

8 changes: 0 additions & 8 deletions isis/src/base/apps/std2isis/tsts/grayscale/Makefile

This file was deleted.

12 changes: 0 additions & 12 deletions isis/src/base/apps/std2isis/tsts/jpeg2000/Makefile

This file was deleted.

10 changes: 0 additions & 10 deletions isis/src/base/apps/std2isis/tsts/special/Makefile

This file was deleted.

10 changes: 0 additions & 10 deletions isis/src/base/apps/std2isis/tsts/tiff/Makefile

This file was deleted.

7 changes: 0 additions & 7 deletions isis/src/base/objs/ImageImporter/ImageImporter.truth

This file was deleted.

39 changes: 0 additions & 39 deletions isis/src/base/objs/ImageImporter/unitTest.cpp

This file was deleted.

Loading

0 comments on commit 5622f85

Please sign in to comment.