Have cam2map create results as ASP's mapproject#5988
Have cam2map create results as ASP's mapproject#5988acpaquette merged 13 commits intoDOI-USGS:devfrom
Conversation
|
The build and test suite have started for your pull request. To view your build log, please reference the build with source version: "PR_5988". Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch. |
|
The build and test suite have started for your pull request. To view your build log, please reference the build with source version: "PR_5988". Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch. |
|
Looks like any pull request is failing at: ObservationPair.FunctionalTestJigsawOutputCsmState. |
|
@oleg-alexandrov That test is also failing on dev so this PR is clean |
|
The build and test suite have started for your pull request. To view your build log, please reference the build with source version: "PR_5988". Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch. |
1 similar comment
|
The build and test suite have started for your pull request. To view your build log, please reference the build with source version: "PR_5988". Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch. |
|
The build and test suite have started for your pull request. To view your build log, please reference the build with source version: "PR_5988". Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch. |
|
The build and test suite have started for your pull request. To view your build log, please reference the build with source version: "PR_5988". Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch. |
|
Getting auth error unrelated to the actual code. |
|
@oleg-alexandrov I think Amy fixed the auth issues for running tests. Could you rebase this off dev and push to get a clean test run? |
On macOS, `ulimit -n unlimited` returns a very large value that overflows the unsigned int cast in CubeManager, producing 0 and causing a null pointer dereference. Fix by capping at a reasonable maximum (8192) and using size_t to avoid the overflow.
Implement a new asp_map=true mode in cam2map that performs per-pixel exact camera model evaluation, matching ASP mapproject output. For each output pixel, compute the full ground->image transform through the camera model and DEM ray intersection, bypassing the patch-based affine approximation in ProcessRubberSheet. New files: - AspMapProjection.cpp: per-pixel projection engine, GeoRef class with GDAL-based coordinate transforms, RasterReader with ISIS Portal-based tiled I/O and VW-matching bicubic interpolation, grid computation (auto bbox/GSD from camera footprint, snapping), option handling (map= files via GDAL and PVL, matchmap, PPD, lat/lon bounds override), pvlToWkt for 12 ISIS projections, PVL metadata output. - AspMapProjection.h: header declarations. Modified files: - cam2map.cpp: wire asp_map mode, call asp::mapproject() when enabled. - cam2map.xml: add ASP_MAP (bool) and DEM (filename) parameters. Parity with ASP mapproject: ~1e-6 max abs diff on LROC NAC stereo pair, tested across equicylindrical, sinusoidal, stereographic, and polar stereographic projections.
Add TEST_F(DemCube, FunctionalTestCam2mapAspMap) that exercises the asp_map=true path with equirectangular projection, explicit GSD and bounds from a map file. Verifies the output cube has correct dimensions and projection metadata.
Add Cube::addInMemoryBlob() to inject a blob without modifying the file on disk. Add ISD parameter to cam2map.xml. When provided, loadCsmIntoCube() constructs a CSM camera from the ISD, serializes its state into a CSMState blob, and injects it into the cube so cube->camera() returns a CSMCamera.
Add band-dependent camera handling in ASP_MAP mode. Extracted projectPixel() helper. Cached input image coords per output line to avoid redundant re-projection across bands. For band-dependent cameras (THEMIS IR, CRISM), SetBand() called per band with full re-projection. For band-independent cameras, project once and reuse. Unified PPD-to-MPP conversion via ppdToMpp helper. Added clarifying comments for the spherical-radius bake-in behavior.
Add pixel-value accuracy check to FunctionalTestCam2mapAspMap (valid pixel count + DN range). Add FunctionalTestCam2mapAspMapMultiBand (3-band mock camera, band-independent). Extract shared checkPixelValues() helper. Add FunctionalTestCam2mapAspMapCsm (CSM framer using orbitalMarsFramer.json, auto-detects USGSCSM plugin). Add FunctionalTestCam2mapAspMapMatchmapPvl (matchmap=true with PVL .map file, self-consistency test exercising computeAutoGrid and readGridFromPvl). Fix buildAspGroup to write CAMERA_MODEL_TYPE=csm when ISD is provided. Add unsupported projection error test. Enhance main ASP_MAP GTest with sinusoidal projection, user lat/lon bounds (20% inset), and bounds verification.
Use ISIS Progress class when ProgressBar=On in user preferences (feeds the GUI progress bar). Fall back to manual std::cout percentage when ProgressBar=Off (the default). Print "Writing:" before projection starts. Gate DEM and ISD parameters behind ASP_MAP in cam2map.xml (grayed out in GUI when ASP_MAP is off). Improve error messages for unsupported PVL projections. Rename snap_ulx/uly and deltax/y to camelCase. Add pixel-edge vs pixel-center convention comments. Simplify validateUi to silently ignore unsupported DEFAULTRANGE values. Replace non-ASCII em-dash with ASCII hyphen.
…-trip Add CSMCamera(Cube&, pluginName, modelName, stateString) constructor that calls init() directly, avoiding the blob serialize/deserialize round-trip when loading CSM cameras from ISD files. Add Cube::setCamera() to set a pre-constructed camera on a cube. Update cam2map ASP_MAP mode to use the new constructor instead of addInMemoryBlob.
The CSM test changed ISISROOT to CONDA_PREFIX when the build dir lacked csmplugins. This broke ISIS file lookups for CubeFormatTemplate.pft on CI. CSM plugin loading already works via TestPreferences which lists CONDA_PREFIX paths. Added try/catch as safety net for environments where CSM setup is incomplete.
9b69419 to
e85f1ba
Compare
|
Thanks. Looks like the workflow needs approval. |
|
@oleg-alexandrov I think the auth token for our ci may have expired. Working on getting this back up and running |
|
The build and test suite have started for your pull request. To view your build log, please reference the build with source version: "PR_5988". Additionally, check the latest "dev" source version to identify existing test failures. Please note that you are not responsible for the test failures that exist on both your PR and the dev branch. |
|
The build went through with no failures. |
* Fix CubeManager overflow when ulimit is unlimited On macOS, `ulimit -n unlimited` returns a very large value that overflows the unsigned int cast in CubeManager, producing 0 and causing a null pointer dereference. Fix by capping at a reasonable maximum (8192) and using size_t to avoid the overflow. * Add ASP_MAP per-pixel exact projection mode to cam2map Implement a new asp_map=true mode in cam2map that performs per-pixel exact camera model evaluation, matching ASP mapproject output. For each output pixel, compute the full ground->image transform through the camera model and DEM ray intersection, bypassing the patch-based affine approximation in ProcessRubberSheet. New files: - AspMapProjection.cpp: per-pixel projection engine, GeoRef class with GDAL-based coordinate transforms, RasterReader with ISIS Portal-based tiled I/O and VW-matching bicubic interpolation, grid computation (auto bbox/GSD from camera footprint, snapping), option handling (map= files via GDAL and PVL, matchmap, PPD, lat/lon bounds override), pvlToWkt for 12 ISIS projections, PVL metadata output. - AspMapProjection.h: header declarations. Modified files: - cam2map.cpp: wire asp_map mode, call asp::mapproject() when enabled. - cam2map.xml: add ASP_MAP (bool) and DEM (filename) parameters. Parity with ASP mapproject: ~1e-6 max abs diff on LROC NAC stereo pair, tested across equicylindrical, sinusoidal, stereographic, and polar stereographic projections. * Add GTest for cam2map ASP_MAP mode Add TEST_F(DemCube, FunctionalTestCam2mapAspMap) that exercises the asp_map=true path with equirectangular projection, explicit GSD and bounds from a map file. Verifies the output cube has correct dimensions and projection metadata. * Add changelog entry for PR DOI-USGS#5988 * Fix bbox-to-grid, GSD fallback, DEM validation, remove debug prints * Add CSM camera support via ISD parameter in cam2map ASP_MAP mode Add Cube::addInMemoryBlob() to inject a blob without modifying the file on disk. Add ISD parameter to cam2map.xml. When provided, loadCsmIntoCube() constructs a CSM camera from the ISD, serializes its state into a CSMState blob, and injects it into the cube so cube->camera() returns a CSMCamera. * Add multi-band support with band-dependent camera handling Add band-dependent camera handling in ASP_MAP mode. Extracted projectPixel() helper. Cached input image coords per output line to avoid redundant re-projection across bands. For band-dependent cameras (THEMIS IR, CRISM), SetBand() called per band with full re-projection. For band-independent cameras, project once and reuse. Unified PPD-to-MPP conversion via ppdToMpp helper. Added clarifying comments for the spherical-radius bake-in behavior. * Add GTests: multi-band, CSM camera, matchmap PVL, pixel-value checks Add pixel-value accuracy check to FunctionalTestCam2mapAspMap (valid pixel count + DN range). Add FunctionalTestCam2mapAspMapMultiBand (3-band mock camera, band-independent). Extract shared checkPixelValues() helper. Add FunctionalTestCam2mapAspMapCsm (CSM framer using orbitalMarsFramer.json, auto-detects USGSCSM plugin). Add FunctionalTestCam2mapAspMapMatchmapPvl (matchmap=true with PVL .map file, self-consistency test exercising computeAutoGrid and readGridFromPvl). Fix buildAspGroup to write CAMERA_MODEL_TYPE=csm when ISD is provided. Add unsupported projection error test. Enhance main ASP_MAP GTest with sinusoidal projection, user lat/lon bounds (20% inset), and bounds verification. * Add ISIS Progress integration, GUI param gating, code cleanup Use ISIS Progress class when ProgressBar=On in user preferences (feeds the GUI progress bar). Fall back to manual std::cout percentage when ProgressBar=Off (the default). Print "Writing:" before projection starts. Gate DEM and ISD parameters behind ASP_MAP in cam2map.xml (grayed out in GUI when ASP_MAP is off). Improve error messages for unsupported PVL projections. Rename snap_ulx/uly and deltax/y to camelCase. Add pixel-edge vs pixel-center convention comments. Simplify validateUi to silently ignore unsupported DEFAULTRANGE values. Replace non-ASCII em-dash with ASCII hyphen. * Add CSMCamera string constructor, use setCamera instead of blob round-trip Add CSMCamera(Cube&, pluginName, modelName, stateString) constructor that calls init() directly, avoiding the blob serialize/deserialize round-trip when loading CSM cameras from ISD files. Add Cube::setCamera() to set a pre-constructed camera on a cube. Update cam2map ASP_MAP mode to use the new constructor instead of addInMemoryBlob. * Remove unused addInMemoryBlob function per review feedback * Fix CSM GTest crash on CI: stop overwriting ISISROOT The CSM test changed ISISROOT to CONDA_PREFIX when the build dir lacked csmplugins. This broke ISIS file lookups for CubeFormatTemplate.pft on CI. CSM plugin loading already works via TestPreferences which lists CONDA_PREFIX paths. Added try/catch as safety net for environments where CSM setup is incomplete. * Minor wording fix: map-projected to mapprojected
Description
This adds to cam2map the option asp_map=true that produces mapprojected cubes in agreement with ASP at each grid point.
Documentation: https://stereopipeline.readthedocs.io/en/latest/tools/mapproject.html#isis-compatibility
Relevant issue: #5984
I added a unit test. I will put some more.
This does not bring over any classes from ASP. Projections are done with GDAL and the image processing with the ISIS logic.
It would be good to get some review on this as there is quite some new logic.
Related Issue
How Has This Been Validated?
Types of changes
Checklist:
Licensing
This project is mostly composed of free and unencumbered software released into the public domain, and we are unlikely to accept contributions that are not also released into the public domain. Somewhere near the top of each file should have these words: