feat: serve motion-corrected micrograph preview image (#308)#312
Open
vredchenko wants to merge 1 commit into
Open
feat: serve motion-corrected micrograph preview image (#308)#312vredchenko wants to merge 1 commit into
vredchenko wants to merge 1 commit into
Conversation
Add GET /micrographs/{uuid}/micrograph_image, the leaf of the spatial
hierarchy that previously had no image endpoint (ADR 0021). Resolves in
order: the pre-downscaled JPEG snapshot served as-is (zero render), then
the motion-corrected MRC rendered to PNG with an optional x,y,w,h crop for
zoom parity with atlas_image, else 404.
Never reads high_res_path (the raw multi-GB movie stack). Returns 404
against today's data since the ingestion paths (#309) are still null;
behaviour is covered by unit tests over the real routing and render path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #308. Adds the serving half of ADR 0021: the micrograph leaf of the Atlas → Grid Square → Foil Hole → Micrograph hierarchy, which previously had no image endpoint (
FoilholeDetail.tsxrenders grey placeholders).Endpoint
GET /micrographs/{micrograph_uuid}/micrograph_imageresolves in order:motion_corrected_snapshot_path) — if set and on disk, streamed as-is viaFileResponse(image/jpeg), no decode/render. Structurally immune to the atlas-page OOM class.motion_corrected_image_path) — else rendered to PNG through the existing_render_image_png/_cached_image_responsehelpers, accepting the same optionalx,y,w,hcrop asatlas_imagefor future zoom parity.Never reads
high_res_path(the raw movie stack). Modeled on the existingatlas_image/gridsquare_imageendpoints (same helpers, cache headers, auth).Verification
test_micrograph_image.pydrives the real app viaTestClientacross all branches: 404 (missing micrograph), 404 (no paths), JPEG snapshot served and preferred over a present MRC path, and a real.mrcrendered to PNG. 54 route/image/consumer tests pass.whereclausefalse positive — the same SQLModel.where(Model.uuid == value)pattern already flagged 105× acrossapi_server.py(identical to_require_micrograph); matching the established idiom.Behaviour today
Against the current data every micrograph returns 404 (the ingestion paths from #309 are null until #310's cryoem-services adapter supplies them). Correct behaviour; a release is warranted once this and #311 land.