-
Notifications
You must be signed in to change notification settings - Fork 430
feat(image): image smoothing for stack/volume viewports #2353
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
base: main
Are you sure you want to change the base?
feat(image): image smoothing for stack/volume viewports #2353
Conversation
…23/cornerstone3D into feat/image-smoothing
@sedghi could you please review this? |
+1, maybe @IbrahimCSAE can have look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces GPU-based image smoothing functionality for stack and volume viewports using dynamically generated Gaussian kernels. The feature allows users to control smoothing intensity through negative values, providing flexible blur effects to reduce noise and soften edges in medical images.
Key changes include:
- Added
createGaussianKernel
utility function for generating normalized Gaussian blur kernels - Implemented smoothing render pass with configurable intensity control
- Extended viewport properties and rendering logic to support smoothing alongside existing sharpening
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
utils/ExampleRunner/example-info.json | Added smoothing example entry to demo configuration |
packages/core/src/types/ViewportProperties.ts | Added smoothing property to viewport properties interface |
packages/core/src/RenderingEngine/renderPasses/smoothingRenderPass.ts | New render pass implementation with Gaussian kernel generation |
packages/core/src/RenderingEngine/renderPasses/index.ts | Exported new smoothing render pass function |
packages/core/src/RenderingEngine/StackViewport.ts | Integrated smoothing support into stack viewport rendering |
packages/core/src/RenderingEngine/BaseVolumeViewport.ts | Integrated smoothing support into volume viewport rendering |
packages/core/examples/smoothing/index.ts | Complete example demonstrating smoothing functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
packages/core/src/RenderingEngine/renderPasses/smoothingRenderPass.ts
Outdated
Show resolved
Hide resolved
packages/core/src/RenderingEngine/renderPasses/smoothingRenderPass.ts
Outdated
Show resolved
Hide resolved
Im confused with the latest change, if i understood correctly, you made it so if sharpening is a negative value you apply smoothing? I don't like that because it's a bit confusing, my initial comment suggested if there's a way to apply both at the same time, for ex sharpening 0.5, smoothing 0.5, and then use both render passes. If you have tried this and it wasn't possible, then let me know protected shouldUseCustomRenderPass(): boolean {
return !this.useCPURendering;
}
/**
* Get render passes for this viewport.
* If sharpening is enabled, returns appropriate render passes.
* @returns Array of VTK render passes or null if no custom passes are needed
*/
public getRenderPasses = () => {
if (!this.shouldUseCustomRenderPass()) {
return null;
}
const renderPasses = []
try {
if (this.smoothing > 0) {
renderPasses.push(createSmoothingRenderPass(this.smoothing))
}
if (this.sharpening > 0) {
renderPasses.push(createSharpeningRenderPass(this.sharpening))
}
return renderPasses.length ? renderPasses : null
} catch (e) {
console.warn('Failed to create custom render passes:', e);
return null;
} |
df60140
to
363b645
Compare
Changes have been made as per the above comment. Please check @IbrahimCSAE |
@IbrahimCSAE , could you please review this PR again? |
merge after CI |
git pull origin main -> so that ci is fixed |
Context
This PR introduces a GPU-based image smoothing feature using a dynamically generated Gaussian kernel. The smoothing intensity is controlled by the user, allowing for flexible and strong blur effects. This addresses requests for more effective image smoothing in the rendering pipeline.
Fixes issue: #246
Changes & Results
createGaussianKernel
to generate normalized Gaussian kernels of arbitrary size and blur strength.Testing
Checklist
PR
semantic-release format and guidelines.
Code
etc.)
Public Documentation Updates
additions or removals.
Tested Environment