Isis 3.0 Programmer Reference
Back | Home
ProcessByBrick.cpp
Go to the documentation of this file.
1 
23 #include "ProcessByBrick.h"
24 
25 #include "Brick.h"
26 #include "Cube.h"
27 
28 using namespace std;
29 
30 namespace Isis {
31  ProcessByBrick::ProcessByBrick() {
32  p_inputBrickSamples.clear();
33  p_inputBrickLines.clear();
34  p_inputBrickBands.clear();
35 
36  p_outputBrickSamples.clear();
37  p_outputBrickLines.clear();
38  p_outputBrickBands.clear();
39 
40  p_outputRequirements = 0;
41  p_inputBrickSizeSet = false;
42  p_outputBrickSizeSet = false;
43  p_wrapOption = false;
44  p_reverse = false;
45  }
46 
47 
48 
49 
50  ProcessByBrick::~ProcessByBrick() {
51  }
52 
53 
73  Cube *ProcessByBrick::SetInputCube(const QString &parameter,
74  int requirements) {
75  int allRequirements = AllMatchOrOne;
76  allRequirements |= requirements;
77  return Process::SetInputCube(parameter, allRequirements);
78  }
79 
101  Cube *ProcessByBrick::SetInputCube(const QString &file,
102  const CubeAttributeInput &att,
103  int requirements) {
104  int allRequirements = AllMatchOrOne;
105  allRequirements |= requirements;
106  return Process::SetInputCube(file, att, allRequirements);
107  }
108 
109 
110 void ProcessByBrick::SetOutputRequirements(int outputRequirements) {
111 
112  p_outputRequirements = outputRequirements;
113 
114 
115 }
116 
117  void ProcessByBrick::SetBricks(IOCubes cn){
118 
119  ;
120 
121  }
122 
139  void ProcessByBrick::VerifyCubes(IOCubes cn){
140 
141 
142  switch(cn){
143 
144  //Error check
145  case InPlace:
146 
147  if (InputCubes.size() +OutputCubes.size() > 1) {
148  string m = "You can only specify exactly one input or output cube";
149  throw IException(IException::Programmer,m,_FILEINFO_);
150  }
151  else if ( (InputCubes.size() + OutputCubes.size() == 0) ){
152 
153  string m = "You haven't specified an input or output cube";
154  throw IException(IException::Programmer, m, _FILEINFO_);
155 
156  }
157 
158  break;
159 
160  case InputOutput:
161 
162  //Error checks ... there must be one input and output
163  if(InputCubes.size() != 1) {
164  string m = "You must specify exactly one input cube";
165  throw IException(IException::Programmer, m, _FILEINFO_);
166  }
167  else if(OutputCubes.size() != 1) {
168  string m = "You must specify exactly one output cube";
169  throw IException(IException::Programmer, m, _FILEINFO_);
170  }
171 
172  // The lines in the input and output must match
173 
174 
175  if(InputCubes[0]->lineCount() != OutputCubes[0]->lineCount()) {
176  string m = "The number of lines in the input and output cubes ";
177  m += "must match";
178  throw IException(IException::Programmer, m, _FILEINFO_);
179  }
180 
181  if(InputCubes[0]->sampleCount() != OutputCubes[0]->sampleCount()) {
182  string m = "The number of samples in the input and output cubes ";
183  m += "must match";
184  throw IException(IException::Programmer, m, _FILEINFO_);
185  }
186 
187 
188  // The bands in the input and output must match
189 
190  //If we are only looking for a spatial match (just match lines/samples)
191  //but not bands, then we skip over this check.
192 
193  if ( !(p_outputRequirements & Isis::SpatialMatch ) ) {
194  if(InputCubes[0]->bandCount() != OutputCubes[0]->bandCount()) {
195  string m = "The number of bands in the input and output cubes ";
196  m += "must match";
197  throw IException(IException::Programmer, m, _FILEINFO_);
198  }
199 
200  }
201 
202  break;
203 
204 
205 
206  case InputOutputList:
207 
208  // Make sure we had an image
209  if (InputCubes.size() + OutputCubes.size() < 1) {
210  string m = "You have not specified any input or output cubes";
211  throw IException(IException::Programmer, m, _FILEINFO_);
212  }
213 
214  for (unsigned int i = 0; i < OutputCubes.size(); i++) {
215  if (OutputCubes[i]->lineCount() != OutputCubes[0]->lineCount() ) {
216  string m = "All output cubes must have the same number of lines ";
217  m += "as the first input cube or output cube";
218  throw IException(IException::Programmer, m, _FILEINFO_);
219  }
220  //If we are only looking for a spatial match (just match lines/samples)
221  //but not bands, then we skip over this check.
222  if ( !(p_outputRequirements & Isis::SpatialMatch ) ) {
223  if (OutputCubes[i]->bandCount() != OutputCubes[0]->bandCount() ) {
224  string m = "All output cubes must have the same number of bands ";
225  m += "as the first input cube or output cube";
226  throw IException(IException::Programmer, m, _FILEINFO_);
227  }
228  }
229  }
230 
231  break;
232 
233 
234  }//end switch
235 
236  }
237 
238 
239 
252  void ProcessByBrick::SetBrickSize(int ns, int nl, int nb) {
253  SetInputBrickSize(ns, nl, nb);
254  SetOutputBrickSize(ns, nl, nb);
255  return;
256  }
257 
258 
268  void ProcessByBrick::SetInputBrickSize(int ns, int nl, int nb) {
269  p_inputBrickSamples.clear();
270  p_inputBrickSamples.resize(InputCubes.size() + 1, ns);
271  p_inputBrickLines.clear();
272  p_inputBrickLines.resize(InputCubes.size() + 1, nl);
273  p_inputBrickBands.clear();
274  p_inputBrickBands.resize(InputCubes.size() + 1, nb);
275 
276  p_inputBrickSizeSet = true;
277  }
278 
279 
291  void ProcessByBrick::SetInputBrickSize(int ns, int nl, int nb, int cube) {
292  if (cube > (int)InputCubes.size()) {
293  string m = "The specified cube is out of range";
294  throw IException(IException::Programmer, m, _FILEINFO_);
295  }
296 
297  // If a default size has already been set, use it to fill in
298  if (p_inputBrickSamples.size() > 0) {
299  p_inputBrickSamples.resize(InputCubes.size() + 1, p_inputBrickSamples[0]);
300  p_inputBrickLines.resize(InputCubes.size() + 1, p_inputBrickLines[0]);
301  p_inputBrickBands.resize(InputCubes.size() + 1, p_inputBrickBands[0]);
302  }
303  // otherwise, make this the default size
304  else {
305  p_inputBrickSamples.resize(InputCubes.size() + 1, ns);
306  p_inputBrickLines.resize(InputCubes.size() + 1, nl);
307  p_inputBrickBands.resize(InputCubes.size() + 1, nb);
308  }
309 
310  p_inputBrickSamples[cube] = ns;
311  p_inputBrickLines[cube] = nl;
312  p_inputBrickBands[cube] = nb;
313 
314  p_inputBrickSizeSet = true;
315  }
316 
317 
327  void ProcessByBrick::SetOutputBrickSize(int ns, int nl, int nb) {
328  p_outputBrickSamples.clear();
329  p_outputBrickSamples.resize(OutputCubes.size() + 1, ns);
330  p_outputBrickLines.clear();
331  p_outputBrickLines.resize(OutputCubes.size() + 1, nl);
332  p_outputBrickBands.clear();
333  p_outputBrickBands.resize(OutputCubes.size() + 1, nb);
334 
335  p_outputBrickSizeSet = true;
336  }
337 
338 
350  void ProcessByBrick::SetOutputBrickSize(int ns, int nl, int nb, int cube) {
351  if(cube > (int)OutputCubes.size()) {
352  string m = "The specified cube is out of range";
353  throw IException(IException::Programmer, m, _FILEINFO_);
354  }
355 
356  // If a default size has already been set, use it to fill in
357  if(p_outputBrickSamples.size() > 0) {
358  p_outputBrickSamples.resize(OutputCubes.size() + 1,
359  p_outputBrickSamples[0]);
360  p_outputBrickLines.resize(OutputCubes.size() + 1, p_outputBrickLines[0]);
361  p_outputBrickBands.resize(OutputCubes.size() + 1, p_outputBrickBands[0]);
362  }
363  // otherwise, make this the default size
364  else {
365  p_outputBrickSamples.resize(OutputCubes.size() + 1, ns);
366  p_outputBrickLines.resize(OutputCubes.size() + 1, nl);
367  p_outputBrickBands.resize(OutputCubes.size() + 1, nb);
368  }
369 
370  p_outputBrickSamples[cube] = ns;
371  p_outputBrickLines[cube] = nl;
372  p_outputBrickBands[cube] = nb;
373 
374  p_outputBrickSizeSet = true;
375  }
376 
391  Isis::Cube *ProcessByBrick::SetOutputCube(const QString &fname,
392  const Isis::CubeAttributeOutput &att) {
393  int nl = InputCubes[0]->lineCount();
394  int ns = InputCubes[0]->sampleCount();
395  int nb = InputCubes[0]->bandCount();
396  return Process::SetOutputCube(fname, att, ns, nl, nb);
397  }
398 
407  void ProcessByBrick::SetProcessingDirection(ProcessingDirection direction) {
408  p_reverse = direction == BandsFirst ? true : false;
409  }
410 
411 
420  ProcessByBrick::ProcessingDirection ProcessByBrick::GetProcessingDirection() {
421  return p_reverse ? BandsFirst : LinesFirst;
422  }
423 
424 
436  void ProcessByBrick::SetWrap(bool wrap) {
437  p_wrapOption = wrap;
438  }
439 
440 
446  bool ProcessByBrick::Wraps() {
447  return p_wrapOption;
448  }
449 
450 
464  void ProcessByBrick::StartProcess(void funct(Buffer &in)) {
465  Cube *cube = NULL;
466  Brick *brick = NULL;
467 
468  bool haveInput = PrepProcessCubeInPlace(&cube, &brick);
469 
470  // Loop and let the app programmer work with the bricks
471  p_progress->SetMaximumSteps(brick->Bricks());
472  p_progress->CheckStatus();
473 
474  for (brick->begin(); !brick->end(); (*brick)++) {
475  if (haveInput)
476  cube->read(*brick); // input only
477 
478  funct(*brick);
479 
480  // output only or input/output
481  if ((!haveInput) || (cube->isReadWrite())) {
482  cube->write(*brick);
483  }
484 
485  p_progress->CheckStatus();
486  }
487 
488  delete brick;
489  }
490 
491 
506  void ProcessByBrick::StartProcess(void funct(Buffer &in, Buffer &out)) {
507  Brick *ibrick = NULL;
508  Brick *obrick = NULL;
509 
510  int numBricks = PrepProcessCube(&ibrick, &obrick);
511 
512  // Loop and let the app programmer work with the bricks
513  p_progress->SetMaximumSteps(numBricks);
514  p_progress->CheckStatus();
515 
516  ibrick->begin();
517  obrick->begin();
518 
519  for (int i = 0; i < numBricks; i++) {
520  InputCubes[0]->read(*ibrick);
521  funct(*ibrick, *obrick);
522  OutputCubes[0]->write(*obrick);
523  p_progress->CheckStatus();
524  (*ibrick)++;
525  (*obrick)++;
526  }
527 
528  delete ibrick;
529  delete obrick;
530  }
531 
532 
546  void ProcessByBrick::StartProcess(void funct(std::vector<Buffer *> &in,
547  std::vector<Buffer *> &out)) {
548  // Construct two vectors of brick buffer managers
549  // The input buffer managers
550  vector<Brick *> imgrs;
551  vector<Buffer *> ibufs;
552 
553  // And the output buffer managers
554  vector<Brick *> omgrs;
555  vector<Buffer *> obufs;
556 
557  int numBricks = PrepProcessCubes(ibufs, obufs, imgrs, omgrs);
558 
559  // Loop and let the app programmer process the bricks
560  p_progress->SetMaximumSteps(numBricks);
561  p_progress->CheckStatus();
562 
563  for(int t = 0; t < numBricks; t++) {
564  // Read the input buffers
565  for(unsigned int i = 0; i < InputCubes.size(); i++) {
566  InputCubes[i]->read(*ibufs[i]);
567  }
568 
569  // Pass them to the application function
570  funct(ibufs, obufs);
571 
572  // And copy them into the output cubes
573  for(unsigned int i = 0; i < OutputCubes.size(); i++) {
574  OutputCubes[i]->write(*obufs[i]);
575  omgrs[i]->next();
576  }
577 
578  for(unsigned int i = 0; i < InputCubes.size(); i++) {
579  imgrs[i]->next();
580 
581  // if the manager has reached the end and the
582  // wrap option is on, wrap around to the beginning
583  if(Wraps() && imgrs[i]->end())
584  imgrs[i]->begin();
585 
586  // Enforce same band
587  if(imgrs[i]->Band() != imgrs[0]->Band() &&
588  InputCubes[i]->bandCount() != 1) {
589  imgrs[i]->SetBaseBand(imgrs[0]->Band());
590  }
591  }
592  p_progress->CheckStatus();
593  }
594 
595  for(unsigned int i = 0; i < ibufs.size(); i++) {
596  delete ibufs[i];
597  }
598  ibufs.clear();
599  imgrs.clear();
600 
601  for(unsigned int i = 0; i < obufs.size(); i++) {
602  delete obufs[i];
603  }
604  obufs.clear();
605  omgrs.clear();
606  }
607 
614  void ProcessByBrick::EndProcess() {
615  p_inputBrickSizeSet = false;
616  p_outputBrickSizeSet = false;
617  Process::EndProcess();
618  }
619 
620 
624  void ProcessByBrick::Finalize() {
625  EndProcess();
626  }
627 
628 
636  void ProcessByBrick::BlockingReportProgress(QFuture<void> &future) {
637  int isisReportedProgress = 0;
638  int lastProgressValue = future.progressValue();
639  // Using a mutex with a timeout isn't as bad of a hack as inheriting QThread
640  // but there ought to be a better way.
641  // Does having a local mutex make sense?
642  QMutex sleeper;
643  sleeper.lock();
644  while (!future.isFinished()) {
645  sleeper.tryLock(100);
646 
647  if (future.progressValue() != lastProgressValue) {
648  lastProgressValue = future.progressValue();
649  // Progress min/max are reporting as 0's currently, so we're
650  // assuming the progress value is an Isis progress value.
651  int isisProgressValue = lastProgressValue;
652  while (isisReportedProgress < isisProgressValue) {
653  p_progress->CheckStatus();
654  isisReportedProgress++;
655  }
656  }
657  }
658 
659  while (isisReportedProgress < future.progressValue()) {
660  p_progress->CheckStatus();
661  isisReportedProgress++;
662  }
663 
664  // Need to unlock the mutex before it goes out of scope, otherwise Qt5 issues a warning
665  sleeper.unlock();
666  }
667 
668 
682  vector<int> ProcessByBrick::CalculateMaxDimensions(
683  vector<Cube *> cubes) const {
684  int maxSamples = 0;
685  int maxLines = 0;
686  int maxBands = 0;
687 
688  for (unsigned int i = 0; i < cubes.size(); i++) {
689  int sampleCount = cubes[i]->sampleCount();
690  int lineCount = cubes[i]->lineCount();
691  int bandCount = cubes[i]->bandCount();
692 
693  if (sampleCount > maxSamples)
694  maxSamples = sampleCount;
695  if (lineCount > maxLines)
696  maxLines = lineCount;
697  if (bandCount > maxBands)
698  maxBands = bandCount;
699  }
700 
701  vector<int> maxDimensions;
702  maxDimensions.push_back(maxSamples);
703  maxDimensions.push_back(maxLines);
704  maxDimensions.push_back(maxBands);
705  return maxDimensions;
706  }
707 
708 
724  bool ProcessByBrick::PrepProcessCubeInPlace(Cube **cube, Brick **bricks) {
725  // Error checks
726  if ((InputCubes.size() + OutputCubes.size()) != 1) {
727  string m = "You can only specify exactly one input or output cube";
728  throw IException(IException::Programmer, m, _FILEINFO_);
729  }
730 
731  bool haveInput;
732  if (InputCubes.size() == 1) {
733  // Make sure the brick size has been set
734  if (!p_inputBrickSizeSet) {
735  string m = "Use the SetBrickSize() or SetInputBrickSize() method to set"
736  " the input brick size";
737  throw IException(IException::Programmer, m, _FILEINFO_);
738  }
739  // And the size is stored
740  else if (p_inputBrickSamples.size() == 1) {
741  SetInputBrickSize(p_inputBrickSamples[0], p_inputBrickLines[0],
742  p_inputBrickBands[0], 1);
743  }
744 
745  haveInput = true;
746  *cube = InputCubes[0];
747  *bricks = new Brick(**cube, p_inputBrickSamples[1],
748  p_inputBrickLines[1], p_inputBrickBands[1], p_reverse);
749  }
750  else {
751  // Make sure the brick size has been set
752  if (!p_outputBrickSizeSet) {
753  string m = "Use the SetBrickSize() or SetOutputBrickSize() method to "
754  "set the output brick size";
755  throw IException(IException::Programmer, m, _FILEINFO_);
756  }
757  // And the size is stored
758  else if (p_outputBrickSamples.size() == 1) {
759  SetOutputBrickSize(p_outputBrickSamples[0], p_outputBrickLines[0],
760  p_outputBrickBands[0], 1);
761  }
762 
763  haveInput = false;
764  *cube = OutputCubes[0];
765  *bricks = new Brick(**cube, p_outputBrickSamples[1],
766  p_outputBrickLines[1], p_outputBrickBands[1], p_reverse);
767  }
768 
769  return haveInput;
770  }
771 
772 
788  int ProcessByBrick::PrepProcessCube(Brick **ibrick, Brick **obrick) {
789  // Error checks ... there must be one input and output
790  if (InputCubes.size() != 1) {
791  string m = "You must specify exactly one input cube";
792  throw IException(IException::Programmer, m, _FILEINFO_);
793  }
794  else if (OutputCubes.size() != 1) {
795  string m = "You must specify exactly one output cube";
796  throw IException(IException::Programmer, m, _FILEINFO_);
797  }
798 
799  // Make sure the brick size has been set
800  if (!p_inputBrickSizeSet || !p_outputBrickSizeSet) {
801  string m = "Use the SetBrickSize(), SetInputBrickSize(), or "
802  "SetOutputBrickSize() method to set the brick sizes";
803  throw IException(IException::Programmer, m, _FILEINFO_);
804  }
805 
806  // Make all input and/or output cubes have the same size
807  if (p_outputBrickSamples.size() == 1) {
808  SetOutputBrickSize(p_outputBrickSamples[0], p_outputBrickLines[0],
809  p_outputBrickBands[0], 1);
810  }
811  if (p_inputBrickSamples.size() == 1) {
812  SetInputBrickSize(p_inputBrickSamples[0], p_inputBrickLines[0],
813  p_inputBrickBands[0], 1);
814  }
815 
816  // Construct brick buffers
817  if (Wraps()) {
818  // Use the size of each cube as the area for the bricks to traverse since
819  // we will be wrapping if we hit the end of one, but not the other.
820  *ibrick = new Brick(*InputCubes[0], p_inputBrickSamples[1],
821  p_inputBrickLines[1], p_inputBrickBands[1], p_reverse);
822  *obrick = new Brick(*OutputCubes[0], p_outputBrickSamples[1],
823  p_outputBrickLines[1], p_outputBrickBands[1], p_reverse);
824  }
825  else {
826  // Since we are not wrapping, we need to find the maximum size of the
827  // input cube and the output cube. We will use this size when
828  // constructing each of the bricks' area to traverse so that we don't
829  // read into nonexistent bands of the smaller of the two cubes.
830  vector<Cube *> allCubes;
831  allCubes.push_back(InputCubes[0]);
832  allCubes.push_back(OutputCubes[0]);
833  vector<int> maxDimensions = CalculateMaxDimensions(allCubes);
834  int maxSamples = maxDimensions[0];
835  int maxLines = maxDimensions[1];
836  int maxBands = maxDimensions[2];
837 
838  *ibrick = new Brick(maxSamples, maxLines, maxBands,
839  p_inputBrickSamples[1],
840  p_inputBrickLines[1],
841  p_inputBrickBands[1],
842  InputCubes[0]->pixelType(),
843  p_reverse);
844  *obrick = new Brick(maxSamples, maxLines, maxBands,
845  p_outputBrickSamples[1],
846  p_outputBrickLines[1],
847  p_outputBrickBands[1],
848  OutputCubes[0]->pixelType(),
849  p_reverse);
850  }
851 
852  int numBricks;
853  if((*ibrick)->Bricks() > (*obrick)->Bricks()) {
854  numBricks = (*ibrick)->Bricks();
855  }
856  else {
857  numBricks = (*obrick)->Bricks();
858  }
859 
860  return numBricks;
861  }
862 
863 
880  int ProcessByBrick::PrepProcessCubes(vector<Buffer *> & ibufs,
881  vector<Buffer *> & obufs,
882  vector<Brick *> & imgrs,
883  vector<Brick *> & omgrs) {
884  // Make sure we had an image
885  if(InputCubes.size() == 0 && OutputCubes.size() == 0) {
886  string m = "You have not specified any input or output cubes";
887  throw IException(IException::Programmer, m, _FILEINFO_);
888  }
889 
890  // Make sure the brick size has been set
891  if(!p_inputBrickSizeSet && InputCubes.size() > 0) {
892  string m = "Use the SetBrickSize() or SetInputBrick() method to set the "
893  "input brick size(s)";
894  throw IException(IException::Programmer, m, _FILEINFO_);
895  }
896  else if(p_inputBrickSizeSet && p_inputBrickSamples.size() == 1) {
897  SetInputBrickSize(p_inputBrickSamples[0], p_inputBrickLines[0],
898  p_inputBrickBands[0], InputCubes.size());
899  }
900  if(!p_outputBrickSizeSet && OutputCubes.size() > 0) {
901  string m = "Use the SetBrickSize() or SetOutputBrick() method to set the "
902  "output brick size(s)";
903  throw IException(IException::Programmer, m, _FILEINFO_);
904  }
905  else if(p_outputBrickSizeSet && p_outputBrickSamples.size() == 1) {
906  SetOutputBrickSize(p_outputBrickSamples[0], p_outputBrickLines[0],
907  p_outputBrickBands[0], OutputCubes.size());
908  }
909 
910  // this parameter holds the number of bricks to be used in processing
911  // which is the maximum number of bricks of all the cubes.
912  int numBricks = 0;
913 
914  // If we are not wrapping, we need to find the maximum size of the input and
915  // output cubes. We will use this size when constructing each of the bricks'
916  // area to traverse so that we don't read into nonexistent bands of the
917  // smaller cubes.
918  int maxSamples = 0;
919  int maxLines = 0;
920  int maxBands = 0;
921  if (!Wraps()) {
922  vector<Cube *> allCubes(InputCubes);
923  for (unsigned int i = 0; i < OutputCubes.size(); i++)
924  allCubes.push_back(OutputCubes[i]);
925  vector<int> maxDimensions = CalculateMaxDimensions(allCubes);
926  maxSamples = maxDimensions[0];
927  maxLines = maxDimensions[1];
928  maxBands = maxDimensions[2];
929  }
930 
931  for (unsigned int i = 1; i <= InputCubes.size(); i++) {
932  Brick *ibrick = NULL;
933  if (Wraps()) {
934  // Use the size of each cube as the area for the bricks to traverse
935  // since we will be wrapping if we hit the end of a cube before we are
936  // done processing.
937  ibrick = new Brick(*InputCubes[i-1],
938  p_inputBrickSamples[i],
939  p_inputBrickLines[i],
940  p_inputBrickBands[i],
941  p_reverse);
942  }
943  else {
944  ibrick = new Brick(maxSamples, maxLines, maxBands,
945  p_inputBrickSamples[i],
946  p_inputBrickLines[i],
947  p_inputBrickBands[i],
948  InputCubes[i - 1]->pixelType(),
949  p_reverse);
950  }
951  ibrick->begin();
952  ibufs.push_back(ibrick);
953  imgrs.push_back(ibrick);
954  if(numBricks < ibrick->Bricks()) {
955  numBricks = ibrick->Bricks();
956  }
957  }
958 
959  for (unsigned int i = 1; i <= OutputCubes.size(); i++) {
960  Brick *obrick = NULL;
961  if (Wraps()) {
962  obrick = new Brick(*OutputCubes[i-1],
963  p_outputBrickSamples[i],
964  p_outputBrickLines[i],
965  p_outputBrickBands[i],
966  p_reverse);
967  }
968  else {
969  obrick = new Brick(maxSamples, maxLines, maxBands,
970  p_outputBrickSamples[i],
971  p_outputBrickLines[i],
972  p_outputBrickBands[i],
973  OutputCubes[i - 1]->pixelType(),
974  p_reverse);
975  }
976  obrick->begin();
977  obufs.push_back(obrick);
978  omgrs.push_back(obrick);
979  if(numBricks < obrick->Bricks()) {
980  numBricks = obrick->Bricks();
981  }
982  }
983 
984  return numBricks;
985  }
986 
987 
993  ProcessByBrick::ProcessIterator::ProcessIterator(int position) :
994  m_currentPosition(position) {
995  }
996 
997 
1004  const ProcessIterator &other) :
1005  m_currentPosition(other.m_currentPosition) {
1006  }
1007 
1008 
1013  m_currentPosition = -1;
1014  }
1015 
1016 
1023  m_currentPosition++;
1024  return *this;
1025  }
1026 } // end namespace isis
1027 
Buffer for reading and writing cube data.
Definition: Buffer.h:68
Manipulate and parse attributes of input cube filenames.
This class is designed to iterate over all brick positions in a cube.
bool end() const
Returns true if the shape buffer has accessed the end of the cube.
Buffer for containing a three dimensional section of an image.
Definition: Brick.h:60
bool isReadWrite() const
Test if the opened cube is read-write, that is read and write operations should succeed if this is tr...
Definition: Cube.cpp:150
void read(Blob &blob) const
This method will read data from the specified Blob object.
Definition: Cube.cpp:686
ProcessIterator & operator++()
Increment the process iterator to the next position.
bool begin()
Moves the shape buffer to the first position.
int Bricks()
Returns the number of Bricks in the cube.
Definition: Brick.h:160
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:38
Manipulate and parse attributes of output cube filenames.
void write(Blob &blob)
This method will write a blob of data (e.g.
Definition: Cube.cpp:725
ProcessIterator(int position)
Initialize a process iterator given a position.
Isis exception class.
Definition: IException.h:99
int lineCount() const
Definition: Cube.cpp:1331
IO Handler for Isis Cubes.
Definition: Cube.h:158

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:26:10