Loading isis/src/base/objs/TrackingTable/TrackingTable.cpp +49 −0 Original line number Diff line number Diff line Loading @@ -176,4 +176,53 @@ namespace Isis { return m_fileList.size() - 1 + VALID_MINUI4; } /** * Returns the serial number that corresponds to a pixel value. * * @param pixel The pixel value to find the serial number for * @returns @b QString The serial number represented by the pixel value */ QString TrackingTable::pixelToSN(unsigned int pixel) { if (pixel < VALID_MINUI4) { QString msg = "Cannot convert pixel [" + toString(pixel) + "] to a serial number, pixel is below valid minimum [" + toString(VALID_MINUI4) + "]."; throw IException(IException::Programmer, msg, _FILEINFO_); } unsigned int index = pixel - VALID_MINUI4; if (index >= (unsigned int)m_fileList.size()) { QString msg = "Cannot convert pixel [" + toString(pixel) + "] to a serial number, pixel is above valid maximum [" + toString(VALID_MINUI4 + m_fileList.size()) + "]."; throw IException(IException::Programmer, msg, _FILEINFO_); } return m_fileList[index].second; } /** * Returns the index of the filename/serialnumber combination. * * @param file The FileName within m_fileList to find the index of * @param serialNumber The QString of the serial number within m_fileList * to find the index of * * @return @b int The index corresponding to the * filename/serialnumber combination */ int TrackingTable::fileNameToIndex(FileName file, QString serialNumber) { for (int i = 0; i < m_fileList.size(); i++) { if (m_fileList[i].first == file) { return i; } } // At this point, the file is not in the internal file list so append it // and return its new index. m_fileList.append(QPair<FileName, QString>(file, serialNumber)); return m_fileList.size() - 1 + VALID_MINUI4; } } isis/src/base/objs/TrackingTable/TrackingTable.h +4 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,10 @@ namespace Isis { unsigned int fileNameToPixel(FileName file, QString serialNumber); int fileNameToIndex(FileName file, QString serialNumber); QString pixelToSN(unsigned int pixel); private: QList< QPair< FileName, QString > > m_fileList; //!< The list to keep track of images Loading isis/src/qisis/objs/AdvancedTrackTool/AdvancedTrackTool.cpp +18 −22 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include "TableMainWindow.h" #include "Target.h" #include "TProjection.h" #include "TrackingTable.h" namespace Isis { Loading Loading @@ -569,30 +570,25 @@ namespace Isis { Cube *cCube = cvp->cube(); int iTrackBand = -1; if(cCube->hasGroup("Tracking")) { PvlGroup trackingGroup = cCube->group("Tracking"); trackingGroup.findKeyword("FileName")[0]; FileName trackingCubeFileName(trackingGroup.findKeyword("FileName")[0]); Cube trackingCube(trackingCubeFileName); if(cCube->fileName().contains("_tracking")) { // // Read the cube DN value from TRACKING cube at location (piLine, piSample) Portal trackingPortal(trackingCube.sampleCount(), 1, trackingCube.pixelType()); // Read the cube DN value from TRACKING cube at location (piLine, piSample) Portal trackingPortal(cCube->sampleCount(), 1, cCube->pixelType()); trackingPortal.SetPosition(piSample, piLine, 1); trackingCube.read(trackingPortal); // // FIXME: will need to be changed for whatever base + index DN value we end up using. // int trackingTableIndex = (unsigned int)trackingPortal[0] - VALID_MINUI4; cCube->read(trackingPortal); int currentPixel = trackingPortal[0]; if (currentPixel != NULLUI4) { // Get the input file name and serial number Table table(m_tableMosaicSrc); trackingCube.read(table); cCube->read(table); TrackingTable trackingTable(table); psSrcFileName = trackingTable.pixelToFileName(trackingPortal[0]) // int numRecs = trackingTable.Records(); // if(trackingTableIndex >= 0 && trackingTableIndex < numRecs) { // psSrcFileName = QString(trackingTable[trackingTableIndex][0]); // psSrcSerialNum = QString(trackingTable[trackingTableIndex][1]); // } FileName trackingFileName = trackingTable.pixelToFileName(currentPixel); psSrcFileName = trackingFileName.name(); psSrcSerialNum = trackingTable.pixelToSN(currentPixel); piOrigin = trackingTable.fileNameToIndex(trackingFileName, psSrcSerialNum); } } // Backwards compatability. Have this tool work with attached TRACKING bands else if(cCube->hasTable(m_tableMosaicSrc)) { Loading Loading
isis/src/base/objs/TrackingTable/TrackingTable.cpp +49 −0 Original line number Diff line number Diff line Loading @@ -176,4 +176,53 @@ namespace Isis { return m_fileList.size() - 1 + VALID_MINUI4; } /** * Returns the serial number that corresponds to a pixel value. * * @param pixel The pixel value to find the serial number for * @returns @b QString The serial number represented by the pixel value */ QString TrackingTable::pixelToSN(unsigned int pixel) { if (pixel < VALID_MINUI4) { QString msg = "Cannot convert pixel [" + toString(pixel) + "] to a serial number, pixel is below valid minimum [" + toString(VALID_MINUI4) + "]."; throw IException(IException::Programmer, msg, _FILEINFO_); } unsigned int index = pixel - VALID_MINUI4; if (index >= (unsigned int)m_fileList.size()) { QString msg = "Cannot convert pixel [" + toString(pixel) + "] to a serial number, pixel is above valid maximum [" + toString(VALID_MINUI4 + m_fileList.size()) + "]."; throw IException(IException::Programmer, msg, _FILEINFO_); } return m_fileList[index].second; } /** * Returns the index of the filename/serialnumber combination. * * @param file The FileName within m_fileList to find the index of * @param serialNumber The QString of the serial number within m_fileList * to find the index of * * @return @b int The index corresponding to the * filename/serialnumber combination */ int TrackingTable::fileNameToIndex(FileName file, QString serialNumber) { for (int i = 0; i < m_fileList.size(); i++) { if (m_fileList[i].first == file) { return i; } } // At this point, the file is not in the internal file list so append it // and return its new index. m_fileList.append(QPair<FileName, QString>(file, serialNumber)); return m_fileList.size() - 1 + VALID_MINUI4; } }
isis/src/base/objs/TrackingTable/TrackingTable.h +4 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,10 @@ namespace Isis { unsigned int fileNameToPixel(FileName file, QString serialNumber); int fileNameToIndex(FileName file, QString serialNumber); QString pixelToSN(unsigned int pixel); private: QList< QPair< FileName, QString > > m_fileList; //!< The list to keep track of images Loading
isis/src/qisis/objs/AdvancedTrackTool/AdvancedTrackTool.cpp +18 −22 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include "TableMainWindow.h" #include "Target.h" #include "TProjection.h" #include "TrackingTable.h" namespace Isis { Loading Loading @@ -569,30 +570,25 @@ namespace Isis { Cube *cCube = cvp->cube(); int iTrackBand = -1; if(cCube->hasGroup("Tracking")) { PvlGroup trackingGroup = cCube->group("Tracking"); trackingGroup.findKeyword("FileName")[0]; FileName trackingCubeFileName(trackingGroup.findKeyword("FileName")[0]); Cube trackingCube(trackingCubeFileName); if(cCube->fileName().contains("_tracking")) { // // Read the cube DN value from TRACKING cube at location (piLine, piSample) Portal trackingPortal(trackingCube.sampleCount(), 1, trackingCube.pixelType()); // Read the cube DN value from TRACKING cube at location (piLine, piSample) Portal trackingPortal(cCube->sampleCount(), 1, cCube->pixelType()); trackingPortal.SetPosition(piSample, piLine, 1); trackingCube.read(trackingPortal); // // FIXME: will need to be changed for whatever base + index DN value we end up using. // int trackingTableIndex = (unsigned int)trackingPortal[0] - VALID_MINUI4; cCube->read(trackingPortal); int currentPixel = trackingPortal[0]; if (currentPixel != NULLUI4) { // Get the input file name and serial number Table table(m_tableMosaicSrc); trackingCube.read(table); cCube->read(table); TrackingTable trackingTable(table); psSrcFileName = trackingTable.pixelToFileName(trackingPortal[0]) // int numRecs = trackingTable.Records(); // if(trackingTableIndex >= 0 && trackingTableIndex < numRecs) { // psSrcFileName = QString(trackingTable[trackingTableIndex][0]); // psSrcSerialNum = QString(trackingTable[trackingTableIndex][1]); // } FileName trackingFileName = trackingTable.pixelToFileName(currentPixel); psSrcFileName = trackingFileName.name(); psSrcSerialNum = trackingTable.pixelToSN(currentPixel); piOrigin = trackingTable.fileNameToIndex(trackingFileName, psSrcSerialNum); } } // Backwards compatability. Have this tool work with attached TRACKING bands else if(cCube->hasTable(m_tableMosaicSrc)) { Loading