Conversation
|
Thanks, seems like the tests are passing. @finetjul can we get a review on this please, i will apply them |
| @@ -0,0 +1,900 @@ | |||
| import '@kitware/vtk.js/favicon'; | |||
There was a problem hiding this comment.
please add a screenshot in the example gallery
| @@ -0,0 +1,534 @@ | |||
| import '@kitware/vtk.js/favicon'; | |||
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; |
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); |
There was a problem hiding this comment.
isn't vtkMath.perpendiculars() already doing what you want ? what you want ?
|
@PaulHax i applied the review and save it as patch with new screenshots here could you please apply it? (did not have permission to push on your fork) |
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
…apper Co-authored-by: Alireza <ar.sedghi@gmail.com>
6fd0c24 to
7ffbc91
Compare
The label outline texture cache used a fresh object literal as the Map key each frame, so the cache never hit and a new GPU texture was uploaded every render. Replace with hash-based skip on model. Extract shared helper to reduce duplication between thickness and opacity texture updates. Pre-allocate scratch mat3/vec3 arrays used in the render loop.
cfdbfb0 to
853415e
Compare
|
Thank you @sedghi. I pushed up your changes. Also added a fix for always missing outline texture cache. |
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