-
Notifications
You must be signed in to change notification settings - Fork 83
Fix windowing configuration precedence and DICOMs with no window level tags #801
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3004b94
fix: window/level not initially set correctly for DICOM without metadata
PaulHax e8b901c
fix(windowing): disable auto windowing when runtime config is set
PaulHax 065921a
refactor(windowing): extract helpers to clarify default config logic
PaulHax 0bfc997
test(e2e): add test for runtime config windowing precedence
PaulHax a3a6485
test(e2e): verify auto windowing for DICOM without W/L tags
PaulHax File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| import { volViewPage } from '../pageobjects/volview.page'; | ||
| import { openUrls, writeManifestToFile } from './utils'; | ||
|
|
||
| describe('VolView windowing configuration', () => { | ||
| it('should use runtime config window level over DICOM window level', async () => { | ||
| const runtimeWindowLevel = { | ||
| width: 2000, | ||
| level: 1000, | ||
| }; | ||
|
|
||
| const config = { | ||
| windowing: runtimeWindowLevel, | ||
| }; | ||
|
|
||
| const configFileName = 'windowing-config.json'; | ||
| await writeManifestToFile(config, configFileName); | ||
|
|
||
| const manifest = { | ||
| resources: [ | ||
| { url: `/tmp/${configFileName}` }, | ||
| { | ||
| url: 'https://data.kitware.com/api/v1/file/6566aa81c5a2b36857ad1783/download/CT000085.dcm', | ||
| name: 'CT000085.dcm', | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| const manifestFileName = 'windowing-manifest.json'; | ||
| await writeManifestToFile(manifest, manifestFileName); | ||
|
|
||
| await volViewPage.open(`?urls=[tmp/${manifestFileName}]`); | ||
| await volViewPage.waitForViews(); | ||
|
|
||
| const view = await $('div[data-testid="vtk-view vtk-two-view"]'); | ||
|
|
||
| await volViewPage.waitForLoadingIndicator(view); | ||
|
|
||
| const viewAnnotations = await view.$('.view-annotations'); | ||
| const wlText = await viewAnnotations.getText(); | ||
|
|
||
| const match = wlText.match(/W\/L:\s*([\d.]+)\s*\/\s*([\d.]+)/); | ||
| expect(match).not.toBeNull(); | ||
|
|
||
| const displayedWidth = parseFloat(match![1]); | ||
| const displayedLevel = parseFloat(match![2]); | ||
|
|
||
| expect(displayedWidth).toBe(runtimeWindowLevel.width); | ||
| expect(displayedLevel).toBe(runtimeWindowLevel.level); | ||
| }); | ||
|
|
||
| it('should use DICOM window level when no runtime config is provided', async () => { | ||
| await openUrls([ | ||
| { | ||
| url: 'https://data.kitware.com/api/v1/file/6566aa81c5a2b36857ad1783/download/CT000085.dcm', | ||
| name: 'CT000085.dcm', | ||
| }, | ||
| ]); | ||
|
|
||
| const view = await $('div[data-testid="vtk-view vtk-two-view"]'); | ||
|
|
||
| await volViewPage.waitForLoadingIndicator(view); | ||
|
|
||
| const viewAnnotations = await view.$('.view-annotations'); | ||
| const wlText = await viewAnnotations.getText(); | ||
|
|
||
| const match = wlText.match(/W\/L:\s*([\d.]+)\s*\/\s*([\d.]+)/); | ||
| expect(match).not.toBeNull(); | ||
|
|
||
| const displayedWidth = parseFloat(match![1]); | ||
| const displayedLevel = parseFloat(match![2]); | ||
|
|
||
| expect(displayedWidth).toBe(410); | ||
| expect(displayedLevel).toBe(70); | ||
| }); | ||
|
|
||
| it('should use auto windowing for DICOM without window/level metadata', async () => { | ||
| await openUrls([ | ||
| { | ||
| url: 'https://data.kitware.com/api/v1/file/68e9807dbf0f869935e36481/download/minimal.dcm', | ||
| name: 'minimal.dcm', | ||
| }, | ||
| ]); | ||
|
|
||
| const view = await $('div[data-testid="vtk-view vtk-two-view"]'); | ||
|
|
||
| await volViewPage.waitForLoadingIndicator(view); | ||
|
|
||
| const viewAnnotations = await view.$('.view-annotations'); | ||
| const wlText = await viewAnnotations.getText(); | ||
|
|
||
| const match = wlText.match(/W\/L:\s*([\d.]+)\s*\/\s*([\d.]+)/); | ||
| expect(match).not.toBeNull(); | ||
|
|
||
| const displayedWidth = parseFloat(match![1]); | ||
| const displayedLevel = parseFloat(match![2]); | ||
|
|
||
| expect(displayedWidth).toBe(1900); | ||
| expect(displayedLevel).toBe(1050); | ||
| }); | ||
| }); |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.