Isis 3 Programmer Reference
ProcessBySample.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #include "ProcessBySample.h"
8 
9 #include "Buffer.h"
10 #include "Cube.h"
11 #include "IException.h"
12 #include "Process.h"
13 #include "ProcessByBrick.h"
14 
15 using namespace std;
16 namespace Isis {
37  Isis::Cube *ProcessBySample::SetInputCube(const QString &parameter,
38  int requirements) {
39  int allRequirements = Isis::SpatialMatch | Isis::BandMatchOrOne;
40  allRequirements |= requirements;
41  return Process::SetInputCube(parameter, allRequirements);
42  }
43 
44 
57  Isis::Cube *ProcessBySample::SetInputCube(const QString &file,
59  int requirements) {
60  int allRequirements = Isis::SpatialMatch | Isis::BandMatchOrOne;
61  allRequirements |= requirements;
62  return Process::SetInputCube(file, att, allRequirements);
63  }
64 
65 
77  void ProcessBySample::StartProcess(void funct(Isis::Buffer &inout)) {
78  VerifyCubes(InPlace);
79  SetBricks(InPlace);
80  ProcessByBrick::StartProcess(funct);
81  }
82 
83 
94  void ProcessBySample::StartProcess(void funct(Isis::Buffer &in,
95  Isis::Buffer &out)) {
96  VerifyCubes(InputOutput);
97  SetBricks(InputOutput);
98  ProcessByBrick::StartProcess(funct);
99  }
100 
101 
111  void ProcessBySample::StartProcess(void funct(std::vector<Isis::Buffer *> &in,
112  std::vector<Isis::Buffer *> &out)) {
113  VerifyCubes(InputOutputList) ;
114  SetBricks(InputOutputList);
115  ProcessByBrick::StartProcess(funct);
116  }
117 
118 
119  void ProcessBySample::SetBricks(IOCubes cn){
120  switch(cn){
121  case InPlace:
122  if (InputCubes.size() == 1) {
123  SetBrickSize(1, InputCubes[0]->lineCount(), 1);
124  }
125  else {
126  SetBrickSize(1, OutputCubes[0]->lineCount(), 1);
127  }
128  break;
129 
130  case InputOutput:
131  SetInputBrickSize(1, InputCubes[0]->lineCount(), 1);
132  SetOutputBrickSize(1, OutputCubes[0]->lineCount(), 1);
133  break;
134 
135  case InputOutputList:
136  for(unsigned int i = 0; i < InputCubes.size(); i++) {
137  SetInputBrickSize(1, InputCubes[i]->lineCount(), 1, i + 1);
138  }
139  for(unsigned int i = 0; i < OutputCubes.size(); i++) {
140  SetOutputBrickSize(1, OutputCubes[i]->lineCount(), 1, i + 1);
141  }
142  break;
143  }
144  }
145 }
Isis::Buffer
Buffer for reading and writing cube data.
Definition: Buffer.h:53
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
std
Namespace for the standard library.
Isis::CubeAttributeInput
Manipulate and parse attributes of input cube filenames.
Definition: CubeAttribute.h:381
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16