cornerstoneTools
cornerstoneTools copied to clipboard
How to draw a Point's CT value?
Prerequisites
-
[ ] Which version are you using? (Is it latest?) A: the version is cornerstone-tools - 5.1.4
-
[ ] Are you reporting to the correct repository? A:not yet
-
[ ] Did you search existing issues? (Were any related?) A: I seached "CT" and "hounsfield ",there is no result
Description
Dear 👍 👍 👍 I searched the cornerstoneTools.js ,there are many tools, and i can use every tools in my project,but i can not found the CT value Tools ,could you please tell me how to test a Point's CT value ? is probe means CT value? thank you very much!
the lists tools is just copied from the cornerstoneTools.js : AngleTool, ArrowAnnotateTool, BidirectionalTool, CircleRoiTool, CobbAngleTool, EllipticalRoiTool, FreehandRoiTool, LengthTool, ProbeTool, RectangleRoiTool, TextMarkerTool, BrushTool, SphericalBrushTool, RectangleScissorsTool, FreehandScissorsTool, CircleScissorsTool, CorrectionScissorsTool, CrosshairsTool, DoubleTapFitToWindowTool, DragProbeTool, EraserTool, FreehandRoiSculptorTool, MagnifyTool, OverlayTool, OrientationMarkersTool, PanMultiTouchTool, PanTool, ReferenceLinesTool, RotateTool, RotateTouchTool, ScaleOverlayTool, StackScrollMouseWheelTool, StackScrollMultiTouchTool, StackScrollTool, WwwcRegionTool, WwwcTool, ZoomMouseWheelTool, ZoomTool, ZoomTouchPinchTool, init, stackPrefetch, stackRenderers, playClip, stopClip, store, getModule, getToolForElement, addTool, addToolForElement, removeTool, removeToolForElement, setToolOptions, setToolOptionsForElement, isToolActiveForElement, setToolActive, setToolActiveForElement, setToolEnabled, setToolEnabledForElement, setToolDisabled, setToolDisabledForElement, setToolPassive, setToolPassiveForElement, addToolState, getToolState, removeToolState, clearToolState, setElementToolStateManager, getElementToolStateManager, textStyle, toolStyle, toolColors, toolCoordinates, stackSpecificStateManager, newStackSpecificToolStateManager, addStackStateManager, loadHandlerManager, newImageIdSpecificToolStateManager, globalImageIdSpecificToolStateManager, newFrameOfReferenceSpecificToolStateManager, globalFrameOfReferenceSpecificToolStateManager, forceEnabledElementResize, orientation, SaveAs, enableLogger, disableLogger, register, registerSome, wwwcSynchronizer, updateImageSynchronizer, Synchronizer, stackScrollSynchronizer, stackImagePositionSynchronizer, stackImagePositionOffsetSynchronizer, stackImageIndexSynchronizer, panZoomSynchronizer, requestPoolManager, importInternal, external, EVENTS, version, import,
Do you mean hounsfield unit by 'CT value'? Mostly a HU follows this rule
hu = pixel_value * slope + intercept
And cornerstoneTools DragProbeTool directly shows this value when activated. Please check HERE
storedPixels = cornerstone.getStoredPixels(element, x, y, 1, 1);
const sp = storedPixels[0];
const mo = sp * image.slope + image.intercept;
const suv = calculateSUV(image, sp);
// Draw text
str = `SP: ${sp} MO: ${parseFloat(mo.toFixed(3))}`;
You can also use the ProbeTool
from CornerstoneTools to get the Hounsfield unit (HU) value of a pixel. The ProbeTool
allows you to probe a single pixel and get its HU value as well as its position in image coordinates.
Here is an example of how to use the ProbeTool
:
// Get the element to attach the tool to
const element = document.getElementById('myElement');
// Enable the probe tool for the element
cornerstoneTools.addTool(cornerstoneTools.ProbeTool);
// Activate the probe tool for the element
cornerstoneTools.setToolActiveForElement(element, 'Probe', {
mouseButtonMask: 1 // left mouse button
});
// Add an event listener to get the probe result
element.addEventListener('cornerstoneimagerendered', function(event) {
// Get the active tool
const tool = cornerstoneTools.getToolForElement(element, 'Probe');
// Get the probe result
const result = tool.probe(event.detail.image, event.detail.canvasContext, event.detail.element);
// Check if the probe result is valid
if (result) {
// Get the HU value and position of the pixel
const huValue = result.hounsfieldUnits;
const position = result.imageCoordinates;
console.log(`Pixel position: (${position.x}, ${position.y})`);
console.log(`HU value: ${huValue}`);
}
});
This code attaches the ProbeTool
to an element, activates the tool, and adds an event listener to get the probe result. The probe
function of the ProbeTool
is called whenever the image is rendered and returns the HU value and position of the probed pixel. You can then use these values to draw the CT value in the image.
You can check out my answer on StackOverflow for more information and references on this issue:
https://stackoverflow.com/a/73204850/2371987
这是来自QQ邮箱的假期自动回复邮件。 您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。