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

feat(ViewportActionMenu): window level per viewport / new patient info / colorbars/ 3D presets and 3D volume rendering #3963

Merged
merged 20 commits into from
Apr 2, 2024

Conversation

IbrahimCSAE
Copy link
Collaborator

@IbrahimCSAE IbrahimCSAE commented Feb 28, 2024

👏👏👏 Big shoutout to @jbocce for kicking off the work on this fantastic feature! 💯 👏👏


ViewportActionMenu, Patient Info Header, 3D Presets and more

This PR will address several feature requests with and design changes

Major changes are:

  • New action menu per viewport that allows user to control different things including: Window Level, Colormaps, Colorbars, 3D Presets, 3D Rendering Properties
  • Addition of new patient info header in the viewer that shows the information of the currently displayed patient
  • Introduction of Colorbars to OHIF
  • Introduction of 3D Rendering and features allowing to set cinematic rendering, shift, shade, ambiance, diffuse and specular.

Viewport Action Menu

A fully customizable action menu, where you can define your own window level presets per modality, colormaps, 3D presets.

image

image

Customizing the existing presets can be done using the customizationService:

An example below:

function getCustomizationModule() {
  return [
    {
      name: 'default',
      value: [
        {
          id: 'cornerstone.windowLevelPresets',
          presets: defaultWindowLevelPresets,
        },
        {
          id: 'cornerstone.colorbar',
          width: '16px',
          colorbarTickPosition: 'left',
          colormaps,
          colorbarContainerPosition: 'right',
          colorbarInitialColormap: DefaultColormap,
        },
        {
          id: 'cornerstone.3dVolumeRendering',
          volumeRenderingPresets: VIEWPORT_PRESETS,
          volumeRenderingQualityRange: {
            min: 1,
            max: 4,
            step: 1,
          },
        },
      ],
    },
  ];
}

For window level, the array of presets follows this structure:

const defaultWindowLevelPresets = {
  CT: [
    { description: 'Soft tissue', window: '400', level: '40' },
    { description: 'Lung', window: '1500', level: '-600' },
    { description: 'Liver', window: '150', level: '90' },
    { description: 'Bone', window: '2500', level: '480' },
    { description: 'Brain', window: '80', level: '40' },
  ],

  PT: [
    { description: 'Default', window: '5', level: '2.5' },
    { description: 'SUV', window: '0', level: '3' },
    { description: 'SUV', window: '0', level: '5' },
    { description: 'SUV', window: '0', level: '7' },
    { description: 'SUV', window: '0', level: '8' },
    { description: 'SUV', window: '0', level: '10' },
    { description: 'SUV', window: '0', level: '15' },
  ],
};

You can add the modalities you require, and the window/level values for each preset.

Colormaps

You can now change the colormap for the viewport using the action menu, not only that, you are also able to change colormaps on fusion viewports, and pick which modality you'd like to change the colormap for.

Regular viewport:

Peek 2024-03-28 06-37

Fusion viewport:

Peek 2024-03-28 06-39

Colormaps Previews

You can also preview colormaps before selecting them, by toggling the preview colormap toggle, which gives you a chance to see if the colormap works for you before selecting it:

Peek 2024-03-28 06-40

Colorbars

Colorbars are being introduced to OHIF. They are interactive and can be used to manipulate the VOI on stack and volume viewports. They also support fusion viewports with PT/CT displaysets, and turn into dual mode, each colorbar controlling it's respective displayset.

Regular viewport:

Peek 2024-03-28 06-43

Fusion viewport:

Peek 2024-03-28 06-45

Responsive to colormap changes

Colorbars also respond to colormap changes, as seen here:

Peek 2024-03-28 06-46

The colorbar state is maintained during the lifecycle of the viewport.

3D Rendering

The viewport action menu also allows you to manipulate the currently displayed 3D volume, offering a varity of options such as presets, quality, and more. I will showcase each feature below:

