Use of renderImageObject on a stack viewport

I would like guidance on using renderImageObject.

I can use viewport.setStack([imageId]) followed by viewport.render() no problem.

But when I try cornerstone.imageLoader.loadAndCacheImage(imageId) followed by viewport.renderImageObject(imageId) I don’t see the same behaviour. I haven’t debugged in detail, but at least I can say that I don’t see the IMAGE_RENDERED event.

In our use case after render we copy the bitmap from the cornerstone canvas (which is hidden in the page). Normally we copy after IMAGE_RENDERED fires. If instead I copy after the renderImageObject call the bitmap is empty.

I know that’s not much to go on - but is there anything obvious that I might be missing?

thanks!

1 Like

You should avoid really rendering without setStack.
Why you want to loadAndCache manually?

Hi
The reason I wanted to use renderImageObject was that its description here Types | API | Cornerstone.js seems to better match my use case: it is “intended to be used by utilities to render an individual image, rather than by applications that want to display a complete image stack”.
I do not necessarily want to let cornerstone manage a stack of images. I want to provide single images. Giving cornerstone a stack with one image seems to be working fine for me at the moment. So I was more curious than anything else.
Do the docs describe the advantages of providing a stack to cornerstone? What features does that enable?
thanks
ben