How to use the dicom-parser.parseDicom 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 FNNDSC / ami / src / parsers / parsers.dicom.js View on Github external
constructor(data, id) {
    super();

    this._id = id;

    this._arrayBuffer = data.buffer;

    let byteArray = new Uint8Array(this._arrayBuffer);

    // catch error
    // throw error if any!
    this._dataSet = null;

    try {
      this._dataSet = DicomParser.parseDicom(byteArray);
    } catch (e) {
      console.log(e);
      const error = new Error('parsers.dicom could not parse the file');
      throw error;
    }
  }
github InsightSoftwareConsortium / itk-js / examples / Dicom / src / parseDicomFiles.js View on Github external
const parseFile = async (file) => {
    // Read
    const arrayBuffer = await PromiseFileReader.readAsArrayBuffer(file)

    // Parse
    const byteArray = new Uint8Array(arrayBuffer)
    const dicomMetaData = dicomParser.parseDicom(byteArray)

    // Add to patientDict
    const tag = DICOMPatient.primaryTag
    const patientId = dicomMetaData.string(DICOM_DICTIONARY[tag])
    var patient = patientDict[patientId]
    if (patient === undefined) {
      patient = new DICOMPatient()
      patientDict[patientId] = patient
    }
    patient.parseMetaData(dicomMetaData, file)
  }
github OHIF / Viewers / extensions / dicom-pdf / src / DicomPDFViewport.js View on Github external
parseByteArray = byteArray => {
    const options = {
      untilTag: '',
    };

    let dataSet;

    try {
      dataSet = dicomParser.parseDicom(byteArray, options);
    } catch (error) {
      this.setState({
        error,
      });
    }

    return dataSet;
  };