Rendering presets

Peek 2024-03-28 06-53

There's several presets to choose from, depending on your use case.

Rendering Quality

ezgif-7-36258c8160

Shift

shift-ezgif com-optimize

Shade

shade

Ambient

ambient

Diffuse

diffuse

Specular

specular

New Patient Info Header

The new patient info header displays information about the patient for the currently displayed study.

image

It also includes safe guards where there are multiple patients loading into the viewer, if the following case is detected, the header will only render a text that indicates there's multiple patients, to avoid assuming it's a single patient.

image

The patient info header contains 3 configuration options that you can pick from and set in your appConfig located in default.js

export enum PatientInfoVisibility {
  VISIBLE = 'visible',
  VISIBLE_COLLAPSED = 'visibleCollapsed',
  DISABLED = 'disabled',
}

visible: the patient info header will always be visible and it's in expanded state.
visibleCollapsed: the patient info header will be visible, but it's initial state is collapsed, a user would have to click on it to expand it.
disabled: the patient info header will not be shown.

Copy link

netlify bot commented Feb 28, 2024

Deploy Preview for ohif-platform-docs canceled.

Name Link
🔨 Latest commit 958fdf7
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/660c06b66e4b7a0008989179

Copy link

netlify bot commented Feb 28, 2024

Deploy Preview for ohif-dev canceled.

Name Link
🔨 Latest commit 958fdf7
🔍 Latest deploy log https://app.netlify.com/sites/ohif-dev/deploys/660c06b6f546830009a944d3

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 44.37%. Comparing base (8a335bd) to head (958fdf7).
Report is 272 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3963      +/-   ##
==========================================
- Coverage   46.23%   44.37%   -1.87%     
==========================================
  Files          78       80       +2     
  Lines        1276     1334      +58     
  Branches      312      327      +15     
==========================================
+ Hits          590      592       +2     
- Misses        548      589      +41     
- Partials      138      153      +15     
Files Coverage Δ
platform/app/src/appInit.js 0.00% <0.00%> (ø)

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 07301fc...958fdf7. Read the comment docs.

@IbrahimCSAE IbrahimCSAE changed the title feat(ViewportActionMenu): Initial WindowLevel per viewport and new patient info feat(ViewportActionMenu): window level per viewport / new patient info / colorbars/ 3D presets and cinematic rendering Mar 27, 2024
Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the dropdown for the window level anymore, just use a simple radioButton like zoom or pan

<img width="430" alt="CleanShot 2024-03-27 at 11 20 42@2x" src="https://github.com/OHIF/Viewe


The issue i sent over slack for color bar sticking around with old colors

CleanShot.2024-03-27.at.09.14.56.mp4

I don't think the icon is correct color in the inverted viewports

CleanShot 2024-03-27 at 11 24 23@2x

it probably should be the same color as the text, see text overlay on how we detect background is inverted and accordingly use a separate color for texts


when inverted color the colorbar tickers should be black or something they are white seems like , it is not readable

CleanShot 2024-03-27 at 11 25 39@2x

we should probably have another toggle that is invert background so that when the LUT is changed, the user can toggle the background to black to make it work

CleanShot 2024-03-27 at 11 26 53@2x

something weird happens when you set PT preset, seems like the winodw level does not work after that. maybe it is related to the weird binary image after the preset selection.

CleanShot.2024-03-27.at.11.28.35.mp4

Not sure why we don't show the dates for the cor, sag ct

CleanShot 2024-03-27 at 11 29 42@2x

we should not show I: for the reconstructed views since they are not instance number

CleanShot 2024-03-27 at 11 30 11@2x


I should not be able to select overlay texts

CleanShot 2024-03-27 at 11 30 49@2x

we don't need PT fusion color map after this PR and also remove the dropdown for window level presets for tmtv as well

CleanShot 2024-03-27 at 11 31 37@2x

color bar for tmtv is weird

