Loading isis/make/isismake.apps +3 −3 Original line number Diff line number Diff line Loading @@ -121,9 +121,9 @@ quickclean: localclean clean: localclean $(RM) $(OBJS) $(BINS) $(PROTOSGEN) $(MOCGEN) `basename $(CURDIR)`.html \ $(UIHEADERS) $(QTRESOURCEFILES) *.csexe *.csmes; \ $(RM) -r scopecoverage scopecoverage.html \ linecoverage linecoverage.html \ functioncoverage functioncoverage.html; \ $(RM) -r scopecoverage scopecoverage.html scopecoverage_html \ linecoverage linecoverage.html linecoverage_html \ functioncoverage functioncoverage.html functioncoverage_html; \ if [ -d "tsts" ]; \ then \ if [ -f "tsts/Makefile" ]; \ Loading isis/make/isismake.objs +3 −3 Original line number Diff line number Diff line Loading @@ -231,9 +231,9 @@ clean: localclean $(UIHEADERS) $(ARCHIVELIB) $(SHAREDLIB) libisis$(ISISLIBVERSION).a \ libisis$(ISISLIBVERSION).so libisis$(ISISLIBVERSION).dylib \ unitTest.output; \ $(RM) -rf html scopecoverage scopecoverage.html \ linecoverage linecoverage.html functioncoverage \ functioncoverage.html .objs *.csexe *.csmes $(RM) -rf html scopecoverage scopecoverage.html scopecoverage_html \ linecoverage linecoverage.html linecoverage_html functioncoverage \ functioncoverage.html functioncoverage_html .objs *.csexe *.csmes localclean: if [ "$(findstring cleanlocal,$(shell $(GREP) cleanlocal Makefile))" = "cleanlocal" ]; \ Loading isis/src/base/apps/ascii2isis/ascii2isis.cpp +25 −3 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ double TestSpecial(const double pixel); void ascii2isis(Buffer &out); ifstream fin; QString order; QString from; //Initialize values to make special pixels invalid double null_min = DBL_MAX; double null_max = DBL_MIN; Loading @@ -24,10 +25,15 @@ double lrs_min = DBL_MAX; double lrs_max = DBL_MIN; void IsisMain() { //initialize fin if (fin.is_open()) { fin.close(); } // Open input text file UserInterface &ui = Application::GetUserInterface(); QString from = ui.GetFileName("FROM"); from = ui.GetFileName("FROM"); // Get storage order of data order = ui.GetString("ORDER"); Loading @@ -45,6 +51,7 @@ void IsisMain() { null_min = ui.GetDouble("NULLMIN"); null_max = ui.GetDouble("NULLMAX"); } if (ui.GetBoolean("SETHRSRANGE")) { hrs_min = ui.GetDouble("HRSMIN"); hrs_max = ui.GetDouble("HRSMAX"); Loading @@ -54,19 +61,23 @@ void IsisMain() { lrs_max = ui.GetDouble("LRSMAX"); } fin.open(from.toAscii().data(), std::ios::in); if (!fin.is_open()) { QString msg = "Cannot open input file [" + from + "]"; throw IException(IException::Io, msg, _FILEINFO_); } // Skip header information if it exists fin.seekg(skip, std::ios::beg); // Set up process depending on order if (order == "BSQ") { ProcessByLine p; p.SetOutputCube(ui.GetFileName("TO"), att, ns, nl, nb); p.StartProcess(ascii2isis); p.EndProcess(); Loading @@ -74,6 +85,7 @@ void IsisMain() { if (order == "BIL") { ProcessBySpectra p(Isis::ProcessBySpectra::ByLine); // Set Special Pixel ranges p.SetOutputCube(ui.GetFileName("TO"), att, ns, nl, nb); p.StartProcess(ascii2isis); Loading @@ -82,6 +94,7 @@ void IsisMain() { if (order == "BIP") { ProcessBySpectra p(Isis::ProcessBySpectra::PerPixel); p.SetOutputCube(ui.GetFileName("TO"), att, ns, nl, nb); p.StartProcess(ascii2isis); p.EndProcess(); Loading @@ -93,13 +106,22 @@ void IsisMain() { void ascii2isis(Buffer &out) { //Define all legal characters for the beginning of a number const string legal = ".0123456789+-"; for (int i = 0; i < out.size(); i++) { fin >> out[i]; out[i] = TestSpecial(out[i]); //Discard all nonlegal characters while ((legal.find(fin.peek()) == string::npos) && !fin.eof()) { fin.ignore(); } fin >> out[i]; if (!fin && fin.eof()) { QString msg = "End of file reached. There is not enough data in [" + from; msg += "] to fill the output cube."; throw IException(IException::User, msg, _FILEINFO_); } out[i] = TestSpecial(out[i]); } } Loading isis/src/base/apps/ascii2isis/ascii2isis.xml +4 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,10 @@ <change name="Steven Koechle" date="2008-08-30"> Added ability to change special pixel ranges. Added example. </change> <change name="Makayla Shepherd" data="2015-07-15"> Fixed a problem with non-numeric cahracters in the file which resulted ascii2isis hanging. Fixes #2066. </change> </history> Loading isis/src/base/apps/ascii2isis/tsts/badfile/Makefile 0 → 100644 +18 −0 Original line number Diff line number Diff line APPNAME = ascii2isis include $(ISISROOT)/make/isismake.tsts commands: # Test an input file with not enough data if [ `$(APPNAME) \ from=$(INPUT)/ascii2isis_input.txt \ to=$(OUTPUT)/temp.cub >& $(OUTPUT)/temp.txt \ order=bsq \ lines=100 \ samples=100 \ bands=100 \ skip=0` ]; then \ true; \ fi; $(SED) 's/\[.*\/\(ascii2isis_input.txt\)\]/[\1]/' < $(OUTPUT)/temp.txt > $(OUTPUT)/not_enough_data.txt; $(RM) $(OUTPUT)/temp.txt $(OUTPUT)/temp.cub > /dev/null; Loading
isis/make/isismake.apps +3 −3 Original line number Diff line number Diff line Loading @@ -121,9 +121,9 @@ quickclean: localclean clean: localclean $(RM) $(OBJS) $(BINS) $(PROTOSGEN) $(MOCGEN) `basename $(CURDIR)`.html \ $(UIHEADERS) $(QTRESOURCEFILES) *.csexe *.csmes; \ $(RM) -r scopecoverage scopecoverage.html \ linecoverage linecoverage.html \ functioncoverage functioncoverage.html; \ $(RM) -r scopecoverage scopecoverage.html scopecoverage_html \ linecoverage linecoverage.html linecoverage_html \ functioncoverage functioncoverage.html functioncoverage_html; \ if [ -d "tsts" ]; \ then \ if [ -f "tsts/Makefile" ]; \ Loading
isis/make/isismake.objs +3 −3 Original line number Diff line number Diff line Loading @@ -231,9 +231,9 @@ clean: localclean $(UIHEADERS) $(ARCHIVELIB) $(SHAREDLIB) libisis$(ISISLIBVERSION).a \ libisis$(ISISLIBVERSION).so libisis$(ISISLIBVERSION).dylib \ unitTest.output; \ $(RM) -rf html scopecoverage scopecoverage.html \ linecoverage linecoverage.html functioncoverage \ functioncoverage.html .objs *.csexe *.csmes $(RM) -rf html scopecoverage scopecoverage.html scopecoverage_html \ linecoverage linecoverage.html linecoverage_html functioncoverage \ functioncoverage.html functioncoverage_html .objs *.csexe *.csmes localclean: if [ "$(findstring cleanlocal,$(shell $(GREP) cleanlocal Makefile))" = "cleanlocal" ]; \ Loading
isis/src/base/apps/ascii2isis/ascii2isis.cpp +25 −3 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ double TestSpecial(const double pixel); void ascii2isis(Buffer &out); ifstream fin; QString order; QString from; //Initialize values to make special pixels invalid double null_min = DBL_MAX; double null_max = DBL_MIN; Loading @@ -24,10 +25,15 @@ double lrs_min = DBL_MAX; double lrs_max = DBL_MIN; void IsisMain() { //initialize fin if (fin.is_open()) { fin.close(); } // Open input text file UserInterface &ui = Application::GetUserInterface(); QString from = ui.GetFileName("FROM"); from = ui.GetFileName("FROM"); // Get storage order of data order = ui.GetString("ORDER"); Loading @@ -45,6 +51,7 @@ void IsisMain() { null_min = ui.GetDouble("NULLMIN"); null_max = ui.GetDouble("NULLMAX"); } if (ui.GetBoolean("SETHRSRANGE")) { hrs_min = ui.GetDouble("HRSMIN"); hrs_max = ui.GetDouble("HRSMAX"); Loading @@ -54,19 +61,23 @@ void IsisMain() { lrs_max = ui.GetDouble("LRSMAX"); } fin.open(from.toAscii().data(), std::ios::in); if (!fin.is_open()) { QString msg = "Cannot open input file [" + from + "]"; throw IException(IException::Io, msg, _FILEINFO_); } // Skip header information if it exists fin.seekg(skip, std::ios::beg); // Set up process depending on order if (order == "BSQ") { ProcessByLine p; p.SetOutputCube(ui.GetFileName("TO"), att, ns, nl, nb); p.StartProcess(ascii2isis); p.EndProcess(); Loading @@ -74,6 +85,7 @@ void IsisMain() { if (order == "BIL") { ProcessBySpectra p(Isis::ProcessBySpectra::ByLine); // Set Special Pixel ranges p.SetOutputCube(ui.GetFileName("TO"), att, ns, nl, nb); p.StartProcess(ascii2isis); Loading @@ -82,6 +94,7 @@ void IsisMain() { if (order == "BIP") { ProcessBySpectra p(Isis::ProcessBySpectra::PerPixel); p.SetOutputCube(ui.GetFileName("TO"), att, ns, nl, nb); p.StartProcess(ascii2isis); p.EndProcess(); Loading @@ -93,13 +106,22 @@ void IsisMain() { void ascii2isis(Buffer &out) { //Define all legal characters for the beginning of a number const string legal = ".0123456789+-"; for (int i = 0; i < out.size(); i++) { fin >> out[i]; out[i] = TestSpecial(out[i]); //Discard all nonlegal characters while ((legal.find(fin.peek()) == string::npos) && !fin.eof()) { fin.ignore(); } fin >> out[i]; if (!fin && fin.eof()) { QString msg = "End of file reached. There is not enough data in [" + from; msg += "] to fill the output cube."; throw IException(IException::User, msg, _FILEINFO_); } out[i] = TestSpecial(out[i]); } } Loading
isis/src/base/apps/ascii2isis/ascii2isis.xml +4 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,10 @@ <change name="Steven Koechle" date="2008-08-30"> Added ability to change special pixel ranges. Added example. </change> <change name="Makayla Shepherd" data="2015-07-15"> Fixed a problem with non-numeric cahracters in the file which resulted ascii2isis hanging. Fixes #2066. </change> </history> Loading
isis/src/base/apps/ascii2isis/tsts/badfile/Makefile 0 → 100644 +18 −0 Original line number Diff line number Diff line APPNAME = ascii2isis include $(ISISROOT)/make/isismake.tsts commands: # Test an input file with not enough data if [ `$(APPNAME) \ from=$(INPUT)/ascii2isis_input.txt \ to=$(OUTPUT)/temp.cub >& $(OUTPUT)/temp.txt \ order=bsq \ lines=100 \ samples=100 \ bands=100 \ skip=0` ]; then \ true; \ fi; $(SED) 's/\[.*\/\(ascii2isis_input.txt\)\]/[\1]/' < $(OUTPUT)/temp.txt > $(OUTPUT)/not_enough_data.txt; $(RM) $(OUTPUT)/temp.txt $(OUTPUT)/temp.cub > /dev/null;