cornerstonejs / cornerstoneTools

[Deprecated] Use Cornerstone3D Instead https://cornerstonejs.org/
MIT License
579 stars 456 forks source link

Add "Hounsfield Units" support to probe tool #278

Open dannyrb opened 7 years ago

dannyrb commented 7 years ago

The dragProbe tool's "minimal" strategy calculates Hounsfield Units for non-color CT images. You can see the logic for it here:

https://github.com/chafey/cornerstoneTools/blob/master/src/imageTools/dragProbe.js#L126-L148

    storedPixels = cornerstone.getStoredPixels(element, toolCoords.x, toolCoords.y, 1, 1);
    const sp = storedPixels[0];
    const mo = sp * eventData.image.slope + eventData.image.intercept;

    const modalityPixelValueText = parseFloat(mo.toFixed(2));

    if (modality === 'CT') {
      text += `HU: ${modalityPixelValueText}`;
    }

probe does not calculate HU for non-color CT images. You can see where it does it's calculation here:

https://github.com/chafey/cornerstoneTools/blob/master/src/imageTools/probe.js#L86-L102

Is this on purpose? Would a radiologist want HU on drag, but rarely to stay as an annotation? If this is not the case, I think it's worth flagging this as an Enhancement

swederik commented 7 years ago

This is not on purpose. One of the groups using this tool wanted HU to be added, and it was only added to the one they were using. I'd be happy to take a PR to add it to the other tool!

dannyrb commented 7 years ago

@swederik, I did a little digging. Are we sure this is the correct math? The formula calls for

pixel intensity * slope + intercept

Is "pixel intensity" what cornerstone.getStoredPixels(element, toolCoords.x, toolCoords.y, 1, 1) returns? I only ask because I've noticed that the dragProbe tool tends to show different numbers for HU than the desktop software I use. Example values that getStoredPixels() returns for me are: 0, 1, 255, not much else.