CleanShot 2024-03-27 at 11 32 45@2x

logo seems like is a bit to the right, ask Dan, IMO it should align with the left of the viewport grid

CleanShot 2024-03-27 at 11 33 06@2x

similar to how the right side is aligned

CleanShot 2024-03-27 at 11 33 51@2x

the right side vertical bar also seems black, maybe is wrong? ask Dan

(Not your PR) can we fix this as well

CleanShot 2024-03-27 at 11 34 33@2x

@IbrahimCSAE
Copy link
Collaborator Author

IbrahimCSAE commented Mar 28, 2024

@sedghi

Fixed

  • Colorbar sticking around for new displaysets
  • OHIF logo position
  • Viewport overlay no longer selectable, Viewport Markers no longer selectable
  • Removed PET colormap tool in TMTV
  • Removed WindowLevel presets in all modes
  • Fixed colorbar position in TMV mode
  • Fixed study date not showing up in MPR
  • inverted icon for window level menu on inverted displaysets
  • black markers for colorbar on inverted displaysets

Comments

  • For PT window level, it seems the problem is the preset, it puts them in a level where window tool can't control them anymore, u can verify this if you switch back to default preset (first item in list), the window tool will start working again, tell me what u want to do for this
  • we should not show I: for the reconstructed views since they are not instance number: I cant find a good way to do this, suggestions?

image

I don't understand what needs to be fixed?

  • I noticed something has broken the colormap sync again recently in OHIF, it affected this PR as well

https://viewer-dev.ohif.org/tmtv?StudyInstanceUIDs=1.3.6.1.4.1.14519.5.2.1.7009.2403.871108593056125491804754960339

Change the colormap using the tool, then go into 1x1 and comeback out, the sync is broken...

This affected my MPR as well when you change the colormap in none MPR then go into MPR, it goes back to grayscale, it wasn't like this before

@IbrahimCSAE IbrahimCSAE requested a review from sedghi March 28, 2024 10:19
Copy link

cypress bot commented Mar 29, 2024

1 failed test on run #3785 ↗︎

1 42 0 0 Flakiness 0

Details:

Add react-i18next for internationalization support
Project: Viewers Commit: 958fdf7315
Status: Failed Duration: 05:57 💡
Started: Apr 2, 2024 1:33 PM Ended: Apr 2, 2024 1:39 PM
Failed  cypress/integration/customization/HangingProtocol.spec.js • 1 failed test

View Output Video

Test Artifacts
OHIF HP > Should navigate next/previous stage Test Replay Screenshots Video

Review all test suite changes for PR #3963 ↗︎

@sedghi sedghi changed the title feat(ViewportActionMenu): window level per viewport / new patient info / colorbars/ 3D presets and cinematic rendering feat(ViewportActionMenu): window level per viewport / new patient info / colorbars/ 3D presets and 3d volume rendering Apr 2, 2024
@sedghi sedghi changed the title feat(ViewportActionMenu): window level per viewport / new patient info / colorbars/ 3D presets and 3d volume rendering feat(ViewportActionMenu): window level per viewport / new patient info / colorbars/ 3D presets and 3D volume rendering Apr 2, 2024
@sedghi sedghi merged commit b7f90e3 into master Apr 2, 2024
8 of 11 checks passed
edcheyjr pushed a commit to edcheyjr/Viewers that referenced this pull request Apr 7, 2024
…o / colorbars/ 3D presets and 3D volume rendering (OHIF#3963)

Co-authored-by: Joe Boccanfuso <109477394+jbocce@users.noreply.github.com>
thanh-nguyen-dang pushed a commit to uc-cdis/Viewers that referenced this pull request May 1, 2024
…o / colorbars/ 3D presets and 3D volume rendering (OHIF#3963)

Co-authored-by: Joe Boccanfuso <109477394+jbocce@users.noreply.github.com>
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.

None yet

3 participants