Skip to content

Add hide/show for single ROI#229

Closed
GhadeerAlbattarni wants to merge 1 commit intoImagingDataCommons:masterfrom
GhadeerAlbattarni:feat/single-roi-visibility
Closed

Add hide/show for single ROI#229
GhadeerAlbattarni wants to merge 1 commit intoImagingDataCommons:masterfrom
GhadeerAlbattarni:feat/single-roi-visibility

Conversation

@GhadeerAlbattarni
Copy link
Copy Markdown

Summary

This PR adds public viewer APIs to hide/show a single ROI by UID.

Motivation

This addresses a gap in the library API where consuming applications (like OHIF Viewer) need to toggle visibility of individual measurements/annotations via UI controls (e.g., eye icons in measurement panels). Without single-ROI visibility control, users could only hide/show all annotations at once.

Changes Made

New Public Methods in VolumeImageViewer:

hideROI(uid) - Hides an individual region of interest by its unique identifier

  • Sets feature geometry to invisible style while preserving original styleOptions
  • Hides associated markup overlays

showROI(uid) - Shows a previously hidden region of interest

  • Restores the feature geometry using stored styleOptions
  • Shows associated markup overlays

Test plan

  • Add a ROI, confirm it renders with its markup (if applicable).
  • Call hideROI(uid): ROI geometry disappears and its markup/link disappear.
  • Call showROI(uid): ROI geometry and markup/link return.

Comment thread src/viewer.js
const feature = this[_drawingSource].getFeatureById(uid)
if (!feature) return

feature.setStyle(_getOpenLayersStyle({}))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide and Show use a different approach to set the style. Can we have a consistent way?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feature.setStyle vs setFeatureStyle

Comment thread src/viewer.js

_setFeatureStyle(feature, styleOptions)

this[_annotationManager].setMarkupVisibility(uid, true)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of setting the style, could we set the feature's visibility? then no need to change styles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants