Viewers
Viewers copied to clipboard
[Bug] Issue with Reference Line Tool Not Releasing in OHIF Image Viewer
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
- Open any medical image in the OHIF viewer.
- Activate a layout (eg. 2x2)
- Select the reference line tool.
- Attempt to change contrast (W/L).
- Select again contrast.
- Select other window in the layout.
- 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
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 ?
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.
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')"
I managed to get it working (although the 'indexOf' error still remains). The code with the solution is in: https://pastebin.com/RM4nLRfW
@rmasad The URL above is not accessible. Could you please check. Did you manage to get ReferenceLines active in all the windows?
rmasad well done. I managed to resolve this issue as well but its a hack. Posted in #3831
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.
I'm addressing this here https://github.com/OHIF/Viewers/pull/3961
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.