feat: add click-to-zoom for segments - #429
Conversation
Add onClick handler to SegmentItem to zoom to segment's bounding box when the segment label is clicked. This is consistent with the bulk annotation zoom behavior and provides a better UX than auto-zooming on visibility toggle. Changes: - Add onClick prop to SegmentItem and SegmentList components - Add handleSegmentClick method in SlideViewer - Update dicom-microscopy-viewer types with zoomToSegment method
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| JavaScript | Aug 31, 2026 3:48p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
📦 Firebase Preview - Using Published DMVThis preview is using the published
|
|
Visit the preview URL for this PR (updated for commit 70fcdd8): https://idc-external-006--pr429-feat-segment-click-t-apkhs5og.web.app (expires Mon, 07 Sep 2026 15:52:14 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 88aacecd98ba54d2f9c8d201a9444e43d1ad8307 |
📦 Firebase Preview - Using Published DMVThis preview is using the published
|
🔗 Firebase Preview - Linked to DMV BranchThis preview is using a linked
|
Add the ability to configure OIDC settings through the server selection modal UI. This allows users to connect to servers that require different authentication providers without needing to redeploy the application. Changes: - Add OIDC config textarea input in server selection modal - Add info icon with tooltip showing example JSON format - Validate JSON format and required fields (authority, clientId, scope) - Cache OIDC config in localStorage - Recreate OidcManager when OIDC config is provided - Support optional fields: grantType, authorizationEndpoint, endSessionEndpoint The OIDC configuration is optional - if not provided, the existing config from the deployment is used. If provided, it overwrites the current OIDC settings.
🔗 Firebase Preview - Linked to DMV BranchThis preview is using a linked
|
- Add normalizeToJson helper to convert JS object notation to JSON
(allows unquoted keys like { authority: "..." } instead of requiring
{ "authority": "..." })
- Load and apply cached OIDC config in componentDidMount
- Create new OidcManager with cached config before signIn is called
- This ensures OIDC auth flow is triggered on page reload when
custom OIDC config is saved in localStorage
🔗 Firebase Preview - Linked to DMV BranchThis preview is using a linked
|
|
@CPBridge You can try this firebase preview to test the PanopTILs segmentations but since these require authentication you need to set up oidc in the server selector menu of slim and also allow the firebase preview url as valid origin in your oauth (gcp console). You can also test this locally if you link this slim branch with the dmv branch https://github.com/ImagingDataCommons/dicom-microscopy-viewer/tree/fix/tiled-sparse-segmentation-alignment.
|
- Make parseCachedOidcConfig static in App.tsx (JS-0105) - Make normalizeToJson static in Header.tsx (JS-0105) - Prefix unused onClick destructure with underscore in SegmentItem.tsx (JS-0356)
- Make isValidOidcConfig and parseOidcConfig static in Header.tsx (JS-0105) - Add @parcel/watcher to onlyBuiltDependencies in .npmrc for pnpm 11 compatibility
|
🔗 Firebase Preview - Linked to DMV BranchThis preview is using a linked
|
|
@igoroctaviano @fedorov I tried this out with the demo files from panoptils and it looks good. However, the click to zoom behavior isn't really working as I would expect. It pans to roughly the right place but is far more zoomed out than the size of the segment. For example this is the result of clicking on the segment show in yellow (nuclei that you can just about see slightly to the right of the center of this screenshot)
|
I noticed that and forgot to fix. i'll take a look. |
|
@CPBridge Thanks for testing! I've pushed a fix to address the zoom behavior. The issue: For TILED_SPARSE segmentations with scattered features (like nuclei annotations spread across a large region), the segment's bounding box encompasses ALL frames for that segment. When clicking "zoom to segment", the viewer was fitting the entire bounding box - which could span a very large area, resulting in a very zoomed-out view. The fix: The The fix is in the dmv branch: ImagingDataCommons/dicom-microscopy-viewer@947fd74 Could you please test again with the panoptils data to see if the zoom behavior is improved? |
|
Update: I revised the fix after code review to avoid potential regressions. The original 1.5x threshold was too aggressive and could affect normal segments (tumor regions, lesions) that span several tiles but should still be shown in full. Revised approach: Changed the threshold to 10x viewport size. This ensures:
The 10x threshold is intentionally conservative to only catch truly scattered cases like the panoptils data while preserving expected behavior for standard segmentations. Updated commit: ImagingDataCommons/dicom-microscopy-viewer@ca2cd23 |






dmv-branch: fix/tiled-sparse-segmentation-alignment
Summary
Related to #371
This PR adds two features:
1. Click-to-zoom for segments
Add click-to-zoom functionality for segments, matching the existing behavior of bulk annotations.
onClickprop toSegmentItemcomponentonSegmentClickprop toSegmentListcomponenthandleSegmentClickmethod inSlideViewerthat callszoomToSegmenton the viewerdicom-microscopy-viewertype definitions withzoomToSegmentmethodUser Experience:
2. Optional OIDC configuration in server selection
Add the ability to configure OIDC settings through the server selection modal UI. This allows users to connect to servers that require different authentication providers without needing to redeploy the application.
Example OIDC config JSON:
{ "authority": "https://accounts.google.com", "clientId": "your-client-id.apps.googleusercontent.com", "scope": "email profile openid https://www.googleapis.com/auth/cloud-healthcare", "grantType": "implicit" }The OIDC configuration is optional - if not provided, the existing config from the deployment is used. If provided, it overwrites the current OIDC settings.
Accessibility
<button>element for the clickable segment areaDependencies
This PR depends on the corresponding change in dicom-microscopy-viewer that adds the
zoomToSegmentmethod:Test Plan