Skip to content

Commit

Permalink
Merge pull request #24 from exini/robustness-updates
Browse files Browse the repository at this point in the history
Robustness updates
  • Loading branch information
karl-exini committed Oct 20, 2020
2 parents 21777f5 + 4bddb7c commit 69b90a7
Show file tree
Hide file tree
Showing 28 changed files with 7,379 additions and 2,899 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ The next, longer, example reads the file specified by the first input argument t
1. Parsing the binary data into `DicomPart`s for further processing
2. Re-encoding the data to always use indeterminate length sequences and items with explicit sequence and item delimitations
3. Re-encoding the data to use the UTF-8 character set
4. Filtering of the elements to preserve only those on a white list specified as an array of `TagTree`s (trees of pointers into a dataset)
5. Filtering of the remaining elements according to a black list of tag trees
4. Filtering of the elements to preserve only those on a allow list specified as an array of `TagTree`s (trees of pointers into a dataset)
5. Filtering of the remaining elements according to a deny list of tag trees
6. Modification of the remaining elements to set Patient Name to `Anon 001`, add or modifiy the attribute Patient Identity Removed to `YES`, and leave other elements unmodified
7. Map the resulting elements to their corresponding byte representations
8. Write the results to disk using the file name specified by the second input argument.
Expand All @@ -76,8 +76,8 @@ const {
TagTree,
parseFlow,
toBytesFlow,
whitelistFilter,
blacklistFilter,
allowFilter,
denyFilter,
toUtf8Flow,
toIndeterminateLengthSequences,
modifyFlow,
Expand All @@ -94,15 +94,15 @@ pipe(
parseFlow(),
toIndeterminateLengthSequences(),
toUtf8Flow(),
whitelistFilter([
allowFilter([
TagTree.fromTag(Tag.SpecificCharacterSet),
TagTree.fromTag(Tag.PatientName),
TagTree.fromTag(Tag.PatientName),
TagTree.fromTag(Tag.StudyDescription),
TagTree.fromTag(Tag.SeriesDate),
TagTree.fromAnyItem(Tag.MACParametersSequence),
]),
blacklistFilter([TagTree.fromAnyItem(Tag.MACParametersSequence).thenTag(Tag.DataElementsSigned)]),
denyFilter([TagTree.fromAnyItem(Tag.MACParametersSequence).thenTag(Tag.DataElementsSigned)]),
modifyFlow(
[TagModification.equals(TagPath.fromTag(Tag.PatientName), () => Buffer.from('Anon 001'))],
[new TagInsertion(TagPath.fromTag(Tag.PatientIdentityRemoved), () => Buffer.from('YES'))],
Expand Down
13 changes: 11 additions & 2 deletions config/webpack.config-base.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const webpackMerge = require('webpack-merge');
const { merge } = require('webpack-merge');

const commonConfig = {
entry: {
Expand Down Expand Up @@ -38,6 +38,15 @@ const webConfig = {
libraryTarget: 'umd',
},
externals: ['js-joda'],
resolve: {
fallback: {
stream: require.resolve('stream-browserify'),
zlib: require.resolve('browserify-zlib'),
buffer: require.resolve('buffer/'),
util: require.resolve('util/'),
assert: require.resolve('assert/'),
},
},
};

module.exports = [webpackMerge(commonConfig, nodeConfig), webpackMerge(commonConfig, webConfig)];
module.exports = [merge(commonConfig, nodeConfig), merge(commonConfig, webConfig)];
4 changes: 2 additions & 2 deletions config/webpack.config-dev.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const webpackMerge = require('webpack-merge');
const { merge } = require('webpack-merge');
const configs = require('./webpack.config-base');

const devConfig = {
Expand All @@ -9,4 +9,4 @@ const devConfig = {
devtool: 'source-map',
};

module.exports = [webpackMerge(configs[0], devConfig), webpackMerge(configs[1], devConfig)];
module.exports = [merge(configs[0], devConfig), merge(configs[1], devConfig)];
5 changes: 2 additions & 3 deletions config/webpack.config-prod.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const webpackMerge = require('webpack-merge');
const { merge } = require('webpack-merge');
const configs = require('./webpack.config-base');

const prodConfig = {
output: {
filename: 'index.min.js',
},
mode: 'production',
devtool: '',
};

module.exports = [webpackMerge(configs[0], prodConfig), webpackMerge(configs[1], prodConfig)];
module.exports = [merge(configs[0], prodConfig), merge(configs[1], prodConfig)];
8 changes: 4 additions & 4 deletions example/parse-modify-log.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const {
TagPath,
TagTree,
parseFlow,
whitelistFilter,
blacklistFilter,
allowFilter,
denyFilter,
toUtf8Flow,
toIndeterminateLengthSequences,
modifyFlow,
Expand All @@ -23,15 +23,15 @@ pipe(
parseFlow(),
toIndeterminateLengthSequences(),
toUtf8Flow(),
whitelistFilter([
allowFilter([
TagTree.fromTag(Tag.SpecificCharacterSet),
TagTree.fromTag(Tag.PatientName),
TagTree.fromTag(Tag.PatientName),
TagTree.fromTag(Tag.StudyDescription),
TagTree.fromTag(Tag.SeriesDate),
TagTree.fromAnyItem(Tag.MACParametersSequence),
]),
blacklistFilter([TagTree.fromAnyItem(Tag.MACParametersSequence).thenTag(Tag.DataElementsSigned)]),
denyFilter([TagTree.fromAnyItem(Tag.MACParametersSequence).thenTag(Tag.DataElementsSigned)]),
modifyFlow(
[TagModification.equals(TagPath.fromTag(Tag.PatientName), () => Buffer.from('Anon 001'))],
[new TagInsertion(TagPath.fromTag(Tag.PatientIdentityRemoved), () => Buffer.from('YES'))],
Expand Down
8 changes: 4 additions & 4 deletions example/parse-modify-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const {
TagTree,
parseFlow,
toBytesFlow,
whitelistFilter,
blacklistFilter,
allowFilter,
denyFilter,
toUtf8Flow,
toIndeterminateLengthSequences,
modifyFlow,
Expand All @@ -22,15 +22,15 @@ pipe(
parseFlow(),
toIndeterminateLengthSequences(),
toUtf8Flow(),
whitelistFilter([
allowFilter([
TagTree.fromTag(Tag.SpecificCharacterSet),
TagTree.fromTag(Tag.PatientName),
TagTree.fromTag(Tag.PatientName),
TagTree.fromTag(Tag.StudyDescription),
TagTree.fromTag(Tag.SeriesDate),
TagTree.fromAnyItem(Tag.MACParametersSequence),
]),
blacklistFilter([TagTree.fromAnyItem(Tag.MACParametersSequence).thenTag(Tag.DataElementsSigned)]),
denyFilter([TagTree.fromAnyItem(Tag.MACParametersSequence).thenTag(Tag.DataElementsSigned)]),
modifyFlow(
[TagModification.equals(TagPath.fromTag(Tag.PatientName), () => Buffer.from('Anon 001'))],
[new TagInsertion(TagPath.fromTag(Tag.PatientIdentityRemoved), () => Buffer.from('YES'))],
Expand Down

0 comments on commit 69b90a7

Please sign in to comment.