ivmartel / dwv

DICOM Web Viewer: open source zero footprint medical image library.
https://ivmartel.github.io/dwv/
GNU General Public License v3.0
1.67k stars 593 forks source link

LUT handling #769

Open KenanV opened 4 years ago

KenanV commented 4 years ago

As far as I can see the DICOM Web Viewer does not handle LUT tables such as the attribute: (0028,3006)

When the attribute is read, it is done as a String and then a data.split is performed (dwv.js line: 4855)

    else
    {
        if ( vr === "SH" || vr === "LO" || vr === "ST" ||
            vr === "PN" || vr === "LT" || vr === "UT" ) {
            data = reader.readSpecialString( offset, vl );
        } else {
            data = reader.readString( offset, vl );
        }
        offset += vl;
        data = data.split("\\");
    }

I have made a change to the following:

    else
    {
        if ( vr === "SH" || vr === "LO" || vr === "ST" ||
            vr === "PN" || vr === "LT" || vr === "UT" ) {
            data = reader.readSpecialString( offset, vl );
            } else {

            if (tag.name == "x00283006") {
                data = reader.readInt16Array(offset, vl);
            } else {
                data = reader.readString(offset, vl);
            }
        }
        offset += vl;
        if (tag.name != "x00283006") {
            data = data.split("\\");
        }
    }

This works for my image, but there could be other cases where additional work would be required.

ivmartel commented 4 years ago

You are right, dwv does not use the LUT module. As far as I get it, the LUT data type is set by the other LUT attributes.

If you have data you can share, that would be of great help!