src/tools/segmentation/strategies/fillCircle.js
/**
 * Fill all pixels inside/outside the region defined by the circle.
 * @param  {} evt The Cornerstone event.
 * @param {}  operationData An object containing the `pixelData` to
 *                          modify, the `segmentIndex` and the `points` array.
 * @returns {null}
 */
Fill all pixels inside/outside the region defined by the circle.
@param  {} evt The Cornerstone event.
Fill all pixels inside / outside the region defined by the circle . @param {} evt The Cornerstone event .
function fillCircle(evt, operationData, inside = true) {
  const { segmentationMixinType } = operationData;
  if (segmentationMixinType !== `circleSegmentationMixin`) {
    logger.error(
      `fillInsideCircle operation requires circleSegmentationMixin operationData, recieved ${segmentationMixinType}`
    );
    return;
  }
  const eventData = evt.detail;
  const [topLeft, bottomRight] = getBoundingBoxAroundCircle(evt);
  const ellipse = getCircleCoords(
    eventData.handles.start,
    eventData.handles.end
  );
  inside
    ? fillInsideShape(
        evt,
        operationData,
        point => pointInEllipse(ellipse, point),
        topLeft,
        bottomRight
      )
    : fillOutsideShape(
        evt,
        operationData,
        point => pointInEllipse(ellipse, point),
        topLeft,
        bottomRight
      );
}
function fillCircle ( evt , operationData , inside = true ) { const { segmentationMixinType } = operationData ; if ( segmentationMixinType !== ` ` ) { logger . error ( ` ${ segmentationMixinType } ` ) ; return ; } const eventData = evt . detail ; const [ topLeft , bottomRight ] = getBoundingBoxAroundCircle ( evt ) ; const ellipse = getCircleCoords ( eventData . handles . start , eventData . handles . end ) ; inside ? fillInsideShape ( evt , operationData , point => pointInEllipse ( ellipse , point ) , topLeft , bottomRight ) : fillOutsideShape ( evt , operationData , point => pointInEllipse ( ellipse , point ) , topLeft , bottomRight ) ; }
Fill all pixels inside/outside the region defined by the circle.
Fill all pixels inside / outside the region defined by the circle .