-
Notifications
You must be signed in to change notification settings - Fork 334
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 for changing opacity based on segment index #1833
fix for changing opacity based on segment index #1833
Conversation
✅ Deploy Preview for cornerstone-3d-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Thank you for addressing the issue I raised! |
I think I messed up by merging this. I thought the opacity was at the segmentation level, but it seems to be segment-specific. Could you please create a pull request to revert this change? My reasoning is that there's only one layer of opacity change at the API level, which is between Segmentations, not within them. If someone needs a different opacity for any active segment, they can use the This PR also cannot get merged, #1836 as it is adding another layer of opacity configuration at api level. There is already API for perSegment configuration |
doing it. but i don't think perSegment styles are taking effect. and that is because the perSegment API is available for labelMaps not for contour segments. contour segments use |
per segment styles are not respected the original intent itself is not aligned to support perSegment styles cornerstone3D/packages/tools/src/stateManagement/segmentation/SegmentationStyle.ts Lines 21 to 22 in 06ebd68
look at cornerstone3D/packages/tools/src/stateManagement/segmentation/SegmentationStyle.ts Lines 98 to 117 in 06ebd68
and here we are assigning the high level styles to segment level style cornerstone3D/packages/tools/src/stateManagement/segmentation/SegmentationStyle.ts Lines 146 to 155 in 06ebd68
|
I think they are working at least in OHIF, since this is the effect we have in OHIF, if you look at SegmentationService in OHIF you will see it CleanShot.2025-02-21.at.12.46.30.mp4see how per segment we apply different thickness |
true. it works for visibility. even in the original example. but it does not consider fillAlphaInactive, fillOutlineInactive - especially at segment level. try this, create two segments (under same segmentation) run cornerstoneTools.segmentation.config.style.getStyle({segmentationId: "Segmentation 1", type: "Contour"}) and this is what you will get {
"renderOutline": true,
"outlineWidthAutoGenerated": 3,
"outlineWidth": 1,
"outlineWidthInactive": 1,
"outlineOpacity": 1,
"outlineOpacityInactive": 0.85,
"outlineDashAutoGenerated": "5,3",
"activeSegmentOutlineWidthDelta": 0,
"renderFill": false,
"fillAlpha": 0.5, <---------
"fillAlphaInactive": 0.3, <----------
"fillAlphaAutoGenerated": 0.3
} notice how but ofcourse, you see a change in the opacity, the moment you create a new segmentation. |
Context
Fixes #1832
While rendering, segment styles such as opacity, fill etc do not consider active segment based on its index.
Changes & Results
Active segmentationId along with the segmentIndex should determine whether a segment is active or not.
Screen.Recording.2025-02-18.at.10.34.13.PM.mov
Testing
Checklist
PR
semantic-release format and guidelines.
Code
[] My code has been well-documented (function documentation, inline comments,
etc.)
[] I have run the
yarn build:update-api
to update the API documentation, and havecommitted the changes to this PR. (Read more here https://www.cornerstonejs.org/docs/contribute/update-api)
Public Documentation Updates
additions or removals.
Tested Environment