Skip to content

Commit

Permalink
Adds CSM camera model (#4291)
Browse files Browse the repository at this point in the history
* Initial CSMCamera model implementation.

* Get CSM Camera working through a dummy setimage

* More progress on SetImage

* Cleanup.

* Added resolution and radii to CSM camera model (#4261)

* Added psuedoinverse method

* Added CSM pixel resolution calculations

* Add subsurfacepoint code and get working up to but not through setimage (#4264)

Co-authored-by: Kristin Berry <[email protected]>

* Changed pseudoinverse computation to armadillo SVD based (#4263)

* Changed psuedoinverse to Armadillo SVD

* Fixed name

* Fixed comparison warning

* In progress set ground

* Add SetUniversalGround for CSMCamera and nullptr initializations in Spice defaultinit

Co-authored-by: Kristin Berry <[email protected]>

* Modified CSM setImage to intersect the shape model (#4266)

* Fixed scaling issue in setImage

* Added shape model intersection

* added initial CSMCamera test (#4267)

* added initial CSMCamera test

* Added matchers and more tests

* Added more set ground tests

* minor clean up

* Added proper ShapeModel stuff (#4269)

* Added proper ShapeModel stuff

* General clean-up

* Starting to get campt working (#4270)

* Added a bunch more stuff for campt (#4272)

* Added a bunch of stuff for campt

* Fixed compiler error

* Got RA, DEC, and all Solar Calculations from campt correctly returning NULL (#4273)

Co-authored-by: Kristin Berry <[email protected]>

* Updated CSMCamera tests to pass (#4278)

* Updated CSMCamera tests

* made another fixture

* Moved dem radius to 1 place in the fixture

* Added remaining function tests

* Finished CSMCamera tests

* Flipped illumination vector

* Updated CameraFactory unitTest for new error message

* Removed campt couts

* Updated chip truth data for new camera factory error

* Re-fixed CameraFactory truth

* Changed Spice hasGroup to hasBlob for Target unit test

* Update camera plugin loading and add a check to csminit that the camera can be instantiated. (#4279)

* Update camera plugin loading and add a check to csminit that the camera model can be instantiated.

* Update csminit to restore original label contents if csminit fails

* Working on debugging an issue with saving and restoring the original csmstate blob if csminit fails

* Updated StringBlob to be able to read in and then write out the same blob without doubling it

* Update to use existing TargetName in label if not supplied by user.

Co-authored-by: Kristin Berry <[email protected]>

* Added campt and hasblob tests (#4283)

* Added campt and hasblob tests

* Fixed spacing

* Updated CSMCamera doc strings (#4282)

* Updated doc strings

* Added cmapt history

* Fixed typo in CSMCamera::sunPosition docs

* Get csminit tests passing (#4284)

* Update tests

* Get csminit tests passing

Co-authored-by: Kristin Berry <[email protected]>

* Updated UTC time conversions (#4288)

* Converted iTime test

* Modified iTime::setUtc to accept basic formats

* Update CSMCamera to use iTime::setUtc

* Removed old include

* docs clean-up

* Update csminit to work with an input state and add associated tests.

* Combined ISD vs State into single if else

* Added changelog and histories

* Removed duplicate error check

* Fixed review comments

* Added Sensor history comment

Co-authored-by: Kristin <[email protected]>
Co-authored-by: Kristin Berry <[email protected]>
  • Loading branch information
3 people authored Feb 19, 2021
1 parent cf27c7c commit 88112b9
Show file tree
Hide file tree
Showing 50 changed files with 4,522 additions and 1,284 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ release.

- Added the new csminit application and CSM Library loading to the IsisPreferences file. Together these allow users to get CSM state strings from ISD files. Once CSM camera model support is added, these will be used to setup a Cube to use a CSM camera model.
- Added a new application, topds4, which generates an output PDS4 XML label and a PDS4-compliant ISIS Cube from an input Cube, a PDS4 label template, and optionally additional input XML, PVL, or JSON data. The Inja templating engine is used to render the output PDS4 label from the label template. [#4246](https://github.com/USGS-Astrogeology/ISIS3/pull/4246)
- Added the ability to use a Community Sensor Model (CSM) instead of an ISIS camera model. To use a CSM sensor model with a Cube run the csminit application on the Cube instead of spiceinit.

### Fixed

Expand Down
3 changes: 3 additions & 0 deletions isis/src/base/apps/campt/campt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ End_Group
<change name="Kaitlyn Lee" date="2018-02-16">
Removed units on look direction vectors to make them unitless. Fixes #5125.
</change>
<change name="Kristin Berry, Jesse Mapel, and Stuart Sides" date="2021-02-10">
Modified to output Nulls when using a CSM Camera model and some values are not available.
</change>
</history>

<oldName>
Expand Down
360 changes: 267 additions & 93 deletions isis/src/base/apps/csminit/csminit.cpp

Large diffs are not rendered by default.

28 changes: 25 additions & 3 deletions isis/src/base/apps/csminit/csminit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
<change name="Jesse Mapel" date="2020-11-18">
Original Version
</change>
<change name="Jesse Mapel and Stuart Sides" date="2021-02-03">
Modified to always add a TargetName and Instrument group to the label for the camera model.
</change>
<change name="Kristin Berry and Stuart Sides" date="2021-02-10">
Modified to revert label and Cube changes on failure.
</change>
<change name="Kristin Berry and Stuart Sides" date="2021-02-12">
Added the ability to take a state string instead of an ISD.
</change>
</history>

<groups>
Expand All @@ -61,6 +70,7 @@
<parameter name="ISD">
<type>filename</type>
<fileMode>input</fileMode>
<internalDefault>none</internalDefault>
<brief>
The Instrument Support Data (ISD) file that will be used.
</brief>
Expand All @@ -69,18 +79,30 @@
model state string. The ISD can be just a filename ISD or a NITF2.1 ISD.
</description>
</parameter>

<parameter name="STATE">
<type>filename</type>
<internalDefault>none</internalDefault>
<fileMode>input</fileMode>
<brief>
A Community Sensor Model (CSM) state string
</brief>
<description>
A file containing a Community Sensor Model (CSM) state string that will be used to create the
model for the input cube.
</description>
</parameter>
</group>

<group name="Target Specification">
<parameter name="TARGETNAME">
<type>string</type>
<internalDefault>none</internalDefault>
<internalDefault>Current TargetName in input label or Unknown if not present.</internalDefault>
<brief>
The name of the body observed by the image.
</brief>
<description>
The name of the body observed by the image. If not entered, then the
target already listed on the label will be used.
The name of the body observed by the image.
</description>
</parameter>

Expand Down
18 changes: 16 additions & 2 deletions isis/src/base/apps/spiceinit/spiceinit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "PvlToPvlTranslationManager.h"
#include "SpiceClient.h"
#include "SpiceClientStarter.h"
#include "StringBlob.h"
#include "Table.h"
#include "UserInterface.h"
#include "spiceinit.h"
Expand Down Expand Up @@ -262,7 +263,7 @@ namespace Isis {
}
}
icube->deleteGroup("CsmInfo");
icube->deleteBlob("String","CSMState");

p.WriteHistory(*icube);
p.EndProcess();
}
Expand Down Expand Up @@ -377,6 +378,15 @@ namespace Isis {
currentKernels.addKeyword(iakKeyword, Pvl::Replace);
currentKernels.addKeyword(demKeyword, Pvl::Replace);

// Save off the CSM State so it can be restored if spiceinit fails
StringBlob csmState("", "CSMState");
if (icube->hasBlob("String", "CSMState")) {
icube->read(csmState);
}

// Delete the CSM State blob so that CameraFactory doesn't try to instantiate a CSMCamera
icube->deleteBlob("String", "CSMState");

// report qualities
PvlKeyword spkQuality("InstrumentPositionQuality");
spkQuality.addValue(Kernel::typeEnum(spk.type()));
Expand Down Expand Up @@ -478,6 +488,10 @@ namespace Isis {
log->addGroup(currentKernels);
}
icube->putGroup(originalKernels);

// restore CSM State blob if spiceinit failed
icube->write(csmState);

throw IException(e);
}

Expand Down Expand Up @@ -553,7 +567,7 @@ namespace Isis {

*icube->label() += cam->getStoredNaifKeywords();
}
//modify Kernels group only
// Modify Kernels group only
else {
Pvl *label = icube->label();
int i = 0;
Expand Down
Loading

0 comments on commit 88112b9

Please sign in to comment.