_getEnabledElement returns undefined
See original GitHub issueI am currently working on a project that involves the cornerstone libraries (react-cornerstone-viewport 0.1.27 and cornerstone-tools 3.9.2).
I have one CornestoneViewport and one brush tool. I can change the segmentation (previous, next); change the brush size; but if I try to hide the segmentations using:
** hideAllSegmentationsOnElement
**
It is giving me this error:
cornerstone.js:2388 Uncaught Error: getEnabledElement: parameter element must not be undefined
at Object.getEnabledElement (cornerstone.js:2388)
at BaseBrushTool._getEnabledElement (cornerstoneTools.js:25163)
at <anonymous>:1:30
so it seems that the element (this.element) is not set in the brush tool.
This is what I am kind of doing in my React component (render method) just for testing:
cornerstoneTools.addTool(this.state.brushTool)
return (
<div>
<CornerstoneViewport ...
cornerstoneTools = {cornerstoneTools}
... />
</div>
)
Do you have an idea of what I need to do here?
I would appreciate any help, Thanks.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
react-cornerstone: Cannot read property 'getEnabledElement ...
When using react-cornerstone you have to initialise the viewport before being able to use it. In plain JS the function initCornerstone is as ......
Read more >Cannot read property 'getEnabledElement' of undefined in react
I have a project which make a use of the react version of the cornerstone.js library. I'm using :https://github.com/cornerstonejs/react-cornerstone-viewport.
Read more >getEnabledElement | API - Cornerstone.js
Returns IEnabledElement | undefined. the associated EnabledElement, or undefined if no matching EnabledElement can be found.
Read more >Cannot read property 'getEnabledElement' of undefined-Reactjs
[Solved]-react-cornerstone: Cannot read property 'getEnabledElement' of undefined-Reactjs ... Why id returns as undefined in the console when using ...
Read more >How to use the cornerstone-core.metaData function in ... - Snyk
metaData examples, based on popular ways it is used in public projects. ... getEnabledElement(element); const imageId = enabledElement.image.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@d13g0 Are you still having this issue after our changes? I think it was related to passing
cornerstoneTools = {cornerstoneTools}
into the component (which was previously necessary, but is no longer required). I’m guessing we can close this.Closing for now. Please feel free to continue the conversation if your issue is not resolved.