cornerstonejs / cornerstone

JavaScript library to display interactive medical images including but not limited to DICOM
https://docs.cornerstonejs.org/
MIT License
2.04k stars 598 forks source link

does cornerstone offer support for aligning 2 layers using their image position (patient) and image orientation (patient) #544

Closed shanebenlolo closed 2 years ago

shanebenlolo commented 3 years ago

Hello,

I have been working on extending OHIF's functionality to use cornerstone's Layers API in order to perform fusion using two display sets found within the same study.

So far things have been going very well, the Layers API is a pleasure to work with, and I have successfully gotten two display sets layered on top of one another. As of now, the viewport shows new images for both layers every time their is a scroll event in an enabled element.

The scaling is working perfectly, the images are always scaled correctly to fit one another when I add the second display set as a new layer. However, the thing I have not been able to figure out is how to orient the foreground layer along the backgrounds Z-axis.

Currently, when I add a new display set as a layer, I simply use the background display sets currentImageindexto pick which image from the foreground display set to display. However, this results in both images starting at the beginning of the backgrounds display set, when the foreground may not line up with the background until halfway through the backgrounds display set.

Because this is a little hard to verbalize, I made a visualization to help make clear what is happening: New Project

I am beginning to work on a way to create this alignment, but I wanted to know if cornerstone already offers any tools which may be useful for undertaking this task before I go re-inventing the wheel. I hope this question is not too vague, I would appreciate any advice you could offer on how to tackle this task using cornerstone's current tool set. Thanks in advance for any help you can offer.

shanebenlolo commented 2 years ago

After further research I found that the VTK extension available in OHIF offers a fusion feature which can be brought into OHIF. So I have scrapped my work with the layers API and instead am now building features using this example: https://react-vtkjs-viewport.netlify.app/

PattersonOfficial commented 2 years ago

I have been trying to work on this very same thing. Can you teach me how you were able to perform the fusion of the displaySets using the Layer API

shanebenlolo commented 2 years ago

I have been trying to work on this very same thing. Can you teach me how you were able to perform the fusion of the displaySets using the Layer API

I can't teach you but after further research I can tell you the Cornerstone Layers API is not the way to perform fusion in OHIF.

Instead, use the VTK plugin and implement the examples found here https://react-vtkjs-viewport.netlify.app/fusion