Unverified Commit 5622f85e authored by Kelvin Rodriguez's avatar Kelvin Rodriguez Committed by GitHub
Browse files

Std2isis gtests (#4172)

* added std2isis tests

* removed old tests

* added unittests

* removed image importer unittest

* addressed comments
parent 65aa14f2
Loading
Loading
Loading
Loading
+4 −28
Original line number Diff line number Diff line
@@ -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);
  std2isis(ui);
}
 No newline at end of file

  // 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;
}
+36 −0
Original line number Diff line number Diff line
#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;
  }

}
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
#ifndef std2isis_h 
#define std2isis_h

#include "UserInterface.h"

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

#endif
 No newline at end of file
+0 −4
Original line number Diff line number Diff line
BLANKS = "%-6s"    
LENGTH = "%-40s"

include $(ISISROOT)/make/isismake.tststree
+0 −8
Original line number Diff line number Diff line
APPNAME = std2isis

include $(ISISROOT)/make/isismake.tsts

commands:
	$(APPNAME) FROM=$(INPUT)/in.jpg TO=$(OUTPUT)/out.cub \
       	mode=argb \
        > /dev/null;
Loading