How to use the dicom-parser.readFixedString function in dicom-parser

To help you get started, we’ve selected a few dicom-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OHIF / ohif-core / src / lib / parsingUtils.js View on Github external
multiValue: function(data, tag, parser) {
    if (this.isValidDataSet(data) && tag in data.elements) {
      let element = data.elements[tag];
      if (element && element.length > 0) {
        let string = dicomParser.readFixedString(
          data.byteArray,
          element.dataOffset,
          element.length
        );
        if (typeof string === 'string' && string.length > 0) {
          if (typeof parser !== 'function') {
            parser = null;
          }

          return string.split('\\').map(function(value) {
            value = value.trim();
            return parser !== null ? parser(value) : value;
          });
        }
      }
    }