extensions/xnat/src/peppermint-tools/tools/segmentation/Brush3DAutoGatedTool.js
/**
   * _setCustomGate - Gets the minimum and maximum brush values within the image
   * and sets the gate mode to "custom" with these values.
   *
   * @param  {object} evt The cornerstone event.
   * @returns {null}
   */
Gets the minimum and maximum brush values within the image
and sets the gate mode to "custom" with these values.

@param  {object} evt The cornerstone event.
@returns {null}
Gets the minimum and maximum brush values within the image and sets the gate mode to " custom " with these values . @param { object } evt The cornerstone event . @returns { null }
_setCustomGate(evt) {
    const eventData = evt.detail;
    const image = eventData.image;
    const { rows, columns } = image;
    const { x, y } = eventData.currentPoints.image;
    const radius = segmentationModule.configuration.radius;
    const imagePixelData = image.getPixelData();
    const rescaleSlope = image.slope || 1;
    const rescaleIntercept = image.intercept || 0;
    const circle = getCircle(radius, rows, columns, x, y);
    let lo = imagePixelData[circle[0][0] + circle[0][1] * rows];
    let hi = lo;
    for (let i = 0; i < circle.length; i++) {
      let pixelValue = imagePixelData[circle[i][0] + circle[i][1] * rows];
      if (pixelValue < lo) {
        lo = pixelValue;
      }
      if (pixelValue > hi) {
        hi = pixelValue;
      }
    }
    lo = lo * rescaleSlope + rescaleIntercept;
    hi = hi * rescaleSlope + rescaleIntercept;
    this.gate = [lo, hi];
  }
_setCustomGate ( evt ) { const eventData = evt . detail ; const image = eventData . image ; const { rows , columns } = image ; const { x , y } = eventData . currentPoints . image ; const radius = segmentationModule . configuration . radius ; const imagePixelData = image . getPixelData ( ) ; const rescaleSlope = image . slope || 1 ; const rescaleIntercept = image . intercept || 0 ; const circle = getCircle ( radius , rows , columns , x , y ) ; let lo = imagePixelData [ circle [ 0 ] [ 0 ] + circle [ 0 ] [ 1 ] * rows ] ; let hi = lo ; for ( let i = 0 ; i < circle . length ; i ++ ) { let pixelValue = imagePixelData [ circle [ i ] [ 0 ] + circle [ i ] [ 1 ] * rows ] ; if ( pixelValue < lo ) { lo = pixelValue ; } if ( pixelValue > hi ) { hi = pixelValue ; } } lo = lo * rescaleSlope + rescaleIntercept ; hi = hi * rescaleSlope + rescaleIntercept ; this . gate = [ lo , hi ] ; }
_setCustomGate - Gets the minimum and maximum brush values within the image
 and sets the gate mode to "custom" with these values.
_setCustomGate - Gets the minimum and maximum brush values within the image and sets the gate mode to " custom " with these values .
// Initialise hi and lo as the first pixelValue in the circle. // Find the highest and lowest value.