Isis 3 Programmer Reference
ProcessMosaic.cpp
Go to the documentation of this file.
1 
22 #include "Preference.h"
23 
24 #include "Application.h"
25 #include "IException.h"
26 #include "IString.h"
27 #include "Portal.h"
28 #include "ProcessMosaic.h"
29 #include "Pvl.h"
30 #include "SerialNumber.h"
31 #include "SpecialPixel.h"
32 #include "Table.h"
33 #include "TrackingTable.h"
34 
35 using namespace std;
36 
37 namespace Isis {
41  const char *ProcessMosaic::TRACKING_TABLE_NAME = "InputImages";
42 
48  ProcessMosaic::ProcessMosaic() {
49  // Set the BandBin Match
50  SetBandBinMatch(true);
51 
52  // Initialize the structure Track Info
53  m_trackingEnabled = false;
54  m_trackingCube = NULL;
55  m_createOutputMosaic = false;
56  m_bandPriorityBandNumber = 0;
57  m_bandPriorityKeyName = "";
58  m_bandPriorityKeyValue = "";
59  m_bandPriorityUseMaxValue = false;
60 
61  // Initialize the Special Pixel Flags
62  m_placeHighSatPixels = false;
63  m_placeLowSatPixels = false;
64  m_placeNullPixels = false;
65 
66  // Default Priority OnTop
67  m_imageOverlay = PlaceImagesOnTop;
68 
69  m_enforceMatchDEM = false;
70 
71  // Initialize the data members
72  m_iss = -1;
73  m_isl = -1;
74  m_isb = -1;
75  m_ins = -1;
76  m_inl = -1;
77  m_inb = -1;
78  m_oss = -1;
79  m_osl = -1;
80  m_osb = -1;
81  m_onb = -1;
82  }
83 
84 
86  ProcessMosaic::~ProcessMosaic() {
87  if (m_trackingCube) {
88  m_trackingCube->close();
89  delete m_trackingCube;
90  m_trackingCube = NULL;
91  }
92  }
93 
94 
121  void ProcessMosaic::StartProcess(const int &os, const int &ol, const int &ob) {
122  // Error checks ... there must be one input and one output
123  if ((OutputCubes.size() != 1) || (InputCubes.size() != 1)) {
124  QString m = "You must specify exactly one input and one output cube";
125  throw IException(IException::Programmer, m, _FILEINFO_);
126  }
127 
128  bool bTrackExists = false;
129  if (!m_createOutputMosaic) {
130  bTrackExists = GetTrackStatus();
131  if (m_trackingEnabled &&
132  !(OutputCubes[0]->hasGroup("Tracking") || OutputCubes[0]->hasTable("InputImages"))) {
133  QString m = "Cannot enable tracking while adding to a mosaic without tracking ";
134  m += "information. Confirm that your mosaic was originally created with tracking enabled.";
135  throw IException(IException::User, m, _FILEINFO_);
136  }
137  }
138 
139  int ins = m_ins;
140  int inl = m_inl;
141  int inb = m_inb;
142  int iss = m_iss;
143  int isl = m_isl;
144  int isb = m_isb;
145 
146  if (ins == -1)
147  ins = (int)InputCubes[0]->sampleCount();
148 
149  if (inl == -1)
150  inl = (int)InputCubes[0]->lineCount();
151 
152  if (inb == -1)
153  inb = (int)InputCubes[0]->bandCount();
154 
155  // Adjust the input sub-area if it overlaps any edge of the output cube
156  m_oss = os;
157  m_osl = ol;
158  m_osb = ob;
159 
160  // Left edge
161  if (m_oss < 1) {
162  iss = iss - m_oss + 1;
163  ins = ins + m_oss - 1;
164  m_oss = 1;
165  }
166  // Top edge
167  if (m_osl < 1) {
168  isl = isl - m_osl + 1;
169  inl = inl + m_osl - 1;
170  m_osl = 1;
171  }
172  // Right edge
173  if ((m_oss + ins - 1) > OutputCubes[0]->sampleCount()) {
174  ins = OutputCubes[0]->sampleCount() - m_oss + 1;
175  }
176  // Bottom edge
177  if ((m_osl + inl - 1) > OutputCubes[0]->lineCount()) {
178  inl = OutputCubes[0]->lineCount() - m_osl + 1;
179  }
180 
181  PvlGroup imgPosition("ImageLocation");
182  imgPosition += PvlKeyword("File", InputCubes[0]->fileName());
183  imgPosition += PvlKeyword("StartSample", toString(m_oss));
184  imgPosition += PvlKeyword("StartLine", toString(m_osl));
185  m_imagePositions += imgPosition;
186 
187  // Tests for completly off the mosaic
188  if ((ins < 1) || (inl < 1)) {
189  QString m = "The input cube does not overlap the mosaic";
190  throw IException(IException::User, m, _FILEINFO_);
191  }
192 
193  // Band Adjustments
194  if (m_osb < 1) {
195  isb = isb - m_osb + 1;
196  inb = inb + m_osb - 1;
197  m_osb = 1;
198  }
199 
200  p_progress->SetMaximumSteps(
201  (int)InputCubes[0]->lineCount() * (int)InputCubes[0]->bandCount());
202  p_progress->CheckStatus();
203 
204  // Tracking is done for:
205  // (1) Band priority,
206  // (2) Ontop and Beneath priority with number of bands equal to 1,
207  // (3) Ontop priority with all the special pixel flags set to true. (All special pixel flags
208  // must be set to true in order to handle multiple bands since we need to force pixels
209  // from all bands in a single image to be copied to the mosaic with ontop priority so we
210  // don't have multiple input bands to track for any single pixel in our tracking band.)
211  if (m_trackingEnabled) {
212  if (!(m_imageOverlay == UseBandPlacementCriteria ||
213  ((m_imageOverlay == PlaceImagesOnTop || m_imageOverlay == PlaceImagesBeneath) &&
214  // tracking band was already created for Tracking=true
215  (OutputCubes[0]->bandCount()) == 1) ||
216  (m_imageOverlay == PlaceImagesOnTop && m_placeHighSatPixels && m_placeLowSatPixels &&
217  m_placeNullPixels)) ){
218  QString m = "Tracking cannot be True for multi-band Mosaic with ontop or beneath priority";
219  throw IException(IException::Programmer, m, _FILEINFO_);
220  }
221  }
222 
223  // *******************************************************************************
224 
225  Pvl *inLab = InputCubes[0]->label();
226  // Create / Match DEM Shape Model if bMatchDEM Flag is enabled
227  if (m_enforceMatchDEM){
228  MatchDEMShapeModel();
229  }
230 
231  // Check to make sure the bandbins match if necessary
232  if (m_enforceBandBinMatch) {
233  Pvl *outLab = OutputCubes[0]->label();
234 
235  if (inLab->findObject("IsisCube").hasGroup("BandBin")) {
236  // Check to make sure the output cube has a bandbin group & make sure it
237  // matches the input cube bandbin group
238  if (!m_createOutputMosaic && outLab->findObject("IsisCube").hasGroup("BandBin")) {
239  MatchBandBinGroup(isb, inb);
240  }
241  // Otherwise copy the input cube bandbin to the output file
242  else {
243  AddBandBinGroup(isb);
244  }
245  }
246  // BandBin group is not found
247  else {
248  QString m = "Match BandBin cannot be True when the Image does not have the BandBin group";
249  throw IException(IException::Programmer, m, _FILEINFO_);
250  }
251  }
252  // Match BandBin set to false and CREATE and TRACKING is true
253  else {
254  if (m_createOutputMosaic) {
255  if (inLab->findObject("IsisCube").hasGroup("BandBin")) {
256  AddBandBinGroup(isb);
257  }
258  else {
259  AddDefaultBandBinGroup();
260  }
261  }
262  }
263 
264  // Even if the track flag is off, if the track table exists and "TRACKING" exists in bandbin
265  // group continue tracking
266  if (bTrackExists) {
267  m_trackingEnabled = true;
268  }
269 
270  // We don't want to set the filename in the table unless the band info is valid
271  int bandPriorityInputBandNumber = -1;
272  int bandPriorityOutputBandNumber = -1;
273  if (m_imageOverlay == UseBandPlacementCriteria ) {
274  bandPriorityInputBandNumber = GetBandIndex(true);
275  bandPriorityOutputBandNumber = GetBandIndex(false);
276  }
277 
278  // Set index of tracking image to the default offset of the Isis::UnsignedByte
279  int iIndex = VALID_MINUI4;
280  // Propogate tracking if adding to mosaic that was previouly tracked.
281  if (OutputCubes[0]->hasGroup("Tracking") && !m_createOutputMosaic) {
282  m_trackingEnabled = true;
283  }
284 
285  // Create tracking cube if need-be, add bandbin group, and update tracking table. Add tracking
286  // group to mosaic cube.
287  if (m_trackingEnabled) {
288  TrackingTable *trackingTable;
289 
290  if (!m_trackingCube) {
291  m_trackingCube = new Cube;
292 
293  // A new mosaic cube is being created
294  if (m_createOutputMosaic) {
295 
296  // Tracking cubes are always unsigned 4 byte integer
297  m_trackingCube->setPixelType(PixelType::UnsignedInteger);
298 
299  // Tracking cube has the same number of lines and samples as the mosaic and 1 band
300  m_trackingCube->setDimensions(OutputCubes[0]->sampleCount(),
301  OutputCubes[0]->lineCount(),
302  1);
303 
304  // The tracking cube file name convention is "output_cube_file_name" + "_tracking.cub"
305  QString trackingBase = FileName(OutputCubes[0]->fileName()).removeExtension().expanded().split("/").last();//toString();
306  m_trackingCube->create(FileName(OutputCubes[0]->fileName()).path()
307  + "/" + trackingBase + "_tracking.cub");
308 
309  // Add the tracking group to the mosaic cube label
310  Pvl *mosaicLabel = OutputCubes[0]->label();
311  PvlGroup trackingFileGroup("Tracking");
312  PvlKeyword trackingFileName("FileName");
313  trackingFileName.setValue(trackingBase + "_tracking.cub");
314  trackingFileGroup.addKeyword(trackingFileName);
315  mosaicLabel->findObject("IsisCube").addGroup(trackingFileGroup);
316 
317  // Write the bandbin group to the tracking cube label
318  Pvl *trackingLabel = m_trackingCube->label();
319  PvlGroup bandBin("BandBin");
320  PvlKeyword trackBand("FilterName");
321  trackBand += "TRACKING";
322  bandBin.addKeyword(trackBand);
323  trackingLabel->findObject("IsisCube").addGroup(bandBin);
324 
325  // Initialize an empty TrackingTable object to manage tracking table in tracking cube
326  trackingTable = new TrackingTable();
327  }
328 
329  // An existing mosaic cube is being added to
330  else {
331  // Confirm tracking group exists in mosaic cube to address backwards compatibility
332  if ( OutputCubes[0]->hasGroup("Tracking") ) {
333  QString trackingPath = FileName(OutputCubes[0]->fileName()).path();
334  QString trackingFile = OutputCubes[0]->group("Tracking").findKeyword("FileName")[0];
335  m_trackingCube->open(trackingPath + "/" + trackingFile, "rw");
336 
337  // Initialize a TrackingTable object from current mosaic
338  Table *table;
339  try {
340  table = new Table(TRACKING_TABLE_NAME, m_trackingCube->fileName());
341  trackingTable = new TrackingTable(*table);
342  }
343  catch (IException &e) {
344  QString msg = "Unable to find Tracking Table in " + m_trackingCube->fileName() + ".";
345  throw IException(IException::User, msg, _FILEINFO_);
346  }
347  }
348  // If no tracking group exists in mosaic cube, warn user to run utility application to
349  // add it and create a separate tracking cube
350  else {
351  QString msg = "Tracking cannot be enabled when adding to an existing mosaic "
352  "that does not already have a tracking cube. Mosaics with a tracking band must "
353  "have the tracking band extracted into an external tracking cube.";
354  throw IException(IException::User, msg, _FILEINFO_);
355  }
356  }
357 
358  // Add current file to the TrackingTable object
359  iIndex = trackingTable->fileNameToPixel(InputCubes[0]->fileName(),
360  SerialNumber::Compose(*(InputCubes[0])));
361 
362  // Write the tracking table to the tracking cube, overwriting if need-be
363  if (m_trackingCube->hasTable(Isis::trackingTableName)) {
364  m_trackingCube->deleteBlob("Table", Isis::trackingTableName);
365  }
366  Table table = trackingTable->toTable();
367  m_trackingCube->write(table);
368  }
369 
370  }
371  else if (m_imageOverlay == AverageImageWithMosaic && m_createOutputMosaic) {
372  ResetCountBands();
373  }
374 
375  m_onb = OutputCubes[0]->bandCount();
376 
377  if (m_trackingEnabled) {
378 
379  // For mosaic creation, the input is copied onto mosaic by default
380  if (m_imageOverlay == UseBandPlacementCriteria && !m_createOutputMosaic) {
381  BandComparison(iss, isl, ins, inl,
382  bandPriorityInputBandNumber, bandPriorityOutputBandNumber, iIndex);
383  }
384  }
385  else if (m_imageOverlay == AverageImageWithMosaic) {
386  m_onb /= 2;
387  if (m_onb < 1) {
388  QString msg = "The mosaic cube needs a count band.";
389  throw IException(IException::Unknown, msg, _FILEINFO_);
390  }
391  }
392 
393  // Process Band Priority with no tracking
394  if (m_imageOverlay == UseBandPlacementCriteria && !m_trackingEnabled ) {
395  BandPriorityWithNoTracking(iss, isl, isb, ins, inl, inb, bandPriorityInputBandNumber,
396  bandPriorityOutputBandNumber);
397  }
398  else {
399  // Create portal buffers for the input and output files
400  Portal iPortal(ins, 1, InputCubes[0]->pixelType());
401  Portal oPortal(ins, 1, OutputCubes[0]->pixelType());
402  Portal countPortal(ins, 1, OutputCubes[0]->pixelType());
403  Portal trackingPortal(ins, 1, PixelType::UnsignedInteger);
404 
405  for (int ib = isb, ob = m_osb; ib < (isb + inb) && ob <= m_onb; ib++, ob++) {
406  for (int il = isl, ol = m_osl; il < isl + inl; il++, ol++) {
407  // Set the position of the portals in the input and output cubes
408  iPortal.SetPosition(iss, il, ib);
409  InputCubes[0]->read(iPortal);
410 
411  oPortal.SetPosition(m_oss, ol, ob);
412  OutputCubes[0]->read(oPortal);
413 
414  if (m_trackingEnabled) {
415  trackingPortal.SetPosition(m_oss, ol, 1);
416  m_trackingCube->read(trackingPortal);
417  }
418  else if (m_imageOverlay == AverageImageWithMosaic) {
419  countPortal.SetPosition(m_oss, ol, (ob+m_onb));
420  OutputCubes[0]->read(countPortal);
421  }
422 
423  bool bChanged = false;
424  // Move the input data to the output
425  for (int pixel = 0; pixel < oPortal.size(); pixel++) {
426  // Creating Mosaic, copy the input onto mosaic
427  // regardless of the priority
428  if (m_createOutputMosaic) {
429  oPortal[pixel] = iPortal[pixel];
430  if (m_trackingEnabled) {
431  trackingPortal[pixel] = iIndex;
432  bChanged = true;
433  }
434  else if (m_imageOverlay == AverageImageWithMosaic) {
435  if (IsValidPixel(iPortal[pixel])) {
436  countPortal[pixel]=1;
437  bChanged = true;
438  }
439  }
440  }
441  // Band Priority
442  else if (m_trackingEnabled && m_imageOverlay == UseBandPlacementCriteria) {
443  int iPixelOrigin = qRound(trackingPortal[pixel]);
444 
445  Portal iComparePortal( ins, 1, InputCubes[0]->pixelType() );
446  Portal oComparePortal( ins, 1, OutputCubes[0]->pixelType() );
447  iComparePortal.SetPosition(iss, il, bandPriorityInputBandNumber);
448  InputCubes[0]->read(iComparePortal);
449  oComparePortal.SetPosition(m_oss, ol, bandPriorityOutputBandNumber);
450  OutputCubes[0]->read(oComparePortal);
451 
452  if (iPixelOrigin == iIndex) {
453  if ( ( IsValidPixel(iComparePortal[pixel]) &&
454  IsValidPixel(oComparePortal[pixel]) ) &&
455  ( (!m_bandPriorityUseMaxValue &&
456  iComparePortal[pixel] < oComparePortal[pixel]) ||
457  (m_bandPriorityUseMaxValue &&
458  iComparePortal[pixel] > oComparePortal[pixel]) ) ) {
459 
460  if ( IsValidPixel(iPortal[pixel]) ||
461  ( m_placeHighSatPixels && IsHighPixel(iPortal[pixel]) ) ||
462  ( m_placeLowSatPixels && IsLowPixel (iPortal[pixel]) ) ||
463  ( m_placeNullPixels && IsNullPixel(iPortal[pixel]) ) ){
464  oPortal[pixel] = iPortal[pixel];
465  bChanged = true;
466  }
467  }
468  else { //bad comparison
469  if ( ( IsValidPixel(iPortal[pixel]) && !IsValidPixel(oPortal[pixel]) ) ||
470  ( m_placeHighSatPixels && IsHighPixel(iPortal[pixel]) ) ||
471  ( m_placeLowSatPixels && IsLowPixel (iPortal[pixel]) ) ||
472  ( m_placeNullPixels && IsNullPixel(iPortal[pixel]) ) ) {
473  oPortal[pixel] = iPortal[pixel];
474  bChanged = true;
475  }
476  }
477  }
478  }
479  // OnTop/Input Priority
480  else if (m_imageOverlay == PlaceImagesOnTop) {
481  if (IsNullPixel(oPortal[pixel]) ||
482  IsValidPixel(iPortal[pixel]) ||
483  (m_placeHighSatPixels && IsHighPixel(iPortal[pixel])) ||
484  (m_placeLowSatPixels && IsLowPixel(iPortal[pixel])) ||
485  (m_placeNullPixels && IsNullPixel(iPortal[pixel]))) {
486  oPortal[pixel] = iPortal[pixel];
487  if (m_trackingEnabled) {
488  trackingPortal[pixel] = iIndex;
489  bChanged = true;
490  }
491  }
492  }
493  // AverageImageWithMosaic priority
494  else if (m_imageOverlay == AverageImageWithMosaic) {
495  bChanged |= ProcessAveragePriority(pixel, iPortal, oPortal, countPortal);
496  }
497  // Beneath/Mosaic Priority
498  else if (m_imageOverlay == PlaceImagesBeneath) {
499  if (IsNullPixel(oPortal[pixel])) {
500  oPortal[pixel] = iPortal[pixel];
501  // Set the origin if number of input bands equal to 1
502  // and if the track flag was set
503  if (m_trackingEnabled) {
504  trackingPortal[pixel] = iIndex;
505  bChanged = true;
506  }
507  }
508  }
509  } // End sample loop
510  if (bChanged) {
511  if (m_trackingEnabled) {
512  m_trackingCube->write(trackingPortal);
513  }
514  if (m_imageOverlay == AverageImageWithMosaic) {
515  OutputCubes[0]->write(countPortal);
516  }
517  }
518  OutputCubes[0]->write(oPortal);
519  p_progress->CheckStatus();
520  } // End line loop
521  } // End band loop
522  }
523  if (m_trackingCube) {
524  m_trackingCube->close();
525  delete m_trackingCube;
526  m_trackingCube = NULL;
527  }
528  } // End StartProcess
529 
530 
534  void ProcessMosaic::EndProcess() {
535  if (m_trackingCube) {
536  m_trackingCube->close();
537  delete m_trackingCube;
538  m_trackingCube = NULL;
539  }
540  Process::EndProcess();
541  }
542 
543 
549  PvlObject ProcessMosaic::imagePositions() {
550  return m_imagePositions;
551  }
552 
553 
591  Cube *ProcessMosaic::SetInputCube(const QString &parameter,
592  const int ss, const int sl, const int sb,
593  const int ns, const int nl, const int nb) {
594 
595  // Make sure only one input is active at a time
596  if (InputCubes.size() > 0) {
597  QString m = "You must specify exactly one input cube";
598  throw IException(IException::Programmer, m, _FILEINFO_);
599  }
600 
601  m_iss = ss;
602  m_isl = sl;
603  m_isb = sb;
604  m_ins = ns;
605  m_inl = nl;
606  m_inb = nb;
607 
608  Cube *cInCube = Process::SetInputCube(parameter);
609 
610  //get the output label
611  Pvl *cInPvl = InputCubes[0]->label();
612  if (cInPvl->findGroup("Dimensions", Pvl::Traverse).hasKeyword("Bands")) {
613  PvlKeyword &cBandKey = cInPvl->findGroup("Dimensions", Pvl::Traverse).findKeyword("Bands");
614  QString sStr(cBandKey[0]);
615  if (toInt(sStr) < nb) {
616  QString m = "The parameter number of input bands exceeds the actual number of bands in the "
617  "input cube";
618  throw IException(IException::Programmer, m, _FILEINFO_);
619  }
620  }
621  return cInCube;
622  }
623 
624 
661  Cube *ProcessMosaic::SetInputCube(const QString &fname,
662  CubeAttributeInput &att,
663  const int ss, const int sl, const int sb,
664  const int ns, const int nl, const int nb) {
665 
666  // Make sure only one input is active at a time
667  if (InputCubes.size() > 0) {
668  QString m = "You must specify exactly one input cube";
669  throw IException(IException::Programmer, m, _FILEINFO_);
670  }
671 
672  m_iss = ss;
673  m_isl = sl;
674  m_isb = sb;
675  m_ins = ns;
676  m_inl = nl;
677  m_inb = nb;
678 
679  Cube *cInCube = Process::SetInputCube(fname, att);
680 
681  //check if the number of bands specified is not greater than the actual number of bands in the input
682  Pvl *cInPvl = InputCubes[0]->label();
683  if (cInPvl->findGroup("Dimensions", Pvl::Traverse).hasKeyword("Bands")) {
684  PvlKeyword &cBandKey = cInPvl->findGroup("Dimensions", Pvl::Traverse).findKeyword("Bands");
685  QString sStr(cBandKey[0]);
686  if (toInt(sStr) < nb) {
687  QString m = "The parameter number of input bands exceeds the actual number of bands in the input cube";
688  throw IException(IException::Programmer, m, _FILEINFO_);
689  }
690  }
691  return cInCube;
692  }
693 
694 
709  Cube *ProcessMosaic::SetOutputCube(const QString &psParameter) {
710 
711  // Make sure there is only one output cube
712  if (OutputCubes.size() > 0) {
713  QString m = "You must specify exactly one output cube";
714  throw IException(IException::Programmer, m, _FILEINFO_);
715  }
716 
717  // Attempt to open a cube ... get the filename from the user parameter
718  // (e.g., "TO") and the cube size from an input cube
719  Cube *cube = new Cube;
720  try {
721  QString fname = Application::GetUserInterface().GetFileName(psParameter);
722  cube->open(fname, "rw");
723  }
724  catch (IException &) {
725  delete cube;
726  throw;
727  }
728 
729  if (m_createOutputMosaic) {
730  Pvl *outLab = cube->label();
731  if (outLab->findObject("IsisCube").hasGroup("BandBin")) {
732  outLab->findObject("IsisCube").deleteGroup("BandBin");
733  }
734  }
735 
736  // Everything is fine so save the cube on the stack
737  AddOutputCube(cube);
738  return cube;
739  }
740 
741 
745  void ProcessMosaic::SetBandBinMatch(bool enforceBandBinMatch) {
746  m_enforceBandBinMatch = enforceBandBinMatch;
747  }
748 
749 
753  void ProcessMosaic::SetBandKeyword(QString bandPriorityKeyName, QString bandPriorityKeyValue) {
754  m_bandPriorityKeyName = bandPriorityKeyName;
755  m_bandPriorityKeyValue = bandPriorityKeyValue;
756  }
757 
758 
762  void ProcessMosaic::SetBandNumber(int bandPriorityBandNumber) {
763  m_bandPriorityBandNumber = bandPriorityBandNumber;
764  }
765 
766 
771  void ProcessMosaic::SetBandUseMaxValue(bool useMax) {
772  m_bandPriorityUseMaxValue = useMax;
773  }
774 
775 
784  void ProcessMosaic::SetCreateFlag(bool createOutputMosaic) {
785  m_createOutputMosaic = createOutputMosaic;
786  }
787 
788 
793  void ProcessMosaic::SetHighSaturationFlag(bool placeHighSatPixels) {
794  m_placeHighSatPixels = placeHighSatPixels;
795  }
796 
797 
798  void ProcessMosaic::SetImageOverlay(ImageOverlay placement) {
799  m_imageOverlay = placement;
800  }
801 
802 
807  void ProcessMosaic::SetLowSaturationFlag(bool placeLowSatPixels) {
808  m_placeLowSatPixels = placeLowSatPixels;
809  }
810 
815  void ProcessMosaic::SetMatchDEM(bool matchDEM) {
816  m_enforceMatchDEM = matchDEM;
817  }
818 
819 
824  void ProcessMosaic::SetNullFlag(bool placeNullPixels) {
825  m_placeNullPixels = placeNullPixels;
826  }
827 
828 
829  void ProcessMosaic::SetTrackFlag(bool trackingEnabled) {
830  m_trackingEnabled = trackingEnabled;
831  }
832 
833 
837  bool ProcessMosaic::GetHighSaturationFlag() const {
838  return m_placeHighSatPixels;
839  }
840 
841 
845  ProcessMosaic::ImageOverlay ProcessMosaic::GetImageOverlay() const {
846  return m_imageOverlay;
847  }
848 
849 
853  bool ProcessMosaic::GetLowSaturationFlag() const {
854  return m_placeLowSatPixels;
855  }
856 
857 
861  bool ProcessMosaic::GetNullFlag() const {
862  return m_placeNullPixels;
863  }
864 
865 
869  bool ProcessMosaic::GetTrackFlag() const {
870  return m_trackingEnabled;
871  }
872 
873 
877  int ProcessMosaic::GetInputStartLineInMosaic() const {
878  return m_osl;
879  }
880 
881 
885  int ProcessMosaic::GetInputStartSampleInMosaic() const {
886  return m_oss;
887  }
888 
889 
893  int ProcessMosaic::GetInputStartBandInMosaic() const {
894  return m_osb;
895  }
896 
897 
902  QString ProcessMosaic::OverlayToString(ImageOverlay imageOverlay) {
903  QString result;
904 
905  switch (imageOverlay) {
906  case PlaceImagesOnTop:
907  result = "OnTop";
908  break;
909 
910  case PlaceImagesBeneath:
911  result = "Beneath";
912  break;
913 
914  case UseBandPlacementCriteria:
915  result = "Band";
916  break;
917 
918  case AverageImageWithMosaic:
919  result = "Average";
920  break;
921 
922  case NumImageOverlayOptions:
923  break;
924  }
925 
926  if (result == "") {
927  throw IException(IException::Unknown,
928  "Cannot convert overlay [" + toString((int)imageOverlay) + "] to a string",
929  _FILEINFO_);
930  }
931 
932  return result;
933  }
934 
935 
940  ProcessMosaic::ImageOverlay ProcessMosaic::StringToOverlay(QString imageOverlayString) {
941  QString imageOverlayStringUpper = imageOverlayString.toUpper();
942  for (int i = 0; i < NumImageOverlayOptions; i++) {
943  if (OverlayToString((ImageOverlay)i).toUpper() == imageOverlayStringUpper)
944  return (ImageOverlay)i;
945  }
946 
947  throw IException(IException::Unknown,
948  "The text [" + imageOverlayString + "] does not correspond to any known "
949  "image overlay modes (mosaic priorities)",
950  _FILEINFO_);
951  }
952 
953 
961  void ProcessMosaic::MatchDEMShapeModel() {
962  Pvl* inLabel = InputCubes[0]->label();
963  Pvl* outLabel = OutputCubes[0]->label();
964 
965  if (outLabel->findObject("IsisCube").hasGroup("Mosaic")) {
966  PvlGroup outMosaicGrp = outLabel->findObject("IsisCube").findGroup("Mosaic");
967  if (outMosaicGrp.hasKeyword("ShapeModel")) {
968  if (inLabel->findObject("IsisCube").hasGroup("Kernels")) {
969  PvlGroup inMosaicGrp = inLabel->findObject("IsisCube").findGroup("Kernels");
970  if (outMosaicGrp.hasKeyword("ShapeModel") && inMosaicGrp.hasKeyword("ShapeModel")) {
971  PvlKeyword outShapeModelKey = outMosaicGrp.findKeyword("ShapeModel");
972  QString sShapeModel = inMosaicGrp.findKeyword("ShapeModel")[0];
973  int found = sShapeModel.lastIndexOf("/");
974  if (found != -1) {
975  sShapeModel.remove(0, found + 1);
976  }
977  if (sShapeModel == outShapeModelKey[0]) {
978  return;
979  }
980  }
981  }
982  QString sErrMsg = "Input and Mosaic DEM Shape Model do not match";
983  throw IException(IException::User, sErrMsg, _FILEINFO_);
984  }
985  }
986  else {
987  if (m_createOutputMosaic) {
988  if (inLabel->findObject("IsisCube").hasGroup("Kernels")) {
989  QString sShapeModel =
990  inLabel->findObject("IsisCube").findGroup("Kernels").findKeyword("ShapeModel")[0];
991  int found = sShapeModel.lastIndexOf("/");
992  if (found != -1){
993  sShapeModel.remove(0, found+1);
994  }
995  PvlObject & outIsisCubeObj = outLabel->findObject("IsisCube");
996  PvlGroup mosaicGrp("Mosaic");
997  PvlKeyword shapeModelKey("ShapeModel");
998  shapeModelKey += sShapeModel;
999  mosaicGrp += shapeModelKey;
1000  outIsisCubeObj += mosaicGrp;
1001  }
1002  }
1003  }
1004  }
1005 
1006 
1012  void ProcessMosaic::ResetCountBands()
1013  {
1014  int iBand = OutputCubes[0]->bandCount();
1015  int iLines = OutputCubes[0]->lineCount();
1016  int iSample = OutputCubes[0]->sampleCount();
1017 
1018  Portal countPortal(iSample, 1, OutputCubes[0]->pixelType());
1019  int iStartCountBand = iBand/2 + 1;
1020 
1021  for (int band=iStartCountBand; band<=iBand; band++) {
1022  for (int i = 1; i <= iLines; i++) {
1023  countPortal.SetPosition(1, i, band); //sample, line, band position
1024  OutputCubes[0]->read(countPortal);
1025  for (int iPixel = 0; iPixel < countPortal.size(); iPixel++) {
1026  countPortal[iPixel] = 0;
1027  }
1028  OutputCubes[0]->write(countPortal);
1029  }
1030  }
1031  }
1032 
1033 
1047  bool ProcessMosaic::ProcessAveragePriority(int piPixel, Portal& piPortal, Portal& poPortal,
1048  Portal& countPortal)
1049  {
1050  bool bChanged=false;
1051  if (IsValidPixel(piPortal[piPixel]) && IsValidPixel(poPortal[piPixel])) {
1052  int iCount = (int)countPortal[piPixel];
1053  double dNewDN = (poPortal[piPixel] * iCount + piPortal[piPixel]) / (iCount + 1);
1054  poPortal[piPixel] = dNewDN;
1055  countPortal[piPixel] =iCount +1;
1056  bChanged = true;
1057  }
1058  // Input-Valid, Mosaic-Special
1059  else if (IsValidPixel(piPortal[piPixel])) {
1060  poPortal[piPixel] = piPortal[piPixel];
1061  countPortal[piPixel] = 1;
1062  bChanged = true;
1063  }
1064  // Input-Special, Flags-True
1065  else if (IsSpecial(piPortal[piPixel])) {
1066  if ((m_placeHighSatPixels && IsHighPixel(piPortal[piPixel])) ||
1067  (m_placeLowSatPixels && IsLowPixel (piPortal[piPixel])) ||
1068  (m_placeNullPixels && IsNullPixel(piPortal[piPixel]))) {
1069  poPortal[piPixel] = piPortal[piPixel];
1070  countPortal[piPixel] = 0;
1071  bChanged = true;
1072  }
1073  }
1074  return bChanged;
1075  }
1076 
1077 
1089  void ProcessMosaic::MatchBandBinGroup(int origIsb, int &inb) {
1090  Pvl *inLab = InputCubes[0]->label();
1091  Pvl *outLab = OutputCubes[0]->label();
1092 
1093  PvlGroup &inBin = inLab->findGroup("BandBin", Pvl::Traverse);
1094  PvlGroup &outBin = outLab->findGroup("BandBin", Pvl::Traverse);
1095  if (inBin.keywords() != outBin.keywords()) {
1096  QString msg = "Pvl Group [BandBin] does not match between the input and output cubes";
1097  throw IException(IException::User, msg, _FILEINFO_);
1098  }
1099 
1100  //pvl - zero based
1101  int isb = (origIsb - 1);
1102  int osb = (m_osb - 1);
1103  int iOutBandsHalf = OutputCubes[0]->bandCount()/2;
1104 
1105  for (int i = 0; i < outBin.keywords(); i++) {
1106  PvlKeyword &outKey = outBin[i];
1107  QString sOutName = outKey.name();
1108  if (inBin.hasKeyword(sOutName)) {
1109  PvlKeyword &inKey = inBin[sOutName];
1110  for (int j = osb, k = isb; j < outKey.size() && k < inKey.size(); j++, k++) {
1111  if (outKey[j] == "NA") {
1112  outKey[j] = inKey[k];
1113  if (m_imageOverlay == AverageImageWithMosaic) {
1114  if (sOutName.contains("Filter") ||
1115  sOutName.contains("Name")) {
1116  outKey[j+iOutBandsHalf] = inKey[k] + "_Count";
1117  }
1118  else {
1119  outKey[j+iOutBandsHalf] = "Avg_Count";
1120  }
1121  }
1122  }
1123  else if (outKey[j] != inKey[k]) {
1124  QString msg = "The input cube [" + inLab->fileName() + "] and the base mosaic values "
1125  "of the Pvl Group [BandBin] for Keyword [" + outKey.name() + "] do not "
1126  "match. Base mosaic value at index [" + QString::number(j) + "] = " +
1127  outKey[j] + ". Input cube value at index [" + QString::number(k) + "] = "
1128  + inKey[k] + ". **Note: use mapmos/automos MatchBandBin = false to "
1129  "override this check**";
1130  //QString msg = "Pvl Group [BandBin] in Key[" + outKey.name() + "] In value" + inKey[k] +
1131  //"and Out value=" + outKey[j] + " do not match";
1132  throw IException(IException::User, msg, _FILEINFO_);
1133  }
1134  }
1135  }
1136  else {
1137  QString msg = "Pvl Group [BandBin] In Keyword[" + inBin[i].name() + "] and Out Keyword[" +
1138  outBin[i].name() + "] does not match";
1139  throw IException(IException::User, msg, _FILEINFO_);
1140  }
1141  }
1142 
1143  int inputRange = InputCubes[0]->bandCount() - isb;
1144  int outputRange = OutputCubes[0]->bandCount() - osb;
1145  inb = min(inputRange, outputRange);
1146  }
1147 
1148 
1160  void ProcessMosaic::AddBandBinGroup(int origIsb) {
1161  Pvl *inLab = InputCubes[0]->label();
1162  Pvl *outLab = OutputCubes[0]->label();
1163 
1164  int iOutBands = OutputCubes[0]->bandCount();
1165 
1166  // else if (m_imageOverlay == AverageImageWithMosaic) {
1167  if (m_imageOverlay == AverageImageWithMosaic) {
1168  iOutBands /= 2;
1169  }
1170 
1171  int isb = origIsb - 1; // array zero based
1172  int osb = m_osb - 1;
1173 
1174  PvlGroup &cInBin = inLab->findGroup("BandBin", Pvl::Traverse);
1175  PvlGroup cOutBin("BandBin");
1176 
1177  for (int i = 0; i < cInBin.keywords(); i++) {
1178  PvlKeyword &cInKey = cInBin[i];
1179  int iInKeySize = cInKey.size();
1180  PvlKeyword cOutKey(cInKey.name());
1181 
1182  for (int b = 0; b < osb; b++) {
1183  cOutKey += "NA";
1184  }
1185  for (int b = osb; b < iOutBands; b++) {
1186  if (isb < iInKeySize) {
1187  cOutKey += cInKey[isb++];
1188  }
1189  else {
1190  cOutKey += "NA";
1191  }
1192  }
1193 
1194  // Tag the Count Bands if priority is AverageImageWithMosaic.
1195  if (m_imageOverlay == AverageImageWithMosaic) {
1196 
1197  int iTotalOutBands = OutputCubes[0]->bandCount();
1198  isb = origIsb - 1; // reset the input starting band
1199  int iOutStartBand = iOutBands + osb;
1200  QString sKeyName = cInKey.name();
1201  bool bFilterKey = false;
1202  if (sKeyName.contains("Filter") ||
1203  sKeyName.contains("Original") ||
1204  sKeyName.contains("Name")) {
1205  bFilterKey = true;
1206  }
1207  for (int ob=iOutBands; ob<iTotalOutBands; ob++) {
1208  if (isb < iInKeySize && ob >= iOutStartBand) {
1209  if (bFilterKey) {
1210  cOutKey += cInKey[isb++] + "_Count";
1211  }
1212  else {
1213  cOutKey += 0;
1214  isb++;
1215  }
1216  }
1217  else {
1218  cOutKey += 0;
1219  }
1220  }
1221  }
1222 
1223  // Check for units and make sure output keyword units value is set to input
1224  // keyword units value
1225  if (cOutKey.unit() != cInKey.unit()) {
1226  cOutKey.setUnits((QString)(cInKey.unit()));
1227  }
1228 
1229  cOutBin += cOutKey;
1230  isb = origIsb - 1; // reinitialize the input starting band
1231  }
1232  outLab->findObject("IsisCube").addGroup(cOutBin);
1233  }
1234 
1235 
1245  void ProcessMosaic::AddDefaultBandBinGroup() {
1246  Pvl *outLab = OutputCubes[0]->label();
1247 
1248  PvlGroup cOutBin("BandBin");
1249 
1250  int iOutBands = OutputCubes[0]->bandCount();
1251  int iOutBandsTotal = iOutBands;
1252 
1253  if (m_trackingEnabled) {
1254  iOutBands--; // Leave tracking band
1255  }
1256  else if (m_imageOverlay == AverageImageWithMosaic) {
1257  iOutBands /= 2;
1258  }
1259 
1260  PvlKeyword cOutKey("FilterName");
1261 
1262  for (int i=0; i<iOutBands; i++) {
1263  cOutKey += "NA";
1264  }
1265 
1266  if (m_imageOverlay == AverageImageWithMosaic) {
1267  for (int i=iOutBands; i<iOutBandsTotal; i++) {
1268  cOutKey += "NA_Count";
1269  }
1270  }
1271 
1272  if (m_trackingEnabled) {
1273  cOutKey += "TRACKING";
1274  }
1275 
1276  cOutBin += cOutKey;
1277 
1278  outLab->findObject("IsisCube").addGroup(cOutBin);
1279  }
1280 
1281 
1285  int ProcessMosaic::GetBandIndex(bool inputFile) {
1286  bool bFound = false;
1287  int iBandIndex = 0;
1288 
1289  Pvl cPvlLabel;
1290 
1291  if (inputFile) {
1292  cPvlLabel = *(InputCubes[0]->label());
1293  if (m_bandPriorityBandNumber <= InputCubes[0]->bandCount() &&
1294  m_bandPriorityBandNumber > 0) {
1295  iBandIndex = m_bandPriorityBandNumber;
1296  bFound = true;
1297  }
1298  }
1299  else {
1300  cPvlLabel = *(OutputCubes[0]->label());
1301  if (m_bandPriorityBandNumber <= OutputCubes[0]->bandCount() &&
1302  m_bandPriorityBandNumber > 0) {
1303  iBandIndex = m_bandPriorityBandNumber;
1304  bFound = true;
1305  }
1306  }
1307 
1308  //key name
1309  if (!m_bandPriorityBandNumber) {
1310  PvlKeyword cKeyName;
1311  if (cPvlLabel.findGroup("BandBin", Pvl::Traverse).hasKeyword(m_bandPriorityKeyName)) {
1312  cKeyName = cPvlLabel.findGroup("BandBin", Pvl::Traverse).findKeyword(m_bandPriorityKeyName);
1313  }
1314  int iSize = cKeyName.size();
1315  for (int i = 0; i < iSize; i++) {
1316  if (m_bandPriorityKeyValue.toUpper() == cKeyName[i].toUpper()) {
1317  iBandIndex = i + 1; //1 based get key value index
1318  bFound = true;
1319  break;
1320  }
1321  }
1322  }
1323  if (!bFound) {
1324  QString msg = "Invalid Band / Key Name, Value ";
1325  throw IException(IException::User, msg, _FILEINFO_);
1326  }
1327  return iBandIndex;
1328  }
1329 
1330 
1348  void ProcessMosaic::BandComparison(int iss, int isl, int ins, int inl,
1349  int bandPriorityInputBandNumber, int bandPriorityOutputBandNumber, int index) {
1350  //
1351  // Create portal buffers for the input and output files
1352  Portal cIportal(ins, 1, InputCubes[0]->pixelType());
1353  Portal cOportal(ins, 1, OutputCubes[0]->pixelType());
1354  Portal trackingPortal(ins, 1, PixelType::UnsignedInteger);
1355 
1356  for (int iIL = isl, iOL = m_osl; iIL < isl + inl; iIL++, iOL++) {
1357  // Set the position of the portals in the input and output cubes
1358  cIportal.SetPosition(iss, iIL, bandPriorityInputBandNumber);
1359  InputCubes[0]->read(cIportal);
1360 
1361  cOportal.SetPosition(m_oss, iOL, bandPriorityOutputBandNumber);
1362  OutputCubes[0]->read(cOportal);
1363 
1364  trackingPortal.SetPosition(m_oss, iOL, 1);
1365  m_trackingCube->read(trackingPortal);
1366 
1367  // Move the input data to the output
1368  for (int iPixel = 0; iPixel < cOportal.size(); iPixel++) {
1369  if ((m_placeHighSatPixels && IsHighPixel(cIportal[iPixel])) ||
1370  (m_placeLowSatPixels && IsLowPixel(cIportal[iPixel])) ||
1371  (m_placeNullPixels && IsNullPixel(cIportal[iPixel]))) {
1372  trackingPortal[iPixel] = index;
1373  }
1374  else {
1375  if (IsValidPixel(cIportal[iPixel])) {
1376  if (IsSpecial(cOportal[iPixel]) ||
1377  (m_bandPriorityUseMaxValue == false && cIportal[iPixel] < cOportal[iPixel]) ||
1378  (m_bandPriorityUseMaxValue == true && cIportal[iPixel] > cOportal[iPixel])) {
1379  trackingPortal[iPixel] = index;
1380  }
1381  }
1382  }
1383  }
1384  m_trackingCube->write(trackingPortal);
1385  }
1386  }
1387 
1388 
1394 void ProcessMosaic::BandPriorityWithNoTracking(int iss, int isl, int isb, int ins, int inl,
1395  int inb, int bandPriorityInputBandNumber,
1396  int bandPriorityOutputBandNumber) {
1397  /*
1398  * specified band for comparison
1399  * Create portal buffers for the input and output files pointing to the
1400  */
1401  Portal iComparePortal( ins, 1, InputCubes[0]->pixelType() );
1402  Portal oComparePortal( ins, 1, OutputCubes[0]->pixelType() );
1403  Portal resultsPortal ( ins, 1, OutputCubes[0]->pixelType() );
1404 
1405  // Create portal buffers for the input and output files
1406  Portal iPortal( ins, 1, InputCubes[0]->pixelType() );
1407  Portal oPortal( ins, 1, OutputCubes[0]->pixelType() );
1408 
1409  for (int inLine = isl, outLine = m_osl; inLine < isl + inl; inLine++, outLine++) {
1410 // Set the position of the portals in the input and output cubes
1411  iComparePortal.SetPosition(iss, inLine, bandPriorityInputBandNumber);
1412  InputCubes[0]->read(iComparePortal);
1413 
1414  oComparePortal.SetPosition(m_oss, outLine, bandPriorityOutputBandNumber);
1415  OutputCubes[0]->read(oComparePortal);
1416 
1417  Portal iPortal( ins, 1, InputCubes[0]->pixelType() );
1418  Portal oPortal( ins, 1, OutputCubes[0]->pixelType() );
1419 
1420  bool inCopy = false;
1421 // Move the input data to the output
1422  for (int iPixel = 0; iPixel < ins; iPixel++) {
1423  resultsPortal[iPixel] = false;
1424  if (m_createOutputMosaic) {
1425  resultsPortal[iPixel] = true;
1426  inCopy = true;
1427  }
1428  else if ( IsValidPixel(iComparePortal[iPixel]) && IsValidPixel(oComparePortal[iPixel]) ) {
1429  if ( (m_bandPriorityUseMaxValue == false &&
1430  iComparePortal[iPixel] < oComparePortal[iPixel]) ||
1431  (m_bandPriorityUseMaxValue == true &&
1432  iComparePortal[iPixel] > oComparePortal[iPixel]) ) {
1433  resultsPortal[iPixel] = true;
1434  inCopy = true;
1435  }
1436  }
1437  else if (IsValidPixel(iComparePortal[iPixel]) && !IsValidPixel(oComparePortal[iPixel]) ) {
1438  resultsPortal[iPixel] = true;
1439  inCopy = true;
1440  }
1441  }
1442  if (inCopy) {
1443  for (int ib = isb, ob = m_osb; ib < (isb + inb) && ob <= m_onb; ib++, ob++) {
1444 // Set the position of the portals in the input and output cubes
1445  iPortal.SetPosition(iss, inLine, ib);
1446  InputCubes[0]->read(iPortal);
1447 
1448  oPortal.SetPosition(m_oss, outLine, ob);
1449  OutputCubes[0]->read(oPortal);
1450 
1451  for (int iPixel = 0; iPixel < ins; iPixel++) {
1452  if (resultsPortal[iPixel]) {
1453  if (m_createOutputMosaic) {
1454  oPortal[iPixel] = iPortal[iPixel];
1455  }
1456  else if ( IsValidPixel(iPortal[iPixel]) ||
1457  (m_placeHighSatPixels && IsHighPixel(iPortal[iPixel]) ) ||
1458  (m_placeLowSatPixels && IsLowPixel (iPortal[iPixel]) ) ||
1459  (m_placeNullPixels && IsNullPixel(iPortal[iPixel]) ) ) {
1460  oPortal[iPixel] = iPortal[iPixel];
1461  }
1462  }
1463  else if ( IsValidPixel(iPortal[iPixel]) && !IsValidPixel(oPortal[iPixel]) ) {
1464  oPortal[iPixel] = iPortal[iPixel];
1465  }
1466  }
1467  OutputCubes[0]->write(oPortal);
1468  }
1469  }
1470  }
1471  }
1472 
1473 
1486  int ProcessMosaic::GetOriginDefaultByPixelType() {
1487  int iDefault;
1488 
1489  switch (SizeOf(OutputCubes[0]->pixelType())) {
1490  case 1:
1491  iDefault = NULL1;
1492  break;
1493 
1494  case 2:
1495  iDefault = NULL2;
1496  break;
1497 
1498  case 4:
1499  iDefault = INULL4;
1500  break;
1501 
1502  default:
1503  QString msg = "ProcessMosaic::GetOriginDefaultByPixelType - Invalid Pixel Type";
1504  throw IException(IException::Programmer, msg, _FILEINFO_);
1505  }
1506 
1507  return iDefault;
1508  }
1509 
1510 
1520  bool ProcessMosaic::GetTrackStatus() {
1521  //get the output label
1522  Pvl *cPvlOut = OutputCubes[0]->label();
1523 
1524  bool bGroupExists = false;
1525  PvlObject cPvlObj;
1526 
1527  //Check if table already exists
1528  if (cPvlOut->hasGroup("Tracking")) {
1529  bGroupExists = true;
1530  }
1531 
1532  return bGroupExists;
1533  }
1534 
1535 }
1536 
Manipulate and parse attributes of input cube filenames.
int keywords() const
Returns the number of keywords contained in the PvlContainer.
Definition: PvlContainer.h:100
QString path() const
Returns the path of the file name.
Definition: FileName.cpp:119
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
QString unit(const int index=0) const
Returns the units of measurement of the element of the array of values for the object at the specifie...
Definition: PvlKeyword.cpp:373
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
File name manipulation and expansion.
Definition: FileName.h:116
Buffer for containing a two dimensional section of an image.
Definition: Portal.h:52
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:286
bool IsLowPixel(const double d)
Returns if the input pixel is one of the low saturation types.
Definition: SpecialPixel.h:274
int SizeOf(Isis::PixelType pixelType)
Returns the number of bytes of the specified PixelType.
Definition: PixelType.h:62
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:108
Namespace for the standard library.
Table toTable()
Constrcts and returns a Table object based on values in m_fileList.
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
Definition: PvlObject.h:222
ImageOverlay
Enumeration for different Mosaic priorities (input, mosaic, band)
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
void addKeyword(const PvlKeyword &keyword, const InsertMode mode=Append)
Add a keyword to the container.
bool IsValidPixel(const double d)
Returns if the input pixel is valid.
Definition: SpecialPixel.h:238
int size() const
Returns the total number of pixels in the shape buffer.
Definition: Buffer.h:113
QString name() const
Returns the container name.
Definition: PvlContainer.h:77
int size() const
Returns the number of values stored in this keyword.
Definition: PvlKeyword.h:141
void setPixelType(PixelType pixelType)
Used prior to the Create method, this will specify the output pixel type.
Definition: Cube.cpp:1019
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
A single keyword-value pair.
Definition: PvlKeyword.h:98
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:212
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:212
void open(const QString &cfile, QString access="r")
This method will open an isis cube for reading or reading/writing.
Definition: Cube.cpp:544
unsigned int fileNameToPixel(FileName file, QString serialNumber)
Returns the pixel value of the filename/serialnumber combination.
Container for cube-like labels.
Definition: Pvl.h:135
void SetPosition(const double sample, const double line, const int band)
Sets the line and sample position of the buffer.
Definition: Portal.h:109
void setUnits(QString units)
Sets the unit of measure for all current values if any exist.
Definition: PvlKeyword.cpp:182
PvlKeyword & findKeyword(const QString &name)
Find a keyword with a specified name.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1346
Class for storing Table blobs information.
Definition: Table.h:77
Table to store tracking information for a mosaic.
Definition: TrackingTable.h:53
bool IsHighPixel(const double d)
Returns if the input pixel is one of the high saturation types.
Definition: SpecialPixel.h:262
QString fileName() const
Returns the filename used to initialise the Pvl object.
Definition: PvlContainer.h:246
QString name() const
Returns the keyword name.
Definition: PvlKeyword.h:114
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
bool IsNullPixel(const double d)
Returns if the input pixel is null.
Definition: SpecialPixel.h:250
void setValue(QString value, QString unit="")
Sets new values.
Definition: PvlKeyword.cpp:171
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
FileName removeExtension() const
Removes all extensions in the file name.
Definition: FileName.cpp:262
IO Handler for Isis Cubes.
Definition: Cube.h:170