Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(labelmap): apply styles based on active segment index #1836

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stada526
Copy link
Contributor

Context

While rendering, segment styles such as opacity, fill etc do not consider active segment based on its index.
This issue was partly fixed via #1833, but only for Contour, so I’ve made some updates for Labelmap.

Changes & Results

Active segmentationId along with the segmentIndex should determine whether a segment is active or not.

2025-02-19.10.21.58.mov

Testing

Checklist

PR

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

Code

Public Documentation Updates

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

Tested Environment

  • [] "OS:
  • [] "Node version:
  • [] "Browser:

Copy link

netlify bot commented Feb 19, 2025

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit 2809f5a
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/67b5f8064a03a70008210a0f
😎 Deploy Preview https://deploy-preview-1836--cornerstone-3d-docs.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 site configuration.

@minimal-scouser
Copy link
Contributor

yeah i missed raising this change for labelmaps. good spot.

@sedghi
Copy link
Member

sedghi commented Feb 24, 2025

I explained in the other PR why we can't merge this, you can use perSegment config for this purpose

@stada526
Copy link
Contributor Author

Hi @sedghi ,

I tried using segmentIndex in the setStyle function, but it didn’t seem to work properly.
I added the following code at the end of tools/examples/labelmapSegmentLocking/index.ts, but the opacity of each segment didn’t change when switching the active segment index, as shown in the attached video.

segmentation.config.style.setStyle(
  {
    type: csToolsEnums.SegmentationRepresentations.Labelmap,
    segmentationId,
    segmentIndex: 1,
  },
  {
    fillAlpha: 1,
    fillAlphaInactive: 0,
  }
);
segmentation.config.style.setStyle(
  {
    type: csToolsEnums.SegmentationRepresentations.Labelmap,
    segmentationId,
    segmentIndex: 2,
  },
  {
    fillAlpha: 1,
    fillAlphaInactive: 0,
  }
);

I'd appreciate it if you could clarify what I might be missing.

2025-02-24.12.27.29.mov

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.

3 participants