function fill(eventData) {
  var configuration = brush.getConfiguration();
  var radius = configuration.radius;
  var element = eventData.element;
  var layer = _externalModules2.default.cornerstone.getLayer(element, configuration.brushLayerId);
  var _layer$image2 = layer.image,
      rows = _layer$image2.rows,
      columns = _layer$image2.columns;
  var _eventData$currentPoi2 = eventData.currentPoints.image,
      x = _eventData$currentPoi2.x,
      y = _eventData$currentPoi2.y;

  var toolData = (0, _toolState.getToolState)(element, TOOL_STATE_TOOL_TYPE);
  var pixelData = toolData.data[0].pixelData;
  var brushPixelValue = configuration.draw;

  if (x < 0 || x > columns || y < 0 || y > rows) {
    return;
  }

  x = Math.round(x);
  y = Math.round(y);

  // This thisCircle = [(x, y - radius), (x + radius, y), (x, y + radius), (x - radius, y)]
  var thisCircle = (0, _fill.getEndOfCircle)(x, y, columns, rows, pixelData, brushPixelValue);

  if (Math.abs(thisCircle[0] - thisCircle[2]) > radius * 2 && Math.abs(thisCircle[1] - thisCircle[3]) > radius * 2) {
    // If the position you clicked is aleady in same color, this method is not necessary.
    return;
  }

  if ((0, _fill.connectEndsOfBrush)(x, y, columns, rows, thisCircle, pixelData, brushPixelValue)) {
    if ((0, _fill.isCircleInPolygon)(x, y, columns, rows, thisCircle, pixelData, brushPixelValue)) {
      (0, _fill.fillColor)(x, thisCircle[0] - 1, columns, rows, pixelData, brushPixelValue);
    }
  }

  layer.invalid = true;

  _externalModules2.default.cornerstone.updateImage(element);
}
// This method is for fill region of segmentation overlays
This method is for fill region of segmentation overlays
This method is for fill region of segmentation overlays
function fill(eventData) {
  var configuration = brush.getConfiguration();
  var radius = configuration.radius;
  var element = eventData.element;
  var layer = _externalModules2.default.cornerstone.getLayer(element, configuration.brushLayerId);
  var _layer$image2 = layer.image,
      rows = _layer$image2.rows,
      columns = _layer$image2.columns;
  var _eventData$currentPoi2 = eventData.currentPoints.image,
      x = _eventData$currentPoi2.x,
      y = _eventData$currentPoi2.y;
  var toolData = (0, _toolState.getToolState)(element, TOOL_STATE_TOOL_TYPE);
  var pixelData = toolData.data[0].pixelData;
  var brushPixelValue = configuration.draw;
  if (x < 0 || x > columns || y < 0 || y > rows) {
    return;
  }
  x = Math.round(x);
  y = Math.round(y);
  var thisCircle = (0, _fill.getEndOfCircle)(x, y, columns, rows, pixelData, brushPixelValue);
  if (Math.abs(thisCircle[0] - thisCircle[2]) > radius * 2 && Math.abs(thisCircle[1] - thisCircle[3]) > radius * 2) {
    return;
  }
  if ((0, _fill.connectEndsOfBrush)(x, y, columns, rows, thisCircle, pixelData, brushPixelValue)) {
    if ((0, _fill.isCircleInPolygon)(x, y, columns, rows, thisCircle, pixelData, brushPixelValue)) {
      (0, _fill.fillColor)(x, thisCircle[0] - 1, columns, rows, pixelData, brushPixelValue);
    }
  }
  layer.invalid = true;
  _externalModules2.default.cornerstone.updateImage(element);
}
function fill ( eventData ) { var configuration = brush . getConfiguration ( ) ; var radius = configuration . radius ; var element = eventData . element ; var layer = _externalModules2 . default . cornerstone . getLayer ( element , configuration . brushLayerId ) ; var _layer$image2 = layer . image , rows = _layer$image2 . rows , columns = _layer$image2 . columns ; var _eventData$currentPoi2 = eventData . currentPoints . image , x = _eventData$currentPoi2 . x , y = _eventData$currentPoi2 . y ; var toolData = ( 0 , _toolState . getToolState ) ( element , TOOL_STATE_TOOL_TYPE ) ; var pixelData = toolData . data [ 0 ] . pixelData ; var brushPixelValue = configuration . draw ; if ( x < 0 || x > columns || y < 0 || y > rows ) { return ; } x = Math . round ( x ) ; y = Math . round ( y ) ; var thisCircle = ( 0 , _fill . getEndOfCircle ) ( x , y , columns , rows , pixelData , brushPixelValue ) ; if ( Math . abs ( thisCircle [ 0 ] - thisCircle [ 2 ] ) > radius * 2 && Math . abs ( thisCircle [ 1 ] - thisCircle [ 3 ] ) > radius * 2 ) { return ; } if ( ( 0 , _fill . connectEndsOfBrush ) ( x , y , columns , rows , thisCircle , pixelData , brushPixelValue ) ) { if ( ( 0 , _fill . isCircleInPolygon ) ( x , y , columns , rows , thisCircle , pixelData , brushPixelValue ) ) { ( 0 , _fill . fillColor ) ( x , thisCircle [ 0 ] - 1 , columns , rows , pixelData , brushPixelValue ) ; } } layer . invalid = true ; _externalModules2 . default . cornerstone . updateImage ( element ) ; }
This method is for fill region of segmentation overlays
This method is for fill region of segmentation overlays
// This thisCircle = [(x, y - radius), (x + radius, y), (x, y + radius), (x - radius, y)] // If the position you clicked is aleady in same color, this method is not necessary.