extensions/xnat/src/utils/IO/classes/AIMReader.js
/**
   * _addPolygon - Adds a polygon to the list of polygons.
   *
   * @param  {HTMLElement} markupEntity  The AIM MarkupEntity
   * @param  {string} ROIContourUid The UID of the new ROIContour.
   * @returns {null}
   */
Adds a polygon to the list of polygons.
@param  {HTMLElement} markupEntity  The AIM MarkupEntity
@param  {string} ROIContourUid The UID of the new ROIContour.
@returns {null}
Adds a polygon to the list of polygons . @param { HTMLElement } markupEntity The AIM MarkupEntity @param { string } ROIContourUid The UID of the new ROIContour . @returns { null }
_addPolygon(markupEntity, ROIContourUid) {
    const sopInstanceUid = markupEntity
      .getElementsByTagName('imageReferenceUid')[0]
      .getAttribute('root');
    if (!this._sopInstancesInSeries.includes(sopInstanceUid)) {
      return;
    }
    const polygonUid = markupEntity
      .getElementsByTagName('uniqueIdentifier')[0]
      .getAttribute('root');
    const referencedFrameNumber = markupEntity
      .getElementsByTagName('referencedFrameNumber')[0]
      .getAttribute('value');
    const twoDimensionSpatialCoordinateCollection = markupEntity.getElementsByTagName(
      'twoDimensionSpatialCoordinateCollection'
    )[0].children;
    const points = [];
    for (
      let i = 0;
      i < twoDimensionSpatialCoordinateCollection.length - 1;
      i++
    ) {
      points.push({
        x: Number(
          twoDimensionSpatialCoordinateCollection[i]
            .getElementsByTagName('x')[0]
            .getAttribute('value')
        ),
        y: Number(
          twoDimensionSpatialCoordinateCollection[i]
            .getElementsByTagName('y')[0]
            .getAttribute('value')
        ),
      });
    }
    const polygon = new Polygon(
      points,
      sopInstanceUid,
      this._seriesInstanceUidToImport,
      this._roiCollectionLabel,
      ROIContourUid,
      polygonUid,
      referencedFrameNumber
    );
    this._polygons.push(polygon);
  }
_addPolygon ( markupEntity , ROIContourUid ) { const sopInstanceUid = markupEntity . getElementsByTagName ( 'imageReferenceUid' ) [ 0 ] . getAttribute ( 'root' ) ; if ( ! this . _sopInstancesInSeries . includes ( sopInstanceUid ) ) { return ; } const polygonUid = markupEntity . getElementsByTagName ( 'uniqueIdentifier' ) [ 0 ] . getAttribute ( 'root' ) ; const referencedFrameNumber = markupEntity . getElementsByTagName ( 'referencedFrameNumber' ) [ 0 ] . getAttribute ( 'value' ) ; const twoDimensionSpatialCoordinateCollection = markupEntity . getElementsByTagName ( 'twoDimensionSpatialCoordinateCollection' ) [ 0 ] . children ; const points = [ ] ; for ( let i = 0 ; i < twoDimensionSpatialCoordinateCollection . length - 1 ; i ++ ) { points . push ( { x : Number ( twoDimensionSpatialCoordinateCollection [ i ] . getElementsByTagName ( 'x' ) [ 0 ] . getAttribute ( 'value' ) ) , y : Number ( twoDimensionSpatialCoordinateCollection [ i ] . getElementsByTagName ( 'y' ) [ 0 ] . getAttribute ( 'value' ) ) , } ) ; } const polygon = new Polygon ( points , sopInstanceUid , this . _seriesInstanceUidToImport , this . _roiCollectionLabel , ROIContourUid , polygonUid , referencedFrameNumber ) ; this . _polygons . push ( polygon ) ; }
_addPolygon - Adds a polygon to the list of polygons.
_addPolygon - Adds a polygon to the list of polygons .
// Don't extract polygon if it doesn't belong to the series being imported // NOTE: itterate up to length - 1, as first and last points are the same for closed polygons.