Skip to content

Commit

Permalink
dcmjs-codecs is now used for encapsulated syntaxes decoding
Browse files Browse the repository at this point in the history
Removed wasm module
Updated npm versions
Code housekeeping
  • Loading branch information
PantelisGeorgiadis committed Mar 1, 2025
1 parent bb744cb commit 6f35c51
Show file tree
Hide file tree
Showing 380 changed files with 387 additions and 143,710 deletions.
4 changes: 0 additions & 4 deletions .gitattributes

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/build-wasm.yml

This file was deleted.

7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ on:
pull_request:
branches: [ master ]

permissions:
actions: read
contents: read
security-events: write

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [16.x, 18.x, 20.x, 22.x]

steps:
- name: Checkout
Expand Down
3 changes: 1 addition & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ coverage/
examples/
src/
test/
wasm/
documentation/

## Root files
.eslintrc.json
.gitignore
.gitattributes
.jsdocrc.json
.prettierrc.json
index.test-d.ts
karma.config.js
webpack.config.js
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"printWidth": 100,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}
36 changes: 15 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,30 @@ This library was inspired by the rendering pipelines of [fo-dicom][fo-dicom-url]
npm install
npm run build

### Build native decoders WebAssembly (optional)

cd wasm
./build.sh
[Emscripten SDK (emsdk)][emscripten-sdk-url] is required.

### Features
- Renders single and multi-frame datasets with optional adjustment of window/level and color palette.
- Decodes all major transfer syntaxes using a native WebAssembly module.
- Decodes all major transfer syntaxes (using the [dcmjs-codecs][dcmjs-codecs-url] library).
- Handles color and grayscale datasets, from 1 to 32 bits allocated, with signed, unsigned and float pixel values.
- Outputs RGBA pixel arrays, suitable for use with HTML5 Canvas and WebGL, or other imaging libraries.
- Outputs RGBA pixel arrays, suitable for use with HTML5 Canvas, WebGL and WebGPU, or other imaging libraries.
- Provides a common bundle for both Node.js and browser.

### Supported Transfer Syntaxes
- Implicit VR Little Endian (1.2.840.10008.1.2)
- Explicit VR Little Endian (1.2.840.10008.1.2.1)
- Deflated Explicit VR Little Endian (1.2.840.10008.1.2.1.99)
- Explicit VR Big Endian (1.2.840.10008.1.2.2)
- RLE Lossless (1.2.840.10008.1.2.5)\*
- JPEG Baseline - Process 1 (1.2.840.10008.1.2.4.50)\*
- JPEG Baseline - Processes 2 & 4 (1.2.840.10008.1.2.4.51)\*
- JPEG Lossless, Nonhierarchical - Processes 14 (1.2.840.10008.1.2.4.57)\*
- JPEG Lossless, Nonhierarchical, First-Order Prediction - Processes 14 [Selection Value 1] (1.2.840.10008.1.2.4.70)\*
- JPEG-LS Lossless Image Compression (1.2.840.10008.1.2.4.80)\*
- JPEG-LS Lossy Image Compression - Near-Lossless (1.2.840.10008.1.2.4.81)\*
- JPEG 2000 Image Compression - Lossless Only (1.2.840.10008.1.2.4.90)\*
- JPEG 2000 Image Compression (1.2.840.10008.1.2.4.91)\*
- High Throughput JPEG 2000 Image Compression - Lossless Only (1.2.840.10008.1.2.4.201)\*
- High Throughput JPEG 2000 with RPCL Options Image Compression - Lossless Only (1.2.840.10008.1.2.4.202)\*
- RLE Lossless (1.2.840.10008.1.2.5)
- JPEG Baseline - Process 1 (1.2.840.10008.1.2.4.50)
- JPEG Baseline - Processes 2 & 4 (1.2.840.10008.1.2.4.51)
- JPEG Lossless, Nonhierarchical - Processes 14 (1.2.840.10008.1.2.4.57)
- JPEG Lossless, Nonhierarchical, First-Order Prediction - Processes 14 [Selection Value 1] (1.2.840.10008.1.2.4.70)
- JPEG-LS Lossless Image Compression (1.2.840.10008.1.2.4.80)
- JPEG-LS Lossy Image Compression - Near-Lossless (1.2.840.10008.1.2.4.81)
- JPEG 2000 Image Compression - Lossless Only (1.2.840.10008.1.2.4.90)
- JPEG 2000 Image Compression (1.2.840.10008.1.2.4.91)
- High Throughput JPEG 2000 Image Compression - Lossless Only (1.2.840.10008.1.2.4.201)
- High Throughput JPEG 2000 with RPCL Options Image Compression - Lossless Only (1.2.840.10008.1.2.4.202)
- High Throughput JPEG 2000 Image Compression (1.2.840.10008.1.2.4.203)\*
--------
\*: Syntax is decoded using the native decoders WebAssembly.

### Usage

Expand Down Expand Up @@ -161,6 +153,7 @@ Please check the respecting [Wiki][dcmjs-imaging-wiki-examples-url] section for

### Related libraries
* [dcmjs-dimse][dcmjs-dimse-url] - DICOM DIMSE implementation for Node.js using dcmjs.
* [dcmjs-codecs][dcmjs-codecs-url] - DICOM file and dataset transcoding for Node.js and browser using dcmjs.
* [dcmjs-ecg][dcmjs-ecg-url] - DICOM electrocardiography (ECG) rendering for Node.js and browser using dcmjs.

### License
Expand All @@ -180,6 +173,7 @@ dcmjs-imaging is released under the MIT License.
[fo-dicom-url]: https://github.com/fo-dicom/fo-dicom
[mdcm-url]: https://github.com/fo-dicom/mdcm
[dcmjs-dimse-url]: https://github.com/PantelisGeorgiadis/dcmjs-dimse
[dcmjs-codecs-url]: https://github.com/PantelisGeorgiadis/dcmjs-codecs
[dcmjs-ecg-url]: https://github.com/PantelisGeorgiadis/dcmjs-ecg

[dcmjs-imaging-live-example-url]: https://unpkg.com/dcmjs-imaging@latest/build/index.html
Expand Down
10 changes: 10 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ declare class NativePixelDecoder {
webAssemblyModulePathOrUrl?: string;
logNativeDecodersMessages?: boolean;
}): Promise<void>;

/**
* Checks if native pixel decoder module is initialized.
*/
static isInitialized(): boolean;

/**
* Releases native pixel decoder module.
*/
static release(): void;
}

declare class DicomImage {
Expand Down
2 changes: 2 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ expectType<string>(version);

// NativePixelDecoder
expectError(NativePixelDecoder.initializeAsync('string'));
expectType<boolean>(NativePixelDecoder.isInitialized());
expectType<Promise<void>>(
NativePixelDecoder.initializeAsync({
logNativeDecodersMessages: true,
webAssemblyModulePathOrUrl: '',
})
);
expectType<Promise<void>>(NativePixelDecoder.initializeAsync());
expectType<void>(NativePixelDecoder.release());

// WindowLevel
expectError(new WindowLevel());
Expand Down
4 changes: 2 additions & 2 deletions karma.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = function (config) {
config.set({
frameworks: ['browserify', 'mocha', 'chai', 'sinon'],
frameworks: ['browserify', 'mocha', 'chai'],
files: [
'test/**/*.test.js',
{
pattern: 'wasm/bin/native-pixel-decoder.wasm',
pattern: 'node_modules/dcmjs-codecs/build/dcmjs-native-codecs.wasm',
included: false,
watched: false,
served: true,
Expand Down
Loading

0 comments on commit 6f35c51

Please sign in to comment.