Misc. Version 3 syntax and usage questions
See original GitHub issuePrerequisites
- [ X] Are you running the latest version?
- [ X] Are you reporting to the correct repository?
- [ X] Did you perform a cursory search?
For more information, see the CONTRIBUTING
guide.
Description
I’ve been using cornerstonejs for quite some time now. I am currently trying to adapt my tool to use cornerstone tools. The problem is that I get this error and don’t know how to fix it nor how it’s been generated.
Unhandled Rejection (TypeError): undefined is not an object (evaluating ‘cornerstone_tools__WEBPACK_IMPORTED_MODULE_10__[“mouseInput”].enable’)
Steps to Reproduce
- After trying to simply install it on my current tool and nothing seems to work, I’ve search for some people that have done the same. You can check this url. I tried to adapt my tool to his code, nothing. Then I literally copied his code and put it in my project, same error.
Expected behavior: Tool to work as the link provided.
Actual behavior: Getting this error no matter if it is an adaptation to my tool or the exact same code as this person.
Codepen With Reproduction of Issue:
Issue Analytics
- State:
- Created 5 years ago
- Comments:21 (9 by maintainers)
Top Results From Across the Web
What's New In Python 3.0 — Python 3.11.1 documentation
Author, Guido van Rossum,. This article explains the new features in Python 3.0, compared to 2.6. Python 3.0, also known as “Python 3000”...
Read more >MICS6 Tools - UNICEF MICS
A comprehensive set of tools guide survey teams through every step of the MICS process – from overall planning, design and data collection...
Read more >American College of Rheumatology Clinical Guidance for ...
Our understanding of SARS-CoV-2-related syndromes in the pediatric population continues to evolve. This guidance document reflects currently available ...
Read more >Dependencies - Gentoo Development Guide
The Gentoo Devmanual is a technical manual which covers topics such as writing ebuilds and eclasses, and policies that developers should be abiding...
Read more >Telecommunication Version D and Above Questions, Answers ...
NCPDP recognizes the confidentiality of certain information exchanged electronically through the use of its standards. Users should be familiar ...
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
If you don’t have the metadata ahead of time, what you can do is use
cornerstone.loadAndCacheImage
to retrieve your images first, then check the imagePlaneMetadata viacornerstone.metadata.get('imagePlaneModule', imageId)
, and sort them byimagePositionPatient
, and then create the stack.Live Example:
.dcm
file: https://codesandbox.io/s/9z04x8ykjrNotes
Input Listeners
Version 2
Version 3
In version 3, we listen for these by default for each
enabledElement
you create after callingcornerstoneTools.init({ /*option*/ })
Activating Tools
Version 2
In Version 2, we can
activate
a built-in tool for a givenenabledElement
. The 2nd option, when activating amouseButtonTool
is themouseButtonMask
used to determine which button(s) the tool should respond to.Version 3
In Version 3, we make this a 2-step process. You need to:
cornerstoneTools.addTool(ToolClass)
ORcornerstoneTools.addToolForElement(enabledElement, ToolClass)
cornerstoneTools.setToolActive("ToolName", { /* options */ })
ORcornerstoneTools.setToolActiveForElement(enabledElement, "ToolName", { /* options */ })
Where
addTool
andsetToolActive
apply to all currently enabled elements, and theirForElement
counterparts allow for finer control.Parting Thoughts
I realize Version 3 may feel a bit more verbose, but it helps solve some common problems that surface pretty quickly when using Version 2. If you want specific examples of why we made the changes, I can delve deeper.
Or if you have additional questions about version 3’s usage, I can whip up some examples there as well.
The
Version 3
docs I linked you to were written before the API had been finalized. Unfortunately, this means parts of it are outdated and misleading. If you can point me toward the page(s) and excerpts that don’t work, I’ll try to update them. If you’re feeling brave, please feel free to submit a pull request with any changes you feel may correct outdated or incorrect documentation (all of our docs are simplemarkdown
documents).