Viewers: How to modify Cornerstone Tools in OHIF

Created on 28 Jul 2020  路  3Comments  路  Source: OHIF/Viewers

Hello,

I am trying to add a few my own cornorstone-based tools into OHIF, but it turns out that the Cornorstone in OHIF is in a packaged status, and I have no idea how to deal with that. So what shall I do if I want to modify the tools in OHIF?

Looking forward to your reply!

Community Triage

Most helpful comment

Thank you for your help! I tried and it seems worked!

All 3 comments

The core team can probably answer this question better. But I hope this example can help with modifying csTool in the confine of its extension capabilities.

Let's say you want to change the default wwwcTool window leveling strategy. You can do the following

const appConfig = {
  cornerstoneExtensionConfig: {
    tools: {
      Wwwc: wwwcToolConfig
    }
  }
}

where key (Wwwc here) must match the name of the tool.

const wwwcToolConfig = {
    defaultStrategy: myLevelingStrategy.name,
    strategies: { myLevelingStrategy }
}

function myLevelingStrategy(evt) {
    .... code of my strategy.
}

See the wwwc tool basicLevelingStrategy implemented in cornerstoneTool.

The strategies object will be merged and contain both basic and my leveling strategy. Setting the defaultStrategy will tell the tool which strategy to apply when user W/L.

On the other hand, the tools seems to be added in the init.js of extensions/cornerstone extension.
If you are working in your own fork/branch, then perhaps create your own tools and add them to the list?

Thank you for your help! I tried and it seems worked!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TZubiri picture TZubiri  路  3Comments

christianvargasforero picture christianvargasforero  路  4Comments

bhavesh-pandey picture bhavesh-pandey  路  5Comments

MuriloSchaefer picture MuriloSchaefer  路  3Comments

pieper picture pieper  路  3Comments