Skip to content
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

Windowing from dicom tags #442

Merged
merged 20 commits into from
Oct 23, 2023
Merged

Conversation

bnmajor
Copy link
Contributor

@bnmajor bnmajor commented Oct 3, 2023

Adds support for automatically reducing the range of data, setting width/level from presets, and setting width/level from tags.

Fixes #181, #270, #6

@netlify
Copy link

netlify bot commented Oct 3, 2023

Deploy Preview for volview-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 6ca7d71
🔍 Latest deploy log https://app.netlify.com/sites/volview-dev/deploys/65369615067e360007d9151d
😎 Deploy Preview https://deploy-preview-442--volview-dev.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@bnmajor bnmajor force-pushed the windowing-from-dicom-tags branch 5 times, most recently from a683ae2 to 0f1175d Compare October 3, 2023 20:34
@bnmajor
Copy link
Contributor Author

bnmajor commented Oct 3, 2023

This draft needs a little more testing but t This should be ready for review now. The core logic has been added for providing w/l presets for CT data (pulled from this) as well as automatic ranges (available for all modalities). If windowing tags are provided they are also used.

Some additional pieces I would love feedback on:

  • The current UI choices
    • Right now everything is in a menu available by selecting the W/L tool. I have used expansion panels in an attempt to simplify things but there is still the potential for this menu to get quite large. Should this approach be changed? I'm open to ideas (either for the menu or moving the options somewhere else entirely).
    • NOTE: If the modality is not CT or CTPROTOCOL the presets will not be shown. If there are no presets or tags that panel is disabled.
  • Some of the provided preset values are ranges and there very well may be there are better selections than what I've made. When an equivalent was offered in another application I tried to use those values (for example: OHIF values).
  • What reset should mean
    • At the moment selecting "reset" recomputes the width and level values for the currently selected "auto range". If the user has selected a preset or tag the width and level are reset to those values. I am not sure if this is the behavior that users would expect or if it should behave diffrently (or do we need a tooltip or something?).
  • The option of using the full range of data no longer exists and instead the new default is to use data in the [0.1%, 99.9%] range. Should the "full range" be an additional option?
  • I'm always happy to rename anything that doesn't make sense

@floryst @aylward

Demo:
demo_wl

@bnmajor
Copy link
Contributor Author

bnmajor commented Oct 3, 2023

Old vs New preset:

new_wl_defaults

@bnmajor bnmajor force-pushed the windowing-from-dicom-tags branch from b1345cb to fd352f3 Compare October 4, 2023 17:23
@bnmajor bnmajor marked this pull request as ready for review October 4, 2023 18:37
@bnmajor bnmajor force-pushed the windowing-from-dicom-tags branch from fd352f3 to fd5fd81 Compare October 4, 2023 18:38
src/components/VtkTwoView.vue Outdated Show resolved Hide resolved
src/components/VtkTwoView.vue Outdated Show resolved Hide resolved
@floryst
Copy link
Collaborator

floryst commented Oct 4, 2023

Functionality looks good so far! We can discuss styling the menu after I finish going through your code.

@aylward
Copy link
Contributor

aylward commented Oct 5, 2023

Great start!

A few minor tweaks

  1. Don't list the window and level values in the menu - it looks too cluttered.
  2. The selection circle is too large. Make is slightly smaller than the capital letters.
  3. Space is missing between "SoftTissue"
  4. What are "Tags" - I'm not familiar with them. Are they from the dicom file?
  5. Auto Compute Range should instead be called "Auto Window / Level"
  6. No need to repeat "Auto" under "Auto Window / Level"
  7. There is no default under Auto - just pick one.
  8. The auto values should be percentiles of the data, not percentages of the range - you were correct. Instead of sorting, perhaps assign to a historgram first - give the histogram 512 bins and then determine clippings from there.

Also, Default and Default Width/Level (if it is read from the dicom) shouldn't be under CT Presets. It seems more appropriate under Auto Window / Level. It could replace the Default (currently 0.1 and 99.9) in the list. For data without a default, have the default (the value of this selection) be the full range.

I don't think we need a reset buttong.

Right now it is possible to select something in Auto and in CT Presets. Both circles remain selected - so I don't know which W/L is actually being shown. All circles (under Auto and CT Presets) should be exclusive - only one should ever be lit.

If the user changes W/L manually, then no preset should be lit (no circle filled-in).

@bnmajor bnmajor force-pushed the windowing-from-dicom-tags branch 4 times, most recently from eb60f44 to fa342ca Compare October 9, 2023 17:39
@bnmajor
Copy link
Contributor Author

bnmajor commented Oct 9, 2023

  1. Don't list the window and level values in the menu - it looks too cluttered.
  2. The selection circle is too large. Make is slightly smaller than the capital letters.
  3. Space is missing between "SoftTissue"
  4. Auto Compute Range should instead be called "Auto Window / Level"
  5. No need to repeat "Auto" under "Auto Window / Level"

All cleaned up 👍

  1. What are "Tags" - I'm not familiar with them. Are they from the dicom file?

