Commit a1f35dd2 authored by Ian Humphrey's avatar Ian Humphrey
Browse files

Updated from trunk.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@6723 41f8697f-d340-4b68-9986-7bafba869bb8
parents 2423cb71 ac57ad61
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@ Group = DataDirectory
  Near         = $ISIS3DATA/near
  NewHorizons  = $ISIS3DATA/newhorizons
  Odyssey      = $ISIS3DATA/odyssey
  OsirisRex    = $ISIS3DATA/../datalocal/osirisrex
  Rolo         = $ISIS3DATA/rolo
  Rosetta      = $ISIS3DATA/rosetta
  Smart1       = $ISIS3DATA/smart1
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,9 @@ void IsisMain() {

  ProcessBySpectra procSpectra;


  procSpectra.SetOutputRequirements(Isis::SpatialMatch);

  Cube *inCube = procSpectra.SetInputCube("FROM");

  // Get the spectral information for the input cube
+135 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ namespace Isis {
    p_outputBrickLines.clear();
    p_outputBrickBands.clear();

    p_outputRequirements = 0;
    p_inputBrickSizeSet = false;
    p_outputBrickSizeSet = false;
    p_wrapOption = false;
@@ -44,6 +45,8 @@ namespace Isis {
  }




  ProcessByBrick::~ProcessByBrick() {
  }

@@ -104,6 +107,136 @@ namespace Isis {
  }


void ProcessByBrick::SetOutputRequirements(int outputRequirements) {

  p_outputRequirements = outputRequirements;


}

  void ProcessByBrick::SetBricks(IOCubes cn){

      ;

  }

  /**
    *  Verifies the dimensions of the input/output cubes.
    *
    * @param cn  An IOCubes enumeration for one of three possible Input/Output
    * situations:
    *     InPlace:          The input cube is the output cube
    *     InputOutput:      One input cube and one output cube
    *     InputOutputList:  A vector of input and output cubes.  The input vector
    *                       is not necessarily the same length as the output vector
    *
    * @throws iException::Message
    */




  void ProcessByBrick::VerifyCubes(IOCubes cn){


      switch(cn){

           //Error check
            case InPlace:

              if (InputCubes.size() +OutputCubes.size() > 1) {
                string m = "You can only specify exactly one input or output cube";
                throw IException(IException::Programmer,m,_FILEINFO_);
              }
              else if ( (InputCubes.size() + OutputCubes.size() == 0) ){

                  string m = "You haven't specified an input or output cube";
                       throw IException(IException::Programmer, m, _FILEINFO_);

              }

              break;

            case InputOutput:

              //Error checks ... there must be one input and output
              if(InputCubes.size() != 1) {
                    string m = "You must specify exactly one input cube";
                    throw IException(IException::Programmer, m, _FILEINFO_);
                  }
                  else if(OutputCubes.size() != 1) {
                    string m = "You must specify exactly one output cube";
                    throw IException(IException::Programmer, m, _FILEINFO_);
                  }

              // The lines in the input and output must match


               if(InputCubes[0]->lineCount() != OutputCubes[0]->lineCount()) {
                   string m = "The number of lines in the input and output cubes ";
                   m += "must match";
                   throw IException(IException::Programmer, m, _FILEINFO_);
                 }

               if(InputCubes[0]->sampleCount() != OutputCubes[0]->sampleCount()) {
                   string m = "The number of samples in the input and output cubes ";
                   m += "must match";
                   throw IException(IException::Programmer, m, _FILEINFO_);
                 }


                 // The bands in the input and output must match

               //If we are only looking for a spatial match (just match lines/samples)
               //but not bands, then we skip over this check.

               if ( !(p_outputRequirements & Isis::SpatialMatch ) ) {
               if(InputCubes[0]->bandCount() != OutputCubes[0]->bandCount()) {
                   string m = "The number of bands in the input and output cubes ";
                   m += "must match";
                   throw IException(IException::Programmer, m, _FILEINFO_);
                 }

              }

              break;



            case InputOutputList:

              // Make sure we had an image
              if (InputCubes.size() + OutputCubes.size() < 1) {
                string m = "You have not specified any input or output cubes";
                throw IException(IException::Programmer, m, _FILEINFO_);
              }

              for (unsigned int i = 0; i < OutputCubes.size(); i++) {
                    if (OutputCubes[i]->lineCount() != OutputCubes[0]->lineCount() ) {
                      string m = "All output cubes must have the same number of lines ";
                      m += "as the first input cube or output cube";
                      throw IException(IException::Programmer, m, _FILEINFO_);
                    }
                   //If we are only looking for a spatial match (just match lines/samples)
                   //but not bands, then we skip over this check.
                   if ( !(p_outputRequirements & Isis::SpatialMatch ) ) {
                    if (OutputCubes[i]->bandCount() != OutputCubes[0]->bandCount() ) {
                      string m = "All output cubes must have the same number of bands ";
                      m += "as the first input cube or output cube";
                      throw IException(IException::Programmer, m, _FILEINFO_);
                    }
                    }
                  }

              break;


          }//end switch

  }



  /**
  * Sets the input and output bricks sizes to the given number of samples, 
  * lines, and bands. 
@@ -114,6 +247,8 @@ namespace Isis {
  *
  * @param nb Number of bands
  */


  void ProcessByBrick::SetBrickSize(int ns, int nl, int nb) {
    SetInputBrickSize(ns, nl, nb);
    SetOutputBrickSize(ns, nl, nb);
+16 −0
Original line number Diff line number Diff line
@@ -98,6 +98,10 @@ namespace Isis {
      //! Destroys the ProcessByBrick object
      virtual ~ProcessByBrick();

      enum IOCubes{InPlace,
                   InputOutput,
                   InputOutputList};

      enum ProcessingDirection {
        LinesFirst,
        BandsFirst
@@ -111,6 +115,9 @@ namespace Isis {
                         const CubeAttributeInput &att,
                         int requirements = 0);

      virtual void SetBricks(IOCubes cn);
      void VerifyCubes(IOCubes cn);

      void SetBrickSize(int ns, int nl, int nb);

      void SetInputBrickSize(int ns, int nl, int nb);
@@ -130,6 +137,7 @@ namespace Isis {
      void SetProcessingDirection(ProcessingDirection direction);
      ProcessingDirection GetProcessingDirection();

      void SetOutputRequirements(int outputRequirements);
      void SetWrap(bool wrap);
      bool Wraps();

@@ -820,6 +828,10 @@ namespace Isis {
                                      set*/
      bool p_outputBrickSizeSet; /**< Indicates whether the brick size has been
                                      set*/

      int p_outputRequirements;


      std::vector<int> p_inputBrickSamples;  /**< Number of samples in the input
                                                  bricks*/
      std::vector<int> p_inputBrickLines;    /**< Number of lines in the input
@@ -832,6 +844,10 @@ namespace Isis {
                                                  bricks*/
      std::vector<int> p_outputBrickBands;   /**< Number of bands in the output
                                                  bricks*/




  };

};
+864 −9

File changed.

Preview size limit exceeded, changes collapsed.

Loading