extensions/xnat/src/components/XNATSegmentationExportMenu/XNATSegmentationExportMenu.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 { label } = this.state;
    const { firstImageId, viewportData } = this.props;
    const roiCollectionName = this._roiCollectionName;
    if (roiCollectionName.replace(/ /g, '').length === 0) {
      return;
    }
    this.setState({ exporting: true });
    const seriesInfo = getSeriesInfoForImageId(viewportData);
    const element = getElementForFirstImageId(firstImageId);
    const dicomSegWriter = new DICOMSEGWriter(seriesInfo);
    const DICOMSegPromise = dicomSegWriter.write(roiCollectionName, element);
    DICOMSegPromise.then(segBlob => {
      const dicomSegExporter = new DICOMSEGExporter(
        segBlob,
        seriesInfo.seriesInstanceUid,
        label,
        roiCollectionName
      );
      dicomSegExporter
        .exportToXNAT()
        .then(success => {
          console.log('PUT successful.');
          segmentationModule.setters.importMetadata(firstImageId, {
            label: label,
            name: roiCollectionName,
            type: 'SEG',
            modified: false,
          });
          this.props.onExportComplete();
        })
        .catch(error => {
          console.log(error);
          this.props.onExportCancel();
        });
    });
  }
async onExportButtonClick ( ) { const { label } = this . state ; const { firstImageId , viewportData } = this . props ; const roiCollectionName = this . _roiCollectionName ; if ( roiCollectionName . replace ( / / g , '' ) . length === 0 ) { return ; } this . setState ( { exporting : true } ) ; const seriesInfo = getSeriesInfoForImageId ( viewportData ) ; const element = getElementForFirstImageId ( firstImageId ) ; const dicomSegWriter = new DICOMSEGWriter ( seriesInfo ) ; const DICOMSegPromise = dicomSegWriter . write ( roiCollectionName , element ) ; DICOMSegPromise . then ( segBlob => { const dicomSegExporter = new DICOMSEGExporter ( segBlob , seriesInfo . seriesInstanceUid , label , roiCollectionName ) ; dicomSegExporter . exportToXNAT ( ) . then ( success => { console . log ( 'PUT successful.' ) ; segmentationModule . setters . importMetadata ( firstImageId , { label : label , name : roiCollectionName , type : 'SEG' , modified : false , } ) ; 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. // DICOM-SEG // Store that we've 'imported' a collection for this series. // (For all intents and purposes exporting it ends with an imported state, // i.e. not a fresh Mask collection.) // TODO -> Work on backup mechanism, disabled for now. //localBackup.saveBackUpForActiveSeries(); // displayExportFailedDialog(seriesInstanceUid);