Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindImageOverlap optional threaded computation #4047

Merged
merged 5 commits into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ update the Unreleased link so that it compares against the latest release tag.
- Camera models now use the ALE library to interpolate states and orientations. Users will likely see very small changes in sensor ephemerides. These were tested and are within existing interpolation tolerances. [#2370](https://github.com/USGS-Astrogeology/ISIS3/issues/2370)
- The isis3VarInit script is now just called isisVarInit and allows for more robust paths. [#3945](https://github.com/USGS-Astrogeology/ISIS3/pull/3945)
- Isis2raw will now output straight to a 32bit file (no stretch) when stretch is set to None and bittype is set to 32bit. [#3878](https://github.com/USGS-Astrogeology/ISIS3/issues/3878)
- Findimageoverlaps can now have calculations and writes happen at the same time or sequentially. [#4047](https://github.com/USGS-Astrogeology/ISIS3/pull/4047)

### Fixed

- Fixed some line scan images using the incorrect state interpolation. [#3928](https://github.com/USGS-Astrogeology/ISIS3/issues/3928)
- The ISIS library now has the correct version suffix. [#3365](https://github.com/USGS-Astrogeology/ISIS3/issues/3365)
- Equalizer now reports the correct equation and values used to perform the adjustment. [#3987](https://github.com/USGS-Astrogeology/ISIS3/issues/3987)
- Map2cam now works correctly when specifying bands for input cubes. [#3856](https://github.com/USGS-Astrogeology/ISIS3/issues/3856)

- mro/hideal2pds app now writes the correct SAMPLE_BIT_MASK values to the output label. [#3978](https://github.com/USGS-Astrogeology/ISIS3/issues/3978)

- For Histograms in ISIS, updated the math for calculating what bin data should be placed in and the min/max values of each bin to be more intuitive. In addition, the output of hist and cnethist were changed to display the min/max values of each bin instead of the middle pixel's DN. [#3882](https://github.com/USGS-Astrogeology/ISIS3/issues/3882)
Expand Down
8 changes: 4 additions & 4 deletions isis/src/base/apps/findimageoverlaps/findimageoverlaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ using namespace std;

namespace Isis {

void findimageoverlaps(UserInterface &ui, Pvl *log) {
void findimageoverlaps(UserInterface &ui, bool useThread, Pvl *log) {
FileList images(ui.GetFileName("FROMLIST"));

findimageoverlaps(images, ui, log);
findimageoverlaps(images, ui, useThread, log);
}

void findimageoverlaps(FileList &images, UserInterface &ui, Pvl *log) {
void findimageoverlaps(FileList &images, UserInterface &ui, bool useThread, Pvl *log) {
// list of sns/filenames sorted by serial number
SerialNumberList serialNumbers(true);

Expand Down Expand Up @@ -47,7 +47,7 @@ namespace Isis {
}

// Now we want the ImageOverlapSet to calculate our overlaps
ImageOverlapSet overlaps(true);
ImageOverlapSet overlaps(true, useThread);

// Use multi-threading to create the overlaps
overlaps.FindImageOverlaps(serialNumbers,
Expand Down
4 changes: 2 additions & 2 deletions isis/src/base/apps/findimageoverlaps/findimageoverlaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include "UserInterface.h"

namespace Isis {
extern void findimageoverlaps(UserInterface &ui, Pvl *log=nullptr);
extern void findimageoverlaps(UserInterface &ui, bool useThread=true, Pvl *log=nullptr);

extern void findimageoverlaps(FileList &images, UserInterface &ui, Pvl *log=nullptr);
extern void findimageoverlaps(FileList &images, UserInterface &ui, bool useThread=true, Pvl *log=nullptr);
}

#endif
4 changes: 2 additions & 2 deletions isis/src/base/apps/findimageoverlaps/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ using namespace Isis;
void IsisMain() {
UserInterface &ui = Application::GetUserInterface();
Pvl appLog;

try {
findimageoverlaps(ui, &appLog);
findimageoverlaps(ui, true, &appLog);
}
catch (...) {
for (auto grpIt = appLog.beginGroup(); grpIt!= appLog.endGroup(); grpIt++) {
Expand Down
7 changes: 2 additions & 5 deletions isis/src/base/objs/ImageOverlapSet/ImageOverlapSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ namespace Isis {
* addition to logging errors.
* @see automaticRegistration.doc
*/
ImageOverlapSet::ImageOverlapSet(bool continueOnError) {
ImageOverlapSet::ImageOverlapSet(bool continueOnError, bool useThread) {

p_continueAfterError = continueOnError;
p_writtenSoFar = 0;
p_calculatedSoFar = -1;
p_threadedCalculate = false;
p_threadedCalculate = useThread;
p_snlist = NULL;
}

Expand Down Expand Up @@ -181,9 +181,6 @@ namespace Isis {

p_snlist = &boundaries;

// This will enable using mutexes and spawning threads where necessary.
p_threadedCalculate = true;

FindImageOverlaps(boundaries);

// While our exit condition is not true, call WriteImageOverlaps with the filename.
Expand Down
4 changes: 2 additions & 2 deletions isis/src/base/objs/ImageOverlapSet/ImageOverlapSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ namespace Isis {
* undefined behavior caused by unlocking an unlocked mutex.
* @history 2017-05-23 Ian Humphrey - Added a tryLock() to FindAllOverlaps to prevent a
* segfault from occuring on OSX with certain data. Fixes #4810.
*
*
*/
class ImageOverlapSet : private QThread {
public:
ImageOverlapSet(bool continueOnError = false);
ImageOverlapSet(bool continueOnError = false, bool useThread = true);
virtual ~ImageOverlapSet();

void FindImageOverlaps(SerialNumberList &boundaries);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestFindImageOverlapsNoOverlap) {
Pvl appLog;

try {
findimageoverlaps(options, &appLog);
findimageoverlaps(options, false, &appLog);
FAIL() << "Expected an IException with message: \"No overlaps were found\".";
}
catch(IException &e) {
Expand All @@ -76,7 +76,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestFindImageOverlapTwoImageOverlap) {
FileList images;
images.append(FileName(cube1->fileName()));
images.append(FileName(cube2->fileName()));
findimageoverlaps(images, ui, nullptr);
findimageoverlaps(images, ui, false, nullptr);

// Find all the overlaps between the images in the FROMLIST
// The overlap polygon coordinates are in Lon/Lat order
Expand Down Expand Up @@ -145,7 +145,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestFindImageOverlapFullOverlap) {
FileList images;
images.append(FileName(cube1->fileName()));
images.append(FileName(cube2->fileName()));
findimageoverlaps(images, ui, nullptr);
findimageoverlaps(images, ui, false, nullptr);

// Find all the overlaps between the images in the FROMLIST
// The overlap polygon coordinates are in Lon/Lat order
Expand Down