Commit 3b3f1297 authored by Tyler Wilson's avatar Tyler Wilson
Browse files

PROG: Reversing bad commit. References #4698.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@7655 41f8697f-d340-4b68-9986-7bafba869bb8
parent 311ce274
Loading
Loading
Loading
Loading
+6 −44
Original line number Diff line number Diff line
@@ -114,45 +114,9 @@ void ProcessByBrick::SetOutputRequirements(int outputRequirements) {

}


/**
   * Sets the size of the input/output bricks.  This function is virtual and the
   * child classes ProcessByTile/ProcessBySpectra/ProcessBySample,ProcessByLine have their
   * own versions of this function which the call.
   * @param cn  An enumeration which indicates whether one cube is being processed in place,
   * one cube is an input and one cube is an output, or if we are processing a vector
   * of input and output cubes.
   */
  void ProcessByBrick::SetBricks(IOCubes cn){

    switch (cn) {
      case InPlace:
        if (InputCubes.size() == 1) {
          SetBrickSize(InputCubes[0]->sampleCount(), InputCubes[0]->lineCount(),
              InputCubes[0]->bandCount());
        }
        else {
          SetBrickSize(OutputCubes[0]->sampleCount(), OutputCubes[0]->lineCount(),
              OutputCubes[0]->bandCount());
        }
        break;
      case InputOutput:
        SetInputBrickSize(InputCubes[0]->sampleCount(), InputCubes[0]->lineCount(),
            InputCubes[0]->bandCount());
        SetOutputBrickSize(OutputCubes[0]->sampleCount(), OutputCubes[0]->lineCount(),
            OutputCubes[0]->bandCount());
        break;
      case InputOutputList:
        for (unsigned int i = 0; i < InputCubes.size(); i++) {
          SetInputBrickSize(InputCubes[i]->sampleCount(), InputCubes[i]->lineCount(),
                            InputCubes[i]->bandCount(), i + 1);
        }
        for (unsigned int i = 0; i < OutputCubes.size(); i++) {
          SetOutputBrickSize(OutputCubes[i]->sampleCount(), OutputCubes[i]->lineCount(),
                             OutputCubes[i]->bandCount(), i + 1);
        }
        break;
    }
      ;

  }

@@ -168,6 +132,10 @@ void ProcessByBrick::SetBricks(IOCubes cn){
    *
    * @throws iException::Message
    */




  void ProcessByBrick::VerifyCubes(IOCubes cn){


@@ -762,8 +730,6 @@ void ProcessByBrick::SetBricks(IOCubes cn){

    bool haveInput;
    if (InputCubes.size() == 1) {

      SetBricks(InPlace);
      //  Make sure the brick size has been set
      if (!p_inputBrickSizeSet) {
        string m = "Use the SetBrickSize() or SetInputBrickSize() method to set"
@@ -783,7 +749,6 @@ void ProcessByBrick::SetBricks(IOCubes cn){
    }
    else {
      //  Make sure the brick size has been set
      SetBricks(InPlace);
      if (!p_outputBrickSizeSet) {
        string m = "Use the SetBrickSize() or SetOutputBrickSize() method to "
                   "set the output brick size";
@@ -831,8 +796,6 @@ void ProcessByBrick::SetBricks(IOCubes cn){
      throw IException(IException::Programmer, m, _FILEINFO_);
    }

    SetBricks(InputOutput);

    //  Make sure the brick size has been set
    if (!p_inputBrickSizeSet || !p_outputBrickSizeSet) {
      string m = "Use the SetBrickSize(), SetInputBrickSize(), or "
@@ -924,7 +887,6 @@ void ProcessByBrick::SetBricks(IOCubes cn){
      throw IException(IException::Programmer, m, _FILEINFO_);
    }

    SetBricks(InputOutputList);
    //  Make sure the brick size has been set
    if(!p_inputBrickSizeSet && InputCubes.size() > 0) {
      string m = "Use the SetBrickSize() or SetInputBrick() method to set the "
+0 −4
Original line number Diff line number Diff line
@@ -90,10 +90,6 @@ namespace Isis {
   *   @history 2016-04-26 Ian Humphrey - Modified BlockingReportProgress() so that it unlocks
   *                           the local QMutex before it goes out of scope (Qt5 issues a warning
   *                           if a locked QMutex is destroyed).
   *   @history 2017-05-08 Tyler Wilson - Added a call to the virtual method SetBricks inside
   *                          the functions PreProcessCubeInPlace/PreProcessCube/PreProcessCubes.
   *                          Fixes #4698.
   *
   */
  class ProcessByBrick : public Process {
    public:
+1402 −3036

File changed.

Preview size limit exceeded, changes collapsed.

+4 −52
Original line number Diff line number Diff line
#include "Isis.h"
#include "ProcessByBrick.h"
#include "ProcessByLine.h"
#include "ProcessBySample.h"
#include "ProcessBySpectra.h"
#include "ProcessByTile.h"
#include "Cube.h"
#include <iostream>
#include <string>
@@ -50,6 +46,7 @@ void IsisMain() {
  Preference::Preferences(true);
  Cube *icube;
  ProcessByBrick p;

  cout << "Testing Functors\n";
  {
    cout << "Functor2 - ProcessCube One Thread\n";
@@ -75,6 +72,9 @@ void IsisMain() {

    }




    icube = p.SetInputCube("FROM");
    p.SetBrickSize(10, 10, 2);

@@ -196,49 +196,6 @@ void IsisMain() {
    cout << "\n";
  }


  {
    cout << "Testing ProcessByBrick::ProcessCube[Buffer &in, Buffer &out]" << endl;
    Functor2 functor;
    ProcessByBrick *pline;
    pline = new ProcessByLine;
    icube = pline->SetInputCube("FROM");
    pline->SetOutputCube("TO",icube->sampleCount(), icube->lineCount(),icube->bandCount());
    pline->ProcessCube(functor, false);
    pline->EndProcess();

  }



  {
    cout << "Testing ProcessByBrick::ProcessCubes[vector<Buffer> &in, vector<Buffer> &out]" << endl;
    Functor3 functor;
    ProcessByBrick *psample;
    psample = new ProcessBySample;
    Cube *icube = psample->SetInputCube("FROM");
    psample->SetInputCube("FROM2");
    psample->SetBrickSize(10, 10, 2);
    psample->SetOutputCube("TO", icube->sampleCount(), icube->lineCount(), icube->bandCount()+10);
    psample->SetOutputCube("TO2", icube->sampleCount(), icube->lineCount(), icube->bandCount());
    psample->ProcessCubes(functor, false);
    psample->EndProcess();
    cout << "\n";

  }

  {
    cout << "Testing ProcessByBrick::ProcessCubeInPlace[Buffer &inout]" << endl; 
    Functor5 functor;
    ProcessByBrick *psample;
    psample = new ProcessBySample;
    icube=psample->SetInputCube("FROM");
    //psample->SetOutputCube("TO",icube->sampleCount(), icube->lineCount(),icube->bandCount());
    psample->ProcessCubeInPlace(functor, false);
    psample->EndProcess();
  }


  {
    cout << "Functor3 - ProcessCubes One Thread\n";

@@ -318,8 +275,6 @@ void IsisMain() {
    cout << "\n";
  }



  {
    cout << "Functor4 - ProcessCube Threaded\n";
    Cube *icube = p.SetInputCube("FROM");
@@ -411,9 +366,6 @@ void oneInAndOut(Buffer &ib, Buffer &ob) {
  }
}




void twoInAndOut(vector<Buffer *> &ib, vector<Buffer *> &ob) {
  static bool firstTime = true;
  if(firstTime) {