@cornerstonejs/adapters 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +9 -0
- package/.eslintrc.json +18 -0
- package/.prettierrc +5 -0
- package/CHANGELOG.md +106 -0
- package/License.txt +22 -0
- package/README.md +33 -0
- package/generate-dictionary.js +145 -0
- package/netlify.toml +20 -0
- package/package.json +65 -0
- package/rollup.config.js +37 -0
- package/test/adapters.test.js +1 -0
package/.babelrc
ADDED
package/.eslintrc.json
ADDED
package/.prettierrc
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [0.1.2](https://github.com/dcmjs-org/dcmjs/compare/@cornerstonejs/adapters@0.1.1...@cornerstonejs/adapters@0.1.2) (2023-01-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **build:** fixing publish of adapters in package json ([#396](https://github.com/dcmjs-org/dcmjs/issues/396)) ([5a45b2f](https://github.com/dcmjs-org/dcmjs/commit/5a45b2f9ebeca9b800642d2735720a8d8400cd12))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.1.1](https://github.com/dcmjs-org/dcmjs/compare/@cornerstonejs/adapters@0.1.0...@cornerstonejs/adapters@0.1.1) (2023-01-27)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **build:** try to publish adapters ([#395](https://github.com/dcmjs-org/dcmjs/issues/395)) ([191a17b](https://github.com/dcmjs-org/dcmjs/commit/191a17b690d2ac60ad98a4b8ecb8379a92638d67))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# 0.1.0 (2023-01-27)
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
- 🐛 adding readme notes ([#191](https://github.com/dcmjs-org/dcmjs/issues/191)) ([459260d](https://github.com/dcmjs-org/dcmjs/commit/459260d6e2a6f905729ddf68b1f12d3140b53849))
|
|
33
|
+
- 🐛 fix array format regression from commit 70b24332783d63c9db2ed21d512d9f7b526c5222 ([#236](https://github.com/dcmjs-org/dcmjs/issues/236)) ([5441063](https://github.com/dcmjs-org/dcmjs/commit/5441063d0395ede6d9f8bd3ac0d92ee14f6ef209))
|
|
34
|
+
- 🐛 Fix rotation mapping for SEG cornerstone adapter ([#151](https://github.com/dcmjs-org/dcmjs/issues/151)) ([3fab68c](https://github.com/dcmjs-org/dcmjs/commit/3fab68cbfd95f82820663b9fc99a2b0cd07e43c8))
|
|
35
|
+
- 🐛 Harden Segmentation import for different possible SEGs ([#146](https://github.com/dcmjs-org/dcmjs/issues/146)) ([c4952bc](https://github.com/dcmjs-org/dcmjs/commit/c4952bc5842bab80a5d928de0d860f89afc8f400))
|
|
36
|
+
- 🐛 IDC Re [#2003](https://github.com/dcmjs-org/dcmjs/issues/2003): fix regression in parsing segmentation orietations ([#220](https://github.com/dcmjs-org/dcmjs/issues/220)) ([5c0c6a8](https://github.com/dcmjs-org/dcmjs/commit/5c0c6a85e67b25ce5f39412ced37d8e825691481))
|
|
37
|
+
- 🐛 IDC2733: find segmentations reference source image Ids ([#253](https://github.com/dcmjs-org/dcmjs/issues/253)) ([f3e7101](https://github.com/dcmjs-org/dcmjs/commit/f3e71016dffa233bf0fb912cc7cf413718b8a1a9))
|
|
38
|
+
- 🐛 ignore frames without SourceImageSequence information when loading a segmentation ([#198](https://github.com/dcmjs-org/dcmjs/issues/198)) ([82709c4](https://github.com/dcmjs-org/dcmjs/commit/82709c4a8a317aa1354244010300ab9b902802dd))
|
|
39
|
+
- 🐛 indentation in nearlyEqual ([#202](https://github.com/dcmjs-org/dcmjs/issues/202)) ([989d6c9](https://github.com/dcmjs-org/dcmjs/commit/989d6c9a80686425563c55424ac1795e6a06cd7b))
|
|
40
|
+
- 🐛 relax condition in nearlyEquals check for detecting numbers near to zero ([#304](https://github.com/dcmjs-org/dcmjs/issues/304)) ([974cddd](https://github.com/dcmjs-org/dcmjs/commit/974cddd785c076f1ac0211b534a7c0b82a4ba68a))
|
|
41
|
+
- 🐛 When converting to multiframe, fix IPP issues ([#152](https://github.com/dcmjs-org/dcmjs/issues/152)) ([80496e4](https://github.com/dcmjs-org/dcmjs/commit/80496e422152c1a3dfd850a145011dd3dc632964))
|
|
42
|
+
- **adapter:** Removed comment around getTID300RepresentationArguments 'tool' parameter ([#322](https://github.com/dcmjs-org/dcmjs/issues/322)) ([d8f05ff](https://github.com/dcmjs-org/dcmjs/commit/d8f05ffb9ef1b5cce254980a597b4c428ffdfb6e)), closes [#306](https://github.com/dcmjs-org/dcmjs/issues/306)
|
|
43
|
+
- **add check for nullable numeric string vrs:** adds a check for nullable numeric strinv vrs ([#150](https://github.com/dcmjs-org/dcmjs/issues/150)) ([75046c4](https://github.com/dcmjs-org/dcmjs/commit/75046c4e1b2830dd3a32dc8d6938f6def71940a5))
|
|
44
|
+
- **anonymizer:** [FIX & TESTS] cleanTags : check if param is undefined. Add 3 test ([#308](https://github.com/dcmjs-org/dcmjs/issues/308)) ([44d23d6](https://github.com/dcmjs-org/dcmjs/commit/44d23d6a9e347fcf049053129d4d7323a9258b71))
|
|
45
|
+
- ArrowAnnotateTool adapter in Cornerstone3D parsing label ([#270](https://github.com/dcmjs-org/dcmjs/issues/270)) ([cb84979](https://github.com/dcmjs-org/dcmjs/commit/cb84979be6eef8835cc7ced006625751a04356aa))
|
|
46
|
+
- avoid using replaceAll() which isn't available in Node.js 14 ([#296](https://github.com/dcmjs-org/dcmjs/issues/296)) ([7aac3ab](https://github.com/dcmjs-org/dcmjs/commit/7aac3ab05fdedfe1a7a159097690bec00c0bcd2b))
|
|
47
|
+
- bug tolerance parameter was not propagated ([#241](https://github.com/dcmjs-org/dcmjs/issues/241)) ([c2ed627](https://github.com/dcmjs-org/dcmjs/commit/c2ed6275ccb80fbbab3c0f9c67893d6b681b0bab))
|
|
48
|
+
- checking the length before writing a DS and using exponential if ([#176](https://github.com/dcmjs-org/dcmjs/issues/176)) ([601aa9e](https://github.com/dcmjs-org/dcmjs/commit/601aa9e8a6df26876b08da739451e538d46aa37b))
|
|
49
|
+
- **coding-scheme:** Fix coding scheme for updated standard ([ae3f0b5](https://github.com/dcmjs-org/dcmjs/commit/ae3f0b5bcd398a4230c8fba2954e225fda97cc2f))
|
|
50
|
+
- **cornerstone:** exceptions caused by undefined cached stats in adapters. Safe programming fix only ([#301](https://github.com/dcmjs-org/dcmjs/issues/301)) ([893be43](https://github.com/dcmjs-org/dcmjs/commit/893be433af05f11a03cfce0a572b448303b9334b))
|
|
51
|
+
- **cs:** [#318](https://github.com/dcmjs-org/dcmjs/issues/318) - check instance's NumberOfFrames property to see if it is a multi-frame file or not ([#320](https://github.com/dcmjs-org/dcmjs/issues/320)) ([0b030a4](https://github.com/dcmjs-org/dcmjs/commit/0b030a45dd48f22a61a90dfe5bbb5848425960ca))
|
|
52
|
+
- **cs:** Resolves [#316](https://github.com/dcmjs-org/dcmjs/issues/316) Cornerstone3D adaptor - Multiframe support - add "frameNumber" to the Annotation.data ([#317](https://github.com/dcmjs-org/dcmjs/issues/317)) ([5fe862e](https://github.com/dcmjs-org/dcmjs/commit/5fe862e22653d30bfc78e5be5de3669610887727))
|
|
53
|
+
- **dcmjs:** Add a set of accessors to the sequence list so the API is more consistent ([#224](https://github.com/dcmjs-org/dcmjs/issues/224)) ([9dad6c5](https://github.com/dcmjs-org/dcmjs/commit/9dad6c549cb4dd5c351caa13386998cbe48a1ba6))
|
|
54
|
+
- **DicomMessage:** Fix readFile after options were added ([c2b62a1](https://github.com/dcmjs-org/dcmjs/commit/c2b62a13b3afc78516f39b906ca7576537037c20))
|
|
55
|
+
- **encoding:** encapsulation is applied for only PixelData ([#199](https://github.com/dcmjs-org/dcmjs/issues/199)) ([ede2950](https://github.com/dcmjs-org/dcmjs/commit/ede2950d530fb189bb5817db6b5285e2be74ffee)), closes [#194](https://github.com/dcmjs-org/dcmjs/issues/194)
|
|
56
|
+
- Ensure DS and IS Value Representations are returned as arrays ([#83](https://github.com/dcmjs-org/dcmjs/issues/83)) ([a264661](https://github.com/dcmjs-org/dcmjs/commit/a264661d5a0a899b761c58492955f6d18cc03a4d))
|
|
57
|
+
- exception writing NaN and Infinity values of FD tags ([#325](https://github.com/dcmjs-org/dcmjs/issues/325)) ([e86daaa](https://github.com/dcmjs-org/dcmjs/commit/e86daaad4c47e7ec2c135b94f0b0de622de69310))
|
|
58
|
+
- Export loglevelnext logger as dcmjs.log for configuration ([#156](https://github.com/dcmjs-org/dcmjs/issues/156)) ([33515e5](https://github.com/dcmjs-org/dcmjs/commit/33515e5fe3f581d71278674860834ee1ea932faa))
|
|
59
|
+
- Fix UN & AT VR processing logic ([#167](https://github.com/dcmjs-org/dcmjs/issues/167)) ([#168](https://github.com/dcmjs-org/dcmjs/issues/168)) ([7cb975a](https://github.com/dcmjs-org/dcmjs/commit/7cb975af106d2e3e943881a7dac06f1fe391809c))
|
|
60
|
+
- force a release for commit caaac4b ([#240](https://github.com/dcmjs-org/dcmjs/issues/240)) ([f53b630](https://github.com/dcmjs-org/dcmjs/commit/f53b6306ce138c5ad3106015c4751b63fbcca362))
|
|
61
|
+
- **fragment:** Refactor and fragment bug ([#283](https://github.com/dcmjs-org/dcmjs/issues/283)) ([307d60a](https://github.com/dcmjs-org/dcmjs/commit/307d60a6ffecf7d96bc729a37a45775c6b6e189c)), closes [#282](https://github.com/dcmjs-org/dcmjs/issues/282)
|
|
62
|
+
- **fragment:** write padding to even length on final fragments of encapsulated frame data ([#294](https://github.com/dcmjs-org/dcmjs/issues/294)) ([34b7561](https://github.com/dcmjs-org/dcmjs/commit/34b7561fa48870a87b948eb427d4e32808b4d40e)), closes [#293](https://github.com/dcmjs-org/dcmjs/issues/293)
|
|
63
|
+
- **idc-02252:** typo + release ([#180](https://github.com/dcmjs-org/dcmjs/issues/180)) ([3f5cb24](https://github.com/dcmjs-org/dcmjs/commit/3f5cb24fd0e50668d36dc21390a1ff527505a8db))
|
|
64
|
+
- **image-comments:** Move ImageComments to DerivedPixels ([da11200](https://github.com/dcmjs-org/dcmjs/commit/da112001e3c1c01b30acbd634fd9b2f46a9d3a63))
|
|
65
|
+
- **import:** missing import for addAccessors ([#295](https://github.com/dcmjs-org/dcmjs/issues/295)) ([6b631b6](https://github.com/dcmjs-org/dcmjs/commit/6b631b6c8bdb2a7a70637308c9ebfe849fe9ccaf))
|
|
66
|
+
- infinite loop on dcm with no meta length ([#331](https://github.com/dcmjs-org/dcmjs/issues/331)) ([51b156b](https://github.com/dcmjs-org/dcmjs/commit/51b156bf1278fc0f9476de70c89697576c0f4b55))
|
|
67
|
+
- Invalid VR of the private creator tag of the "Implicit VR Endian" typed DICOM file ([#242](https://github.com/dcmjs-org/dcmjs/issues/242)) ([#243](https://github.com/dcmjs-org/dcmjs/issues/243)) ([6d0552f](https://github.com/dcmjs-org/dcmjs/commit/6d0552fb96c59dcf3e39b3306a50004b24128330))
|
|
68
|
+
- issues in binary tag parsing ([#276](https://github.com/dcmjs-org/dcmjs/issues/276)) ([60c3af1](https://github.com/dcmjs-org/dcmjs/commit/60c3af1654b8f64baea1cd47f1049fd16ea2fee8))
|
|
69
|
+
- **measurement-report:** Fix issues with Measurement Report for Bidirectional measurements ([25cf222](https://github.com/dcmjs-org/dcmjs/commit/25cf222e9d80bbe5b68854362383ac4fcaec7f6c))
|
|
70
|
+
- **measurement-report:** Fix ReferencedFrameNumber usage in MeasurementReport ([b80cd2a](https://github.com/dcmjs-org/dcmjs/commit/b80cd2af070d0280295e88ee24d7e4d43c4af861))
|
|
71
|
+
- **naturalize:** revert single element sequence ([#223](https://github.com/dcmjs-org/dcmjs/issues/223)) ([0743ed3](https://github.com/dcmjs-org/dcmjs/commit/0743ed34f657b622d4868fe5db37015ad1aa7850))
|
|
72
|
+
- **naturalizing:** Fix the exception on naturalize twice ([#237](https://github.com/dcmjs-org/dcmjs/issues/237)) ([abced98](https://github.com/dcmjs-org/dcmjs/commit/abced980dccbabce7c4b159600f89c25ba747076))
|
|
73
|
+
- **parsing:** can't read an encapsulated frame whose size is greater than fragment size ([#205](https://github.com/dcmjs-org/dcmjs/issues/205)) ([176875d](https://github.com/dcmjs-org/dcmjs/commit/176875d0c9c34704302512d2c27103db205b1c8f)), closes [#204](https://github.com/dcmjs-org/dcmjs/issues/204)
|
|
74
|
+
- Re IDC [#2761](https://github.com/dcmjs-org/dcmjs/issues/2761) fix loading of segmentations ([#258](https://github.com/dcmjs-org/dcmjs/issues/258)) ([ceaf09a](https://github.com/dcmjs-org/dcmjs/commit/ceaf09af74f5727205e5d5869c97114b2c283ae5))
|
|
75
|
+
- **Segmentation_4X:** Update tag name in getSegmentIndex method for segs ([#183](https://github.com/dcmjs-org/dcmjs/issues/183)) ([1e96ee3](https://github.com/dcmjs-org/dcmjs/commit/1e96ee3ce3280900d56f1887da81471f9b128d30))
|
|
76
|
+
- **seg:** Use ReferencedSegmentNumber in shared fg ([#166](https://github.com/dcmjs-org/dcmjs/issues/166)) ([0ed3347](https://github.com/dcmjs-org/dcmjs/commit/0ed33477bb1c13b05d682c342edaf0a901fe0f7a))
|
|
77
|
+
- several issues with character set handling ([#299](https://github.com/dcmjs-org/dcmjs/issues/299)) ([8e22107](https://github.com/dcmjs-org/dcmjs/commit/8e221074179b6d33b82ab5c6f1ae4c06c5522d6b))
|
|
78
|
+
- **tests:** unified test data loading ([#292](https://github.com/dcmjs-org/dcmjs/issues/292)) ([c34f398](https://github.com/dcmjs-org/dcmjs/commit/c34f39813755227b79f7a0958a81a5e5c0935b73))
|
|
79
|
+
- **update jsdocs, cut release:** release ([#203](https://github.com/dcmjs-org/dcmjs/issues/203)) ([307974c](https://github.com/dcmjs-org/dcmjs/commit/307974cb399d07152e0f6d4dd9f40fe1c17f076e))
|
|
80
|
+
- update readme to trigger release ([#257](https://github.com/dcmjs-org/dcmjs/issues/257)) ([554f50d](https://github.com/dcmjs-org/dcmjs/commit/554f50d838fbcbeed25460c7384e14dc46bebb11))
|
|
81
|
+
- update variable name for frame index ([#332](https://github.com/dcmjs-org/dcmjs/issues/332)) ([5515d6e](https://github.com/dcmjs-org/dcmjs/commit/5515d6e0abe11dee04f9b75272d3fbb5d00b2bd7))
|
|
82
|
+
- use metadataProvider option instead of cornerstone.metaData ([#280](https://github.com/dcmjs-org/dcmjs/issues/280)) ([3a0e484](https://github.com/dcmjs-org/dcmjs/commit/3a0e484d203770cd309e2bd9f78946a733e79d0c))
|
|
83
|
+
- **utilities:** Export Bidirectional and Polyline inside TID300 ([75e0e29](https://github.com/dcmjs-org/dcmjs/commit/75e0e29f771843a80bfa32532d2186a4e7cdbd57))
|
|
84
|
+
- **VR:** added support for specific character set ([#291](https://github.com/dcmjs-org/dcmjs/issues/291)) ([f103d19](https://github.com/dcmjs-org/dcmjs/commit/f103d1918d02780c4881db5c8aa30f653c4da6b6))
|
|
85
|
+
- **vr:** Convert empty DecimalString and NumberString to null instead of to zero ([#278](https://github.com/dcmjs-org/dcmjs/issues/278)) ([43cd8ea](https://github.com/dcmjs-org/dcmjs/commit/43cd8eaa316a08ff1a025b1267fedda239526acb))
|
|
86
|
+
- **writeBytes:** create release from commit ([d9a4105](https://github.com/dcmjs-org/dcmjs/commit/d9a41050e756f9b7e56ef4ae3d5000ce86ea39eb))
|
|
87
|
+
|
|
88
|
+
### Features
|
|
89
|
+
|
|
90
|
+
- **adapters:** Add adapter for exporting polylines from dicom-microscopy-viewer to DICOM-SR ([#44](https://github.com/dcmjs-org/dcmjs/issues/44)) ([7a1947c](https://github.com/dcmjs-org/dcmjs/commit/7a1947c6ec164da4e9f66e90c1bbf1055978b173))
|
|
91
|
+
- **adapters:** Add adapter to generate segments & geometry from SEG for easier use in VTKjs (migrated from vtkDisplay example) ([398b74d](https://github.com/dcmjs-org/dcmjs/commit/398b74d70deb32824a74e98210127326887dfa77))
|
|
92
|
+
- **adapters:** First steps for DICOM-SR read support for polylines with dicom-microscopy-viewer ([#49](https://github.com/dcmjs-org/dcmjs/issues/49)) ([37f1888](https://github.com/dcmjs-org/dcmjs/commit/37f18881dd7369818de4aa22c5730012c2829616))
|
|
93
|
+
- Add Cornerstone3D adapter for Length tool ([#261](https://github.com/dcmjs-org/dcmjs/issues/261)) ([2cab0d9](https://github.com/dcmjs-org/dcmjs/commit/2cab0d9edba20e99b11407d41ed2a4bf60a6ab9b))
|
|
94
|
+
- Add overlapping segment check to Cornerstone 4.x DICOM SEG adapter ([#155](https://github.com/dcmjs-org/dcmjs/issues/155)) ([df44e27](https://github.com/dcmjs-org/dcmjs/commit/df44e27b3b1c26082bf3d7a9477ab7f0d5ca1d19))
|
|
95
|
+
- Allow backslashes in UIDs in order to support DICOM Q&R ([#277](https://github.com/dcmjs-org/dcmjs/issues/277)) ([6d2d5c6](https://github.com/dcmjs-org/dcmjs/commit/6d2d5c60f500174abb1be7757094178ec6a1d144))
|
|
96
|
+
- **anonymizer:** export Array tagNamesToEmpty and modify cleanTags ([#303](https://github.com/dcmjs-org/dcmjs/issues/303)) ([e960085](https://github.com/dcmjs-org/dcmjs/commit/e960085ca08fb28a0a8134fbfee7d450722d8c64))
|
|
97
|
+
- Bidirectional Arrow and EllipticalROI adapters for CS3D ([#264](https://github.com/dcmjs-org/dcmjs/issues/264)) ([1fc7932](https://github.com/dcmjs-org/dcmjs/commit/1fc7932e3eed85fa1a0f857d84bab35a2e62d80d))
|
|
98
|
+
- **cornerstone:** Feature add cornerstone adapters ([#225](https://github.com/dcmjs-org/dcmjs/issues/225)) ([23c0877](https://github.com/dcmjs-org/dcmjs/commit/23c08777f7a93d4c0576a5e583113029a1a1e05f))
|
|
99
|
+
- **deflated:** Added support for reading datasets with deflated transfer syntax ([#312](https://github.com/dcmjs-org/dcmjs/issues/312)) ([ee8f8f2](https://github.com/dcmjs-org/dcmjs/commit/ee8f8f21babbbd8eac2b19e8e957db2cc5a09325))
|
|
100
|
+
- **mem:** Zero Copy ArrayBuffer ([#279](https://github.com/dcmjs-org/dcmjs/issues/279)) ([a17f2d7](https://github.com/dcmjs-org/dcmjs/commit/a17f2d75bc102cc789289f0eae51e5b416ce1567))
|
|
101
|
+
- Move adapters from dcmjs for Cornerstone/3d and VTK ([b136a21](https://github.com/dcmjs-org/dcmjs/commit/b136a21fb96bb28c3a10a63b6b78083b897f4e19))
|
|
102
|
+
- **npm:** bump minor version (minor readme edits) ([b48f665](https://github.com/dcmjs-org/dcmjs/commit/b48f665893f5e4b643c68ddc2fc3b13c641b6b29))
|
|
103
|
+
- **readme:** stress need for a PR for npm package ([#310](https://github.com/dcmjs-org/dcmjs/issues/310)) ([dafd78d](https://github.com/dcmjs-org/dcmjs/commit/dafd78d004ccb9d0b505f0b7e0fd461eda9c3710))
|
|
104
|
+
- **sr:** export TID300 - Point class ([#323](https://github.com/dcmjs-org/dcmjs/issues/323)) ([d2aebc3](https://github.com/dcmjs-org/dcmjs/commit/d2aebc3166c23e14dce4d7a8b7f1e2fc933f6328))
|
|
105
|
+
- **structured-reports:** Add initial work on Adapters / Utilities for Imaging Measurement Structured Report input / output ([#17](https://github.com/dcmjs-org/dcmjs/issues/17)) ([941ad75](https://github.com/dcmjs-org/dcmjs/commit/941ad75320eece3368104d08247fdc371497c7cd))
|
|
106
|
+
- **testing:** Use the Jest testing framework and switch to GitHub Actions ([#254](https://github.com/dcmjs-org/dcmjs/issues/254)) ([a91ff2b](https://github.com/dcmjs-org/dcmjs/commit/a91ff2babd2c6a44f20ecbd954ab38901276cf41))
|
package/License.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2017 Steve Pieper
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>Adapters for VTK, Cornerstone and Cornerstone3D</h1>
|
|
3
|
+
<p>Conversion to/from the internal model and DICOM SR for annotations and other
|
|
4
|
+
types of objects.</p>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<hr />
|
|
8
|
+
|
|
9
|
+
# History
|
|
10
|
+
|
|
11
|
+
- 2014
|
|
12
|
+
- [DCMTK](dcmtk.org) cross compiled to javascript at [CTK Hackfest](http://www.commontk.org/index.php/CTK-Hackfest-May-2014). While this was useful and powerful, it was heavyweight for typical web usage.
|
|
13
|
+
- 2016
|
|
14
|
+
- A [Medical Imaging Web Appliction meeting at Stanford](http://qiicr.org/web/outreach/Medical-Imaging-Web-Apps/) and [follow-on hackfest in Boston](http://qiicr.org/web/outreach/MIWS-hackfest/) helped elaborate the needs for manipulating DICOM in pure Javascript.
|
|
15
|
+
- Based on [DICOM Part 10 read/write code](https://github.com/OHIF/dicom-dimse) initiated by Weiwei Wu of [OHIF](http://ohif.org), Steve Pieper [developed further features](https://github.com/pieper/sites/tree/gh-pages/dcmio) and [examples of creating multiframe and segmentation objects](https://github.com/pieper/sites/tree/gh-pages/DICOMzero) discussed with the community at RSNA
|
|
16
|
+
- 2017
|
|
17
|
+
- At [NA-MIC Project Week 25](https://na-mic.org/wiki/Project_Week_25) Erik Ziegler and Steve Pieper [worked](https://na-mic.org/wiki/Project_Week_25/DICOM_Segmentation_Support_for_Cornerstone_and_OHIF_Viewer)
|
|
18
|
+
with the community to define some example use cases to mix the pure JavaScript DICOM code with Cornerstone and [CornerstoneTools](https://github.com/chafey/cornerstoneTools).
|
|
19
|
+
- 2018-2022
|
|
20
|
+
- Work continues to develop SR and SEG support to [OHIFViewer](http://ohif.org) allow interoperability with [DICOM4QI](https://legacy.gitbook.com/book/qiicr/dicom4qi/details)
|
|
21
|
+
- 2023
|
|
22
|
+
- Moved the adapters into cornerstone3D from dcmjsj
|
|
23
|
+
|
|
24
|
+
# Support
|
|
25
|
+
|
|
26
|
+
The developers gratefully acknowledge their research support:
|
|
27
|
+
|
|
28
|
+
- Open Health Imaging Foundation ([OHIF](http://ohif.org))
|
|
29
|
+
- Quantitative Image Informatics for Cancer Research ([QIICR](http://qiicr.org))
|
|
30
|
+
- [Radiomics](http://radiomics.io)
|
|
31
|
+
- The [Neuroimage Analysis Center](http://nac.spl.harvard.edu)
|
|
32
|
+
- The [National Center for Image Guided Therapy](http://ncigt.org)
|
|
33
|
+
- The [NCI Imaging Data Commons](https://imagingdatacommons.github.io/) NCI Imaging Data Commons: contract number 19X037Q from Leidos Biomedical Research under Task Order HHSN26100071 from NCI
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create the dictionary.js DICOM dictionary file from the Standard.
|
|
3
|
+
* Reformat The DICOM dictionary PS3.6 and PS3.7 docbook XML files (from e.g. standard docs) to JavaScript syntax.
|
|
4
|
+
* Based on https://github.com/pydicom/pydicom/blob/8112bb69bfc0423c3a08cb89e7960defbe7237bf/source/generate_dict/generate_dicom_dict.py
|
|
5
|
+
*/
|
|
6
|
+
const fs = require('fs/promises');
|
|
7
|
+
const http = require('http');
|
|
8
|
+
const xml2js = require('xml2js');
|
|
9
|
+
|
|
10
|
+
require('@babel/register');
|
|
11
|
+
const DICTIONARY_PATH = './src/dictionary.js';
|
|
12
|
+
const dictionary = require(DICTIONARY_PATH).default;
|
|
13
|
+
const { Tag } = require('./src/Tag');
|
|
14
|
+
|
|
15
|
+
async function main() {
|
|
16
|
+
const tags = [];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Collect DICOM tags from XML documents
|
|
20
|
+
*/
|
|
21
|
+
const part06 = await getDocbook('part06/part06.xml');
|
|
22
|
+
const part06Rows = part06.book.chapter.find(chapter => chapter.$['xml:id'] === 'chapter_6').table[0].tbody[0].tr;
|
|
23
|
+
tags.push(...part06Rows.map(row => {
|
|
24
|
+
const retired = getCellData(row.td[5])?.startsWith('RET');
|
|
25
|
+
const name = getCellData(row.td[2]);
|
|
26
|
+
return {
|
|
27
|
+
tag: getCellData(row.td[0]),
|
|
28
|
+
vr: getCellData(row.td[3]),
|
|
29
|
+
name: retired ? `RETIRED_${name}` : name,
|
|
30
|
+
vm: getCellData(row.td[4]),
|
|
31
|
+
version: retired ? 'DICOM/retired' : 'DICOM',
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
const part07 = await getDocbook('part07/part07.xml');
|
|
36
|
+
const chapterE = part07.book.chapter.find(chapter => chapter.$['xml:id'] === 'chapter_E');
|
|
37
|
+
const commandFields = chapterE.section[0].table[0].tbody[0].tr;
|
|
38
|
+
tags.push(...commandFields.map(row => {
|
|
39
|
+
return {
|
|
40
|
+
tag: getCellData(row.td[0]),
|
|
41
|
+
vr: getCellData(row.td[3]),
|
|
42
|
+
name: getCellData(row.td[2]),
|
|
43
|
+
vm: getCellData(row.td[4]),
|
|
44
|
+
version: 'DICOM',
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
const retiredCommandFields = chapterE.section[1].table[0].tbody[0].tr;
|
|
48
|
+
tags.push(...retiredCommandFields.map(row => {
|
|
49
|
+
return {
|
|
50
|
+
tag: getCellData(row.td[0]),
|
|
51
|
+
vr: getCellData(row.td[3]),
|
|
52
|
+
name: `RETIRED_${getCellData(row.td[2])}`,
|
|
53
|
+
vm: getCellData(row.td[4]),
|
|
54
|
+
version: 'DICOM/retired',
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
const newTags = tags.filter(tag => tag.vr && tag.name && tag.vm)
|
|
59
|
+
.filter(tag => !(tag.tag in dictionary)) // filter already defined
|
|
60
|
+
.filter(tag => !/[(,\dA-F]x+[A-F\d,)]/.test(tag.tag)); // filter repeater tags
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Insert new tags into dictionary, ordered among tags with the same version
|
|
64
|
+
*/
|
|
65
|
+
const dictionaryArray = Object.values(dictionary);
|
|
66
|
+
for (const newTag of newTags) {
|
|
67
|
+
const parsedTag = Tag.fromPString(newTag.tag);
|
|
68
|
+
const insertIndex = dictionaryArray.findIndex(tag => {
|
|
69
|
+
if (tag.version !== newTag.version) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const thisTag = Tag.fromPString(tag.tag);
|
|
73
|
+
return thisTag.toCleanString() > parsedTag.toCleanString();
|
|
74
|
+
});
|
|
75
|
+
dictionaryArray.splice(insertIndex, 0, newTag);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
await writeDictionary(dictionaryArray);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async function writeDictionary(tags) {
|
|
82
|
+
let data = 'const dictionary = {';
|
|
83
|
+
for (const tag of tags) {
|
|
84
|
+
if (!tag.tag) {
|
|
85
|
+
data += `
|
|
86
|
+
"": {
|
|
87
|
+
tag: ""
|
|
88
|
+
},`
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const tagKey = tag.tag.includes('"') ? `'${tag.tag}'` : `"${tag.tag}"`;
|
|
92
|
+
data += `
|
|
93
|
+
${tagKey}: {
|
|
94
|
+
tag: ${tagKey},
|
|
95
|
+
vr: "${tag.vr}",
|
|
96
|
+
name: "${tag.name}",
|
|
97
|
+
vm: "${tag.vm}",
|
|
98
|
+
version: "${tag.version ?? 'PrivateTag'}"
|
|
99
|
+
},`;
|
|
100
|
+
}
|
|
101
|
+
data += `
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export default dictionary;
|
|
105
|
+
`;
|
|
106
|
+
|
|
107
|
+
await fs.writeFile(DICTIONARY_PATH, data);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function getDocbook(part) {
|
|
111
|
+
const source = await getUrl(`http://dicom.nema.org/medical/dicom/current/source/docbook/${part}`);
|
|
112
|
+
return xml2js.parseStringPromise(source);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function getCellData(td) {
|
|
116
|
+
const para = td.para?.[0];
|
|
117
|
+
if (!para) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
const text = para.emphasis ? para.emphasis[0]._ : para._;
|
|
121
|
+
return text?.trim().replace(/[\u200b\uffff]/g, '');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function getUrl(url) {
|
|
125
|
+
return new Promise((resolve, reject) => {
|
|
126
|
+
http.get(url, request => {
|
|
127
|
+
let data = '';
|
|
128
|
+
request.on('error', () => {
|
|
129
|
+
reject(error);
|
|
130
|
+
});
|
|
131
|
+
request.on('end', () => {
|
|
132
|
+
resolve(data);
|
|
133
|
+
});
|
|
134
|
+
request.on('data', chunk => {
|
|
135
|
+
data += chunk;
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (require.main === module) {
|
|
142
|
+
main().catch(error => {
|
|
143
|
+
console.log(error);
|
|
144
|
+
});
|
|
145
|
+
}
|
package/netlify.toml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Netlify Config
|
|
2
|
+
#
|
|
3
|
+
# TOML Reference:
|
|
4
|
+
# https://www.netlify.com/docs/netlify-toml-reference/
|
|
5
|
+
|
|
6
|
+
# Settings in the [build] context are global and are applied to all contexts
|
|
7
|
+
# unless otherwise overridden by more specific contexts.
|
|
8
|
+
[build]
|
|
9
|
+
# Directory to change to before starting a build.
|
|
10
|
+
# This is where we will look for package.json/.nvmrc/etc.
|
|
11
|
+
base = ""
|
|
12
|
+
publish = "examples/"
|
|
13
|
+
command = "npm run build:examples"
|
|
14
|
+
|
|
15
|
+
# Deploy Preview context: all deploys generated from a pull/merge request will
|
|
16
|
+
# inherit these settings.
|
|
17
|
+
[context.deploy-preview]
|
|
18
|
+
base = ""
|
|
19
|
+
publish = "examples/"
|
|
20
|
+
command = "npm run build:examples"
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cornerstonejs/adapters",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Adapters for Cornerstone3D to/from formats including DICOM SR and others",
|
|
5
|
+
"src": "src/index.js",
|
|
6
|
+
"main": "build/adapters.js",
|
|
7
|
+
"module": "build/adapters.es.js",
|
|
8
|
+
"directories": {
|
|
9
|
+
"example": "examples"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"test": "jest --testTimeout 60000",
|
|
16
|
+
"build": "rollup -c",
|
|
17
|
+
"build:examples": "npm run build && npx cpx 'build/**/*.{js,map}' examples/js",
|
|
18
|
+
"start": "rollup -c -w",
|
|
19
|
+
"format": "prettier --write 'src/**/*.js' 'test/**/*.js'",
|
|
20
|
+
"lint": "eslint --fix ."
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/dcmjs-org/dcmjs.git"
|
|
25
|
+
},
|
|
26
|
+
"author": "@cornerstonejs (formerly Steve Pieper from dcmjs)",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/cornerstonejs/cornerstone3D-beta/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/cornerstonejs/cornerstone3D-beta/blob/main/packages/adapters/README.md",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@babel/core": "^7.16.12",
|
|
34
|
+
"@babel/preset-env": "^7.16.11",
|
|
35
|
+
"@babel/register": "^7.13.0",
|
|
36
|
+
"acorn": "^7.1.0",
|
|
37
|
+
"acorn-jsx": "^5.2.0",
|
|
38
|
+
"eslint": "^8.17.0",
|
|
39
|
+
"eslint-config-prettier": "^8.5.0",
|
|
40
|
+
"follow-redirects": "^1.10.0",
|
|
41
|
+
"husky": "^1.3.1",
|
|
42
|
+
"jest": "^27.5.1",
|
|
43
|
+
"lint-staged": "^8.2.1",
|
|
44
|
+
"prettier": "^2.6.2",
|
|
45
|
+
"rollup": "^1.31.1",
|
|
46
|
+
"rollup-plugin-babel": "^4.3.3",
|
|
47
|
+
"rollup-plugin-commonjs": "^9.3.4",
|
|
48
|
+
"rollup-plugin-json": "^3.1.0",
|
|
49
|
+
"rollup-plugin-node-builtins": "^2.1.2",
|
|
50
|
+
"rollup-plugin-node-globals": "^1.4.0",
|
|
51
|
+
"rollup-plugin-node-resolve": "^4.2.4",
|
|
52
|
+
"unzipper": "^0.10.9",
|
|
53
|
+
"xml2js": "^0.4.23"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@babel/runtime-corejs2": "^7.17.8",
|
|
57
|
+
"dcmjs": "^0.29.4",
|
|
58
|
+
"gl-matrix": "^3.4.3",
|
|
59
|
+
"lodash.clonedeep": "^4.5.0",
|
|
60
|
+
"loglevelnext": "^3.0.1",
|
|
61
|
+
"ndarray": "^1.0.19",
|
|
62
|
+
"pako": "^2.0.4"
|
|
63
|
+
},
|
|
64
|
+
"gitHead": "61375822b22da7b8e81e521043b06ed32cf42a69"
|
|
65
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import babel from "rollup-plugin-babel";
|
|
2
|
+
import resolve from "rollup-plugin-node-resolve";
|
|
3
|
+
import globals from "rollup-plugin-node-globals";
|
|
4
|
+
import builtins from "rollup-plugin-node-builtins";
|
|
5
|
+
import commonjs from "rollup-plugin-commonjs";
|
|
6
|
+
import json from "rollup-plugin-json";
|
|
7
|
+
import pkg from "./package.json";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
input: pkg.src,
|
|
11
|
+
output: [
|
|
12
|
+
{
|
|
13
|
+
file: pkg.main,
|
|
14
|
+
format: "umd",
|
|
15
|
+
name: pkg.name,
|
|
16
|
+
sourcemap: true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
file: pkg.module,
|
|
20
|
+
format: "es",
|
|
21
|
+
sourcemap: true
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
plugins: [
|
|
25
|
+
resolve({
|
|
26
|
+
browser: true
|
|
27
|
+
}),
|
|
28
|
+
commonjs(),
|
|
29
|
+
globals(),
|
|
30
|
+
builtins(),
|
|
31
|
+
babel({
|
|
32
|
+
runtimeHelpers: true,
|
|
33
|
+
exclude: "node_modules/**"
|
|
34
|
+
}),
|
|
35
|
+
json()
|
|
36
|
+
]
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
it("No tests yet", () => {});
|