-
Notifications
You must be signed in to change notification settings - Fork 314
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
feat(voi): add linear exact voi lut function #1717
Conversation
Run & review this pull request in StackBlitz Codeflow. |
❌ Deploy Preview for cornerstone-3d-docs failed. Why did it fail? →
|
const lower = windowCenter - 0.5 - (windowWidth - 1) / 2; | ||
const upper = windowCenter - 0.5 + (windowWidth - 1) / 2; | ||
if (windowWidth < 1 || windowCenter < 1) { | ||
// use fallback |
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.
Please add a console.warn('Non DICOM standard compliant width/center", windowWidth, windowCenter)
@@ -41,10 +41,18 @@ function toLowHighRange( | |||
lower: number; | |||
upper: number; | |||
} { | |||
const lower = windowCenter - 0.5 - (windowWidth - 1) / 2; | |||
const upper = windowCenter - 0.5 + (windowWidth - 1) / 2; | |||
if (windowWidth < 1 || windowCenter < 1) { |
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.
Only check windowWidth, the windowCenter should be allowed to be bigger.
|
||
return { lower, upper }; | ||
return { |
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.
Please add a comment:
// This definition is from the DICOM standard PS3.3
…ring and metadata processes - Added voiLUTFunction to viewport VOI settings in StackViewport and related utilities. - Updated window level calculations to consider voiLUTFunction for accurate range determination. - Enhanced metadata extraction to include voiLUTFunction from DICOM data. - Introduced new logit utility for improved sigmoid function handling in window level transformations. - Updated relevant types and interfaces to accommodate voiLUTFunction. This change improves the flexibility and accuracy of volume rendering based on user-defined LUT functions.
const imageIdIndex = Math.floor(imageIds.length / 2); | ||
const imageId = imageIds[imageIdIndex]; | ||
const voiLutModule = metaData.get('voiLutModule', imageId); | ||
if (voiLutModule?.windowWidth && voiLutModule.windowCenter) { | ||
if (voiLutModule && voiLutModule.windowWidth && voiLutModule.windowCenter) { | ||
voi.voiLUTFunction = voiLutModule.voiLUTFunction; |
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.
this is not always defined, it's crashing tests in OHIF
related OHIF/Viewers#4298
related OHIF/Viewers#4538
This pull request includes an important update to the
toLowHighRange
function in thepackages/core/src/utilities/windowLevel.ts
file. The change adds a conditional check to handle cases wherewindowWidth
orwindowCenter
are less than 1, providing a fallback calculation for thelower
andupper
values.Key change:
packages/core/src/utilities/windowLevel.ts
: Added a conditional check in thetoLowHighRange
function to handle cases wherewindowWidth
orwindowCenter
are less than 1, and provided a fallback calculation forlower
andupper
values.