extensions/xnat/src/peppermint-tools/tools/segmentation/Brush3DAutoGatedTool.js
/**
   * _gateCircle - Given an image and a brush circle, gate the circle between
   * the set gate values, and then cleanup the resulting mask using the
   * holeFill and strayRemove properties of the brush module.
   *
   * @param  {object} image   The cornerstone image.
   * @param  {Number[][]} circle  An array of image pixels contained within the brush
   *                        circle.
   * @returns {Number[][]}  An array containing the gated/cleaned pixels to fill.
   */
Given an image and a brush circle, gate the circle between
the set gate values, and then cleanup the resulting mask using the
holeFill and strayRemove properties of the brush module.

@param  {object} image   The cornerstone image.
@param  {Number[][]} circle  An array of image pixels contained within the brush
circle.
@returns {Number[][]}  An array containing the gated/cleaned pixels to fill.
Given an image and a brush circle gate the circle between the set gate values and then cleanup the resulting mask using the holeFill and strayRemove properties of the brush module . @param { object } image The cornerstone image . @param { Number [] [] } circle An array of image pixels contained within the brush circle . @returns { Number [] [] } An array containing the gated / cleaned pixels to fill .
_gateCircle(image, circle) {
    const rows = image.rows;
    const imagePixelData = image.getPixelData();
    const gateValues = this.gate;
    const rescaleSlope = image.slope || 1;
    const rescaleIntercept = image.intercept || 0;
    const gatedCircleArray = [];
    for (let i = 0; i < circle.length; i++) {
      let pixelValue = imagePixelData[circle[i][0] + circle[i][1] * rows];
      pixelValue = pixelValue * rescaleSlope + rescaleIntercept;
      if (pixelValue >= gateValues[0] && pixelValue <= gateValues[1]) {
        gatedCircleArray.push(circle[i]);
      }
    }
    return this._cleanGatedCircle(circle, gatedCircleArray);
  }
_gateCircle ( image , circle ) { const rows = image . rows ; const imagePixelData = image . getPixelData ( ) ; const gateValues = this . gate ; const rescaleSlope = image . slope || 1 ; const rescaleIntercept = image . intercept || 0 ; const gatedCircleArray = [ ] ; for ( let i = 0 ; i < circle . length ; i ++ ) { let pixelValue = imagePixelData [ circle [ i ] [ 0 ] + circle [ i ] [ 1 ] * rows ] ; pixelValue = pixelValue * rescaleSlope + rescaleIntercept ; if ( pixelValue >= gateValues [ 0 ] && pixelValue <= gateValues [ 1 ] ) { gatedCircleArray . push ( circle [ i ] ) ; } } return this . _cleanGatedCircle ( circle , gatedCircleArray ) ; }
_gateCircle - Given an image and a brush circle, gate the circle between
 the set gate values, and then cleanup the resulting mask using the
 holeFill and strayRemove properties of the brush module.
_gateCircle - Given an image and a brush circle gate the circle between the set gate values and then cleanup the resulting mask using the holeFill and strayRemove properties of the brush module .