question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

_getEnabledElement returns undefined

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
swederikcommented, May 27, 2019

@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.

0reactions
dannyrbcommented, Jun 9, 2019

Closing for now. Please feel free to continue the conversation if your issue is not resolved.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found