8 #include "ProcessBySpectra.h"
12 #include "IException.h"
14 #include "ProcessByBrick.h"
41 Isis::Cube *ProcessBySpectra::SetInputCube(
const QString ¶meter,
42 const int requirements) {
43 return ProcessByBrick::SetInputCube(parameter,
44 Isis::SpatialMatch | requirements);
60 Isis::Cube *ProcessBySpectra::SetInputCube(
const QString &file,
62 const int requirements) {
63 return ProcessByBrick::SetInputCube(file, att,
64 Isis::SpatialMatch | requirements);
81 void ProcessBySpectra::StartProcess(
void funct(
Isis::Buffer &in)) {
87 ProcessByBrick::StartProcess(funct);
103 void ProcessBySpectra::StartProcess(
void
107 VerifyCubes(InputOutput);
108 SetBricks(InputOutput);
110 ProcessByBrick::StartProcess(funct);
125 void ProcessBySpectra::StartProcess(
void funct(std::vector<Isis::Buffer *> &in,
126 std::vector<Isis::Buffer *> &out)) {
128 VerifyCubes(InputOutputList);
129 SetBricks(InputOutputList);
130 ProcessByBrick::StartProcess(funct);
143 void ProcessBySpectra::SetType(
const int type) {
144 if (type != PerPixel && type != ByLine && type != BySample) {
145 string m =
"The specified spectra type is invalid";
146 throw IException(IException::Programmer, m, _FILEINFO_);
148 else p_spectraType = type;
152 void ProcessBySpectra::SetBricks(IOCubes cn){
161 if(InputCubes.size() == 1) {
163 ns = InputCubes[0]->sampleCount();
164 nl = InputCubes[0]->lineCount();
165 nb = InputCubes[0]->bandCount();
168 ns = OutputCubes[0]->sampleCount();
169 nl = OutputCubes[0]->lineCount();
170 nb = OutputCubes[0]->bandCount();
173 if(Type() == PerPixel) SetBrickSize(1, 1, nb);
175 else if(Type() == ByLine) SetBrickSize(ns, 1, nb);
177 else SetBrickSize(1, nl, nb);
183 if(Type() == PerPixel) {
184 SetInputBrickSize(1, 1, InputCubes[0]->bandCount());
185 SetOutputBrickSize(1, 1, OutputCubes[0]->bandCount());
187 else if(Type() == ByLine) {
188 SetInputBrickSize(InputCubes[0]->sampleCount(), 1,
189 InputCubes[0]->bandCount());
190 SetOutputBrickSize(OutputCubes[0]->sampleCount(), 1,
191 OutputCubes[0]->bandCount());
194 SetInputBrickSize(1, InputCubes[0]->lineCount(),
195 InputCubes[0]->bandCount());
196 SetOutputBrickSize(1, OutputCubes[0]->lineCount(),
197 OutputCubes[0]->bandCount());
203 case InputOutputList:
205 if(Type() == PerPixel) {
206 for(
unsigned int i = 0; i < InputCubes.size(); i++) {
207 SetInputBrickSize(1, 1, InputCubes[i]->bandCount(), i + 1);
209 for(
unsigned int i = 0; i < OutputCubes.size(); i++) {
210 SetOutputBrickSize(1, 1, OutputCubes[i]->bandCount(), i + 1);
213 else if(Type() == ByLine) {
214 for(
unsigned int i = 0; i < InputCubes.size(); i++) {
215 SetInputBrickSize(InputCubes[i]->sampleCount(), 1,
216 InputCubes[i]->bandCount(), i + 1);
218 for(
unsigned int i = 0; i < OutputCubes.size(); i++) {
219 SetOutputBrickSize(OutputCubes[i]->sampleCount(), 1,
220 OutputCubes[i]->bandCount(), i + 1);
224 for(
unsigned int i = 0; i < InputCubes.size(); i++) {
225 SetInputBrickSize(1, InputCubes[i]->lineCount(),
226 InputCubes[i]->bandCount(), i + 1);
228 for(
unsigned int i = 0; i < OutputCubes.size(); i++) {
229 SetOutputBrickSize(1, OutputCubes[i]->lineCount(),
230 OutputCubes[i]->bandCount(), i + 1);