[Bug] VOI LUT images not rendered correctly
Describe the Bug
Images with a VOI LUT don't get their levels computed correctly when rendering, so they display incorrectly.
Cornerstone3D version: 1.36.3 This works as expected when using Cornerstone JS 2.6.1 (wado image loader 3.3.2)
Attached is a file which demonstrates the issue. hand.dcm.zip
Correct rendering
Current rendering
(ignore the green annotation in the top right corner)
Tags relevant to VOI LUT
(0028,3010) SQ (Sequence with undefined length #=1) # u/l, 1 VOILUTSequence
(fffe,e000) na (Item with undefined length #=6) # u/l, 1 Item
(0028,3002) US 16384\0\14 # 6, 3 LUTDescriptor
(0028,3003) LO [User Selection] # 14, 1 LUTExplanation
(0028,3006) OW 0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000\0000... # 32768, 1 LUTData
(07a3,0010) LO [ELSCINT1] # 8, 1 PrivateCreator
(07a3,109d) DS [2332] # 4, 1 Unknown Tag & Data
(07a3,109e) DS [1149] # 4, 1 Unknown Tag & Data
Steps to Reproduce
- Load an image with a VOI LUT
The current behavior
The image gets rendered with incorrect levels
The expected behavior
The image renders with correct levels. This used to work in the "old" cornerstone.
OS
Linux
Node version
18.18.2
Browser
Chromium 119.0.6045.159, Firefox 120.0b9
Unfortunately, we currently do not have support for using the predefined VOI LUT in DICOM.
Do you have an idea how hard it’d be to port the logic from the “old” cornerstone? Just to know if it’s something I, as a total outsider, could consider doing…
Hmm, was it working in the old cs?
Yup, there it worked without doing anything special
Hello, Are there any plans to implement a predefined VOI LUT in DICOM?
Hmm, if I switch to setUseCPURendering(true) => Then it works fine. I'm trying to make a workaround - I'm trying to dynamically change the rendering engine and viewport - but it doesn't seem to work :( - no success
@sedghi are there any plans to support voi luts, dicom tag 0028 3010? It is really important that it works. It's one of the requirements in law that software for rtg dicoms diagnosis has it.
https://isap.sejm.gov.pl/isap.nsf/download.xsp/WDU20230000195/O/D20230195.pdf page 9 4) c).
I put together a very, very rough implementation in https://github.com/abustany/cornerstone3D/tree/voi-lut . That's unfortunately not in a shape that I could directly upstream, among others because:
- it's based on a an older cornerstone3D release (we haven't migrated to 2.0 yet)
- it's for the stack viewport only
- it's for GPU rendering only
- ideally we wouldn't need to duplicate the LUT decoding code between wadouri and wadors so much, for that we'd need to abstract how DICOM metadata is accessed in the code
I'm still putting this out in case it can be of any help to others.
Is there some update for this feature? @sedghi
@abustany hi, i wanted to ask if you have maybe gone forward with some other changes related to lut tables? maybe updated cornerstone or something?
Hey hey, we’re running the patch I linked above in production… but we’re still on an old Cornerstone version, I’m planning an update in the coming months but this doesn’t have highest priority for us.
I've tried using your changes, but i am stuck on how to apply it to the image. eg there are 3 lut tables and how to apply one of them to stack viewport and displayed image? @abustany
If I remember correctly, the code just picks the first LUT and applies it… you’d need further work to dynamically choose which LUT is applied.