cornerstone3D icon indicating copy to clipboard operation
cornerstone3D copied to clipboard

[Bug] VOI LUT images not rendered correctly

Open abustany opened this issue 2 years ago • 6 comments

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

hand

Current rendering

(ignore the green annotation in the top right corner)

image

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

  1. 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

abustany avatar Dec 11 '23 20:12 abustany

Unfortunately, we currently do not have support for using the predefined VOI LUT in DICOM.

sedghi avatar Dec 13 '23 22:12 sedghi

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…

abustany avatar Dec 13 '23 22:12 abustany

Hmm, was it working in the old cs?

sedghi avatar Dec 13 '23 23:12 sedghi

Yup, there it worked without doing anything special

abustany avatar Dec 14 '23 08:12 abustany

Hello, Are there any plans to implement a predefined VOI LUT in DICOM?

AnnaKuduk avatar Mar 28 '24 09:03 AnnaKuduk

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

AnnaKuduk avatar Mar 28 '24 15:03 AnnaKuduk

@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).

kubanm3 avatar Nov 19 '24 07:11 kubanm3

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.

abustany avatar Jan 13 '25 09:01 abustany

Is there some update for this feature? @sedghi

kubanm3 avatar May 29 '25 06:05 kubanm3

@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?

kubanm3 avatar May 29 '25 08:05 kubanm3

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.

abustany avatar May 29 '25 08:05 abustany

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

kubanm3 avatar Jun 20 '25 11:06 kubanm3

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.

abustany avatar Jun 21 '25 00:06 abustany