Skip to content

Commit

Permalink
Merge branch 'DOI-USGS:dev' into enhancement/cam2camKeywords
Browse files Browse the repository at this point in the history
  • Loading branch information
artmathgirl authored Jan 21, 2025
2 parents 80bd6e4 + 3aa6d78 commit ae2b05b
Show file tree
Hide file tree
Showing 11 changed files with 675 additions and 27 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ release.
### Fixed
- Fixed kaguyatc2isis invalid BandBin values [#5629](https://github.com/DOI-USGS/ISIS3/issues/5629)
- Fixed SpiceClient to handle redirect requests.
- Fixed jigsaw to default OUTADJUSTMENTH5 option to false and allow this feature to run on read-only images [#5700](https://github.com/DOI-USGS/ISIS3/issues/5700)
- Fixed Cube::fromIsd to add "LineScanTimes" table from HRSC isds [#5668](https://github.com/DOI-USGS/ISIS3/issues/5668)

## [9.0.0] - 09-25-2024

Expand All @@ -64,6 +66,8 @@ release.
- Changed 'User Parameters' group in camstats to UserParameters for PVL compliance [#5625](https://github.com/DOI-USGS/ISIS3/issues/5625).

### Fixed
- Fixed bug in the method BundleSolutionInfo::outputPointsCSV() where, when performing a rectangular (XYZ) bundle adjustment, the Lat/Lon/Radius point corrections written to points.csv are incorrect and do not match those written to bundleout.txt. Also modified the ctest FunctionalTestJigsawBundleXYZ to spot check six lines (points) in points.csv.
Issue: [5646](https://github.com/DOI-USGS/ISIS3/issues/5646)
- Fixed noseam bug where a debugging output statement was inadvertently left in noseam.cpp.
Issue: [5660](https://github.com/DOI-USGS/ISIS3/issues/5660)
- Fixed jigsaw bugs in which RADIUS is handled incorrectly in the jigsaw gui and in the bundleout.txt
Expand Down
26 changes: 26 additions & 0 deletions isis/src/base/objs/Cube/Cube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ namespace Isis {
*/
void Cube::fromIsd(const FileName &fileName, Pvl &label, nlohmann::json &isd, QString access) {
fromLabel(fileName, label, access);

PvlGroup &instGrp = label.findGroup("Instrument", Pvl::Traverse);
if (isd.contains("line_scan_rate") && (QString)instGrp["InstrumentId"] == "HRSC") {
attachLineScanTableFromIsd(isd);
}

attachSpiceFromIsd(isd);

close();
Expand Down Expand Up @@ -1532,6 +1538,26 @@ namespace Isis {
this->camera();
}

void Cube::attachLineScanTableFromIsd(nlohmann::json isd) {
TableField ephTimeField("EphemerisTime", TableField::Double);
TableField expTimeField("ExposureTime", TableField::Double);
TableField lineStartField("LineStart", TableField::Integer);

TableRecord timesRecord;
timesRecord += ephTimeField;
timesRecord += expTimeField;
timesRecord += lineStartField;

Table timesTable("LineScanTimes", timesRecord);
for (size_t i = 0; i < isd["line_scan_rate"].size(); ++i) {
timesRecord[0] = isd["line_scan_rate"][i][1].get<double>() + isd["center_ephemeris_time"].get<double>();
timesRecord[1] = isd["line_scan_rate"][i][2].get<double>();
timesRecord[2] = (int)(isd["line_scan_rate"][i][0].get<double>() + 0.5);
timesTable += timesRecord;
}
this->write(timesTable);
}


/**
* If this is an external cube label file, this will give you the cube dn file that this label
Expand Down
1 change: 1 addition & 0 deletions isis/src/base/objs/Cube/Cube.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ namespace Isis {
bool labelsAttached() const;

void attachSpiceFromIsd(nlohmann::json Isd);
void attachLineScanTableFromIsd(nlohmann::json isd);

void close(bool remove = false);
Cube *copy(FileName newFile, const CubeAttributeOutput &newFileAttributes);
Expand Down
2 changes: 1 addition & 1 deletion isis/src/control/apps/jigsaw/jigsaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ namespace Isis {
for (int i = 0; i < bundleAdjustment->numberOfImages(); i++) {
Process p;
CubeAttributeInput inAtt;
Cube *c = p.SetInputCube(bundleAdjustment->fileName(i), inAtt, ReadWrite);
Cube *c = p.SetInputCube(bundleAdjustment->fileName(i), inAtt, 0); // 0 for read only

// Only for ISIS adjustment values
if (!c->hasBlob("CSMState", "String")) {
Expand Down
11 changes: 6 additions & 5 deletions isis/src/control/apps/jigsaw/jigsaw.xml
Original file line number Diff line number Diff line change
Expand Up @@ -921,9 +921,6 @@
<default>
<item>No</item>
</default>
<exclusions>
<item>ADJUSTMENT_INPUT</item>
</exclusions>
</parameter>

<parameter name="OUTLIER_REJECTION">
Expand Down Expand Up @@ -1880,7 +1877,7 @@
</description>
<type>boolean</type>
<default>
<item>yes</item>
<item>no</item>
</default>
</parameter>

Expand All @@ -1898,6 +1895,11 @@
<filter>
*.h5
</filter>
<inclusions>
<item>
UPDATE
</item>
</inclusions>
<exclusions>
<item>ONET</item>
<item>CNET</item>
Expand All @@ -1907,7 +1909,6 @@
<item>SCCONFIG</item>
<item>OBSERVATIONS</item>
<item>RADIUS</item>
<item>UPDATE</item>
<item>OUTLIER_REJECTION</item>
<item>REJECTION_MULTIPLIER</item>
<item>ERRORPROPAGATION</item>
Expand Down
72 changes: 64 additions & 8 deletions isis/src/control/objs/BundleSolutionInfo/BundleSolutionInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1613,9 +1613,15 @@ namespace Isis {
double dX, dY, dZ;
double dSigmaLat, dSigmaLong, dSigmaRadius;
QString strStatus;
double cor_lat_m;
double cor_lon_m;
double cor_rad_m;
double cor_lat_dd = 0.0; // lat correction, decimal degrees
double cor_lon_dd = 0.0; // lon correction, decimal degrees
double cor_rad_km = 0.0; // radius correction, kilometers
double cor_lat_m = 0.0; // lat correction, meters
double cor_lon_m = 0.0; // lon correction, meters
double cor_rad_m = 0.0; // radius correction, meters
double latInit = Isis::Null;
double lonInit = Isis::Null;
double radInit = Isis::Null;
int numMeasures, numRejectedMeasures;
double dResidualRms;

Expand Down Expand Up @@ -1655,13 +1661,63 @@ namespace Isis {
numRejectedMeasures = bundlecontrolpoint->numberOfRejectedMeasures();
dResidualRms = bundlecontrolpoint->residualRms();

// Use the local radius in meters, rad*1000., to convert radians to meters now instead of the
// target body equatorial radius (DAC 09/17/2018; from BundleControlPoint.cpp)
double rtm = dRadius * 1000.;

// point corrections and initial sigmas
boost::numeric::ublas::bounded_vector< double, 3 > corrections = bundlecontrolpoint->
corrections();
// Now use the local radius to convert radians to meters instead of the target body equatorial radius
cor_lat_m = bundlecontrolpoint->adjustedSurfacePoint().LatitudeToMeters(corrections[0]);
cor_lon_m = bundlecontrolpoint->adjustedSurfacePoint().LongitudeToMeters(corrections[1]);
cor_rad_m = corrections[2]*1000.0;
corrections();

if (m_settings->controlPointCoordTypeBundle() == SurfacePoint::Rectangular) {
double xCor = corrections(0); // km
double yCor = corrections(1); // km
double zCor = corrections(2); // km

if (!IsSpecial(dX) && !IsSpecial(dY) && !IsSpecial(dZ)) {
SurfacePoint rectPoint(Displacement(dX - xCor, Displacement::Kilometers),
Displacement(dY - yCor, Displacement::Kilometers),
Displacement(dZ - zCor, Displacement::Kilometers));

latInit = rectPoint.GetLatitude().degrees();
lonInit = rectPoint.GetLongitude().degrees();
radInit = rectPoint.GetLocalRadius().kilometers();

if (!IsSpecial(dLat)) {
cor_lat_dd = (dLat - latInit); // degrees
cor_lat_m = cor_lat_dd * DEG2RAD * rtm;
}
if (!IsSpecial(dLon)) {
cor_lon_dd = (dLon - lonInit); // degrees
cor_lon_m = cor_lon_dd * DEG2RAD * rtm * cos(dLat*DEG2RAD); // lon corrections meters
}
if (!IsSpecial(dRadius)) {
cor_rad_km = dRadius - radInit;
cor_rad_m = cor_rad_km * 1000.;
}
}
}
else if (m_settings->controlPointCoordTypeBundle() == SurfacePoint::Latitudinal) {
cor_lat_dd = corrections(0) * RAD2DEG; // lat correction, decimal degs
cor_lon_dd = corrections(1) * RAD2DEG; // lon correction, decimal degs
cor_rad_m = corrections(2) * 1000.0; // radius correction, meters

cor_lat_m = bundlecontrolpoint->adjustedSurfacePoint().LatitudeToMeters(corrections(0));
cor_lon_m = bundlecontrolpoint->adjustedSurfacePoint().LongitudeToMeters(corrections(1));
cor_rad_km = corrections(2);

if (!IsSpecial(dLat)) {
latInit = dLat - cor_lat_dd;
}

if (!IsSpecial(dLon)) {
lonInit = dLon - cor_lon_dd;
}

if (!IsSpecial(dRadius)) {
radInit = dRadius - corrections(2); // km
}
}

if (bundlecontrolpoint->type() == ControlPoint::Fixed) {
strStatus = "FIXED";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ namespace Isis {
* solution. 3) Cleaned up spacing of Point Coordinate output in the
* "INPUT: GLOBAL IMAGE PARAMETER UNCERTAINTIES" section. Originally
* added to UofA code on 2019-07-30.
*
* @history 2024-12-03 Ken Edmundson - Fixed bug where, when performing a rectangular (XYZ)
* bundle adjustment, the Lat/Lon/Radius point corrections written
* to the points.csv file are incorrect and do not match those written
* to the bundleout.txt file.
*/
class BundleSolutionInfo : public QObject {
Q_OBJECT
Expand Down
14 changes: 7 additions & 7 deletions isis/src/mex/objs/HrscCamera/HrscCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ namespace Isis {
SetPixelPitch(0.007);
instrumentRotation()->SetFrame(-41210);

ReadLineRates(cube);

// Get required keywords from instrument group
Pvl &lab = *cube.label();
PvlGroup &inst = lab.findGroup("Instrument", Pvl::Traverse);

ReadLineRates(lab.fileName());

// Setup detector map for transform of image pixels to detector position
new VariableLineScanCameraDetectorMap(this, p_lineRates);
DetectorMap()->SetDetectorSampleSumming(inst["Summing"]);
Expand Down Expand Up @@ -119,14 +119,14 @@ namespace Isis {


/**
* @param filename
* @param cube
*/
void HrscCamera::ReadLineRates(QString filename) {
Table timesTable("LineScanTimes", filename);
void HrscCamera::ReadLineRates(Cube &cube) {
Table timesTable = cube.readTable("LineScanTimes");

if(timesTable.Records() <= 0) {
QString msg = "Table [LineScanTimes] in [";
msg += filename + "] must not be empty";
msg += cube.fileName() + "] must not be empty";
throw IException(IException::Unknown, msg, _FILEINFO_);
}

Expand All @@ -138,7 +138,7 @@ namespace Isis {

if(p_lineRates.size() <= 0) {
QString msg = "There is a problem with the data within the Table ";
msg += "[LineScanTimes] in [" + filename + "]";
msg += "[LineScanTimes] in [" + cube.fileName() + "]";
throw IException(IException::Unknown, msg, _FILEINFO_);
}
}
Expand Down
2 changes: 1 addition & 1 deletion isis/src/mex/objs/HrscCamera/HrscCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace Isis {
virtual int SpkReferenceId() const;

private:
void ReadLineRates(QString filename);
void ReadLineRates(Cube &cube);

std::vector<LineRateChange> p_lineRates; /**< Vector of the variable line rates for this
camera model.*/
Expand Down
Loading

0 comments on commit ae2b05b

Please sign in to comment.