Skip to content

Commit

Permalink
Lro lidar infrastructure Added a new input parameter, FROMLIST to the…
Browse files Browse the repository at this point in the history
… user interface (#3162)

* Updated the cmake version to 3.10

* Adding configurations for gtest

* Tweaking things for gtest

* Got gtest working and made a small example test

* Updated the cmake version to be 3.10 or greater

* Added test file discovery support and seperated the main into another file

* Added more tests for FileName

* Updated with the new testing guidelines and added new tests.

* Added gmock

* PixelTest (#536)

* initial Pixel test

* Add more test cases for Pixel

* testing parameterization in Pixel test

* testing function parameterization

* parameterize static vs object methods

* basic PixelTests implementation

* clean up and more static tests

* update PixelTests with float/dbl expects

* Refactored stats to a functions

* Modified to have cubeit remove mosaic pixel tracking info from labels. Fixes #5533

* Update cubeit.xml

Fixed a typo

* Fixes conda channels in Jenkinsfile & adds a MacOS node (#633)

* Merged dev and cleaned up header conflicts

* Update for #619.

* Fix libtiff dependency (#636) (#644)

* Upgrade libtiff to 4.0.10 (#636)

* Switch libtiff to 4.0.9 or higher to remove geotiff conflict

* Moved ISIS3 conda-build recipe from ISIS3_deps repository (#650)

* Fixed warning in Pixel unit tests

* Removing build numbers from external libraries (#660)

* Moved ISIS3 conda-build recipe from ISIS3_deps repository

* Un-pinned non-astro build numbers

* Removing build numbers from external libraries in the environment and meta.yeml files

* Final merging

* Added pixel type attribute to the output image of program shadow. Fixes #5187 (#659)

* Removed bolding of some text to decrease distraction.

* Fixed some typos.

* Reworded documentation.

* Added section for Environment and PreferemcesSetup in the Getting Started Section. (#663)

* Updated .gitmodules to use https rather than ssh (#673)

* Added build type release to conda recipe (#676)

* Updates README with Discourse (#690)

* Updates README with Discourse

* Update README.md

* Update README.md

* Added fix to Spice Server to accept clients with version nums >=3.5.*.* (#780)

* Fixed error when trying to export a compressed image using pds2hideal. Fixes #5525. (#2059)

* Added capability to export a compressed image with tables missing RECORD_BYTES keyword. Added test for compressed image.

* Changed names of test output cubes.

* Adding explanatory comments to the meta.yaml file (#2358)

* Adding explanatory comments to the recipes/meta.yaml

* Replacing accidentally erased line

* Added option to sort the output for consistent order in testing and added a test case

* Cleaned up commented out lines in LidarData.h and .cpp

* Added additional documentation for LidarData, LidarControlPoint, and lrolola2isis

* Multisegment DSK support for Bullet engine (#2791)

* Merged multisegment DSKs for Bullet

* basic tests

* removed original tests

* Minor updates to download sizes and some text. (#2790)

* Removed debug lines from LidarData.cpp and old comments from the lrolola2isis twoImage test

* Added an additional comment about the Test format to LidarData.cpp

* Phocube will export RA and declination planes even if the point is not on the planet. Fixes #4446 (#657)

* Made it so that RA and Dec are added last.

* Updated code to be up to standards.

* Added RA and dec test.

* Updated history comment.

* Renamed test.

* Fixed typo in documentation

* Refactored code so that RA and dec are placed in the correct bands instead of moving them to the last two bands.

* Updated documentation, test now checks cube label.

* Fixed SummingMode keyword being set in tgocassis2isis  (#2847)

* Adding Expanded keyword to cassis label and modifying SummingMode keyword

* Updating the window count value

* Adding capacity to handle imports without Expanded tag

* Setting tgocassismos to have tracking turned-on (#2856)

* Adding parameter "tracking=true" to tgocassismos call to automos

* Adding documentation

* Fixing indentation in documentation

* Updates to tgocassisrdrgen and ProcessExportPds4 to add content to exported CaSSIS Label. (#2858)

* Add 32-bit ISIS Special Pixel Constants to ProcessExportPds4

* Add ability to set title and version id in exported PDS4 produce in tgocassisrdrgen and ProcessExportPds4 API

* Fix bug that occurs when exporting mosaics with Archive groups and fixed min/max lat/lon to east/west bounding box positive east flip bug

* Added docs.

* Update schema to most recent versions and comment-out schema that isn't used (temporarily) in tgocassisrdrgen.

* Adds Issue Templates to Issues (#664)

* Adds issue templates

* Verbage update

* Updates issue template for questions (#3131)

Removed a newline in the header that I believe was causing the automatic template detection to fail.

* Added gtest for ID and split TestUtilities into a cpp and h file to fix duplicate symbol error when building. (#2824)

Code reviewed and tested

* tgocassisrdrgen exported label re-order.  (#3135)

* Add 32-bit ISIS Special Pixel Constants to ProcessExportPds4

* Add ability to set title and version id in exported PDS4 produce in tgocassisrdrgen and ProcessExportPds4 API

* Fix bug that occurs when exporting mosaics with Archive groups and fixed min/max lat/lon to east/west bounding box positive east flip bug

* Added docs.

* Update schema to most recent versions and comment-out schema that isn't used (temporarily) in tgocassisrdrgen.

* Added reorder function to ProcessExportPds4 to reorder xml files generated in the wrong order for PDS4 and added cassis-specific schema

* Update label generated by tgocassisrdrgen from additional feedback (#3137)

* Add 32-bit ISIS Special Pixel Constants to ProcessExportPds4

* Add ability to set title and version id in exported PDS4 produce in tgocassisrdrgen and ProcessExportPds4 API

* Fix bug that occurs when exporting mosaics with Archive groups and fixed min/max lat/lon to east/west bounding box positive east flip bug

* Added docs.

* Update schema to most recent versions and comment-out schema that isn't used (temporarily) in tgocassisrdrgen.

* Added reorder function to ProcessExportPds4 to reorder xml files generated in the wrong order for PDS4 and added cassis-specific schema

* Add StopTime to tgocassismos's Mosaic PVL group, as it is required for PDS4 export. Also, fix time formatting and east_azimuth units

* Remove comment

* Changed global variable proj back to projection to avoid build ambiguity errors with the std::proj

* Added option to enter a list of Lidar input files

* Removed deprecated code requiring target body radii to convert point coordinate sigmas from distances to angles in lrololo2isis
  • Loading branch information
dcookastro authored and kledmundson committed Mar 13, 2019
1 parent 7b24c75 commit 2ed006e
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 113 deletions.
20 changes: 1 addition & 19 deletions isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,24 +429,6 @@ namespace Isis {
}


/**
* Allows mission specific programs to set version_id
* required for PDS4 labels. This value is added to the xml file
* by the identificationArea() method.
*
* The input string should be colon separated string with 6
* identifiers:
*
* @author 2019-03-01 Kristin Berry
*
* @param versiondId The version_id value required for PDS4
* compliant labels.
*/
void ProcessExportPds4::setVersionId(QString versionId) {
m_versionId = versionId;
}


/**
* Allows mission specific programs to set the title
* required for PDS4 labels. This value is added to the xml file
Expand All @@ -462,7 +444,7 @@ namespace Isis {
}


/**
/**
* Allows mission specific programs to use specified
* versions of dictionaries.
*
Expand Down
40 changes: 37 additions & 3 deletions isis/src/lro/apps/lrolola2isis/lrolola2isis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@
</change>
<change name="Debbie A Cook" date="2019-02-23">
Added new file OUTPUTTYPE=TEST, to be used strictly for testing.
This option does a SLOW sort on the output data. References #5343.
This option does a SLOW sort on the output data. The resulting output file
is sorted by pointID, which allows testing software to compare
output with truth data. References #5343.
</change>
<change name="Debbie A Cook" date="2019-03-11">
Added new input parameter FROMLIST to allow entering multiple input
Lidar CSV files. All input points are written out into a single Lidar data file.
</change>
</history>

Expand All @@ -57,16 +63,44 @@
<type>filename</type>
<fileMode>input</fileMode>
<brief>
Input LOLA Lidar CSV
Input LOLA Lidar RDR data in CSV format
</brief>
<description>
This file is a complied CSV with data from LOLA.
This file is downloaded from Washington University at

"https://ode.rsl.wustl.edu/moon/indextools.aspx?displaypage=lolardr"

It contains altimetry readings organized along the spacecraft orbit track.

</description>
<exclusions>
<item>FROMLIST</item>
</exclusions>
<filter>
*.csv
</filter>
</parameter>

<parameter name="FROMLIST">
<type>filename</type>
<fileMode>input</fileMode>
<internalDefault>None</internalDefault>
<brief>
Input LOLA Lidar CSV file list from which to generate the Lidar control point file
</brief>
<description>
This file contains a list of CSV files of LOLA Lidar RDR that will be used to generate
an Isis Lidar control point file. Each file in FROMLIST is expected to be a CSV with
LOLA Lidar RDR data. See FROM for more information on the data.
</description>
<exclusions>
<item>FROM</item>
</exclusions>
<filter>
*.lis
</filter>
</parameter>

<parameter name="CUBES">
<type>filename</type>
<fileMode>input</fileMode>
Expand Down
167 changes: 76 additions & 91 deletions isis/src/lro/apps/lrolola2isis/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "FileName.h"
#include "ID.h"

#include "FileList.h"
#include "IException.h"
#include "iTime.h"
#include "Latitude.h"
Expand All @@ -36,8 +37,19 @@ struct LidarCube {

void IsisMain() {

FileList filelist;
UserInterface &ui = Application::GetUserInterface();
FileName dataFile = ui.GetFileName("FROM");

// Get the Lidar csv data from either/or both FROM and FROMLIST
if (ui.WasEntered("FROM")) filelist.push_back(FileName(ui.GetFileName("FROM")));
if (ui.WasEntered("FROMLIST")) filelist.read(FileName(ui.GetFileName("FROMLIST")));

if (filelist.size() < 1) {
QString msg =
"Input CSV files must be specified in FROM and/or FROMLIST - no files were found.";
throw IException(IException::User,msg,_FILEINFO_);
}

SerialNumberList cubeList = SerialNumberList(ui.GetFileName("CUBES"));
double threshold = ui.GetDouble("THRESHOLD");
double rangeSigma = ui.GetDouble("POINT_RANGE_SIGMA");
Expand All @@ -56,6 +68,7 @@ void IsisMain() {
radiusSigma = ui.GetDouble("POINT_RADIUS_SIGMA");
}

// Read necessary label information from cubes
QList<LidarCube> images;

for (int i = 0; i < cubeList.size(); i++) {
Expand All @@ -73,8 +86,6 @@ void IsisMain() {
images.append(lidarCube);
}

CSVReader lidarDataFile;
lidarDataFile.read(dataFile.expanded());
LidarData lidarDataSet;
CubeManager cubeMgr;
Distance majorAx;
Expand All @@ -84,110 +95,84 @@ void IsisMain() {
// Set up an automatic id generator for the point ids
ID pointId = ID(ui.GetString("POINTID"));

//Start at 1 because there is a header. TODO actually set a header in lidarDataFile
for (int i = 1; i < lidarDataFile.rows(); i++) {
CSVReader::CSVAxis row = lidarDataFile.getRow(i);

iTime time(row[0]);
Latitude lat(row[2].toDouble(), Angle::Units::Degrees);
Longitude lon(row[1].toDouble(), Angle::Units::Degrees);
Distance radius(row[3].toDouble(), Distance::Units::Kilometers);
double range = row[4].toDouble();
// QString quality = row[]; //TODO figure out how/where to find this value
// Loop through Lidar csv data file(s) and load the data into a single LidarData object, LidarDataSet
for (int ifile = 0; ifile < filelist.size(); ifile++) {
CSVReader lidarDataFile;
lidarDataFile.read(filelist[ifile].expanded());

// Start at 1 to skip the header. TODO actually set a header in lidarDataFile

for (int i = 1; i < lidarDataFile.rows(); i++) {
CSVReader::CSVAxis row = lidarDataFile.getRow(i);

iTime time(row[0]);
Latitude lat(row[2].toDouble(), Angle::Units::Degrees);
Longitude lon(row[1].toDouble(), Angle::Units::Degrees);
Distance radius(row[3].toDouble(), Distance::Units::Kilometers);
double range = row[4].toDouble();
// QString quality = row[]; //TODO figure out how/where to find this value

LidarControlPoint *lidarPoint = new LidarControlPoint;
lidarPoint->SetId(pointId.Next());

lidarPoint->setTime(time);
lidarPoint->setRange(range);
lidarPoint->setSigmaRange(rangeSigma);

// Just set the point coordinates for now. We need to wait until we set
// the target radii to be able to set the coordinate sigmas. The sigmas
// will be converted to angles and the target radii are needed to do that.
SurfacePoint spoint(lat, lon, radius);
// lidarPoint->SetAprioriSurfacePoint(SurfacePoint(lat, lon, radius));
LidarControlPoint *lidarPoint = new LidarControlPoint;
lidarPoint->SetId(pointId.Next());

lidarPoint->setTime(time);
lidarPoint->setRange(range);
lidarPoint->setSigmaRange(rangeSigma);

// Set the point coordinates and their sigmas and add to the Lidar Control Point file
SurfacePoint spoint(lat, lon, radius);
spoint.SetSphericalSigmasDistance(
Distance(latSigma, Distance::Units::Meters),
Distance(lonSigma, Distance::Units::Meters),
Distance(radiusSigma, Distance::Units::Meters));
lidarPoint->SetAprioriSurfacePoint(spoint);

bool setSurfacePointRadii = true;

for (int j = 0; j < images.size(); j++) {
Cube *cube = cubeMgr.OpenCube(images[j].name.expanded());
// Loop through images to set measures in the Lidar Control Point
for (int j = 0; j < images.size(); j++) {
Cube *cube = cubeMgr.OpenCube(images[j].name.expanded());

if (cube != NULL) {
if (cube != NULL) {
Camera *camera = cube->camera();

Camera *camera = cube->camera();

if (camera != NULL) {
if (camera->SetGround(spoint)) {
double samp = camera->Sample();
double line = camera->Line();
if (camera != NULL) {
if (camera->SetGround(spoint)) {
double samp = camera->Sample();
double line = camera->Line();

if (samp > 0.5 - threshold && line > 0.5 - threshold
&& samp < camera->Samples() + .5 && line < camera->Lines() + .5) {

ControlMeasure *measure = new ControlMeasure;

measure->SetCoordinate(camera->Sample(), camera->Line());
measure->SetCubeSerialNumber(images[j].sn);

if (setSurfacePointRadii) {
// Get the radii and set the radii in the SurfacePoint
std::vector<Distance> targetRadii;
targetRadii = camera->target()->radii();
majorAx = targetRadii[0];
minorAx = targetRadii[1];
polarAx = targetRadii[2];
setSurfacePointRadii = false;
spoint.SetSphericalSigmasDistance(
Distance(latSigma, Distance::Units::Meters),
Distance(lonSigma, Distance::Units::Meters),
Distance(radiusSigma, Distance::Units::Meters));
lidarPoint->SetAprioriSurfacePoint(spoint);
// if (camera->target()->shape()->hasValidTarget()) {
// targetRadii = camera->target()->shape()->targetRadii();
// }
// else {
// QString msg = "Valid target not defined in shape model ";
// throw IException(IException::Unknown, msg, _FILEINFO_);
// }

// targid = camera->SpkTargetId();
// Distance targetRadii[3];
// camera0>getDouble(
// camera->radii(targetRadii);
// majorAx = targetRadii[0];
// minorAx = targetRadii[1];
// polarAx = targetRadii[2];
// setSurfacePointRadii = false;
}

lidarPoint->Add(measure);
if (time >= images[j].startTime && time <= images[j].endTime) {
QString newSerial = measure->GetCubeSerialNumber();
lidarPoint->addSimultaneous(newSerial);
if (samp > 0.5 - threshold && line > 0.5 - threshold
&& samp < camera->Samples() + .5 && line < camera->Lines() + .5) {
ControlMeasure *measure = new ControlMeasure;
measure->SetCoordinate(camera->Sample(), camera->Line());
measure->SetCubeSerialNumber(images[j].sn);
lidarPoint->Add(measure);
if (time >= images[j].startTime && time <= images[j].endTime) {
QString newSerial = measure->GetCubeSerialNumber();
lidarPoint->addSimultaneous(newSerial);
}
}
}
}
else {
QString msg = "Unable to create a camera from " + images[j].name.expanded();
throw IException(IException::Unknown, msg, _FILEINFO_);
}
}
else {
QString msg = "Unable to create a camera from " + images[j].name.expanded();
QString msg = "Unable to open a cube from " + images[j].name.expanded();
throw IException(IException::Unknown, msg, _FILEINFO_);
}
}
}
else {
QString msg = "Unable to open a cube from " + images[j].name.expanded();
throw IException(IException::Unknown, msg, _FILEINFO_);
}
}
// end image loop
// end image loop

if (lidarPoint->GetNumMeasures() <= 0 ||
lidarPoint->snSimultaneous().size() <=0) {
continue;
}
continue;
}

lidarDataSet.insert(QSharedPointer<LidarControlPoint>(lidarPoint));
}
lidarDataSet.insert(QSharedPointer<LidarControlPoint>(lidarPoint));
} // End loop on lidarDataFile rows
lidarDataFile.clear();
} // End loop on lidar data file list


if (ui.GetString("OUTPUTTYPE") == "JSON") {
Expand Down

0 comments on commit 2ed006e

Please sign in to comment.