Skip to main content

Examples

We have already written plenty number of examples that you can access here. When you click on an example you will be taken to its example page. You can interact with each example and see how it works.

Click here to open examples page

Source Code and Debugging

If you are interested in looking into the source code for each example, we have added a link to the source code when you open the chrome developer tools. You can see the following video to see how to do this. In summary, after opening the chrome developer tools, click on the console and click on the index.ts that is shown in the console.

You can put breakpoints at any line of the code and investigate the variables and functions that are being called.

Run Examples Locally

You can also run each example locally. It should be noted that Cornerstone3D is a monorepo and contains three packages (core, tools, streaming-image-volume). Examples for each of these packages are included in the examples directory inside each package. To run the example you need to change directory to the package root and run yarn run example ExampleName (this is a limitation and we will be working on a better solution to run examples from the root of the monorepo).

  1. Clone the repository
  2. yarn install
  3. Run example
    • For core examples:
    cd packages/core
    yarn run example ExampleName
    # for instance:
    # yarn run example volumeAPI
    • For tools examples:
    cd packages/tools
    yarn run example ExampleName
    # for instance:
    # yarn run example petCt
    • For streaming-image-volume examples:
    cd packages/streaming-image-volume
    yarn run example ExampleName
Important

Example names are case sensitive, and they match their folder name