Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSM Camera Skymap #5072

Merged
merged 33 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
95a309b
stuff
Kelvinrr Oct 27, 2022
e42982c
idk
Oct 31, 2022
58aab7f
working skypt on csm cam
Nov 2, 2022
fb7d58c
Initial tweeks to the CSM camera to get skymap to work with it
acpaquette Nov 10, 2022
398f222
Adds body rotation in csminit if it is present on the ISD
acpaquette Nov 10, 2022
61da0f8
Adds test to extract body rotation from isd if it exists
acpaquette Nov 10, 2022
58f3678
Addressed feedback and did extra clean uip
acpaquette Nov 10, 2022
90f5f2d
A bunch of msl related camera changes
acpaquette Dec 16, 2022
8476a12
Removed left over print statements
acpaquette Jan 30, 2023
043eff2
Updated csminit/CSMCamera pipeline to get the correct data
acpaquette May 1, 2023
e9652b0
Small doc fix in RaDecRange in Camera.cpp
acpaquette May 1, 2023
ae6c286
Cleaned up constant frame check in SpiceRotation
acpaquette May 1, 2023
7a719b2
Set camera based center longitude and allowed users to select mapping…
acpaquette May 1, 2023
9925a83
Updated the skymap docs
acpaquette May 1, 2023
583aeb3
Addressed PR feedback
acpaquette Sep 6, 2023
aca8d57
Moved git into its own environment
acpaquette Sep 8, 2023
ab56adf
Removed git submodule update in favor of jenkins doing it
acpaquette Sep 8, 2023
8ef96d0
Fixed most test failures
acpaquette Sep 9, 2023
1c4e60b
Fixed last failing test
acpaquette Sep 12, 2023
7912410
Clean up
acpaquette Oct 4, 2023
0c136b9
Fixed changes to comments in camera.cpp
acpaquette Oct 13, 2023
8be33de
Added changelog entries
acpaquette Oct 13, 2023
53acbd7
Minor fixes and guards in CSMCamera
acpaquette Jan 6, 2024
1b9abb3
Fixes in qview tools when working with sky target imagery
acpaquette Jan 6, 2024
626f7b9
Fixed spacing
acpaquette Jan 8, 2024
834fe61
Removed body rotation extraction from ISDs
acpaquette Jan 23, 2024
06f6821
Fixed failing test
acpaquette Jan 23, 2024
bd6c50f
Updated cam camera tests
acpaquette Jan 24, 2024
d45ee4f
Merge branch 'dev' into clean_csmcamera_sky
acpaquette Jan 24, 2024
36a7745
Remove body rotation tests
acpaquette Jan 26, 2024
4eb0482
Added print statement
acpaquette Jan 29, 2024
8f0b2fe
Removed print statement
acpaquette Jan 31, 2024
ab298bd
Modified imageToRemoteImageLocus expected call
acpaquette Feb 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ release.

## [Unreleased]

### Added

