src/tools/segmentation/strategies/fillRectangle.js
/**
 * FillInsideRectangle - Fill all pixels inside/outside the region defined
 * by the rectangle.
 * @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 rectangle.
@param  {} evt The Cornerstone event.
Fill all pixels inside / outside the region defined by the rectangle . @param {} evt The Cornerstone event .
function fillRectangle(evt, operationData, inside = true) {
  const { points, segmentationMixinType } = operationData;
  if (segmentationMixinType !== `rectangleSegmentationMixin`) {
    logger.error(
      `eraseInsideRectangle operation requires rectangleSegmentationMixin operationData, recieved ${segmentationMixinType}`
    );
    return;
  }
  const { image } = evt.detail;
  const vertices = points.map(a => [a.x, a.y]);
  const [topLeft, bottomRight] = getBoundingBoxAroundPolygon(vertices, image);
  inside
    ? fillInsideShape(evt, operationData, () => true, topLeft, bottomRight)
    : fillOutsideBoundingBox(evt, operationData, topLeft, bottomRight);
}
function fillRectangle ( evt , operationData , inside = true ) { const { points , segmentationMixinType } = operationData ; if ( segmentationMixinType !== ` ` ) { logger . error ( ` ${ segmentationMixinType } ` ) ; return ; } const { image } = evt . detail ; const vertices = points . map ( a => [ a . x , a . y ] ) ; const [ topLeft , bottomRight ] = getBoundingBoxAroundPolygon ( vertices , image ) ; inside ? fillInsideShape ( evt , operationData , ( ) => true , topLeft , bottomRight ) : fillOutsideBoundingBox ( evt , operationData , topLeft , bottomRight ) ; }
FillInsideRectangle - Fill all pixels inside/outside the region defined
 by the rectangle.
FillInsideRectangle - Fill all pixels inside / outside the region defined by the rectangle .