extensions/xnat/src/components/XNATContourExportMenu/XNATContourExportMenu.js
/**
   * async onExportButtonClick - Exports the current mask to XNAT.
   *
   * @returns {null}
   */
async onExportButtonClick - Exports the current mask to XNAT.
@returns {null}
async onExportButtonClick - Exports the current mask to XNAT . @returns { null }
async onExportButtonClick() {
    const { roiContourList, selectedCheckboxes, label, dateTime } = this.state;
    const { SeriesInstanceUID, viewportData } = this.props;
    const roiCollectionName = this._roiCollectionName;
    if (roiCollectionName.replace(/ /g, '').length === 0
      || roiCollectionName === '_') {
      return;
    }
    const exportMask = [];
    let atLeastOneRoiContourSelected = false;
    for (let i = 0; i < roiContourList.length; i++) {
      if (selectedCheckboxes[i]) {
        exportMask[roiContourList[i].index] = true;
        atLeastOneRoiContourSelected = true;
      }
    }
    if (!atLeastOneRoiContourSelected) {
      return;
    }
    this.setState({ exporting: true });
    const roiExtractor = new RoiExtractor(SeriesInstanceUID);
    const roiContours = roiExtractor.extractROIContours(exportMask);
    const seriesInfo = getSeriesInfoForImageId(viewportData);
    const aw = new AIMWriter(roiCollectionName, label, dateTime);
    aw.writeImageAnnotationCollection(roiContours, seriesInfo);
    const aimExporter = new AIMExporter(aw);
    await aimExporter
      .exportToXNAT()
      .then(success => {
        console.log('PUT successful.');
        lockStructureSet(
          exportMask,
          seriesInfo.seriesInstanceUid,
          roiCollectionName,
          label
        );
        this.props.onExportComplete();
      })
      .catch(error => {
        console.log(error);
        this.props.onExportCancel();
      });
  }
async onExportButtonClick ( ) { const { roiContourList , selectedCheckboxes , label , dateTime } = this . state ; const { SeriesInstanceUID , viewportData } = this . props ; const roiCollectionName = this . _roiCollectionName ; if ( roiCollectionName . replace ( / / g , '' ) . length === 0 || roiCollectionName === '_' ) { return ; } const exportMask = [ ] ; let atLeastOneRoiContourSelected = false ; for ( let i = 0 ; i < roiContourList . length ; i ++ ) { if ( selectedCheckboxes [ i ] ) { exportMask [ roiContourList [ i ] . index ] = true ; atLeastOneRoiContourSelected = true ; } } if ( ! atLeastOneRoiContourSelected ) { return ; } this . setState ( { exporting : true } ) ; const roiExtractor = new RoiExtractor ( SeriesInstanceUID ) ; const roiContours = roiExtractor . extractROIContours ( exportMask ) ; const seriesInfo = getSeriesInfoForImageId ( viewportData ) ; const aw = new AIMWriter ( roiCollectionName , label , dateTime ) ; aw . writeImageAnnotationCollection ( roiContours , seriesInfo ) ; const aimExporter = new AIMExporter ( aw ) ; await aimExporter . exportToXNAT ( ) . then ( success => { console . log ( 'PUT successful.' ) ; lockStructureSet ( exportMask , seriesInfo . seriesInstanceUid , roiCollectionName , label ) ; this . props . onExportComplete ( ) ; } ) . catch ( error => { console . log ( error ) ; this . props . onExportCancel ( ) ; } ) ; }
async onExportButtonClick - Exports the current mask to XNAT.
async onExportButtonClick - Exports the current mask to XNAT .
// Check the name isn't empty, and isn't just whitespace. // Attempt export to XNAT. Lock ROIs for editing if the export is successful. //lockExportedROIs( // TODO -> Work on backup mechanism, disabled for now. //localBackup.saveBackUpForActiveSeries(); //displayExportFailedDialog(seriesInfo.seriesInstanceUid);