Update convert shapes to use image class#111
Conversation
|
|
Overall Grade |
Security Reliability Complexity Hygiene Coverage |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Python | Apr 3, 2026 4:03p.m. | Review ↗ | |
| Test coverage | Apr 3, 2026 4:04p.m. | Review ↗ |
Code Coverage Summary
| Language | Line Coverage (New Code) | Line Coverage (Overall) |
|---|---|---|
| Aggregate | 100% |
100% |
| Python | 100% |
100% |
➟ Additional coverage metrics may have been reported. See full coverage report ↗
There was a problem hiding this comment.
Pull request overview
This PR migrates several geospatial conversion/transform utilities from using plantcv.Spectral_data.metadata[...] to the new plantcv.geospatial.images.GEO interface (.crs, .transform, .thumb) and updates tests/docs accordingly as part of the broader Image/GEO/DSM migration (Issue #110).
Changes:
- Update
transform_polygons,convert.points,convert.shapes,convert.to_roi, and_helpers._transform_geojson_crsto useGEOattributes (img.crs,img.transform,img.thumb). - Update test fixtures/usages to load a pickled
GEOobject instead of a pickledSpectral_dataobject. - Update docs to reference
GEOand useimg.thumbin examples; adddilldependency.
Reviewed changes
Copilot reviewed 18 out of 20 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
plantcv/geospatial/transform_polygons.py |
Switch from img.metadata["transform"] to img.transform. |
plantcv/geospatial/_helpers.py |
Switch CRS comparison/transform to img.crs. |
plantcv/geospatial/convert/points.py |
Use img.transform/img.crs for geojson IO. |
plantcv/geospatial/convert/shapes.py |
Use img.transform/img.crs for geojson IO. |
plantcv/geospatial/convert/to_roi.py |
Update docs/types and draw ROIs on img.thumb. |
plantcv/geospatial/create_shapes/interactive_shapes.py |
Display img.thumb in Napari viewer instead of img.pseudo_rgb. |
tests/test_geospatial_transform_polygons.py |
Load GEO from pickle and relax assertions. |
tests/test_geospatial_helpers.py |
Load GEO from pickle; assert CRS via img.crs. |
tests/create_shapes/test_geospatial_interactive_shapes.py |
Load GEO from pickle in InteractiveShapes tests. |
tests/convert/test_geospatial_to_roi.py |
Load GEO from pickle; change/relax ROI contour assertions. |
tests/convert/test_geospatial_shapes.py |
Load GEO from pickle; use img.thumb for viewer image. |
tests/convert/test_geospatial_points.py |
Load GEO from pickle; use img.thumb for viewer image. |
tests/conftest.py |
Add geo_pickled/dsm_pickled testdata paths and update comments. |
docs/to_roi.md |
Update parameter description to GEO (but introduces an API reference mismatch). |
docs/convert_shapes.md |
Update parameter docs to GEO and example to img.thumb. |
docs/convert_points.md |
Update parameter docs to GEO. |
docs/InteractiveShapes.md |
Update parameter docs to GEO (but introduces markdown formatting issue). |
pyproject.toml |
Add dill dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "rasterstats", | ||
| "joblib", | ||
| "netCDF4", | ||
| "altair < 6" | ||
| "altair < 6", | ||
| "dill" | ||
| ] |
There was a problem hiding this comment.
dill is only imported/used in the test suite, but it's being added to the package's required runtime dependencies. This forces all library users to install dill even when they don't run tests. Consider moving dill to [project.optional-dependencies].test (or switching the fixtures back to stdlib pickle/joblib) so the core install remains minimal.
joshqsumner
left a comment
There was a problem hiding this comment.
This looks good to me!
Describe your changes
This PR updates several functions to use the new GEO image class instead of a spectral object. The following functions needed to be bundled because of overlap in helper usage:
class.InteractiveShapesconvert.pointsconvert.shapesconvert.to_roitransform_polygons_helpers._transform_geojson_crsType of update
Associated issues
Addresses part of #110
For the reviewer
See this page for instructions on how to review the pull request.
plantcv-geospatial/mkdocs.ymlchangelog.md