AAPM TG-18 tests not rendering correct luminance values

I was testing slicer using the AAPM TG-18 test dataset from here:
looking at the luminance tests. The RGB pixel value for the luminance 2 test should be #0F0F0F (this is the value in the center of the image). This can be seen by reading the raw pixel value in the center, which is 240, and then apply the window width/center of 4080/2040 using the formulas from the DICOM standard:
y = ((x - (c - 0.5)) / (w-1) + 0.5) * (ymax- ymin) + ymin
So, plugging in x=240, c=2040, w=4080, ymax=255, ymin=0, we get:
y = ((240 - (2040 - 0.5)) / (4080-1) + 0.5) * 255 = 15.003
which, when rounded should be 0F hex, but the value I’m seeing in 3D Slicer is 0D. Interestingly, OHIF, also based on VTK, produces a 0E value, also incorrect.

I’ve loaded 2: TG18-LN series of lumin-1k-dcm.zip and the rendering in Slicer-5.2.2 was perfect (on Windows11, using Intel Integrated Graphics):

Numeric values (voxel HU is read from Data probe in Slicer; rendered pixel value is read from a screen capture):

Voxel HU Rendered pixel value
4080 255
3840 240
3600 225
3360 210
3120 195
2880 180
2640 165
2400 150
2160 135
1920 120
1680 105
1440 90
1200 75
960 60
720 45
480 30
240 15
0 0

What positions you measured at? Interpolation is enabled by default, so if you are not at the exact center of the slice then you’ll get values interpolated between neighbor slices. See rendering with interpolation enabled:

I’ve checked the result with interpolation enabled and at slice center positions all the rendered pixel values were perfect.

What operating system do you use? Have you enabled any night light/blue light filter or HDR display, or performed any kind of screen calibration on your computer? On some operating systems or when using some third-party applications, appearance of screenshots may be affected by such settings.

Looks like this has been resolved in 5.2.2 - I upgraded (but forgot to check which version I was running), and it is now displaying the right values for the luminance.

1 Like

For me it is 0D on Mac M2 GPU on Slicer 5.2.2

@lassoan can you test this dicom Dropbox - TG18-LN-1k-02.dcm - Simplify your life

This is a volume and by default you see interpolated values, so it matters where you do the probing.

What is the RAS position and the voxel value where the rendered pixel is 0x0d?

If you disable interpolation and probe each slice do you see the same voxel and rendered pixel values as in the table above?

Hi all, Let’s back up a second. Any Medical Physicist who thinks to use 3D Slicer in fulfilling regulatory testing, he or she needs to do testing and keep records as to how they verified said software.

@wayfarer3130, @alireza, where are you going with this?

I’m not picking the color on the edge of grey/black to get affected with the interpolation. Although I turned it off and it is still showing 0D (maybe it is only on Mac?)

Just note that we are talking about a color picker and not talking about the color lookup table.

@gcsharp Bill showed this to me that we (at Cornerstone3D) are off by 0.5 in window level (PR here Fix an off by 0.5/1 error in window level calculations by wayfarer3130 · Pull Request #736 · cornerstonejs/cornerstone3D · GitHub) and I was interested to see what are other softwares doing regarding this and here we are

Currently, in Slicer we don’t request any specific color space in the surface format, so the default, unspecified color space is used. This could either mean “monitor RGB” value or some standard color space, such as sRGB. If your display’s color profile is different from the color profile of the sceenshot you take then the pixel values may be slightly modified.

@wayfarer3130, @alireza, what is the purpose of the testing? Do you expect to have your calculated 8-bit value to match the monitor RGB value or some standard color RGB value (e.g., sRGB)? Do you expect the 8-bit value to match perceptual lightness, luminance, luminosity,…?

Agreed. In the AAPM TG-18 test document the testing is performed by calibrated instruments, not by inspecting screenshots. For example, how the TG18-LN pattern is supposed to be used:

luminance is measured using a calibrated luminance meter at the center of the 18 TG18-LN test patterns, corresponding to 18 distinct digital driving levels