src/tools/segmentation/SphericalBrushTool.js
/**
   * _getImagesInRange - Returns an array of image Ids within range of the
   * sphere, and the in-plane brush radii of those images.
   *
   * @param  {string} currentImageIdIndex The imageId of the image displayed on
   *                                   the cornerstone enabled element.
   * @param  {number[]} ippOfCurrentImage   The image position patient of the image.
   * @param  {string[]} imageIds           An array of images in the stack.
   * @param  {number} radius             The radius of the sphere.
   * @param  {number} pixelSpacing       The pixelSpacing.
   * @returns {Object[]}                   An array of imageIds in range and their
   *                                   in plane brush radii.
   */
Returns an array of image Ids within range of the
sphere, and the in-plane brush radii of those images.

@param  {string} currentImageIdIndex The imageId of the image displayed on
the cornerstone enabled element.
@param  {number[]} ippOfCurrentImage   The image position patient of the image.
@param  {string[]} imageIds           An array of images in the stack.
@param  {number} radius             The radius of the sphere.
@param  {number} pixelSpacing       The pixelSpacing.
@returns {Object[]}                   An array of imageIds in range and their
in plane brush radii.
Returns an array of image Ids within range of the sphere and the in - plane brush radii of those images . @param { string } currentImageIdIndex The imageId of the image displayed on the cornerstone enabled element . @param { number [] } ippOfCurrentImage The image position patient of the image . @param { string [] } imageIds An array of images in the stack . @param { number } radius The radius of the sphere . @param { number } pixelSpacing The pixelSpacing . @returns { Object [] } An array of imageIds in range and their in plane brush radii .
_getImagesInRange(
    currentImageIdIndex,
    ippOfCurrentImage,
    imageIds,
    radius,
    pixelSpacing
  ) {
    const radiusInMM = radius * pixelSpacing;
    const imagesInRange = [
      {
        imageIdIndex: currentImageIdIndex,
        radiusOnImage: radius,
      },
    ];
    for (let i = currentImageIdIndex + 1; i < imageIds.length; i++) {
      const radiusOnImage = this._getRadiusOnImage(
        imageIds[i],
        ippOfCurrentImage,
        radiusInMM,
        pixelSpacing
      );
      if (!radiusOnImage) {
        break;
      }
      imagesInRange.push({
        imageIdIndex: i,
        radiusOnImage,
      });
    }
    for (let i = currentImageIdIndex - 1; i >= 0; i--) {
      const radiusOnImage = this._getRadiusOnImage(
        imageIds[i],
        ippOfCurrentImage,
        radiusInMM,
        pixelSpacing
      );
      if (!radiusOnImage) {
        break;
      }
      imagesInRange.push({
        imageIdIndex: i,
        radiusOnImage,
      });
    }
    return imagesInRange;
  }
_getImagesInRange ( currentImageIdIndex , ippOfCurrentImage , imageIds , radius , pixelSpacing ) { const radiusInMM = radius * pixelSpacing ; const imagesInRange = [ { imageIdIndex : currentImageIdIndex , radiusOnImage : radius , } , ] ; for ( let i = currentImageIdIndex + 1 ; i < imageIds . length ; i ++ ) { const radiusOnImage = this . _getRadiusOnImage ( imageIds [ i ] , ippOfCurrentImage , radiusInMM , pixelSpacing ) ; if ( ! radiusOnImage ) { break ; } imagesInRange . push ( { imageIdIndex : i , radiusOnImage , } ) ; } for ( let i = currentImageIdIndex - 1 ; i >= 0 ; i -- ) { const radiusOnImage = this . _getRadiusOnImage ( imageIds [ i ] , ippOfCurrentImage , radiusInMM , pixelSpacing ) ; if ( ! radiusOnImage ) { break ; } imagesInRange . push ( { imageIdIndex : i , radiusOnImage , } ) ; } return imagesInRange ; }
_getImagesInRange - Returns an array of image Ids within range of the
 sphere, and the in-plane brush radii of those images.
_getImagesInRange - Returns an array of image Ids within range of the sphere and the in - plane brush radii of those images .
// The current image. // Check images above // Check images below