extensions/xnat/src/utils/IO/classes/RoiImporter.js
/**
   * _addOnePolygonToToolStateManager - Adds a single polygon to the
   *                                    cornerstoneTools toolState.
   *
   * @param  {Polygon} polygon            The polygon to add.
   * @param  {object} toolStateManager    The toolStateManager object.
   * @param  {string} correspondingImageId The imageId the polygon should be added to.
   * @param  {type} importType           The source file type (used for scaling).
   * @returns {null}
   */
Adds a single polygon to the
cornerstoneTools toolState.

@param  {Polygon} polygon            The polygon to add.
Adds a single polygon to the cornerstoneTools toolState . @param { Polygon } polygon The polygon to add .
_addOnePolygonToToolStateManager(
    polygon,
    toolStateManager,
    correspondingImageId,
    importType
  ) {
    if (!correspondingImageId) {
      return;
    }
    correspondingImageId = this._modifyImageIdIfMultiframe(
      correspondingImageId,
      polygon
    );
    this._addImageToolStateIfNotPresent(toolStateManager, correspondingImageId);
    const freehandToolData =
      toolStateManager[correspondingImageId][FREEHAND_ROI_3D_TOOL].data;
    if (this._polygonNotAlreadyPresent(freehandToolData, polygon.uid)) {
      const data = polygon.getFreehandToolData(importType);
      this._freehand3DStore.setters.incrementPolygonCount(
        data.seriesInstanceUid,
        data.structureSetUid,
        data.ROIContourUid
      );
      scaleHandles(data, correspondingImageId);
      freehandToolData.push(data);
    }
    console.log(toolStateManager);
  }
_addOnePolygonToToolStateManager ( polygon , toolStateManager , correspondingImageId , importType ) { if ( ! correspondingImageId ) { return ; } correspondingImageId = this . _modifyImageIdIfMultiframe ( correspondingImageId , polygon ) ; this . _addImageToolStateIfNotPresent ( toolStateManager , correspondingImageId ) ; const freehandToolData = toolStateManager [ correspondingImageId ] [ FREEHAND_ROI_3D_TOOL ] . data ; if ( this . _polygonNotAlreadyPresent ( freehandToolData , polygon . uid ) ) { const data = polygon . getFreehandToolData ( importType ) ; this . _freehand3DStore . setters . incrementPolygonCount ( data . seriesInstanceUid , data . structureSetUid , data . ROIContourUid ) ; scaleHandles ( data , correspondingImageId ) ; freehandToolData . push ( data ) ; } console . log ( toolStateManager ) ; }
_addOnePolygonToToolStateManager - Adds a single polygon to the
                                    cornerstoneTools toolState.
_addOnePolygonToToolStateManager - Adds a single polygon to the cornerstoneTools toolState .
// ROI for image which is not loaded // Point to correct imageId if multiframe Image