Commit bce01de5 authored by John Bonn's avatar John Bonn
Browse files

Updated documentation for ProcessBySample m04124

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@7439 41f8697f-d340-4b68-9986-7bafba869bb8
parent d4a9aced
Loading
Loading
Loading
Loading
+40 −72
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
 *   http://www.usgs.gov/privacy.html.
 */


#include "ProcessBySample.h"

#include "Buffer.h"
@@ -50,8 +49,6 @@ namespace Isis {
   *
   * @param requirements See Process::SetInputCube for more information.
   *                     Defaults to 0
   *
   * @throws Isis::iException::Message
   */
  Isis::Cube *ProcessBySample::SetInputCube(const QString &parameter,
                                            int requirements) {
@@ -92,15 +89,10 @@ namespace Isis {
   *
   * @deprecated Please use ProcessCubeInPlace()
   * @param funct (Isis::Buffer &b) Name of your processing function
   *
   * @throws Isis::iException::Message
   *
   */

  void ProcessBySample::StartProcess(void funct(Isis::Buffer &inout)) {
    VerifyCubes(InPlace);
    SetBricks(InPlace);
    //SetBrickSizesForProcessCubeInPlace();
    ProcessByBrick::StartProcess(funct);
  }

@@ -114,16 +106,11 @@ namespace Isis {
   * @deprecated Please use ProcessCube()
   * @param funct (Isis::Buffer &in, Isis::Buffer &out) Name of your processing
   *                                                    function
   *
   * @throws Isis::iException::Message
   */ 

  void ProcessBySample::StartProcess(void
                                     funct(Isis::Buffer &in, Isis::Buffer &out)) {

  void ProcessBySample::StartProcess(void funct(Isis::Buffer &in,
                                                Isis::Buffer &out)) {
    VerifyCubes(InputOutput);
    SetBricks(InputOutput);
    //SetBrickSizesForProcessCube();
    ProcessByBrick::StartProcess(funct);
  }

@@ -136,58 +123,39 @@ namespace Isis {
   * @deprecated Please use ProcessCubes()
   * @param funct (vector<Isis::Buffer *> &in, vector<Isis::Buffer *> &out) Name
   *                of your processing function
   *
   * @throws Isis::iException::Message
   */

  void ProcessBySample::StartProcess(void funct(std::vector<Isis::Buffer *> &in,
                                                std::vector<Isis::Buffer *> &out)) {

    VerifyCubes(InputOutputList) ;
    SetBricks(InputOutputList);
    //SetBrickSizesForProcessCubes();
    ProcessByBrick::StartProcess(funct);
  }

  void ProcessBySample::SetBricks(IOCubes cn){

  void ProcessBySample::SetBricks(IOCubes cn){
    switch(cn){

      case InPlace:
          if(InputCubes.size() == 1) SetBrickSize(1, InputCubes[0]->lineCount(), 1);
          else SetBrickSize(1, OutputCubes[0]->lineCount(), 1);

        if (InputCubes.size() == 1) {
          SetBrickSize(1, InputCubes[0]->lineCount(), 1);
        }
        else {
          SetBrickSize(1, OutputCubes[0]->lineCount(), 1);
        }
        break;

      case InputOutput:

        SetInputBrickSize(1, InputCubes[0]->lineCount(), 1);
        SetOutputBrickSize(1, OutputCubes[0]->lineCount(), 1);




        break;

      case InputOutputList:

        for(unsigned int i = 0; i < InputCubes.size(); i++) {
          SetInputBrickSize(1, InputCubes[i]->lineCount(), 1, i + 1);
        }
        for(unsigned int i = 0; i < OutputCubes.size(); i++) {
          SetOutputBrickSize(1, OutputCubes[i]->lineCount(), 1, i + 1);
        }

        break;



    }


  }




}
+20 −29
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@
 *   http://www.usgs.gov/privacy.html.
 */

#include "ProcessByBrick.h"
#include "Buffer.h"
#include "ProcessByBrick.h"

namespace Isis {
  /**
@@ -36,7 +36,6 @@ namespace Isis {
   * the Process class which give many functions for setting up input and output
   * cubes.
   *
   *
   * @ingroup HighLevelCubeIO
   *
   * @author  2006-03-27 Jacob Danton
@@ -48,9 +47,10 @@ namespace Isis {
   *                           Added some documentation to methods.
   *   @history 2012-02-22 Steven Lambright - Updated to have functorized and
   *                           threaded StartProcess equivalents.
   *   @history 2017-02-17 JP Bonn - Formatting changes, removed commented out
   *                           code.
   */
  class ProcessBySample : public Isis::ProcessByBrick {

    public:
      ProcessBySample(): ProcessByBrick() {
        SetWrap(true);
@@ -64,19 +64,16 @@ namespace Isis {
                               int requirements = 0);

      void StartProcess(void funct(Isis::Buffer &inout));

      void StartProcess(void funct(Isis::Buffer &in, Isis::Buffer &out));

      void StartProcess(void funct(std::vector<Isis::Buffer *> &in,
                                   std::vector<Isis::Buffer *> &out));

      /**
       * @see ProcessByBrick::ProcessCubeInPlace()
       * @param funct
       * @param threaded
       * @param funct The processing function or functor which does your
       *              desired calculations.
       * @param threaded True if multi-threading is supported, false otherwise.
       */


      template <typename Functor>
      void ProcessCubeInPlace(const Functor & funct, bool threaded = true) {
        VerifyCubes(InPlace);
@@ -85,42 +82,36 @@ namespace Isis {
        ProcessByBrick::ProcessCubeInPlace(funct, threaded);
      }


      /**
       * @see ProcessByBrick::ProcessCube()
       * @param funct
       * @param threaded
       * @param funct The processing function or functor which does your
       *              desired calculations.
       * @param threaded True if multi-threading is supported, false otherwise.
       */

      template <typename Functor>
      void ProcessCube(const Functor & funct, bool threaded = true) {
        VerifyCubes(InputOutput);
        SetBricks(InputOutput);
        //SetBrickSizesForProcessCube();
        ProcessByBrick::ProcessCube(funct, threaded);
      }


      /**
       * @see ProcessByBrick::ProcessCubes()
       * @param funct
       * @param threaded
       * @param funct The processing function or functor which does your
       *              desired calculations.
       * @param threaded True if multi-threading is supported, false otherwise.
       */

      template <typename Functor>
      void ProcessCubes(const Functor & funct, bool threaded = true) {
        VerifyCubes(InputOutputList);
        SetBricks(InputOutputList);
        //SetBrickSizesForProcessCubes();
        ProcessByBrick::ProcessCubes(funct, threaded);
      }


    private:

      void SetBricks(IOCubes cn);

      //void SetBrickSizesForProcessCubeInPlace();
      //void SetBrickSizesForProcessCube();
      //void SetBrickSizesForProcessCubes();
  };
};