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

Proposal for compositional layer support #116

Open
Ouwen opened this issue Mar 17, 2021 · 2 comments
Open

Proposal for compositional layer support #116

Ouwen opened this issue Mar 17, 2021 · 2 comments

Comments

@Ouwen
Copy link

Ouwen commented Mar 17, 2021

Since cornerstonejs has layer API support (cornerstonejs/cornerstone#68), the react-cornerstone-viewport could provide props support. This would allow for easy overlays of segmentation maps, heat maps, and other fusion based image information.

The current behaviour for react-cornsertone-viewport is to take in a list of imageIds as a stack and display some initial index.

cornerstoneTools.clearToolState(this.element, 'stack');
cornerstoneTools.addStackStateManager(this.element, [
'stack',
'playClip',
'referenceLines',
]);
cornerstoneTools.addToolState(this.element, 'stack', {
imageIds: [...imageIds],
currentImageIdIndex: imageIdIndex,
});
// Load first image in stack
const image = await cornerstone.loadAndCacheImage(imageId);
// Display
cornerstone.displayImage(this.element, image);

However, it would be useful to take in layers as a prop where layers can contain many imageIds, but ultimately they are fused together as with the composite image example: https://rawgit.com/cornerstonejs/cornerstone/master/example/layers/index.html.

// layers prop
const layers = [{
            imageId: 'ct://1',
            options: {
                name: 'CT'
            }
        }, {
            imageId: 'pet://1',
            options: {
                name: 'PET',
                opacity: 0.7,
                viewport: {
                    colormap: 'hotIron',
                    voi: {
                        windowWidth: 30,
                        windowCenter: 16
                    }
                }
            }
        }
    ];

Alternatively, the imageIds could by default be added to a single element layer with that layer being set active.

A potential barrier is that the cornerstoneTools stack stateManagement relies on imageIds. Not sure if this would be a big deal though since the cornerstone layer API uses underlying imageIds, and tools can be applied to just the the active layer. I was wondering what would happen if we just provided the list of imageIds from the active layer.

Happy to put together a PR, but wanted to feel out opinions on better API design or caveats.

@Ouwen Ouwen changed the title Support for compositional layers Proposal compositional layer support Apr 11, 2021
@Ouwen Ouwen changed the title Proposal compositional layer support Proposal for compositional layer support Apr 11, 2021
@shanebenlolo
Copy link

Did you ever write a PR for this? I'm trying to implement the same thing.

@Ouwen
Copy link
Author

Ouwen commented Aug 10, 2021

No I have not

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