Hello everyone,
I tried displaying a dicom image on a web interface using cornerstone3D. Is there any way to filter the dicom image on the viewport, meaning changing the pixel values?
Thanks a lot.
You can use threshold tools, right now we have a brush threshold and in future we will have global threshold
brush threshold
https://www.cornerstonejs.org/live-examples/labelmapsegmentationtools
global threshold PR
cornerstonejs:main
← pavel-kaiko:feature/threshold-optional-center-and-threshold-area
opened 12:07PM - 22 May 24 UTC
### Context
<!--
Provide a clear explanation of the reasoning behind this ch… ange, such as:
- A link to the issue being addressed, using the format "Fixes #ISSUE_NUMBER"
- An image showing the issue or problem being addressed (if not already in the issue)
- Error logs or callStacks to help with the understanding of the problem (if not already in the issue)
-->
- **Issue Link**: N/A
- **Problem Description**: We want to show the threshold for the whole slice.
- **Error Logs**: N/A
- **Specific Requirements**: The threshold needs to be displayed for the entire viewport (slice).
- **Design/UI Guidelines**: No specific guidelines.
- **Integration with Existing Functionality**: Extra flags have been added to ensure backwards compatibility and make the functionality more flexible.
- **Performance Considerations**: No performance issues for one viewport. Volume visualization is currently out of scope.
- **Specific Test Cases/Scenarios**: There are issues with MPR mode (checked during OHIF Viewer integration), where it doesn't recognize any existing segments. Also I need some help with proper edge coordinates for AreaFill (some of them are currently hardcoded with approximate values).
### Changes & Results
<!--
List all the changes that have been done, such as:
- Add new components
- Remove old components
- Update dependencies
What are the effects of this change?
- Before vs After
- Screenshots / GIFs / Videos
-->
- **Changes Made**:
- Added area-fill strategy composition and manual preview mode.
- Refactored `fillCircle` by extracting helper functions to improve code readability.
- No old components were removed.
- No dependencies were updated.
- **Effects of Changes**:
- **Before**: Threshold was not displayed for the entire slice.
- **After**: Threshold is now displayed for the entire slice.
- **Screenshots**:
- **Before**: N/A (Videos are attached below)
- **After**: N/A (Videos are attached below)
### Testing
<!--
Describe how we can test your changes.
- open a URL
- visit a page
- click on a button
- etc.
-->
- **Steps to Test**:
- Run the command `npm run example -- labelmapSegmentationDynamicThreshold`.
- Open a browser and navigate to `http://localhost:3000`.
- Ensure the slice is displayed with the threshold correctly shown.
- **Test Cases**:
- Threshold area with CenterJDK disabled by default
[![Threshold area with CenterJDK disabled by default. ](https://docs.ohif.org/img/ohif-logo.svg)](https://github.com/cornerstonejs/cornerstone3D/assets/143810329/fd5bcb1e-de61-4993-a117-65737da601f5)
- Threshold circle with enabled and disabled CenterJDK
[![Threshold circle with enabled and disabled CenterJDK.](https://docs.ohif.org/img/ohif-logo.svg)](https://github.com/cornerstonejs/cornerstone3D/assets/143810329/c47c2ca4-4423-4cab-b24e-86b99df38511)
- Manual preview for threshold Circle with CenterJDK enabled by default and manual brush radius
[![Manual preview for threshold Circle with CenterJDK enabled by default and manual brush radius.](https://docs.ohif.org/img/ohif-logo.svg)](https://github.com/cornerstonejs/cornerstone3D/assets/143810329/89a076b9-b2cc-440f-abba-23c75ae0fc93)
### Checklist
#### PR
<!--
https://semantic-release.gitbook.io/semantic-release/#how-does-it-work
Examples:
Please note the letter casing in the provided examples (upper or lower).
- feat(ThresholdPreview): add AreaFill, make CircleFill more flexible
You don't need to have each commit within the Pull Request follow the rule,
but the PR title must comply with it, as it will be used as the commit message
after the commits are squashed.
-->
- [x] My Pull Request title is descriptive, accurate and follows the
semantic-release format and guidelines.
#### Code
- [x] My code has been well-documented (function documentation, inline comments,
etc.)
- [x] I have run the `yarn build:update-api` to update the API documentation, and have
committed the changes to this PR. (Read more here https://www.cornerstonejs.org/docs/contribute/update-api)
#### Public Documentation Updates
- [x] The documentation page has been updated as necessary for any public API
additions or removals.
#### Tested Environment
- [x] "OS: macOS 14.5"
- [x] "Node version: v18.19.1"
- [x] "Browser: Chrome Version 125.0.6422.61 (Official Build) (arm64)"
1 Like
@alireza Thanks for your answer