DICOM Edit 6 JavaScript (de6js) provides support for extracting and modifying DICOM header metadata and values in DICOM data. This JavaScript implementation of DICOM Edit 6 uses the same grammar as the original Java library, parses it using antlr4-tool to generate Typescript code for the parser, and builds a library very similar to the existing Java-based functionality for DICOM Edit 6.
To build de6js:
$ yarn install
$ yarn build-parser
antlr4-tool will create a number of Typescript and JavaScript files in the parser folder:
- DE6Lexer.d.ts
- DE6Lexer.js
- DE6Parser.d.ts
- DE6Parser.js
- DE6ParserListener.d.ts
- DE6ParserListener.js
- DE6ParserVisitor.js
- TagPathLexer.d.ts
- TagPathLexer.js
- TagPathListener.d.ts
- TagPathListener.js
- TagPathParser.d.ts
- TagPathParser.js
- TagPathVisitor.js
The main script in [src/index.js] can reference these:
const DE6Parser = require('./parser/DE6Parser').DE6Parser
const DE6Lexer = require('./parser/DE6Lexer').DE6Lexer
Documentation for the script-file syntax: https://wiki.xnat.org/display/XTOOLS/DicomEdit+6.2+Language+Reference