Skip to content

Commit

Permalink
Merge pull request #394 from cornerstonejs/import/lerna-import-dcmjs-3
Browse files Browse the repository at this point in the history
feat(adapters): Import the adapters for cornerstone 3D to DICOM SR for annotations
  • Loading branch information
sedghi authored Jan 27, 2023
2 parents 315c56f + b136a21 commit 78374d0
Show file tree
Hide file tree
Showing 54 changed files with 8,352 additions and 124 deletions.
1 change: 1 addition & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"version": "independent",
"packages": [
"packages/adapters",
"packages/core",
"packages/tools",
"packages/streaming-image-volume-loader"
Expand Down
9 changes: 9 additions & 0 deletions packages/adapters/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets": [
["@babel/preset-env", {
"targets": {
"browsers": ["ie 11"]
}
}]
]
}
18 changes: 18 additions & 0 deletions packages/adapters/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"env": {
"browser": true,
"node": true,
"es6": true,
"jest": true
},

"extends": [
"eslint:recommended",
"prettier"
],

"parserOptions": {
"ecmaVersion": 11,
"sourceType": "module"
}
}
10 changes: 10 additions & 0 deletions packages/adapters/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

*.sw*
*~

node_modules
.idea
yarn-error.log
yarn.lock
.DS_Store
build
5 changes: 5 additions & 0 deletions packages/adapters/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.dcm
.jshintrc
examples/
src/
config/
5 changes: 5 additions & 0 deletions packages/adapters/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tabWidth": 4,
"trailingComma": "none",
"arrowParens": "avoid"
}
22 changes: 22 additions & 0 deletions packages/adapters/License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

The MIT License (MIT)

Copyright (c) 2017 Steve Pieper

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
33 changes: 33 additions & 0 deletions packages/adapters/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<div align="center">
<h1>Adapters for VTK, Cornerstone and Cornerstone3D</h1>
<p>Conversion to/from the internal model and DICOM SR for annotations and other
types of objects.</p>
</div>

<hr />

# History

- 2014
- [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.
- 2016
- 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.
- 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
- 2017
- 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)
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).
- 2018-2022
- 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)
- 2023
- Moved the adapters into cornerstone3D from dcmjsj

# Support

The developers gratefully acknowledge their research support:

- Open Health Imaging Foundation ([OHIF](http://ohif.org))
- Quantitative Image Informatics for Cancer Research ([QIICR](http://qiicr.org))
- [Radiomics](http://radiomics.io)
- The [Neuroimage Analysis Center](http://nac.spl.harvard.edu)
- The [National Center for Image Guided Therapy](http://ncigt.org)
- 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
42 changes: 42 additions & 0 deletions packages/adapters/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## Moved to @cornerstonejs/adapters

Removed all but the adapters code, based on dcmjs 0.29.4

## [0.2.1] - 2018-10-17

### Added

- Added Adapters and Utilities to support translation between common imaging toolkits (Cornerstone, VTK.js) and DICOM Structured Reports. Utilities are tied to the DICOM Standard and help build compliant files. Adapters are specific to the toolkits in question and help make it easier for developers to use the Utilities.

Note: These are generally still a work in progress. We are currently only confident in the Cornerstone Length adapter, and the Utilities (TID1500, TID1501, TID300, Length) which back it.

## [0.2.0] - 2018-10-02

### Added

- Example using [VTK.js with DICOM Segmentation](https://dcmjs-org.github.io/dcmjs/examples/vtkDisplay/index.html)

### Changed

- BitArray class provides static methods
to pack and unpack bit and bytes to support
dicom SEG encoding.

## [0.1.5] - 2018-08-23

### Fixed

- Fixed dcmjs compatibility with IE11

## [0.1.4] - 2018-08-23

### Added

- Added Webpack and babel to replace Rollup
4 changes: 4 additions & 0 deletions packages/adapters/config/webpack/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const env = process.env.ENV || 'dev';
const config = require(`./webpack-${env}`);

module.exports = config;
15 changes: 15 additions & 0 deletions packages/adapters/config/webpack/merge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const _ = require('lodash');

// Merge two objects
// Instead of merging array objects index by index (n-th source
// item with n-th object item) it concatenates both arrays
module.exports = function(object, source) {
const clone = _.cloneDeep(object);
const merged = _.mergeWith(clone, source, function(objValue, srcValue, key, object, source, stack) {
if(objValue && srcValue && _.isArray(objValue) && _.isArray(srcValue)) {
return _.concat(objValue, srcValue);
}
});

return merged;
}
30 changes: 30 additions & 0 deletions packages/adapters/config/webpack/webpack-base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const path = require('path');
const rootPath = process.cwd();
const context = path.join(rootPath, "src");
const outputPath = path.join(rootPath, 'build');

module.exports = {
context,
entry: {
dcmjs: './dcmjs.js'
},
output: {
filename: 'dcmjs.js',
library: 'dcmjs',
libraryTarget: 'umd',
path: outputPath,
umdNamedDefine: true
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules)/,
use: [{
loader: 'babel-loader'
}]
}
]
}
};
16 changes: 16 additions & 0 deletions packages/adapters/config/webpack/webpack-dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const webpack = require('webpack');
const merge = require('./merge');
const baseConfig = require('./webpack-base');

const devConfig = {
mode: "development",
devServer: {
hot: true,
publicPath: '/build/'
},
plugins: [
new webpack.HotModuleReplacementPlugin({})
]
};

module.exports = merge(baseConfig, devConfig);
16 changes: 16 additions & 0 deletions packages/adapters/config/webpack/webpack-prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const merge = require('./merge');
const baseConfig = require('./webpack-base');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');

const prodConfig = {
mode: "production",
optimization: {
minimizer: [
new UglifyJSPlugin({
sourceMap: true
})
]
},
};

module.exports = merge(baseConfig, prodConfig);
Loading

0 comments on commit 78374d0

Please sign in to comment.