cornerstonejs / cornerstone3D

Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the OHIF Viewer.
https://cornerstonejs.org
MIT License
490 stars 256 forks source link

[Feature Request] Passing multiple volume Ids to `createAndCacheDerivedSegmentationVolume()` #1331

Closed prerakmody closed 2 weeks ago

prerakmody commented 4 weeks ago

What feature or change would you like to see made?

Task

To perform segmentation on a scan and check them on a different scan. Check scan swapping on this netlify example. On that:

Requirement

Ability to pass multiple volumeIds to createAndCacheDerivedSegmentationVolume(). Currently (core - v1.78.1) it only supports one volumeId string (ref)

Sample snippet

const imageIdsPET = await createImageIdsAndCacheMetaData(searchObjPET); volumePT = await cornerstone3D.volumeLoader.createAndCacheVolume(volumeIdPET, { imageIds: imageIdsPET }); volumePT.load();

// Step 2 - Set volume for viewports await cornerstone3D.setVolumesForViewports(renderingEngine, [{ volumeId:volumeIdCT, callback: setCtTransferFunctionForVolumeActor }], viewportIds);

// Step 3 - Set segmentation on volume(s) await cornerstone3D.volumeLoader.createAndCacheDerivedSegmentationVolume(volumeIdCT, {volumeId: segmentationId,}); // await cornerstone3D.volumeLoader.createAndCacheDerivedSegmentationVolume([volumeIdCT, volumeIdPET], {volumeId: segmentationId,}); // (to implement) For multiple volumes



### Why should we prioritize this feature?

Clinicians often do segmentations on multi-modality settings (e.g. CT + PET, CT + MR) and hence its useful to have this feature to drive adoption of cornerstone.

#### Caveat
There is an [example](https://www.cornerstonejs.org/live-examples/multivolumeapi) that shows swapping between CT and PET, but unfortunately I was unable to get the same visual output when using the `setPetColorMapTransferFunctionForVolumeActor.js`([link](https://github.com/cornerstonejs/cornerstone3D/blob/v1.77.13/utils/demo/helpers/setPetColorMapTransferFunctionForVolumeActor.js)) file
sedghi commented 3 weeks ago

So what you're describing already exists in our pipeline. Basically, a segmentation can be rendered on viewports regardless of the reference resolution. Our example probably doesn't have that set up, but in the following example, you can see that the same segmentation is rendered on both CT and PET. What you're describing is about rendering, and we already have that set up.

https://viewer-dev.ohif.org/tmtv?StudyInstanceUIDs=1.3.6.1.4.1.14519.5.2.1.7009.2403.334240657131972136850343327463

prerakmody commented 3 weeks ago

I think I get what you are saying. Thanks!