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

[Bug] Issue with Reference Line Tool Not Releasing in OHIF Image Viewer #3848

Closed
rmasad opened this issue Dec 11, 2023 · 9 comments
Closed
Assignees
Labels
fixed-in-dev-await-release This issue is fixed in master (viewer-dev) but we are pending testing for release (viewer.ohif.org)

Comments

@rmasad
Copy link

rmasad commented Dec 11, 2023

Describe the Bug

Once reference line tool selected, the tool does not seem to release properly. When selecting the tool, the previously selected tool (for example contrast change) is not selected (although it appears as active). Additionally, when the tool is selected again, it must be selected for each window (when using layouts).

Tested in 3.8-beta.27

Steps to Reproduce

  1. Open any medical image in the OHIF viewer.
  2. Activate a layout (eg. 2x2)
  3. Select the reference line tool.
  4. Attempt to change contrast (W/L).
  5. Select again contrast.
  6. Select other window in the layout.
  7. Attempt to change contrast (W/L).

The current behavior

  • Instead of being activated by default as expected, the reference line feature might require manual activation each time the software is used or for each individual session.
  • When a tool that is currently activated is selected, and the reference line tool is actived, the tool is still selected but doesn't work.
  • When tools like contrast or window/level (W/L) are selected, their effects might not apply to all windows in the layout simultaneously. This behavior contrasts with the expected uniform application across all windows, necessitating individual adjustments for each window.

The expected behavior

  • The reference line should be activated by default.
  • When selecting a tool that is activated (not used) you should not leave the previously used tool selected.
  • When selecting a tool (such as contrast, W/L) it must be for all windows in the layout.

OS

MacOS 11.7

Node version

18

Browser

Chrome 118

@rmasad rmasad added the Awaiting Reproduction Can we reproduce the reported bug? label Dec 11, 2023
@raviaiken
Copy link

Adding this in this issue since I am trying to activate reference line as the default tool.

Changed the setDefaultTool in modes\longitudinal\src\index.js as below

toolbarService.setDefaultTool({ groupId: 'ReferenceLines', itemId: 'ReferenceLines', interactionType: 'toggle', // interactionType: 'tool', commands: [ { // commandName: 'toggleReferenceLines', commandName: 'setToolActive', commandOptions: { toolName: 'ReferenceLines', }, context: 'CORNERSTONE', }, { commandName: 'setSourceViewportForReferenceLinesTool', context: 'CORNERSTONE', }, ], });

However I keep getting the error "node_modules@cornerstonejs\tools\src\utilities\planar\filterAnnotationsForDisplay.ts:50 Uncaught TypeError: Cannot read properties of null (reading 'indexOf')"

Believe need to enable below listeners as done during the creation on ReferenceLines Tool Button
listeners: { [EVENTS.ACTIVE_VIEWPORT_ID_CHANGED]: ReferenceLinesCommands, [EVENTS.STACK_VIEWPORT_NEW_STACK]: ReferenceLinesCommands, },

Any pointers on how to do this in DefaultTool ?

@rmasad
Copy link
Author

rmasad commented Dec 11, 2023

The problem with this solution is that it removes the (correct) behavior that the default tool is Windows Level (contrast).

By default Reference Lines should be active as is Image Overlay.

Furthermore, it does not solve the problem that when using a tool in one of the layout windows, it is not active for all of them.

@raviaiken
Copy link

Agreed.
Making changes in below files sets ReferenceLines to active. However like you mentioned, its not active for all the windows.

modes\longitudinal\src\initToolGroups.js -

enabled: [{ toolName: toolNames.ReferenceLines }],

modes\longitudinal\src\moreTools.ts -
modes\longitudinal\src\moreToolsMpr.ts -
{ listeners: { [EVENTS.STACK_VIEWPORT_NEW_STACK]: ReferenceLinesCommands, [EVENTS.ACTIVE_VIEWPORT_ID_CHANGED]: ReferenceLinesCommands, }, isActive: true, }

Keep getting this error "node_modules@cornerstonejs\tools\src\utilities\planar\filterAnnotationsForDisplay.ts:50 Uncaught TypeError: Cannot read properties of null (reading 'indexOf')"

@james-hanks james-hanks self-assigned this Dec 14, 2023
@rmasad
Copy link
Author

rmasad commented Dec 18, 2023

I managed to get it working (although the 'indexOf' error still remains). The code with the solution is in: https://pastebin.com/RM4nLRfW

@raviaiken
Copy link

@rmasad The URL above is not accessible. Could you please check. Did you manage to get ReferenceLines active in all the windows?

@matowuut
Copy link

rmasad well done. I managed to resolve this issue as well but its a hack. Posted in #3831

@james-hanks james-hanks added the Bugs Bug reported, reproducible, and verified. label Dec 22, 2023
@sedghi sedghi removed the Awaiting Reproduction Can we reproduce the reported bug? label Jan 9, 2024
@tzuccher
Copy link

Went into the above bug and was able to verify the following:

  • Reference lines are not on by default - the user has to go in and select the tool
  • Once you do select the Reference Line tool, you do have to go in and manually select the W/L tool (that is highlighted and looks to be enabled) in each viewport before using W/L
  • Changing the W/L on one viewport does not change it for every viewport - only the active one.

@sedghi
Copy link
Member

sedghi commented Feb 26, 2024

I'm addressing this here #3961

@sedghi sedghi added fixed-in-dev-await-release This issue is fixed in master (viewer-dev) but we are pending testing for release (viewer.ohif.org) and removed Bugs Bug reported, reproducible, and verified. labels Apr 3, 2024
@sedghi
Copy link
Member

sedghi commented May 1, 2024

We just release the OHIF 3.8, you can find more details here https://ohif.org/release-notes/3p8/
If you still encounter this issue in 3.8, please re-open this.

@sedghi sedghi closed this as completed May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed-in-dev-await-release This issue is fixed in master (viewer-dev) but we are pending testing for release (viewer.ohif.org)
Projects
None yet
Development

No branches or pull requests

6 participants