extensions/xnat/src/components/XNATContourImportMenu/XNATContourImportMenu.js
/**
   * async _getAndImportFile - Imports the file from the REST url and loads it into
   *                     cornerstoneTools toolData.
   *
   * @param  {string} uri             The REST URI of the file.
   * @param  {Object} collectionInfo  An object describing the roiCollection to
   *                                  import.
   * @returns {null}
   */
async _getAndImportFile - Imports the file from the REST url and loads it into
cornerstoneTools toolData.

@param  {string} uri             The REST URI of the file.
@param  {Object} collectionInfo  An object describing the roiCollection to
import.
@returns {null}
async _getAndImportFile - Imports the file from the REST url and loads it into cornerstoneTools toolData . @param { string } uri The REST URI of the file . @param { Object } collectionInfo An object describing the roiCollection to import . @returns { null }
async _getAndImportFile(uri, roiCollectionInfo) {
    const roiImporter = new RoiImporter(
      roiCollectionInfo.referencedSeriesInstanceUid,
      this.updateProgress
    );
    uri = uri.slice(1);
    console.log('_getAndImportFile URI:');
    console.log(uri);
    switch (roiCollectionInfo.collectionType) {
      case 'AIM':
        this._updateImportingText(roiCollectionInfo.name);
        const aimFile = await fetchXML(uri).promise;
        if (!aimFile) {
          break;
        }
        roiImporter.importAIMfile(
          aimFile,
          roiCollectionInfo.name,
          roiCollectionInfo.label
        );
        break;
      case 'RTSTRUCT':
        this._updateImportingText(roiCollectionInfo.name);
        const rtStructFile = await fetchArrayBuffer(uri).promise;
        if (!rtStructFile) {
          break;
        }
        roiImporter.importRTStruct(
          rtStructFile,
          roiCollectionInfo.name,
          roiCollectionInfo.label
        );
        break;
      default:
        console.error(
          `RoiImportListDialog._getAndImportFile not configured for filetype: ${fileType}.`
        );
    }
    this._incrementNumCollectionsParsed(roiCollectionInfo.name);
  }
async _getAndImportFile ( uri , roiCollectionInfo ) { const roiImporter = new RoiImporter ( roiCollectionInfo . referencedSeriesInstanceUid , this . updateProgress ) ; uri = uri . slice ( 1 ) ; console . log ( '_getAndImportFile URI:' ) ; console . log ( uri ) ; switch ( roiCollectionInfo . collectionType ) { case 'AIM' : this . _updateImportingText ( roiCollectionInfo . name ) ; const aimFile = await fetchXML ( uri ) . promise ; if ( ! aimFile ) { break ; } roiImporter . importAIMfile ( aimFile , roiCollectionInfo . name , roiCollectionInfo . label ) ; break ; case 'RTSTRUCT' : this . _updateImportingText ( roiCollectionInfo . name ) ; const rtStructFile = await fetchArrayBuffer ( uri ) . promise ; if ( ! rtStructFile ) { break ; } roiImporter . importRTStruct ( rtStructFile , roiCollectionInfo . name , roiCollectionInfo . label ) ; break ; default : console . error ( ` ${ fileType } ` ) ; } this . _incrementNumCollectionsParsed ( roiCollectionInfo . name ) ; }
async _getAndImportFile - Imports the file from the REST url and loads it into
                     cornerstoneTools toolData.
async _getAndImportFile - Imports the file from the REST url and loads it into cornerstoneTools toolData .
// The URIs fetched have an additional /, so remove it.