Open
Conversation
Add multi-input mode to ImageResliceMapper for rendering segmentation labelmaps overlaid on background images. Supports: - Label outline rendering with configurable thickness and opacity - Per-segment colors via transfer functions - Fill opacity control for label regions
Demonstrates multi-input mode with segmentation labelmap overlay, including label outline rendering controls.
Add per-input coordinate transforms for labelmaps with different resolution/spacing than the background image: - Per-input WCTCMatrix uniforms for world-to-texture transforms - Per-input texelSize uniforms for outline detection - Per-input tangent vectors for different orientations - Track numValidInputs to trigger shader rebuild when inputs change Update test to use half-resolution labelmap and reduce outline thickness to 1 to make outline vs fill visually distinguishable.
…utions Add test for dynamic labelmap inputs and fix GLSL sampler indexing. - Add testImageResliceMapperDynamicInputs to verify: - Single background input - Adding labelmaps dynamically - Multiple labelmaps with different resolutions - Removing labelmaps - Fix GLSL shader compilation error: array index for samplers must be constant integral expressions - Use conditional operators instead of dynamic indexing for volumeTexture array in label outline shader code
Extract common label outline shader generation into a helper function. This reduces code duplication across cases 2, 3, and 4 by consolidating the label outline shader generation logic. - Add generateLabelOutlineShader() helper function - Replace 3 nearly-identical shader code blocks with function calls - Net reduction: 138 lines (231 removed, 93 added)
Remove hardcoded assumption that input 0 must be background. Any input can now be a labelmap or background image based on its property's useLabelOutline setting. - Create generateMultiInputCompositeShader() for flexible composition - Consolidate switch duplication with generateWeightedSumShader() helper - Update test to demonstrate labelmap on input 0 with background on input 1
…alues Add properties that exist in DEFAULT_VALUES but were missing from TypeScript: - backgroundColor - colorTextureWidth - opacityTextureWidth - labelOutlineTextureWidth
Demonstrates ImageResliceMapper with labelmap overlay using ResliceCursorWidget for quad-view MPR navigation with interactive labelmap controls.
- Get component weight from each input's property instead of just the first - Process backgrounds before labelmaps for correct compositing order - Update baseline image for labelmap test
- Use 1.0 for global opacity in multi-texture mode so labelmap properties don't affect other inputs' opacity - Build 2D textures for outline thickness/opacity (one row per labelmap) - Sample correct row in shader based on labelmap index
Contributor
|
Thanks, seems like the tests are passing. @finetjul can we get a review on this please, i will apply them |
finetjul
reviewed
Feb 10, 2026
| @@ -0,0 +1,900 @@ | |||
| import '@kitware/vtk.js/favicon'; | |||
Member
There was a problem hiding this comment.
please add a screenshot in the example gallery
| @@ -0,0 +1,534 @@ | |||
| import '@kitware/vtk.js/favicon'; | |||
Member
There was a problem hiding this comment.
please add a screenshot in the example gallery
| const absNormal = normal.map(Math.abs); | ||
| const minIdx = absNormal.indexOf(Math.min(...absNormal)); | ||
| const up = [0, 0, 0]; | ||
| up[minIdx] = 1; |
Member
There was a problem hiding this comment.
You might want to create a convenient vtkMath.getMinorAxisIndex function similar to vtkMath.getMajorAxisIndex()
| vtkMath.cross(normal, up, tangent1); | ||
| vtkMath.normalize(tangent1); | ||
| vtkMath.cross(normal, tangent1, tangent2); | ||
| vtkMath.normalize(tangent2); |
Member
There was a problem hiding this comment.
isn't vtkMath.perpendiculars() already doing what you want ? what you want ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
This brings ImageResliceMapper closer to feature parity with ImageSliceMapper by adding the label outline effect for oblique slicing. A PR by request going out to @sedghi in github land.
Results
Changes
ImageResliceMapper uses inputs to compose the background and label map images. Thats different than using image components like ImageSliceMapper does. This alows for different resolution labelmap images at the cost of much complexity and breaking of convention. Not sure its worth it.
Add two new examples: ResliceCursorWidgetLabelmap and ImageResliceMapperLabelOutline
PR and Code Checklist
npm run reformatto have correctly formatted codeTesting
New examples
ImageResliceMapperLabelOutline example
ResliceCursorWidgetLabelmap example