Yes, these are the DICOM tags (if any)

  1. There is no default under Auto - just pick one.

Fixed

  1. The auto values should be percentiles of the data, not percentages of the range - you were correct. Instead of sorting, perhaps assign to a historgram first - give the histogram 512 bins and then determine clippings from there.

Thanks! Done.

Also, Default and Default Width/Level (if it is read from the dicom) shouldn't be under CT Presets. It seems more appropriate under Auto Window / Level. It could replace the Default (currently 0.1 and 99.9) in the list. For data without a default, have the default (the value of this selection) be the full range.

Fixed

I don't think we need a reset buttong.

This reset button lets users get back to the starting point (full data range). Requested in #401, added in #437.

Right now it is possible to select something in Auto and in CT Presets. Both circles remain selected - so I don't know which W/L is actually being shown. All circles (under Auto and CT Presets) should be exclusive - only one should ever be lit.

Fixed

If the user changes W/L manually, then no preset should be lit (no circle filled-in).

This is now the behavior

src/components/VtkTwoView.vue Outdated Show resolved Hide resolved
src/components/tools/windowing/WindowLevelControls.vue Outdated Show resolved Hide resolved
@bnmajor bnmajor force-pushed the windowing-from-dicom-tags branch 2 times, most recently from ea19bf7 to 1c40985 Compare October 12, 2023 12:57
@floryst
Copy link
Collaborator

floryst commented Oct 12, 2023

UI tweak: if we don't have any presets, I'd suggest hiding the "Presets" expansion panel.

@aylward
Copy link
Contributor

aylward commented Oct 12, 2023 via email

@bnmajor
Copy link
Contributor Author

bnmajor commented Oct 12, 2023

There should always be presets...the ones based on percentiles. S

I think @floryst's comment meant just the section with the CT Preset values. So for non-CT images we'd change from disabled to hidden.

Image Scratch Page

@floryst
Copy link
Collaborator

floryst commented Oct 12, 2023

Yes, thanks for the clarification @bnmajor. I did intend to convey what your graphics indicate.

@bnmajor bnmajor force-pushed the windowing-from-dicom-tags branch from 5c5b2d9 to 28d0451 Compare October 13, 2023 13:31
@bnmajor
Copy link
Contributor Author

bnmajor commented Oct 13, 2023

UI tweak: if we don't have any presets, I'd suggest hiding the "Presets" expansion panel.

Fixed and rebased

@aylward
Copy link
Contributor

aylward commented Oct 13, 2023

Looks great!

A few suggestions:

  1. When CT data is loaded, the CT Presets should be opened by default and the auto W/L can be closed
  2. Thanks for the explanation, the Tags should go into their own section at the top. Call the category "Data-Specific Presets". Also, we should have the default W/L settings to be Tag 1 if it exists.
  3. The "Percent" should be "Percentiles" right? If so, let's call them "0.1 Percentile", "1.0 Percentile", "2.0 Percentile" and "5.0 Percentile". There is no need to list the values. You could add "+/-" in front if you want to be even more precise, but it isn't necessary and might make the labels too long.

Thanks!!

@bnmajor bnmajor force-pushed the windowing-from-dicom-tags branch from f5617eb to ccd1f3d Compare October 13, 2023 21:20
@aylward
Copy link
Contributor

aylward commented Oct 18, 2023 via email

@bnmajor
Copy link
Contributor Author

bnmajor commented Oct 19, 2023

Looks like e2e tests should pass after #458 (update to 117 and pin version) is merged

@bnmajor bnmajor force-pushed the windowing-from-dicom-tags branch 2 times, most recently from c2ad2d0 to 8cdc6eb Compare October 19, 2023 14:55
@bnmajor
Copy link
Contributor Author

bnmajor commented Oct 19, 2023

@floryst @aylward I don't have permissions to merge but this has been tested with non-DICOM data and should be ready to go

@floryst
Copy link
Collaborator

floryst commented Oct 23, 2023

LGTM once rebased on main!

There are currently four default auto ranges available to users that will
exclude either the tail 0.1%, 1%, 2%, or 5% of the data values.
If there are DICOM tags for window width and level tags list those for the user
to select from.
Make sure that we'll catch typing errors in case we ever rename 'Default' to
something else.
Users should not be able to select a percentile range AND preset or tag - only
one or the other.
This provides better visibility in the event it needs updating.
We now use the first window/level tag by default.
Replace instead with an option to use the full data range that lives under the
"auto" menu. This also renames the auto options to low/medium/high contrast.
@bnmajor bnmajor force-pushed the windowing-from-dicom-tags branch from 8cdc6eb to 6ca7d71 Compare October 23, 2023 15:49
@bnmajor
Copy link
Contributor Author

bnmajor commented Oct 23, 2023

LGTM once rebased on main!

Rebased!

@floryst floryst merged commit b59bbae into Kitware:main Oct 23, 2023
6 checks passed
@bnmajor bnmajor deleted the windowing-from-dicom-tags branch October 23, 2023 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Window/level presets to choose from
3 participants