Skip to content

Conversation

@GhadeerAlbattarni
Copy link
Contributor

@GhadeerAlbattarni GhadeerAlbattarni commented Jan 19, 2026

Context

Fixes #5659

This PR fixes the inability to hide/show individual measurements in microscopy mode using the eye icon in the measurements panel.
It Implements visibility toggle functionality in the dicom-microscopy extension

Changes

  • RoiAnnotation.js: Added isVisible property and setVisibility() method to track annotation visibility state
  • MicroscopyService.ts: Added toggleROIVisibility() method to coordinate visibility changes across all managed
    viewers
  • viewerManager.js: Added toggleROIVisibility() method to add/remove ROI from the dicom-microscopy-viewer
  • getCommandsModule.ts: Added toggleMeasurementVisibility command
  • MicroscopyPanel.tsx: Wired up the visibility toggle handler to the DataRow component

Results

Before
The measurement stays visible when the user clicks on the eye icon.

After
The measurement can be hidden and shown when the user clicks on the eye icon.

Screen.Recording.2026-01-18.at.7.52.46.PM.mov

Testing

  1. Open a study in microscopy mode
  2. Add few different markups
  3. In the right-side measurements panel, click the eye icon for a measurement
  4. Verify the measurement hides on the viewport
  5. Click again on the eye icon
  6. Verify the measurement shows again

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • OS: macOS 10.15.4
  • Node version: v22.12.0
  • Browser: Chrome 83.0.4103.116

@netlify
Copy link

netlify bot commented Jan 19, 2026

Deploy Preview for ohif-dev ready!

Name Link
🔨 Latest commit f45031c
🔍 Latest deploy log https://app.netlify.com/projects/ohif-dev/deploys/696d859a760b3e0008bc1d0d
😎 Deploy Preview https://deploy-preview-5725--ohif-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jbocce jbocce self-requested a review January 23, 2026 21:06
@jbocce
Copy link
Collaborator

jbocce commented Jan 26, 2026

Please update your branch with master and push the result. Thanks.

@jbocce
Copy link
Collaborator

jbocce commented Jan 26, 2026

I did some testing and each of the various measurements can be hidden and displayed.

I did notice #5722 which is a separate issue but continues to exist. It will/should be handled in a separate PR.

* Toggle visibility of a specific ROI
* @param uid The UID of the ROI to toggle
*/
toggleROIVisibility(uid) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We are clobbering toggleROIVisibility that is on line 396. If we want to replace the old one, then this code should replace above. However I don't think that is what we want to do because the one on line 396 is toggling ALL the visibility of ALL ROIs. So this one should be renamed. Please come up with an appropriate name and/or consider asking AI for a name - it is good with that. 😊

Copy link
Collaborator

Choose a reason for hiding this comment

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

Apologies. I see the name difference now. But they are still too similar in my opinion.

* @param {boolean} isVisible - Whether the ROI should be visible or hidden
*/
toggleROIVisibility(uid, roiGraphic, isVisible) {
if (isVisible) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

In my opinion, adding and removing the ROI is NOT the same as hiding and showing it - eventhough it could be argued that is one way to implement visibility. Furthermore, if we look at hideROIs and showROIs they are NOT doing that to hide and show the ROIs. I looked further and unfortunately the underlying DICOM microscopy viewer does NOT appear to have an API for showing and hiding individual annotations. We may need to look into this further.

toggleAnnotations: () => {
microscopyService.toggleROIsVisibility();
},
toggleMeasurementVisibility: ({ uid }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this name should be consistent with using the annotations instead of measurements.

Copy link
Collaborator

@jbocce jbocce left a comment

Choose a reason for hiding this comment

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

Thanks for this PR. You have a lot of the fundamentals needed for adding the visibility toggle. 👍 Your proposal for toggling the visibility using add and remove needs to be revisited. It is likely best to add methods in the DICOM micrsoscopy viewer API (https://github.com/ImagingDataCommons/dicom-microscopy-viewer/blob/master/src/viewer.js) to accomplish this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I know this was existing prior to your changes, but line 397 has an error. It should be this.showROIs() (i.e. an actual method invocation). We should update this.

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.

[Bug] In microscopy mode measurements cannot be hidden

2 participants