Capture coordinates after drawing a contour an image dicom

Describe Your Question

  • I am trying to capture coordinates after I drawing a contour in an image dicom using Brush Tool of Cornerstone JS library.
  • v1.14 (CornerstoneJS)

What steps can we follow to reproduce the bug?

  1. Create a new folder in packages/tools/examples and a index.ts file
  2. Add the follow code in your index.ts file:

// Crea un arreglo para almacenar las coordenadas del contorno
const contourCoordinates: cornerstone.Point = ;

element1.addEventListener(‘CORNERSTONE_TOOLS_MOUSE_MOVE’, (event: Event) => {
const eventData = event as CustomEvent;

//if (eventData.detail.toolType === ‘Brush’) {
// Obtiene las coordenadas del evento
const coords = eventData.detail.currentPoints.image;

// Almacena las coordenadas en el arreglo


element1.addEventListener(‘CORNERSTONE_TOOLS_MOUSE_UP’, (event: Event) => {
const eventData = event as CustomEvent;

// Puedes hacer lo que desees con las coordenadas almacenadas en contourCoordinates
console.log('Coordenadas del trazado:', contourCoordinates);

// Limpia el arreglo de coordenadas después de obtenerlas
contourCoordinates.length = 0;


  1. Run your project

Hello @rcolomer and welcome to the OHIF community forum.

A couple of things about the sample code you sent above…

  1. It is likely best to listen for 'CORNERSTONE_TOOLS_MOUSE_DRAG' since the brush is applied only during a drag.
  2. The eventData.detail.currentPoints object does NOT have an image field, but it does have a world field and the image coordinates can be obtained by using the utilties.worldToImageCoords function.

I hope this helps.