9#include "Application.h"
10#include "IException.h"
13#include "ProcessMosaic.h"
15#include "SerialNumber.h"
16#include "SpecialPixel.h"
18#include "TrackingTable.h"
35 SetBandBinMatch(
true);
38 m_trackingEnabled =
false;
40 m_createOutputMosaic =
false;
41 m_bandPriorityBandNumber = 0;
42 m_bandPriorityKeyName =
"";
43 m_bandPriorityKeyValue =
"";
44 m_bandPriorityUseMaxValue =
false;
47 m_placeHighSatPixels =
false;
48 m_placeLowSatPixels =
false;
49 m_placeNullPixels =
false;
109 QString m =
"You must specify exactly one input and one output cube";
110 throw IException(IException::Programmer, m, _FILEINFO_);
113 bool bTrackExists =
false;
114 if (!m_createOutputMosaic) {
116 if (m_trackingEnabled &&
118 QString m =
"Cannot enable tracking while adding to a mosaic without tracking ";
119 m +=
"information. Confirm that your mosaic was originally created with tracking enabled.";
120 throw IException(IException::User, m, _FILEINFO_);
147 iss = iss -
m_oss + 1;
148 ins = ins +
m_oss - 1;
153 isl = isl -
m_osl + 1;
154 inl = inl +
m_osl - 1;
166 PvlGroup imgPosition(
"ImageLocation");
167 imgPosition += PvlKeyword(
"File",
InputCubes[0]->fileName());
173 if ((ins < 1) || (inl < 1)) {
174 QString m =
"The input cube does not overlap the mosaic";
175 throw IException(IException::User, m, _FILEINFO_);
180 isb = isb -
m_osb + 1;
181 inb = inb +
m_osb - 1;
196 if (m_trackingEnabled) {
201 (m_imageOverlay ==
PlaceImagesOnTop && m_placeHighSatPixels && m_placeLowSatPixels &&
202 m_placeNullPixels)) ){
203 QString m =
"Tracking cannot be True for multi-band Mosaic with ontop or beneath priority";
204 throw IException(IException::Programmer, m, _FILEINFO_);
220 if (inLab->findObject(
"IsisCube").hasGroup(
"BandBin")) {
223 if (!m_createOutputMosaic && outLab->findObject(
"IsisCube").hasGroup(
"BandBin")) {
233 QString m =
"Match BandBin cannot be True when the Image does not have the BandBin group";
234 throw IException(IException::Programmer, m, _FILEINFO_);
239 if (m_createOutputMosaic) {
240 if (inLab->findObject(
"IsisCube").hasGroup(
"BandBin")) {
252 m_trackingEnabled =
true;
256 int bandPriorityInputBandNumber = -1;
257 int bandPriorityOutputBandNumber = -1;
264 int iIndex = VALID_MINUI4;
266 if (
OutputCubes[0]->hasGroup(
"Tracking") && !m_createOutputMosaic) {
267 m_trackingEnabled =
true;
272 if (m_trackingEnabled) {
273 TrackingTable *trackingTable;
279 if (m_createOutputMosaic) {
290 QString trackingBase = FileName(
OutputCubes[0]->fileName()).removeExtension().expanded().split(
"/").last();
292 +
"/" + trackingBase +
"_tracking.cub");
296 PvlGroup trackingFileGroup(
"Tracking");
297 PvlKeyword trackingFileName(
"FileName");
298 trackingFileName.setValue(trackingBase +
"_tracking.cub");
299 trackingFileGroup.addKeyword(trackingFileName);
300 mosaicLabel->findObject(
"IsisCube").addGroup(trackingFileGroup);
304 PvlGroup bandBin(
"BandBin");
305 PvlKeyword trackBand(
"FilterName");
306 trackBand +=
"TRACKING";
307 bandBin.addKeyword(trackBand);
308 trackingLabel->findObject(
"IsisCube").addGroup(bandBin);
311 if (inLab->findObject(
"IsisCube").hasGroup(
"Mapping")) {
312 PvlGroup & mappingGroup = inLab->findGroup(
"Mapping", Pvl::Traverse);
313 trackingLabel->findObject(
"IsisCube").addGroup(mappingGroup);
317 trackingTable =
new TrackingTable();
324 QString trackingPath = FileName(
OutputCubes[0]->fileName()).path();
325 QString trackingFile =
OutputCubes[0]->group(
"Tracking").findKeyword(
"FileName")[0];
332 trackingTable =
new TrackingTable(*table);
334 catch (IException &e) {
335 QString msg =
"Unable to find Tracking Table in " +
m_trackingCube->fileName() +
".";
336 throw IException(IException::User, msg, _FILEINFO_);
342 QString msg =
"Tracking cannot be enabled when adding to an existing mosaic "
343 "that does not already have a tracking cube. Mosaics with a tracking band must "
344 "have the tracking band extracted into an external tracking cube.";
345 throw IException(IException::User, msg, _FILEINFO_);
350 iIndex = trackingTable->fileNameToPixel(
InputCubes[0]->fileName(),
355 Table table = trackingTable->toTable();
366 if (m_trackingEnabled) {
371 bandPriorityInputBandNumber, bandPriorityOutputBandNumber, iIndex);
377 QString msg =
"The mosaic cube needs a count band.";
378 throw IException(IException::Unknown, msg, _FILEINFO_);
385 bandPriorityOutputBandNumber);
389 Portal iPortal(ins, 1,
InputCubes[0]->pixelType());
390 Portal oPortal(ins, 1,
OutputCubes[0]->pixelType());
391 Portal countPortal(ins, 1,
OutputCubes[0]->pixelType());
392 Portal trackingPortal(ins, 1, PixelType::UnsignedInteger);
394 for (
int ib = isb, ob =
m_osb; ib < (isb + inb) && ob <=
m_onb; ib++, ob++) {
395 for (
int il = isl, ol =
m_osl; il < isl + inl; il++, ol++) {
397 iPortal.SetPosition(iss, il, ib);
400 oPortal.SetPosition(
m_oss, ol, ob);
403 if (m_trackingEnabled) {
404 trackingPortal.SetPosition(
m_oss, ol, 1);
408 countPortal.SetPosition(
m_oss, ol, (ob+
m_onb));
412 bool bChanged =
false;
414 for (
int pixel = 0; pixel < oPortal.size(); pixel++) {
417 if (m_createOutputMosaic) {
418 oPortal[pixel] = iPortal[pixel];
419 if (m_trackingEnabled) {
420 trackingPortal[pixel] = iIndex;
424 if (IsValidPixel(iPortal[pixel])) {
425 countPortal[pixel]=1;
432 int iPixelOrigin = qRound(trackingPortal[pixel]);
434 Portal iComparePortal( ins, 1,
InputCubes[0]->pixelType() );
435 Portal oComparePortal( ins, 1,
OutputCubes[0]->pixelType() );
436 iComparePortal.SetPosition(iss, il, bandPriorityInputBandNumber);
438 oComparePortal.SetPosition(
m_oss, ol, bandPriorityOutputBandNumber);
441 if (iPixelOrigin == iIndex) {
442 if ( ( IsValidPixel(iComparePortal[pixel]) &&
443 IsValidPixel(oComparePortal[pixel]) ) &&
444 ( (!m_bandPriorityUseMaxValue &&
445 iComparePortal[pixel] < oComparePortal[pixel]) ||
446 (m_bandPriorityUseMaxValue &&
447 iComparePortal[pixel] > oComparePortal[pixel]) ) ) {
449 if ( IsValidPixel(iPortal[pixel]) ||
450 ( m_placeHighSatPixels && IsHighPixel(iPortal[pixel]) ) ||
451 ( m_placeLowSatPixels && IsLowPixel (iPortal[pixel]) ) ||
452 ( m_placeNullPixels && IsNullPixel(iPortal[pixel]) ) ){
453 oPortal[pixel] = iPortal[pixel];
458 if ( ( IsValidPixel(iPortal[pixel]) && !IsValidPixel(oPortal[pixel]) ) ||
459 ( m_placeHighSatPixels && IsHighPixel(iPortal[pixel]) ) ||
460 ( m_placeLowSatPixels && IsLowPixel (iPortal[pixel]) ) ||
461 ( m_placeNullPixels && IsNullPixel(iPortal[pixel]) ) ) {
462 oPortal[pixel] = iPortal[pixel];
470 if (IsNullPixel(oPortal[pixel]) ||
471 IsValidPixel(iPortal[pixel]) ||
472 (m_placeHighSatPixels && IsHighPixel(iPortal[pixel])) ||
473 (m_placeLowSatPixels && IsLowPixel(iPortal[pixel])) ||
474 (m_placeNullPixels && IsNullPixel(iPortal[pixel]))) {
475 oPortal[pixel] = iPortal[pixel];
476 if (m_trackingEnabled) {
477 trackingPortal[pixel] = iIndex;
488 if (IsNullPixel(oPortal[pixel])) {
489 oPortal[pixel] = iPortal[pixel];
492 if (m_trackingEnabled) {
493 trackingPortal[pixel] = iIndex;
500 if (m_trackingEnabled) {
581 const int ss,
const int sl,
const int sb,
582 const int ns,
const int nl,
const int nb) {
586 QString m =
"You must specify exactly one input cube";
587 throw IException(IException::Programmer, m, _FILEINFO_);
601 if (cInPvl->findGroup(
"Dimensions", Pvl::Traverse).hasKeyword(
"Bands")) {
602 PvlKeyword &cBandKey = cInPvl->findGroup(
"Dimensions", Pvl::Traverse).findKeyword(
"Bands");
603 QString sStr(cBandKey[0]);
604 if (toInt(sStr) < nb) {
605 QString m =
"The parameter number of input bands exceeds the actual number of bands in the "
607 throw IException(IException::Programmer, m, _FILEINFO_);
652 const int ss,
const int sl,
const int sb,
653 const int ns,
const int nl,
const int nb) {
657 QString m =
"You must specify exactly one input cube";
658 throw IException(IException::Programmer, m, _FILEINFO_);
672 if (cInPvl->findGroup(
"Dimensions", Pvl::Traverse).hasKeyword(
"Bands")) {
673 PvlKeyword &cBandKey = cInPvl->findGroup(
"Dimensions", Pvl::Traverse).findKeyword(
"Bands");
674 QString sStr(cBandKey[0]);
675 if (toInt(sStr) < nb) {
676 QString m =
"The parameter number of input bands exceeds the actual number of bands in the input cube";
677 throw IException(IException::Programmer, m, _FILEINFO_);
708 QString m =
"You must specify exactly one output cube";
709 throw IException(IException::Programmer, m, _FILEINFO_);
714 Cube *cube =
new Cube;
716 cube->open(fname,
"rw");
718 catch (IException &) {
723 if (m_createOutputMosaic) {
724 Pvl *outLab = cube->label();
725 if (outLab->findObject(
"IsisCube").hasGroup(
"BandBin")) {
726 outLab->findObject(
"IsisCube").deleteGroup(
"BandBin");
739 void ProcessMosaic::SetBandBinMatch(
bool enforceBandBinMatch) {
748 m_bandPriorityKeyName = bandPriorityKeyName;
749 m_bandPriorityKeyValue = bandPriorityKeyValue;
757 m_bandPriorityBandNumber = bandPriorityBandNumber;
766 m_bandPriorityUseMaxValue = useMax;
779 m_createOutputMosaic = createOutputMosaic;
788 m_placeHighSatPixels = placeHighSatPixels;
792 void ProcessMosaic::SetImageOverlay(ImageOverlay placement) {
793 m_imageOverlay = placement;
802 m_placeLowSatPixels = placeLowSatPixels;
819 m_placeNullPixels = placeNullPixels;
823 void ProcessMosaic::SetTrackFlag(
bool trackingEnabled) {
824 m_trackingEnabled = trackingEnabled;
832 return m_placeHighSatPixels;
840 return m_imageOverlay;
848 return m_placeLowSatPixels;
856 return m_placeNullPixels;
864 return m_trackingEnabled;
899 switch (imageOverlay) {
916 case NumImageOverlayOptions:
921 throw IException(IException::Unknown,
922 "Cannot convert overlay [" +
toString((
int)imageOverlay) +
"] to a string",
935 QString imageOverlayStringUpper = imageOverlayString.toUpper();
936 for (
int i = 0; i < NumImageOverlayOptions; i++) {
941 throw IException(IException::Unknown,
942 "The text [" + imageOverlayString +
"] does not correspond to any known "
943 "image overlay modes (mosaic priorities)",
959 if (outLabel->findObject(
"IsisCube").hasGroup(
"Mosaic")) {
960 PvlGroup outMosaicGrp = outLabel->findObject(
"IsisCube").findGroup(
"Mosaic");
961 if (outMosaicGrp.hasKeyword(
"ShapeModel")) {
962 if (inLabel->findObject(
"IsisCube").hasGroup(
"Kernels")) {
963 PvlGroup inMosaicGrp = inLabel->findObject(
"IsisCube").findGroup(
"Kernels");
964 if (outMosaicGrp.hasKeyword(
"ShapeModel") && inMosaicGrp.hasKeyword(
"ShapeModel")) {
965 PvlKeyword outShapeModelKey = outMosaicGrp.findKeyword(
"ShapeModel");
966 QString sShapeModel = inMosaicGrp.findKeyword(
"ShapeModel")[0];
967 int found = sShapeModel.lastIndexOf(
"/");
969 sShapeModel.remove(0, found + 1);
971 if (sShapeModel == outShapeModelKey[0]) {
976 QString sErrMsg =
"Input and Mosaic DEM Shape Model do not match";
977 throw IException(IException::User, sErrMsg, _FILEINFO_);
981 if (m_createOutputMosaic) {
982 if (inLabel->findObject(
"IsisCube").hasGroup(
"Kernels")) {
983 QString sShapeModel =
984 inLabel->findObject(
"IsisCube").findGroup(
"Kernels").findKeyword(
"ShapeModel")[0];
985 int found = sShapeModel.lastIndexOf(
"/");
987 sShapeModel.remove(0, found+1);
989 PvlObject & outIsisCubeObj = outLabel->findObject(
"IsisCube");
990 PvlGroup mosaicGrp(
"Mosaic");
991 PvlKeyword shapeModelKey(
"ShapeModel");
992 shapeModelKey += sShapeModel;
993 mosaicGrp += shapeModelKey;
994 outIsisCubeObj += mosaicGrp;
1013 int iStartCountBand = iBand/2 + 1;
1015 for (
int band=iStartCountBand; band<=iBand; band++) {
1016 for (
int i = 1; i <= iLines; i++) {
1019 for (
int iPixel = 0; iPixel < countPortal.
size(); iPixel++) {
1020 countPortal[iPixel] = 0;
1044 bool bChanged=
false;
1045 if (IsValidPixel(piPortal[piPixel]) && IsValidPixel(poPortal[piPixel])) {
1046 int iCount = (int)countPortal[piPixel];
1047 double dNewDN = (poPortal[piPixel] * iCount + piPortal[piPixel]) / (iCount + 1);
1048 poPortal[piPixel] = dNewDN;
1049 countPortal[piPixel] =iCount +1;
1053 else if (IsValidPixel(piPortal[piPixel])) {
1054 poPortal[piPixel] = piPortal[piPixel];
1055 countPortal[piPixel] = 1;
1059 else if (IsSpecial(piPortal[piPixel])) {
1060 if ((m_placeHighSatPixels && IsHighPixel(piPortal[piPixel])) ||
1061 (m_placeLowSatPixels && IsLowPixel (piPortal[piPixel])) ||
1062 (m_placeNullPixels && IsNullPixel(piPortal[piPixel]))) {
1063 poPortal[piPixel] = piPortal[piPixel];
1064 countPortal[piPixel] = 0;
1087 PvlGroup &inBin = inLab->findGroup(
"BandBin", Pvl::Traverse);
1088 PvlGroup &outBin = outLab->findGroup(
"BandBin", Pvl::Traverse);
1089 if (inBin.keywords() != outBin.keywords()) {
1090 QString msg =
"Pvl Group [BandBin] does not match between the input and output cubes";
1091 throw IException(IException::User, msg, _FILEINFO_);
1095 int isb = (origIsb - 1);
1096 int osb = (
m_osb - 1);
1097 int iOutBandsHalf =
OutputCubes[0]->bandCount()/2;
1099 for (
int i = 0; i < outBin.keywords(); i++) {
1100 PvlKeyword &outKey = outBin[i];
1101 QString sOutName = outKey.name();
1102 if (inBin.hasKeyword(sOutName)) {
1103 PvlKeyword &inKey = inBin[sOutName];
1104 for (
int j = osb, k = isb; j < outKey.size() && k < inKey.size(); j++, k++) {
1105 if (outKey[j] ==
"NA") {
1106 outKey[j] = inKey[k];
1108 if (sOutName.contains(
"Filter") ||
1109 sOutName.contains(
"Name")) {
1110 outKey[j+iOutBandsHalf] = inKey[k] +
"_Count";
1113 outKey[j+iOutBandsHalf] =
"Avg_Count";
1117 else if (outKey[j] != inKey[k]) {
1118 QString msg =
"The input cube [" + inLab->fileName() +
"] and the base mosaic values "
1119 "of the Pvl Group [BandBin] for Keyword [" + outKey.name() +
"] do not "
1120 "match. Base mosaic value at index [" + QString::number(j) +
"] = " +
1121 outKey[j] +
". Input cube value at index [" + QString::number(k) +
"] = "
1122 + inKey[k] +
". **Note: use mapmos/automos MatchBandBin = false to "
1123 "override this check**";
1126 throw IException(IException::User, msg, _FILEINFO_);
1131 QString msg =
"Pvl Group [BandBin] In Keyword[" + inBin[i].name() +
"] and Out Keyword[" +
1132 outBin[i].name() +
"] does not match";
1133 throw IException(IException::User, msg, _FILEINFO_);
1137 int inputRange =
InputCubes[0]->bandCount() - isb;
1138 int outputRange =
OutputCubes[0]->bandCount() - osb;
1139 inb = min(inputRange, outputRange);
1165 int isb = origIsb - 1;
1166 int osb =
m_osb - 1;
1168 PvlGroup &cInBin = inLab->findGroup(
"BandBin", Pvl::Traverse);
1169 PvlGroup cOutBin(
"BandBin");
1171 for (
int i = 0; i < cInBin.keywords(); i++) {
1172 PvlKeyword &cInKey = cInBin[i];
1173 int iInKeySize = cInKey.size();
1174 PvlKeyword cOutKey(cInKey.name());
1176 for (
int b = 0; b < osb; b++) {
1179 for (
int b = osb; b < iOutBands; b++) {
1180 if (isb < iInKeySize) {
1181 cOutKey += cInKey[isb++];
1193 int iOutStartBand = iOutBands + osb;
1194 QString sKeyName = cInKey.name();
1195 bool bFilterKey =
false;
1196 if (sKeyName.contains(
"Filter") ||
1197 sKeyName.contains(
"Original") ||
1198 sKeyName.contains(
"Name")) {
1201 for (
int ob=iOutBands; ob<iTotalOutBands; ob++) {
1202 if (isb < iInKeySize && ob >= iOutStartBand) {
1204 cOutKey += cInKey[isb++] +
"_Count";
1219 if (cOutKey.unit() != cInKey.unit()) {
1220 cOutKey.setUnits((QString)(cInKey.unit()));
1226 outLab->findObject(
"IsisCube").addGroup(cOutBin);
1242 PvlGroup cOutBin(
"BandBin");
1245 int iOutBandsTotal = iOutBands;
1247 if (m_trackingEnabled) {
1254 PvlKeyword cOutKey(
"FilterName");
1256 for (
int i=0; i<iOutBands; i++) {
1261 for (
int i=iOutBands; i<iOutBandsTotal; i++) {
1262 cOutKey +=
"NA_Count";
1266 if (m_trackingEnabled) {
1267 cOutKey +=
"TRACKING";
1272 outLab->findObject(
"IsisCube").addGroup(cOutBin);
1280 bool bFound =
false;
1287 if (m_bandPriorityBandNumber <=
InputCubes[0]->bandCount() &&
1288 m_bandPriorityBandNumber > 0) {
1289 iBandIndex = m_bandPriorityBandNumber;
1295 if (m_bandPriorityBandNumber <=
OutputCubes[0]->bandCount() &&
1296 m_bandPriorityBandNumber > 0) {
1297 iBandIndex = m_bandPriorityBandNumber;
1303 if (!m_bandPriorityBandNumber) {
1304 PvlKeyword cKeyName;
1305 if (cPvlLabel.findGroup(
"BandBin", Pvl::Traverse).hasKeyword(m_bandPriorityKeyName)) {
1306 cKeyName = cPvlLabel.findGroup(
"BandBin", Pvl::Traverse).findKeyword(m_bandPriorityKeyName);
1308 int iSize = cKeyName.size();
1309 for (
int i = 0; i < iSize; i++) {
1310 if (m_bandPriorityKeyValue.toUpper() == cKeyName[i].toUpper()) {
1318 QString msg =
"Invalid Band / Key Name, Value ";
1319 throw IException(IException::User, msg, _FILEINFO_);
1343 int bandPriorityInputBandNumber,
int bandPriorityOutputBandNumber,
int index) {
1348 Portal trackingPortal(ins, 1, PixelType::UnsignedInteger);
1350 for (
int iIL = isl, iOL =
m_osl; iIL < isl + inl; iIL++, iOL++) {
1352 cIportal.
SetPosition(iss, iIL, bandPriorityInputBandNumber);
1362 for (
int iPixel = 0; iPixel < cOportal.
size(); iPixel++) {
1363 if ((m_placeHighSatPixels && IsHighPixel(cIportal[iPixel])) ||
1364 (m_placeLowSatPixels && IsLowPixel(cIportal[iPixel])) ||
1365 (m_placeNullPixels && IsNullPixel(cIportal[iPixel]))) {
1366 trackingPortal[iPixel] = index;
1369 if (IsValidPixel(cIportal[iPixel])) {
1370 if (IsSpecial(cOportal[iPixel]) ||
1371 (m_bandPriorityUseMaxValue ==
false && cIportal[iPixel] < cOportal[iPixel]) ||
1372 (m_bandPriorityUseMaxValue ==
true && cIportal[iPixel] > cOportal[iPixel])) {
1373 trackingPortal[iPixel] = index;
1389 int inb,
int bandPriorityInputBandNumber,
1390 int bandPriorityOutputBandNumber) {
1403 for (
int inLine = isl, outLine =
m_osl; inLine < isl + inl; inLine++, outLine++) {
1405 iComparePortal.
SetPosition(iss, inLine, bandPriorityInputBandNumber);
1414 bool inCopy =
false;
1416 for (
int iPixel = 0; iPixel < ins; iPixel++) {
1417 resultsPortal[iPixel] =
false;
1418 if (m_createOutputMosaic) {
1419 resultsPortal[iPixel] =
true;
1422 else if ( IsValidPixel(iComparePortal[iPixel]) && IsValidPixel(oComparePortal[iPixel]) ) {
1423 if ( (m_bandPriorityUseMaxValue ==
false &&
1424 iComparePortal[iPixel] < oComparePortal[iPixel]) ||
1425 (m_bandPriorityUseMaxValue ==
true &&
1426 iComparePortal[iPixel] > oComparePortal[iPixel]) ) {
1427 resultsPortal[iPixel] =
true;
1431 else if (IsValidPixel(iComparePortal[iPixel]) && !IsValidPixel(oComparePortal[iPixel]) ) {
1432 resultsPortal[iPixel] =
true;
1437 for (
int ib = isb, ob =
m_osb; ib < (isb + inb) && ob <=
m_onb; ib++, ob++) {
1445 for (
int iPixel = 0; iPixel < ins; iPixel++) {
1446 if (resultsPortal[iPixel]) {
1447 if (m_createOutputMosaic) {
1448 oPortal[iPixel] = iPortal[iPixel];
1450 else if ( IsValidPixel(iPortal[iPixel]) ||
1451 (m_placeHighSatPixels && IsHighPixel(iPortal[iPixel]) ) ||
1452 (m_placeLowSatPixels && IsLowPixel (iPortal[iPixel]) ) ||
1453 (m_placeNullPixels && IsNullPixel(iPortal[iPixel]) ) ) {
1454 oPortal[iPixel] = iPortal[iPixel];
1457 else if ( IsValidPixel(iPortal[iPixel]) && !IsValidPixel(oPortal[iPixel]) ) {
1458 oPortal[iPixel] = iPortal[iPixel];
1497 QString msg =
"ProcessMosaic::GetOriginDefaultByPixelType - Invalid Pixel Type";
1498 throw IException(IException::Programmer, msg, _FILEINFO_);
1518 bool bGroupExists =
false;
1522 if (cPvlOut->hasGroup(
"Tracking")) {
1523 bGroupExists =
true;
1526 return bGroupExists;
static UserInterface & GetUserInterface()
Returns the UserInterface object.
int size() const
Returns the total number of pixels in the shape buffer.
IO Handler for Isis Cubes.
Buffer for containing a two dimensional section of an image.
void SetPosition(const double sample, const double line, const int band)
Sets the line and sample position of the buffer.
virtual void EndProcess()
End the processing sequence and cleans up by closing cubes, freeing memory, etc.
std::vector< Isis::Cube * > InputCubes
A vector of pointers to opened Cube objects.
Isis::Progress * p_progress
Pointer to a Progress object.
std::vector< Isis::Cube * > OutputCubes
A vector of pointers to allocated Cube objects.
virtual Isis::Cube * SetInputCube(const QString ¶meter, const int requirements=0)
Opens an input cube specified by the user and verifies requirements are met.
void SetMatchDEM(bool matchDEM)
Set the DEM match flag.
void BandPriorityWithNoTracking(int iss, int isl, int isb, int ins, int inl, int inb, int bandPriorityInputBandNumber, int bandPriorityOutputBandNumber)
Mosaicking for Band Priority with no Tracking.
virtual void StartProcess(const int &piOutSample, const int &piOutLine, const int &piOutBand)
This method invokes the process by mosaic operation over a single input cube and single output cube.
bool m_enforceMatchDEM
DEM of the input and mosaic should match.
void BandComparison(int iss, int isl, int ins, int inl, int bandPriorityInputBandNumber, int bandPriorityOutputBandNumber, int index)
This method compares the specified band of the input and output using the criteria (lesser or greater...
bool GetLowSaturationFlag() const
int m_onb
The number of bands in the output cube.
int m_isl
The starting line within the input cube.
Isis::Cube * SetOutputCube(const QString &psParameter)
Opens an output cube specified by the user.
ImageOverlay
Enumeration for different Mosaic priorities (input, mosaic, band)
@ PlaceImagesOnTop
ontop priority
@ UseBandPlacementCriteria
band priority
@ PlaceImagesBeneath
beneath priority
@ AverageImageWithMosaic
average priority
bool GetTrackFlag() const
int m_oss
The starting sample within the output cube.
virtual ~ProcessMosaic()
Destroys the Mosaic object. It will close all opened cubes.
bool GetHighSaturationFlag() const
int GetInputStartLineInMosaic() const
This is the line where the image was placed into the output mosaic.
void SetLowSaturationFlag(bool placeLowSatPixels)
When true, low saturation (LRS, LIS) will be considered valid data for the purposes of placing pixels...
int m_isb
The starting band within the input cube.
virtual void EndProcess()
Cleans up by closing input, output and tracking cubes.
int m_iss
The starting sample within the input cube.
void SetHighSaturationFlag(bool placeHighSatPixels)
When true, high saturation (HRS, HIS) will be considered valid data for the purposes of placing pixel...
static ImageOverlay StringToOverlay(QString)
Convert a QString to an ImageOverlay (case-insensitive).
PvlObject imagePositions()
Accessor for the placed images and their locations.
int m_ins
The number of samples from the input cube.
Cube * m_trackingCube
Output tracking cube. NULL unless tracking is enabled.
void SetCreateFlag(bool createOutputMosaic)
Flag to indicate that the mosaic is being newly created Indication that the new label specific to the...
int m_inl
The number of lines from the input cube.
static QString OverlayToString(ImageOverlay)
Convert an ImageOverlay to a QString.
void SetBandNumber(int bandPriorityBandNumber)
Set the band to use for priorities when using band priority.
int GetInputStartBandInMosaic() const
This is the band where the image was placed into the output mosaic.
bool GetTrackStatus()
This method searchs the mosaic label for a table with name "InputFile".
int m_inb
The number of bands from the input cube.
void SetBandKeyword(QString bandPriorityKeyName, QString bandPriorityKeyValue)
Set the keyword/value to use for comparing when using band priority.
bool ProcessAveragePriority(int piPixel, Portal &pInPortal, Portal &pOutPortal, Portal &pOrigPortal)
Calculate DN value for a pixel for AverageImageWithMosaic priority and set the Count band portal.
void AddDefaultBandBinGroup()
AddDefaultBandBinGroup.
static const char * TRACKING_TABLE_NAME
This is the name of the table in the Cube which will contain the image file names.
int m_osb
The starting band within the output cube.
ProcessMosaic()
ProcessMosaic Contructor.
void MatchBandBinGroup(int origIsb, int &inb)
This method matches the input BandBin group to the mosaic BandBin Group and allows band to be replace...
virtual Isis::Cube * SetInputCube(const QString ¶meter, const int ss, const int sl, const int sb, const int ns, const int nl, const int nb)
Opens an input cube specified by the user.
int GetBandIndex(bool inputFile)
Get the Band Index in an image of type (input/output)
void SetBandUseMaxValue(bool useMax)
Set whether to take the image with the max or min value when using band priority.
void SetNullFlag(bool placeNullPixels)
When true, Null pixels will be considered valid data for the purposes of placing pixels in the output...
int GetOriginDefaultByPixelType()
This method returns the defaults(unassigned origin value) depending on the pixel type.
int GetInputStartSampleInMosaic() const
This is the sample where the image was placed into the output mosaic.
void ResetCountBands()
Reset all the count bands to default at the time of mosaic creation.
void AddBandBinGroup(int origIsb)
This method adds the BandBin group to the mosaic corresponding to the actual bands in the mosaic.
bool m_enforceBandBinMatch
True/False value to determine whether to enforce the input cube bandbin matches the mosaic bandbin gr...
PvlObject m_imagePositions
List of images placed on the mosaic.
int m_osl
The starting line within the output cube.
void MatchDEMShapeModel()
Match the Shape Model for input and mosaic.
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
Command Line and Xml loader, validation, and access.
QString GetCubeName(const QString ¶mName, QString extension="") const
Retrieves of a value for a parameter of type "cubename".
This is free and unencumbered software released into the public domain.
QString toString(const LinearAlgebra::Vector &vector, int precision)
A global function to format LinearAlgebra::Vector as a QString with the given precision.
Namespace for the standard library.