wearemothership / dicom.ts

A small, fast, javascript DICOM renderer
Other
35 stars 13 forks source link

configure Renderer to display multiple dcm images at once #71

Closed klyanyi closed 1 month ago

klyanyi commented 1 year ago

hi guys, is it possible to make the Renderer to display multiple dcm images at once? let's say for example there is an array of dcm images and I want to display them all on a single canvas

starkey commented 1 year ago

Looking through the code, the canvas is resized to fit the image on each render, and I'm not even seeing a native way of doing pan/zoom/crop, so I'd say no.

I'm in the process of evaluating dicom.ts against cornerstone, and while I prefer dicom.ts over all, this is likely going to force me to cornerstone.

nickhingston commented 1 year ago

My suggestion would be to use 2 canvas's - one off screen one for decoding the image(s).

Then on your visible canvas use:

yourVisibleCanvas.getContext('2d').drawImage(theRendererCanvas, xOffset, yOffset, outputWidth, outputHeight);

which is nice and fast.

Any zooming etc would be done on this visible canvas. I personally use paper.js http://paperjs.org for this purpose.

starkey commented 1 year ago

Hi Nick,

thanks, for the suggestion, and yeah that works well for me. I'm stumped on one last thing (and sorry to hijack klyanyi's topic here):

How do I control greyscale windowing? If I'm reading this correctly, the GreyscaleProgram is created from a copy of a passed IGreyscaleProgram in primeGreyscale(). However, the only user controllable value is knownWindow, which seems to toggle whether to use hard coded values or a LUT.

Obviously I'm missing something here.

nickhingston commented 1 year ago

There is no easy external way to control the windowing. Currently we create the image with the windowing as defined in the file. We don't really support any post processing of the image

It should be possible to edit the tags member of DCMImage to set the window center or width (or even set a LUT) before you do the render, but that's not very user friendly!

We could expose setters for these and some other tags, or maybe we'll look into a way of exposing contrast / brightness / windowing separately for render - again this is something we do when BLTing to the destination canvas, but can see it being useful for some.