Loading isis/src/base/apps/trackextract/trackextract.xml +13 −9 Original line number Diff line number Diff line Loading @@ -6,12 +6,14 @@ </brief> <description> Updates an old mosaic cube with a tracking band by removing the tracking band and table and placing them into a separate tracking cube. A reference to the tracking cube is added to the mosaic label. We also have to update the tracking cube's pixels by subtracting the offsett ProcessMosaic adds to each pixel and adding the new offset, the minimum value of an unsigned integer. ProcessMosaic also sets pixels that are not from any cube to a default value. If a pixel has this value, we set it to Null. Updates a mosaic cube with a tracking band created on or before isis version 3.5.2 to be up to date with isis version 3.5.3 or above. Removes the tracking band and table from the input mosaic cube and places them into a separate tracking cube. A reference to the tracking cube is added to the mosaic label. The mosaic cube's bit type remains the same, but the tracking cube's bit type is made unsigned integer. We also have to update the tracking cube's pixels by subtracting the offsett ProcessMosaic adds to each pixel and adding the new offset, the minimum value of an unsigned integer. ProcessMosaic also sets pixels that are not from any cube to a default value. If a pixel has this value, we set it to Null. </description> <category> Loading @@ -33,7 +35,8 @@ Input cube with tracking band </brief> <description> The mosaic that contains the tracking band to be extracted. The mosaic created on or before the isis version 3.5.2 that contains the tracking band to be extracted. </description> <filter> *.cub Loading @@ -47,8 +50,9 @@ Output mosaic and tracking cube </brief> <description> There will be two output cubes: the mosaic cube and the tracking cube, both named by the user, but the tracking cube will have "_tracking" appended onto the name. The output mosaic cube name that will be up to date with isis version 3.5.3 or above. This cube will not have the tracking band, but instead the tracking information will be placed into a new cube with the same name but with "_tracking" added to the end. </description> <filter> *.cub 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; } } isis/src/base/objs/TrackingTable/TrackingTable.h +5 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ namespace Isis { * @internal * @history 2018-07-26 Jesse Mapel - Added offset based on minimum unsigned integer value. * Renamed methods to better convey output/input meaning. * @history 2018-07-30 Kaitlyn Lee - Added pixelToSN() and fileNameToIndex(). */ class TrackingTable{ Loading @@ -65,6 +66,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 +28 −3 Original line number Diff line number Diff line Loading @@ -29,12 +29,12 @@ #include "TableMainWindow.h" #include "Target.h" #include "TProjection.h" #include "TrackingTable.h" namespace Isis { // For mosaic tracking #define FLOAT_MIN -16777215 #define TABLE_MOSAIC_SRC "InputImages" /** * Constructs an AdvancedTrackTool object Loading Loading @@ -569,7 +569,27 @@ namespace Isis { Cube *cCube = cvp->cube(); int iTrackBand = -1; if(cCube->hasTable(TABLE_MOSAIC_SRC)) { if(cCube->hasGroup("Tracking")) { Cube *trackingCube = cvp->trackingCube(); // Read the cube DN value from TRACKING cube at location (piLine, piSample) Portal trackingPortal(trackingCube->sampleCount(), 1, trackingCube->pixelType()); trackingPortal.SetPosition(piSample, piLine, 1); trackingCube->read(trackingPortal); unsigned int currentPixel = trackingPortal[0]; if (currentPixel != NULLUI4) { // If from an image Table table(trackingTableName); // trackingTableName from TrackingTable trackingCube->read(table); TrackingTable trackingTable(table); 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(trackingTableName)) { Pvl *cPvl = cCube->label(); PvlObject cObjIsisCube = cPvl->findObject("IsisCube"); PvlGroup cGrpBandBin = cObjIsisCube.findGroup("BandBin"); Loading Loading @@ -604,7 +624,7 @@ namespace Isis { } // Get the input file name and serial number Table cFileTable(TABLE_MOSAIC_SRC); Table cFileTable(trackingTableName); cCube->read(cFileTable); int iRecs = cFileTable.Records(); if(piOrigin >= 0 && piOrigin < iRecs) { Loading @@ -613,6 +633,11 @@ namespace Isis { } } } if (piOrigin == -1) { // If not from an image, display N/A psSrcFileName = "N/A"; psSrcSerialNum = "N/A"; } } catch (IException &e) { QMessageBox::warning((QWidget *)parent(), "Warning", e.toString()); Loading isis/src/qisis/objs/AdvancedTrackTool/AdvancedTrackTool.h +9 −3 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ class QAction; namespace Isis { class TableMainWindow; class MdiCubeViewport; Loading Loading @@ -82,6 +83,13 @@ namespace Isis { * before it attempts to record a point so that a table is created * to record the point into so that the first recorded point is drawn. * Fixes #5143. * @history 2018-07-18 Kristin Berry and Kaitlyn Lee - Updated TrackMosaicOrigin to work with * an external tracking cube. * @history 2018-07-31 Kaitlyn Lee - Updated TrackMosaicOrigin to use a TrackingTable object * to get the file name, serial number, and index of the image associated * with the current pixel. Moved code opening the tracking cube to * CubeViewport. If the cursor is over a pixel with no tracking info, * file name and serial number display N/A now. */ class AdvancedTrackTool : public Tool { Q_OBJECT Loading Loading @@ -181,9 +189,7 @@ namespace Isis { int p_id; //!< The record id TableMainWindow *p_tableWin; //!< The table window bool m_showHelpOnStart; //!< True to show dialog When tool is started }; }; #endif Loading
isis/src/base/apps/trackextract/trackextract.xml +13 −9 Original line number Diff line number Diff line Loading @@ -6,12 +6,14 @@ </brief> <description> Updates an old mosaic cube with a tracking band by removing the tracking band and table and placing them into a separate tracking cube. A reference to the tracking cube is added to the mosaic label. We also have to update the tracking cube's pixels by subtracting the offsett ProcessMosaic adds to each pixel and adding the new offset, the minimum value of an unsigned integer. ProcessMosaic also sets pixels that are not from any cube to a default value. If a pixel has this value, we set it to Null. Updates a mosaic cube with a tracking band created on or before isis version 3.5.2 to be up to date with isis version 3.5.3 or above. Removes the tracking band and table from the input mosaic cube and places them into a separate tracking cube. A reference to the tracking cube is added to the mosaic label. The mosaic cube's bit type remains the same, but the tracking cube's bit type is made unsigned integer. We also have to update the tracking cube's pixels by subtracting the offsett ProcessMosaic adds to each pixel and adding the new offset, the minimum value of an unsigned integer. ProcessMosaic also sets pixels that are not from any cube to a default value. If a pixel has this value, we set it to Null. </description> <category> Loading @@ -33,7 +35,8 @@ Input cube with tracking band </brief> <description> The mosaic that contains the tracking band to be extracted. The mosaic created on or before the isis version 3.5.2 that contains the tracking band to be extracted. </description> <filter> *.cub Loading @@ -47,8 +50,9 @@ Output mosaic and tracking cube </brief> <description> There will be two output cubes: the mosaic cube and the tracking cube, both named by the user, but the tracking cube will have "_tracking" appended onto the name. The output mosaic cube name that will be up to date with isis version 3.5.3 or above. This cube will not have the tracking band, but instead the tracking information will be placed into a new cube with the same name but with "_tracking" added to the end. </description> <filter> *.cub 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; } }
isis/src/base/objs/TrackingTable/TrackingTable.h +5 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ namespace Isis { * @internal * @history 2018-07-26 Jesse Mapel - Added offset based on minimum unsigned integer value. * Renamed methods to better convey output/input meaning. * @history 2018-07-30 Kaitlyn Lee - Added pixelToSN() and fileNameToIndex(). */ class TrackingTable{ Loading @@ -65,6 +66,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 +28 −3 Original line number Diff line number Diff line Loading @@ -29,12 +29,12 @@ #include "TableMainWindow.h" #include "Target.h" #include "TProjection.h" #include "TrackingTable.h" namespace Isis { // For mosaic tracking #define FLOAT_MIN -16777215 #define TABLE_MOSAIC_SRC "InputImages" /** * Constructs an AdvancedTrackTool object Loading Loading @@ -569,7 +569,27 @@ namespace Isis { Cube *cCube = cvp->cube(); int iTrackBand = -1; if(cCube->hasTable(TABLE_MOSAIC_SRC)) { if(cCube->hasGroup("Tracking")) { Cube *trackingCube = cvp->trackingCube(); // Read the cube DN value from TRACKING cube at location (piLine, piSample) Portal trackingPortal(trackingCube->sampleCount(), 1, trackingCube->pixelType()); trackingPortal.SetPosition(piSample, piLine, 1); trackingCube->read(trackingPortal); unsigned int currentPixel = trackingPortal[0]; if (currentPixel != NULLUI4) { // If from an image Table table(trackingTableName); // trackingTableName from TrackingTable trackingCube->read(table); TrackingTable trackingTable(table); 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(trackingTableName)) { Pvl *cPvl = cCube->label(); PvlObject cObjIsisCube = cPvl->findObject("IsisCube"); PvlGroup cGrpBandBin = cObjIsisCube.findGroup("BandBin"); Loading Loading @@ -604,7 +624,7 @@ namespace Isis { } // Get the input file name and serial number Table cFileTable(TABLE_MOSAIC_SRC); Table cFileTable(trackingTableName); cCube->read(cFileTable); int iRecs = cFileTable.Records(); if(piOrigin >= 0 && piOrigin < iRecs) { Loading @@ -613,6 +633,11 @@ namespace Isis { } } } if (piOrigin == -1) { // If not from an image, display N/A psSrcFileName = "N/A"; psSrcSerialNum = "N/A"; } } catch (IException &e) { QMessageBox::warning((QWidget *)parent(), "Warning", e.toString()); Loading
isis/src/qisis/objs/AdvancedTrackTool/AdvancedTrackTool.h +9 −3 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ class QAction; namespace Isis { class TableMainWindow; class MdiCubeViewport; Loading Loading @@ -82,6 +83,13 @@ namespace Isis { * before it attempts to record a point so that a table is created * to record the point into so that the first recorded point is drawn. * Fixes #5143. * @history 2018-07-18 Kristin Berry and Kaitlyn Lee - Updated TrackMosaicOrigin to work with * an external tracking cube. * @history 2018-07-31 Kaitlyn Lee - Updated TrackMosaicOrigin to use a TrackingTable object * to get the file name, serial number, and index of the image associated * with the current pixel. Moved code opening the tracking cube to * CubeViewport. If the cursor is over a pixel with no tracking info, * file name and serial number display N/A now. */ class AdvancedTrackTool : public Tool { Q_OBJECT Loading Loading @@ -181,9 +189,7 @@ namespace Isis { int p_id; //!< The record id TableMainWindow *p_tableWin; //!< The table window bool m_showHelpOnStart; //!< True to show dialog When tool is started }; }; #endif