- CSMCamera can now read and use the body rotation from ALE produced ISDs [#5072](https://github.com/DOI-USGS/ISIS3/pull/5072)
- CSMSkyMap added to CSMCamera for use with local rover projections in ISIS [#5072](https://github.com/DOI-USGS/ISIS3/pull/5072)
Comment on lines +40 to +41
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't normally allow more than one changelog but this is an old PR so we can probably let it slide.


### Fixed
- Fixed <i>noproj</i> bug where some temporary files were not deleted after call to cam2cam. Issue: [#4813](https://github.com/USGS-Astrogeology/ISIS3/issues/4813)
- Fixed <i>noproj</i> bug where missing shapemodel-related keywords (RayTraceEngine, BulletParts, Tolerance) are dropped when the output label is created. This resulted in the Bullet collision detection engine not being used. Issue: [#5377](https://github.com/USGS-Astrogeology/ISIS3/issues/5377)
Expand Down
20 changes: 20 additions & 0 deletions isis/src/base/apps/csminit/csminit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ find files of those names at the top level of this repository. **/
#include "Pvl.h"
#include "PvlGroup.h"
#include "PvlKeyword.h"
#include "SpiceRotation.h"

using namespace std;
using json = nlohmann::json;

namespace Isis {

Expand Down Expand Up @@ -417,6 +419,24 @@ namespace Isis {
blobLabel += PvlKeyword("PluginName", pluginName);
cube->write(csmStateBlob);

// Try to add naif keywords
if (ui.WasEntered("ISD")) {
QString isdFilePath = ui.GetFileName("ISD");
std::ifstream isdFileStream(isdFilePath.toStdString());
try {
json isd = json::parse(isdFileStream);

if (isd.contains("naif_keywords")) {
json aleNaifKeywords = isd["naif_keywords"];
PvlObject naifKeywords = PvlObject("NaifKeywords", aleNaifKeywords);
*cube->label() += naifKeywords;
}
}
catch (json::parse_error &e) {
// continue if we hit a parse error
}
}

try {
CameraFactory::Create(*cube);
p.WriteHistory(*cube);
Expand Down
14 changes: 13 additions & 1 deletion isis/src/base/apps/skymap/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ void IsisMain() {
userGrp.addKeyword(PvlKeyword("EquatorialRadius", toString(1.0)), Pvl::Replace);
userGrp.addKeyword(PvlKeyword("PolarRadius", toString(1.0)), Pvl::Replace);
userGrp.addKeyword(PvlKeyword("LatitudeType", "Planetocentric"), Pvl::Replace);
AustinSanders marked this conversation as resolved.
Show resolved Hide resolved
userGrp.addKeyword(PvlKeyword("LongitudeDirection", "PositiveWest"), Pvl::Replace);
if (!userGrp.hasKeyword("LongitudeDirection")) {
userGrp.addKeyword(PvlKeyword("LongitudeDirection", "PositiveWest"), Pvl::Replace);
}
userGrp.addKeyword(PvlKeyword("LongitudeDomain", "360"), Pvl::Replace);
if(userGrp.hasKeyword("PixelResolution")) {
userGrp.deleteKeyword("PixelResolution");
Expand All @@ -102,6 +104,9 @@ void IsisMain() {
userGrp.addKeyword(PvlKeyword("MaximumLongitude", toString(maxRa)), Pvl::Replace);
userGrp.addKeyword(PvlKeyword("MinimumLatitude", toString(minDec)), Pvl::Replace);
userGrp.addKeyword(PvlKeyword("MaximumLatitude", toString(maxDec)), Pvl::Replace);
incam->SetImage(icube->sampleCount() / 2.0, icube->lineCount() / 2.0);
double centerRa = incam->RightAscension();
userGrp.addKeyword(PvlKeyword("CenterLongitude", toString(centerRa)), Pvl::Replace);
}
if(ui.GetString("DEFAULTSCALE") == "CAMERA") {
double res = incam->RaDecResolution();
Expand Down Expand Up @@ -247,6 +252,13 @@ bool sky2map::Xform(double &inSample, double &inLine,
if(p_incam->Sample() > p_inputSamples + 0.5) return false;
if(p_incam->Line() > p_inputLines + 0.5) return false;

p_incam->SetImage(p_incam->Sample(), p_incam->Line());

// Check that the new line and sample projects close to the input Right Ascension
// and Declination
if (abs(p_incam->RightAscension() - lon) > 0.1) return false;
AustinSanders marked this conversation as resolved.
Show resolved Hide resolved
if (abs(p_incam->Declination() - lat) > 0.1) return false;
Comment on lines +259 to +260
Copy link
Collaborator Author

@acpaquette acpaquette Feb 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kelvinrr These lines were added to avoid dual projection, changing the values in the skymap test. Basically any look vector projects into two points in right ascension and declination, so if you project to 0, 0 you also project onto 0, 180. This checks avoids look vectors projecting into the inverse right ascension, declination

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you update the test data? We just got to make sure we aren't adding another failing test if we dont have to.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated data, we usually check it in once the PR is merged

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk just making sure


// Everything is good
inSample = p_incam->Sample();
inLine = p_incam->Line();
Expand Down
15 changes: 14 additions & 1 deletion isis/src/base/apps/skymap/skymap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
MaximumLatitude = Computed from the input camera cube or map file
MinimumLongitude = Computed from the input camera cube or map file
MaximumLongitude = Computed from the input camera cube or map file
CenterLongitude = Computed from the input camera cube at the center of the image

ProjectionName = Projection name in the map file
Scale = Computed from the input camera cube or map file
Scale = Computed from the input camera cube or map file
EndGroup
</pre>

Expand All @@ -48,6 +49,14 @@
Finally, the user has the option to override the pixel resolution and the ground range (latitude/longitude). These changes can be
facilitied through the parameters SCALE, SRA, ERA, SDEC, and EDEC.
</p>

<p>
In addition, skymap can be used to produce landed mosaics from rovers like MSL. This can be done using ALE to generate an ISD
which can be attached to the cube via <def link="csminit">csminit</def>. The user would then have to update the LongitudeDirection
their map file to PositiveWest. This converts the projection from a right ascension/declination projection to an azimuth/elevation
projection. Once that is done, the user would run their ISIS cube through <def link="skymap">skymap</def> and see that the landed
rover data would project relative to other images in the same image sequence.
</p>
</description>

<category>
Expand Down Expand Up @@ -101,6 +110,10 @@
<change name="Debbie A. Cook" date="2012-12-10">
Changed to use TProjection instead of Projection. References #775
</change>
<change name="Adam Paquette" date="2023-05-01">
Updated camera to properly calculate the center longitude. Also
allowed users to select PositiveEast in there mapping file.
</change>
</history>

<groups>
Expand Down
10 changes: 8 additions & 2 deletions isis/src/base/apps/skypt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "Brick.h"
#include "Camera.h"
#include "CSMCamera.h"
#include "IException.h"
#include "iTime.h"

Expand Down Expand Up @@ -47,8 +48,13 @@ void IsisMain() {
int intLine = (int)(line + 0.5);
b.SetBasePosition(intSamp, intLine, 1);
cube.read(b);

double rot = cam->CelestialNorthClockAngle();

double rot;
if (cube.hasBlob("CSMState", "String")) {
rot = ((CSMCamera*)cam)->CelestialNorthClockAngle();
} else {
rot = cam->CelestialNorthClockAngle();
}

// Create group with sky position
PvlGroup sp("SkyPoint");
Expand Down
Loading