Skip to content

Commit

Permalink
Merge branch 'dev' into enhancement/noseamCallable
Browse files Browse the repository at this point in the history
  • Loading branch information
kledmundson authored Sep 11, 2024
2 parents a99ceb4 + 5e5b1d9 commit 7832f86
Show file tree
Hide file tree
Showing 49 changed files with 10,136 additions and 496 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ release.

### Changed
- Noseam has been refactored to be callable; old Makefile test has been removed and replaced by a gtest. Issue: [#5599](https://github.com/USGS-Astrogeology/ISIS3/issues/5599)
- Explode has been refactored to be callable; old Makefile test has been removed and replaced by a gtest. Issue: [#5557](https://github.com/USGS-Astrogeology/ISIS3/issues/5557)
- Isisminer has been refactored to be callable; old Makefile tests have been removed and replaced by gtests. Issue: [#5516](https://github.com/USGS-Astrogeology/ISIS3/issues/5516)
- Algebra has been refactored to be callable; old Makefile tests have been removed and replaced by gtests. Issue: [#5594](https://github.com/USGS-Astrogeology/ISIS3/issues/5594)
- Photrim has been refactored to be callable; old Makefile tests have been removed and replaced by gtests. Issue: [#5581](https://github.com/USGS-Astrogeology/ISIS3/issues/5581)
- Bandtrim has been refactored to be callable; old Makefile tests have been removed and replaced by gtests. Issue: [#5571](https://github.com/USGS-Astrogeology/ISIS3/issues/5571)
Expand All @@ -54,6 +56,7 @@ release.
- Changed `qwt` dependency version to 6.2.0 or below [#5498](https://github.com/DOI-USGS/ISIS3/issues/5498)
- Pinned `suitesparse` dependency version to maximum not including 7.7.0 [#5496](https://github.com/DOI-USGS/ISIS3/issues/5496)


### Fixed
- Fixed a bug in noproj.cpp which left a persisent lbl file after running noproj. [#5577] (https://github.com/DOI-USGS/ISIS3/issues/5577)
- Fixed a bug in QVIEW's FindTool in which camera was prioritized over projction [#5508](https://github.com/DOI-USGS/ISIS3/issues/5508)
Expand Down
97 changes: 97 additions & 0 deletions isis/src/base/apps/explode/explode.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/** This is free and unencumbered software released into the public domain.
The authors of ISIS do not claim copyright on the contents of this file.
For more details about the LICENSE terms and the AUTHORS, you will
find files of those names at the top level of this repository. **/

/* SPDX-License-Identifier: CC0-1.0 */

#include "explode.h"

#include "ProcessByLine.h"
#include "IException.h"
#include "FileName.h"

namespace Isis {

// Line processing routine
void CopyBand(Buffer &in, Buffer &out);

/**
* Extracts each band of the input cube into a separate one band cube file.
* Given the output base name of "base", each output cube will be named
* e.g. base.band#.cub. The appropiate BandBin group will be created.
*
* @param ui User Interface with application parameters
*/
void explode(UserInterface &ui) {

// open input cube
Cube icube;
icube.open(ui.GetCubeName("FROM"));

explode(&icube, ui);
}


/**
* Extracts each band of the input cube into a separate one band cube file.
* Given the output base name of "base", each output cube will be named
* e.g. base.band#.cub. The appropiate BandBin group will be created.
*
* @param ui User Interface with application parameters
* @param icube Input cube
*/
void explode(Cube *icube, UserInterface &ui) {

Process p;
p.SetInputCube(icube);
int samps = icube->sampleCount();
int lines = icube->lineCount();
int bands = icube->bandCount();
QString infile = icube->fileName();

// We get the output filename so we can add attributes and extensions
QString outbase = ui.GetCubeName("TO");
CubeAttributeOutput &outatt = ui.GetOutputAttribute("TO");

// Loop and extract each band
for(int band = 1; band <= bands; band++) {
int pband = icube->physicalBand(band);
QString sband(toString(pband));

ProcessByLine p2;
Progress *prog = p2.Progress();
prog->SetText("Exploding band " + sband);

CubeAttributeInput inatt("+" + sband);
p2.SetInputCube(infile, inatt);

QString outfile = outbase + ".band";
if(pband / 1000 == 0) {
outfile += "0";
if(pband / 100 == 0) {
outfile += "0";
if(pband / 10 == 0) {
outfile += "0";
}
}
}
outfile += sband + ".cub";
p2.SetOutputCube(outfile, outatt, samps, lines, 1);

p2.StartProcess(CopyBand);
p2.EndProcess();
}

// Cleanup
p.EndProcess();
}

// Line processing routine
void CopyBand(Buffer &in, Buffer &out) {
for(int i = 0; i < in.size(); i++) {
out[i] = in[i];
}
}
}
19 changes: 19 additions & 0 deletions isis/src/base/apps/explode/explode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** This is free and unencumbered software released into the public domain.
The authors of ISIS do not claim copyright on the contents of this file.
For more details about the LICENSE terms and the AUTHORS, you will
find files of those names at the top level of this repository. **/

/* SPDX-License-Identifier: CC0-1.0 */

#ifndef explode_h
#define explode_h

#include "UserInterface.h"

namespace Isis{
extern void explode(UserInterface &ui);
extern void explode(Cube *icube, UserInterface &ui);
}

#endif
3 changes: 3 additions & 0 deletions isis/src/base/apps/explode/explode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
<change name="Steven Lambright" date="2008-05-12">
Removed references to CubeInfo
</change>
<change name="Ken Edmundson" date="2024-08-15">
Converted to callable app and converted Makefile test to gtest.
</change>
</history>

<groups>
Expand Down
67 changes: 12 additions & 55 deletions isis/src/base/apps/explode/main.cpp
Original file line number Diff line number Diff line change
@@ -1,63 +1,20 @@
#include "Isis.h"
#include "ProcessByLine.h"
#include "IException.h"
#include "FileName.h"

using namespace std;
using namespace Isis;

void CopyBand(Buffer &in, Buffer &out);
/** This is free and unencumbered software released into the public domain.
void IsisMain() {
// Get the cube to explode
Process p;
Cube *icube = p.SetInputCube("FROM");
int samps = icube->sampleCount();
int lines = icube->lineCount();
int bands = icube->bandCount();
QString infile = icube->fileName();

// We the output filename so we can add attributes and extensions
UserInterface &ui = Application::GetUserInterface();
QString outbase = ui.GetCubeName("TO");
CubeAttributeOutput &outatt = ui.GetOutputAttribute("TO");
The authors of ISIS do not claim copyright on the contents of this file.
For more details about the LICENSE terms and the AUTHORS, you will
find files of those names at the top level of this repository. **/

// Loop and extract each band
for(int band = 1; band <= bands; band++) {
int pband = icube->physicalBand(band);
QString sband(toString(pband));
/* SPDX-License-Identifier: CC0-1.0 */

ProcessByLine p2;
Progress *prog = p2.Progress();
prog->SetText("Exploding band " + sband);

CubeAttributeInput inatt("+" + sband);
p2.SetInputCube(infile, inatt);
#include "Isis.h"

QString outfile = outbase + ".band";
if(pband / 1000 == 0) {
outfile += "0";
if(pband / 100 == 0) {
outfile += "0";
if(pband / 10 == 0) {
outfile += "0";
}
}
}
outfile += sband + ".cub";
p2.SetOutputCube(outfile, outatt, samps, lines, 1);
#include "explode.h"

p2.StartProcess(CopyBand);
p2.EndProcess();
}
#include "Application.h"

// Cleanup
p.EndProcess();
}
using namespace Isis;

// Line processing routine
void CopyBand(Buffer &in, Buffer &out) {
for(int i = 0; i < in.size(); i++) {
out[i] = in[i];
}
void IsisMain() {
UserInterface &ui = Application::GetUserInterface();
explode(ui);
}
4 changes: 0 additions & 4 deletions isis/src/base/apps/explode/tsts/Makefile

This file was deleted.

7 changes: 0 additions & 7 deletions isis/src/base/apps/explode/tsts/case01/Makefile

This file was deleted.

4 changes: 2 additions & 2 deletions isis/src/base/apps/isisminer/ResourceManagerStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace Isis {
* @param definition ResourceManager Strategy PVL object
* definition
* @param globals List of global keywords to use in argument substitutions
* @throw IException::User "Invalid operations requestined in ResourceManager."
* @throw IException::User "Invalid operations requested in ResourceManager."
*/
ResourceManagerStrategy::ResourceManagerStrategy(const PvlObject &definition,
const ResourceList &globals) :
Expand Down Expand Up @@ -89,7 +89,7 @@ namespace Isis {
// Handle any errors encountered
if ( !exceptions.empty() ) {
IException ie(IException::User,
"Invalid operations requestined in ResourceManager.",
"Invalid operations requested in ResourceManager.",
_FILEINFO_);
BOOST_FOREACH ( IException e, exceptions ) {
ie.append(e);
Expand Down
1 change: 1 addition & 0 deletions isis/src/base/apps/isisminer/ResourceManagerStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ namespace Isis {
* @history 2015-05-08 Kris Becker - Modify constructor to take a global
* resources list; modified apply() method to accept
* a global resource list.
* @history 2024-07-15 Ken Edmundson - Fixed minor mispellings in error messages.
*/
class ResourceManagerStrategy : public Strategy {

Expand Down
Loading

0 comments on commit 7832f86

Please sign in to comment.