Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
b7a8688
Add support for new VRs OD, OL, UC, and UR.
yagni Sep 5, 2018
916768d
Update data dictionary to 2018b standard.
yagni Jun 6, 2018
c770502
Escape characters that might cause problems in displaying the values …
yagni Jun 6, 2018
7b6b581
pixelData Uint16Array has 2 bytes/pixel
shivasuri Oct 31, 2020
99a0065
fix: prevent undefined module error when checking if we are in a brow…
swederik Aug 16, 2021
d8cba8c
Merge pull request #160 from shivasuri/patch-1
yagni Sep 22, 2021
43479fe
fix: Remove Node browser polyfill libraries from the build (#148). Al…
yagni Sep 22, 2021
0637130
fix: incorrect TypeScript return types (#159) (#183)
yagni Sep 22, 2021
bd4cc4d
Merge pull request #103 from yagni/dump-with-data-dictionary-fixes
yagni Sep 22, 2021
8ccb257
Merge pull request #102 from yagni/updated-vrs
yagni Sep 22, 2021
975c525
fix: Address issues with zlib for browser usage (#186)
yagni Oct 6, 2021
d982570
fix: Upgrade dependencies to most recent supported. (#184)
yagni Oct 6, 2021
305e78b
Feat/parse raw dicom (#194)
wayfarer3130 Feb 7, 2022
6b4afbb
Package version got out of sync with github version
wayfarer3130 Feb 7, 2022
711b66b
fix(dicomParser): Update the version number to build the raw dicom
wayfarer3130 Feb 7, 2022
b6ca4b9
fix(dicomParser):Updating the required arguments to exclude inflater
wayfarer3130 Feb 7, 2022
73195b3
Add syntax highlighting for better readability
MichaelKreil Feb 8, 2022
fa6bfce
Bump follow-redirects from 1.14.4 to 1.14.8
dependabot[bot] Feb 15, 2022
0172852
Bump karma from 6.3.4 to 6.3.16
dependabot[bot] Mar 2, 2022
c374845
Merge pull request #195 from MichaelKreil/patch-1
yagni Mar 8, 2022
98dd998
Merge pull request #198 from cornerstonejs/dependabot/npm_and_yarn/fo…
yagni Mar 8, 2022
075cdd1
Merge pull request #200 from cornerstonejs/dependabot/npm_and_yarn/ka…
yagni Mar 8, 2022
92d04e9
Update data dictionary to DICOM 2022a.
yagni Mar 8, 2022
fdb4639
Fix unclosed <i> tag.
yagni Mar 8, 2022
141fbff
Merge pull request #202 from yagni/dicom-2022a
yagni Mar 22, 2022
226d8ae
Add missing TransferSyntaxUID in type ParseDicomOptions
wlogsky666 Jun 14, 2022
7495016
Bump terser from 4.8.0 to 4.8.1
dependabot[bot] Jul 21, 2022
901a028
fix: change interface declaration to class
kmannislands Sep 14, 2022
6ec467b
fix: correct DataSet method return type declarations
kmannislands Sep 14, 2022
0003d0f
Merge pull request #205 from cornerstonejs/dependabot/npm_and_yarn/te…
yagni Sep 15, 2022
7e504ce
fix: Peek to determine whether a field is an SQ if the vrCallback ret…
yagni Aug 31, 2018
df314f5
Merge pull request #209 from kmannislands/208-align-dataset-returns
yagni Sep 16, 2022
3df32a8
Merge pull request #204 from wlogsky666/master
yagni Sep 16, 2022
04fcbbe
Merge pull request #207 from kmannislands/187-add-bytestream
yagni Sep 19, 2022
eb51626
Merge pull request #101 from yagni/vr-callback-undefined-fix
yagni Sep 19, 2022
24cc195
fix: Parse private sequences if they have an undefined length.
yagni Sep 19, 2022
d16f49d
fix: isPrivateTag no longer silently returns false when given a tag w…
yagni Sep 15, 2022
21378b9
Merge pull request #210 from yagni/fix-private-tag-detection
yagni Sep 28, 2022
eeade8f
Merge pull request #211 from yagni/parse-undefined-length-private-seq…
yagni Sep 28, 2022
420c70f
Relocate data dictionary so it can be shared amongst the examples.
yagni Oct 10, 2022
8949e09
Use data dictionary in explicitDataSetToJS examples in case implicit …
yagni Oct 10, 2022
6ed4f2c
fix: Use vr callback on all tags, not just to determine sequence.
yagni Oct 6, 2022
9010504
Update link in README.
yagni Oct 10, 2022
2c9ee43
Merge pull request #216 from yagni/fix-link-to-pixel-data-example
yagni Oct 10, 2022
98e991d
Merge pull request #215 from yagni/callback-all-tags
yagni Oct 11, 2022
2333fc3
chore(deps): bump loader-utils from 1.4.0 to 1.4.1
dependabot[bot] Nov 8, 2022
2f264f8
chore(deps): bump socket.io-parser from 4.0.4 to 4.0.5
dependabot[bot] Nov 9, 2022
3857fb7
Merge pull request #218 from cornerstonejs/dependabot/npm_and_yarn/lo…
yagni Nov 10, 2022
1a9fec7
Merge pull request #219 from cornerstonejs/dependabot/npm_and_yarn/so…
yagni Nov 10, 2022
51740fa
chore(deps): bump nanoid from 3.1.23 to 3.3.1
dependabot[bot] Nov 10, 2022
d24c5d6
chore(deps): bump minimist and handlebars
dependabot[bot] Nov 10, 2022
f16b1b2
chore(deps): bump node-forge from 0.10.0 to 1.3.1
dependabot[bot] Nov 10, 2022
5857998
Merge pull request #220 from cornerstonejs/dependabot/npm_and_yarn/na…
yagni Nov 10, 2022
1e52034
Merge pull request #222 from cornerstonejs/dependabot/npm_and_yarn/mi…
yagni Nov 10, 2022
acd0616
Merge pull request #223 from cornerstonejs/dependabot/npm_and_yarn/no…
yagni Nov 10, 2022
848dd03
chore(deps): bump set-value and union-value
dependabot[bot] Nov 10, 2022
7661261
chore(deps): bump node-fetch and puppeteer
dependabot[bot] Nov 10, 2022
c5954ec
chore(deps): bump minimatch from 3.0.4 to 3.1.2
dependabot[bot] Nov 10, 2022
b066e3b
Merge pull request #224 from cornerstonejs/dependabot/npm_and_yarn/se…
yagni Nov 10, 2022
c09caf7
Merge pull request #221 from cornerstonejs/dependabot/npm_and_yarn/mi…
yagni Nov 10, 2022
7039def
chore(deps): bump json-schema and jsprim
dependabot[bot] Nov 10, 2022
beb2bb3
Merge pull request #226 from cornerstonejs/dependabot/npm_and_yarn/no…
yagni Nov 10, 2022
dc74c95
Merge pull request #225 from cornerstonejs/dependabot/npm_and_yarn/js…
yagni Nov 10, 2022
33354a0
chore(deps): bump shelljs from 0.8.4 to 0.8.5
dependabot[bot] Nov 10, 2022
f9fddde
Merge pull request #227 from cornerstonejs/dependabot/npm_and_yarn/sh…
yagni Nov 10, 2022
007b1e1
chore(deps): bump loader-utils from 1.4.1 to 1.4.2
dependabot[bot] Nov 18, 2022
5a985c7
Merge pull request #229 from cornerstonejs/dependabot/npm_and_yarn/lo…
yagni Nov 22, 2022
7585867
Add packages needed to run Chrome headless on CircleCI.
yagni Nov 10, 2022
c875588
fix(ci): Cache on package-lock.json so cache is rebuilt if any depend…
yagni Nov 22, 2022
5b0d7fc
Merge pull request #228 from yagni/add-unit-tests-to-circleci
yagni Dec 5, 2022
66a174a
chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2
dependabot[bot] Dec 5, 2022
bc132ac
chore(deps): bump engine.io and socket.io
dependabot[bot] Dec 5, 2022
f5fa5b0
chore(deps): bump marked from 2.1.3 to 4.2.3
dependabot[bot] Dec 5, 2022
b819c1b
Merge pull request #230 from cornerstonejs/dependabot/npm_and_yarn/en…
yagni Dec 5, 2022
7ebb5b8
Merge pull request #231 from cornerstonejs/dependabot/npm_and_yarn/ma…
yagni Dec 5, 2022
9b29566
Merge pull request #232 from cornerstonejs/dependabot/npm_and_yarn/de…
yagni Dec 5, 2022
995fa98
Fix Typescript error re constructor
jmannau Dec 6, 2022
a91c04d
Merge pull request #233 from jmannau/patch-1
yagni Dec 6, 2022
e631851
chore(deps): bump qs from 6.5.2 to 6.5.3
dependabot[bot] Dec 7, 2022
4fc7ef9
Merge pull request #234 from cornerstonejs/dependabot/npm_and_yarn/qs…
yagni Dec 7, 2022
0fe92c9
chore(deps): bump json5 from 1.0.1 to 1.0.2
dependabot[bot] Jan 7, 2023
c189215
Merge pull request #235 from cornerstonejs/dependabot/npm_and_yarn/js…
yagni Jan 18, 2023
c0bdaf4
fix: Use latest semantic-release
yagni Jan 18, 2023
99f1d67
Merge pull request #238 from yagni/release-typescript-fix
yagni Jan 18, 2023
e1f7fcd
chore(deps): bump ua-parser-js from 0.7.31 to 0.7.33
dependabot[bot] Jan 27, 2023
d0cd049
Merge pull request #240 from cornerstonejs/dependabot/npm_and_yarn/ua…
yagni Feb 17, 2023
d3ef78d
Roll semantic-release down to the most recent version that works with…
yagni Feb 17, 2023
eee6b96
Merge pull request #243 from yagni/downgrade-semantic-release
yagni Feb 20, 2023
8ebe5e4
Move examples from rawgit so they work on GitHub pages.
yagni Nov 8, 2019
79c672d
Merge pull request #134 from yagni/github-pages
yagni Feb 22, 2023
7c8df16
chore(deps): bump engine.io and socket.io
dependabot[bot] May 4, 2023
49cae84
chore(deps): bump socket.io-parser from 4.2.1 to 4.2.3
dependabot[bot] May 24, 2023
04d8dce
Merge pull request #246 from cornerstonejs/dependabot/npm_and_yarn/en…
yagni May 24, 2023
b7755a8
Merge pull request #249 from cornerstonejs/dependabot/npm_and_yarn/so…
yagni May 24, 2023
2968f26
Update browser-tools to fix some build issues.
yagni Aug 21, 2023
c8abdd4
Merge pull request #259 from yagni/update-browser-tools
yagni Aug 21, 2023
b686a23
chore(deps-dev): bump word-wrap from 1.2.3 to 1.2.5
dependabot[bot] Aug 21, 2023
7fbbe74
Merge pull request #260 from cornerstonejs/dependabot/npm_and_yarn/wo…
yagni Aug 21, 2023
cd622a6
chore(deps-dev): bump @babel/traverse from 7.17.0 to 7.23.2
dependabot[bot] Oct 17, 2023
7d20843
Merge pull request #261 from cornerstonejs/dependabot/npm_and_yarn/ba…
yagni Oct 17, 2023
65aa3ab
Update to cornerstonejs/dicomParser@7d2084349bf2bdaffe74021e27b286a6c…
mj-heaton Jun 16, 2025
322cc7f
Add tagStartOffset
mj-heaton Jun 16, 2025
220149d
Version number
mj-heaton Jun 16, 2025
7dc9bf1
Fix build/eslint
mj-heaton Jun 16, 2025
378a7f5
Fix parsing, throw Error object on exception
mj-heaton Jun 16, 2025
0a84e34
1.8.14
mj-heaton Jun 16, 2025
6444f40
Add comment
mj-heaton Jun 16, 2025
f7a5717
Merge upstream cornerstonejs/dicomParser@7d20843 and add PR #280 UV s…
mj-heaton May 20, 2026
ec87bea
Merge origin/2025-update: incorporate live 1.8.14 fork features
mj-heaton May 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"presets": [
"es2015"
"@babel/preset-env"
],
"plugins": [
"transform-object-rest-spread"
"@babel/plugin-transform-object-rest-spread"
]
}
120 changes: 60 additions & 60 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
# version: 2
version: 2

# defaults: &defaults
# working_directory: ~/repo
# docker:
# - image: circleci/node:latest
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:latest

# jobs:
# test:
# <<: *defaults
# steps:
# - checkout
# - restore_cache:
# keys:
# - v1-dependencies-{{ checksum "package.json" }}
# - v1-dependencies-
# - run: npm install
# - run: npm run build:ci
# - save_cache:
# paths:
# - node_modules
# key: v1-dependencies-{{ checksum "package.json" }}
# # TODO: Support for unit tests in status check
# # - run: npm run test
jobs:
test:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: npm install
- run: npm run build:ci
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
# TODO: Support for unit tests in status check
# - run: npm run test

# # Publish latest
# deploy:
# <<: *defaults
# steps:
# - checkout
# - restore_cache:
# keys:
# - v1-dependencies-{{ checksum "package.json" }}
# - v1-dependencies-
# - run: npm install
# - save_cache:
# paths:
# - node_modules
# key: v1-dependencies-{{ checksum "package.json" }}
# - run: npm run build:ci
# - run:
# name: Write NPM Token to ~/.npmrc
# command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
# - run:
# name: Publish package
# command: npx semantic-release@17.0.4
# Publish latest
deploy:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run: npm run build:ci
- run:
name: Write NPM Token to ~/.npmrc
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
- run:
name: Publish package
command: npx semantic-release@17.0.4

# workflows:
# version: 2
workflows:
version: 2

# # PULL REQUEST
# test:
# jobs:
# - test:
# filters:
# branches:
# ignore:
# - master
# PULL REQUEST
test:
jobs:
- test:
filters:
branches:
ignore:
- master

# # MERGE TO MASTER
# build-test-deploy:
# jobs:
# - deploy:
# filters:
# branches:
# only: master
# MERGE TO MASTER
build-test-deploy:
jobs:
- deploy:
filters:
branches:
only: master
55 changes: 41 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
dicomParser
===========

dicomParser is a lightweight library for parsing DICOM P10 byte streams in modern HTML5 based web browsers (IE10+),
dicomParser is a lightweight library for parsing DICOM P10 byte streams, as well as raw (not encapsulated in part 10) byte streams, in modern HTML5 based web browsers (IE10+),
Node.js and Meteor. dicomParser is fast, easy to use and has no required external dependencies.

Live Examples
---------------

The best way to see the power of this library is to actually see it in use. A number of live examples are
included that are not only useful but also show how to use dicomParser.
[Click here for a list of all live examples](https://rawgithub.com/cornerstonejs/dicomParser/master/examples/index.html)
Make sure you try out the [DICOM Dump with Data Dictionary](https://rawgit.com/cornerstonejs/dicomParser/master/examples/dumpWithDataDictionary/index.html)
[Click here for a list of all live examples](https://cornerstonejs.github.io/dicomParser/examples/index.html)
Make sure you try out the [DICOM Dump with Data Dictionary](https://cornerstonejs.github.io/dicomParser/examples/dumpWithDataDictionary/index.html)
which is a very useful tool and excellent example of most features.

Community
Expand Down Expand Up @@ -44,16 +44,18 @@ the Deflated Explicit VR Little Endian transfer syntax
Usage
-----

```
```javascript
// create a Uint8Array or node.js Buffer with the contents of the DICOM P10 byte stream
// you want to parse (e.g. XMLHttpRequest to a WADO server)
var arrayBuffer = new ArrayBuffer(bufferSize);
var byteArray = new Uint8Array(arrayBuffer);

try
{
// Parse the byte array to get a DataSet object that has the parsed contents
var dataSet = dicomParser.parseDicom(byteArray/*, options */);
// Allow raw files
const options = { TransferSyntaxUID: '1.2.840.10008.1.2' };
// Parse the byte array to get a DataSet object that has the parsed contents
var dataSet = dicomParser.parseDicom(byteArray, options);

// access a string element
var studyInstanceUid = dataSet.string('x0020000d');
Expand All @@ -62,30 +64,34 @@ try
var pixelDataElement = dataSet.elements.x7fe00010;

// create a typed array on the pixel data (this example assumes 16 bit unsigned data)
var pixelData = new Uint16Array(dataSet.byteArray.buffer, pixelDataElement.dataOffset, pixelDataElement.length);
var pixelData = new Uint16Array(dataSet.byteArray.buffer, pixelDataElement.dataOffset, pixelDataElement.length / 2);
}
catch(ex)
{
console.log('Error parsing byte stream', ex);
}
```

[See the live examples for more in depth usage of the library](https://rawgithub.com/cornerstonejs/dicomParser/master/examples/index.html)
[See the live examples for more in depth usage of the library](https://cornerstonejs.github.io/dicomParser/examples/index.html)

Note that actually displaying DICOM images is quite complex due to the variety of pixel formats and compression
algorithms that DICOM supports. If you are interested in displaying images, please take a look at the
[cornerstone library](https://github.com/cornerstonejs/cornerstone) and the
[cornerstoneWADOImageLoader](https://github.com/cornerstonejs/cornerstoneWADOImageLoader) which uses this
library to extract the pixel data from DICOM files and display the images with
[cornerstone library](https://github.com/cornerstonejs/cornerstone).
You can find the actual code that extracts grayscale pixel data using this library
[here](https://github.com/cornerstonejs/cornerstoneWADOImageLoader/blob/master/src/makeGrayscaleImage.js).
You can find the actual code that extracts pixel data using this library
[here](https://github.com/cornerstonejs/cornerstoneWADOImageLoader/blob/master/src/imageLoader/createImage.js).

Options
-------

```dicomParser.parseDicom``` accepts an optional second argument that is an options object. The accepted properties are:

#### TransferSyntaxUID
A string value used as the default transfer syntax uid for parsing raw DICOM (not encapsualted in Part 10).
For raw DICOM files, this value should be the LEI UID value.

#### untilTag

A tag in the form xggggeeee (where gggg is the hexadecimal group number and eeee is the hexadecimal element number,
Expand Down Expand Up @@ -163,10 +169,31 @@ Automatically running the build and unit tests after each source change:
This library uses `semantic-release` to publish packages. The syntax of commits against the `master` branch
determine how the new version calculated.

> npm run build:ci
> npx semantic-release@17.0.4 --no-ci

Note: Ensure `GITHUB_TOKEN` for bioxydyn/dicomParser is set.
<table>
<tr>
<th>Example Commit</th>
<th>Release Type</th>
</tr>
<tr>
<td>fix(pencil): stop graphite breaking when too much pressure applied</td>
<td>Patch Release</td>
</tr>
<tr>
<td>feat(pencil): add 'graphiteWidth' option</td>
<td>Feature Release</td>
</tr>
<tr>
<td>
perf(pencil): remove graphiteWidth option<br />
<br />
BREAKING CHANGE: The graphiteWidth option has been removed.
The default graphite width of 10mm is always used for performance reasons.
</td>
<td>
Major Breaking Release
</td>
</tr>
</table>


Backlog
Expand Down
4 changes: 4 additions & 0 deletions config/webpack/webpack-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ module.exports = {
entry: {
dicomParser: './index.js'
},
externals: {
'zlib': 'zlib'
},
node: false,
target: 'web',
output: {
filename: '[name].js',
Expand Down
4 changes: 3 additions & 1 deletion config/webpack/webpack-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const baseConfig = require('./webpack-base');
const devConfig = {
devServer: {
hot: true,
publicPath: '/dist/'
static: {
publicPath: '/dist/'
}
},
plugins: [
new webpack.HotModuleReplacementPlugin({})
Expand Down
Loading