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

How to add new tool to the viewer #38

Closed
nodevm opened this issue Sep 10, 2016 · 2 comments
Closed

How to add new tool to the viewer #38

nodevm opened this issue Sep 10, 2016 · 2 comments
Assignees

Comments

@nodevm
Copy link

nodevm commented Sep 10, 2016

I want to add new tools to the viewer. I know how to add the icon to the toolbar for a new tool,but where the code resides for the new tool is not very clear.

Where for instance is the code for the length tool?.

@swederik
Copy link
Member

swederik commented Sep 13, 2016

Hello Lancelot,

The tools reside in the Cornerstone Tools library: https://github.com/chafey/cornerstoneTools/

The length tool specifically is here:

https://github.com/chafey/cornerstoneTools/blob/master/src/imageTools/lengthTool.js

To add a tool to the Viewer there are a few steps:

  1. Add the tool itself to the repository.
    If you're using something from Cornerstone TOols you can skip this step. Some examples of custom tools can be found in the lesion tracker: https://github.com/OHIF/Viewers/tree/master/Packages/lesiontracker/client/compatibility

  2. Add the toolbar button itself to the array of tools in the Toolbar:
    https://github.com/OHIF/Viewers/blob/574a6d02b090b8b2f020430c5919f8377b8316c6/OHIFViewer/client/components/toolbarSection/toolbarSection.js

  3. A: Add it to the toolManager (if it's a tool, such as length / angle):

    toolManager.addTool('bidirectional', {

    OR

    B: Add it to the functionList if it's a command (e.g. toggle CINE play, or Invert the current viewport):

    OHIF.viewer.functionList = {

I've also added these details to the Wiki: https://github.com/OHIF/Viewers/wiki/Adding-a-tool-to-the-Viewer

If this satisfies your question please close the issue. If not, comment here with any issues you encountered and we can update the documentation.

Making this easier is one of our goals, so these steps might change in the future.

Hope that helps,

Erik

@swederik swederik self-assigned this Sep 13, 2016
@nodevm
Copy link
Author

nodevm commented Sep 13, 2016

Many thanks @swederik for your detailed answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants