@dcmjs-org/dcmjs 1.0.0-beta.8 → 1.0.0-beta.9
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/build/dcmjs.cjs +1 -1
- package/build/dcmjs.es.js +1 -1
- package/build/dcmjs.js +167 -4
- package/build/dcmjs.js.map +1 -1
- package/build/dcmjs.min.js +1 -1
- package/build/dcmjs.min.js.map +1 -1
- package/build/{dcmjs.shared-i-QMVPJh.cjs → dcmjs.shared-CvR7StGL.cjs} +3 -2
- package/build/{dcmjs.shared-i-QMVPJh.cjs.map → dcmjs.shared-CvR7StGL.cjs.map} +1 -1
- package/build/{dcmjs.shared-C5jsZ5KD.js → dcmjs.shared-DzVDSFp8.js} +4 -3
- package/build/{dcmjs.shared-C5jsZ5KD.js.map → dcmjs.shared-DzVDSFp8.js.map} +1 -1
- package/build/eventStream.cjs +1 -1
- package/build/eventStream.es.js +1 -1
- package/package.json +7 -7
package/build/dcmjs.cjs
CHANGED
package/build/dcmjs.es.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { D as DICOMWEB, j as adapters, k as anonymizer, l as async, m as constants, n as data, o as default, p as derivations, q as normalizers, s as sr, u as utilities } from './dcmjs.shared-
|
|
1
|
+
export { D as DICOMWEB, j as adapters, k as anonymizer, l as async, m as constants, n as data, o as default, p as derivations, q as normalizers, s as sr, u as utilities } from './dcmjs.shared-DzVDSFp8.js';
|
|
2
2
|
export { log } from '@dcmjs-org/core';
|
|
3
3
|
//# sourceMappingURL=dcmjs.es.js.map
|
package/build/dcmjs.js
CHANGED
|
@@ -12852,7 +12852,7 @@
|
|
|
12852
12852
|
*/
|
|
12853
12853
|
|
|
12854
12854
|
var BLOCK_KEY = /^([0-9A-Fa-f]{4}):(.+)$/;
|
|
12855
|
-
var ELEMENT_KEY = /^x([0-9A-Fa-f]{2})$/;
|
|
12855
|
+
var ELEMENT_KEY$1 = /^x([0-9A-Fa-f]{2})$/;
|
|
12856
12856
|
var HEX_TAG = /^[0-9A-Fa-f]{8}$/;
|
|
12857
12857
|
|
|
12858
12858
|
/** True for an 8-digit hex tag key, for example "00291001". */
|
|
@@ -13008,7 +13008,7 @@
|
|
|
13008
13008
|
onDataset("".concat(group, "00").concat(xx), key, null);
|
|
13009
13009
|
var _loop2 = function _loop2() {
|
|
13010
13010
|
var elementKey = _Object$keys3[_i3];
|
|
13011
|
-
var match = ELEMENT_KEY.exec(elementKey);
|
|
13011
|
+
var match = ELEMENT_KEY$1.exec(elementKey);
|
|
13012
13012
|
if (!match) return 1; // continue
|
|
13013
13013
|
var ee = match[1].toUpperCase();
|
|
13014
13014
|
var tag = "".concat(group).concat(xx).concat(ee);
|
|
@@ -13383,7 +13383,7 @@
|
|
|
13383
13383
|
if (elementKey === "creator" || elementKey === "reservedBlock") {
|
|
13384
13384
|
continue;
|
|
13385
13385
|
}
|
|
13386
|
-
var match = ELEMENT_KEY.exec(elementKey);
|
|
13386
|
+
var match = ELEMENT_KEY$1.exec(elementKey);
|
|
13387
13387
|
if (!match) {
|
|
13388
13388
|
log.warn("Unknown name in private block ".concat(key, ":"), elementKey);
|
|
13389
13389
|
continue;
|
|
@@ -14674,6 +14674,168 @@
|
|
|
14674
14674
|
fileStream.writeRawBytes(pako.deflateRaw(new Uint8Array(bodyStream.getBuffer())));
|
|
14675
14675
|
}
|
|
14676
14676
|
|
|
14677
|
+
var ELEMENT_KEY = /^x[0-9A-Fa-f]{2}$/;
|
|
14678
|
+
|
|
14679
|
+
/**
|
|
14680
|
+
* The view of one frame of a multi-frame naturalized dataset (PS3.3
|
|
14681
|
+
* C.7.6.16): the root attributes, then the attributes of the shared
|
|
14682
|
+
* functional groups, then the attributes of the per-frame functional groups
|
|
14683
|
+
* of that frame. A later level replaces an attribute of an earlier level.
|
|
14684
|
+
*
|
|
14685
|
+
* - The view is built when NumberOfFrames is above 1, or when it is 1 or
|
|
14686
|
+
* more and the dataset has a functional group sequence. A functional group
|
|
14687
|
+
* sequence can be missing or empty: the view then holds only the computed
|
|
14688
|
+
* attributes, for example the defaults of a multi-frame image that is not
|
|
14689
|
+
* enhanced. Any other dataset comes back unchanged, and the option
|
|
14690
|
+
* functions do not run.
|
|
14691
|
+
* - `frameNumber` is 1-based, and a numeric string is accepted. A frame
|
|
14692
|
+
* number that is not an integer from 1 to NumberOfFrames throws a
|
|
14693
|
+
* RangeError. A frame with no per-frame item reads the shared item and
|
|
14694
|
+
* the root.
|
|
14695
|
+
* - Each standard sequence (functional group macro) in a functional group
|
|
14696
|
+
* item gives the attributes of its first item. An item that holds a
|
|
14697
|
+
* SOPInstanceUID is reference or previous value data, and is skipped.
|
|
14698
|
+
* - A private block or a private hex-tag key directly in a functional group
|
|
14699
|
+
* item is skipped. With `options.privateMacros`, each private sequence
|
|
14700
|
+
* there (an SQ in `_vrMap`) is a macro too. A private block inside a macro
|
|
14701
|
+
* item is an attribute of the frame: it replaces a root block with the
|
|
14702
|
+
* same key, and its hex aliases read the frame's block.
|
|
14703
|
+
* - The view is an `Object.create` child of `dataset`. The functional group
|
|
14704
|
+
* attributes are its own keys, with their VRs in an own `_vrMap`, so
|
|
14705
|
+
* `denaturalizeDataset(view)` writes only those attributes. Root
|
|
14706
|
+
* attributes are inherited, so a change to the root shows in the view.
|
|
14707
|
+
* - `options.frameAttributes(view, { dataset, frameNumber })` returns the
|
|
14708
|
+
* computed attributes of the frame, for example an ImagePositionPatient
|
|
14709
|
+
* that a modality gives in another place. They become own enumerable keys
|
|
14710
|
+
* of the view and replace the merged values.
|
|
14711
|
+
* - `options.frameProperties(view, { dataset, frameNumber })` returns the
|
|
14712
|
+
* runtime properties of the frame, for example `frameNumber` or `imageId`.
|
|
14713
|
+
* They become own non-enumerable properties, so JSON and denaturalize
|
|
14714
|
+
* skip them.
|
|
14715
|
+
* - The views are cached on `dataset` in the non-enumerable
|
|
14716
|
+
* `_frameDatasets`, per set of options: pass the same function objects on
|
|
14717
|
+
* each call to use the cache. A change to a functional group item does not
|
|
14718
|
+
* show in a cached view: `delete dataset._frameDatasets` to rebuild the
|
|
14719
|
+
* views.
|
|
14720
|
+
*
|
|
14721
|
+
* docs/specs/naturalized-dataset.md (NAT-U-FRAME, NAT-I-FRAME) is the
|
|
14722
|
+
* specification.
|
|
14723
|
+
*
|
|
14724
|
+
* @param {Object} dataset - a naturalized dataset
|
|
14725
|
+
* @param {number|string} [frameNumber=1] - the 1-based frame number
|
|
14726
|
+
* @param {Object} [options]
|
|
14727
|
+
* @param {Function} [options.frameAttributes] - computed attributes
|
|
14728
|
+
* @param {Function} [options.frameProperties] - runtime properties
|
|
14729
|
+
* @param {boolean} [options.privateMacros=false] - read private macros
|
|
14730
|
+
* @returns {Object} the frame view, or `dataset`
|
|
14731
|
+
*/
|
|
14732
|
+
function frameDataset(dataset) {
|
|
14733
|
+
var frameNumber = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
14734
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
14735
|
+
var NumberOfFrames = dataset.NumberOfFrames,
|
|
14736
|
+
shared = dataset.SharedFunctionalGroupsSequence,
|
|
14737
|
+
perFrame = dataset.PerFrameFunctionalGroupsSequence;
|
|
14738
|
+
var frames = Number(NumberOfFrames);
|
|
14739
|
+
if (!(frames > 1 || frames > 0 && (shared || perFrame))) {
|
|
14740
|
+
return dataset;
|
|
14741
|
+
}
|
|
14742
|
+
frameNumber = Number(frameNumber);
|
|
14743
|
+
if (!Number.isInteger(frameNumber) || frameNumber < 1 || frameNumber > frames) {
|
|
14744
|
+
throw new RangeError("Frame number ".concat(frameNumber, " is not in 1 to ").concat(frames));
|
|
14745
|
+
}
|
|
14746
|
+
if (!Object.prototype.hasOwnProperty.call(dataset, "_frameDatasets")) {
|
|
14747
|
+
Object.defineProperty(dataset, "_frameDatasets", {
|
|
14748
|
+
value: new Map(),
|
|
14749
|
+
configurable: true
|
|
14750
|
+
});
|
|
14751
|
+
}
|
|
14752
|
+
var frameAttributes = options.frameAttributes,
|
|
14753
|
+
frameProperties = options.frameProperties,
|
|
14754
|
+
_options$privateMacro = options.privateMacros,
|
|
14755
|
+
privateMacros = _options$privateMacro === void 0 ? false : _options$privateMacro;
|
|
14756
|
+
var views = entry(entry(entry(dataset._frameDatasets, frameAttributes, Map), frameProperties, Map), privateMacros, Array);
|
|
14757
|
+
if (views[frameNumber]) return views[frameNumber];
|
|
14758
|
+
var view = Object.create(dataset);
|
|
14759
|
+
view._vrMap = _objectSpread2({}, dataset._vrMap);
|
|
14760
|
+
addFunctionalGroups(view, shared === null || shared === void 0 ? void 0 : shared[0], privateMacros);
|
|
14761
|
+
addFunctionalGroups(view, perFrame === null || perFrame === void 0 ? void 0 : perFrame[frameNumber - 1], privateMacros);
|
|
14762
|
+
var context = {
|
|
14763
|
+
dataset: dataset,
|
|
14764
|
+
frameNumber: frameNumber
|
|
14765
|
+
};
|
|
14766
|
+
defineValues(view, frameAttributes === null || frameAttributes === void 0 ? void 0 : frameAttributes(view, context), true);
|
|
14767
|
+
defineValues(view, frameProperties === null || frameProperties === void 0 ? void 0 : frameProperties(view, context), false);
|
|
14768
|
+
definePrivateAliases(view);
|
|
14769
|
+
views[frameNumber] = view;
|
|
14770
|
+
return view;
|
|
14771
|
+
}
|
|
14772
|
+
function entry(map, key, Type) {
|
|
14773
|
+
if (!map.has(key)) map.set(key, new Type());
|
|
14774
|
+
return map.get(key);
|
|
14775
|
+
}
|
|
14776
|
+
|
|
14777
|
+
// a plain own value: an inherited alias or PN setter must not run
|
|
14778
|
+
function defineValue(view, name, value, enumerable) {
|
|
14779
|
+
Object.defineProperty(view, name, {
|
|
14780
|
+
value: value,
|
|
14781
|
+
writable: true,
|
|
14782
|
+
enumerable: enumerable,
|
|
14783
|
+
configurable: true
|
|
14784
|
+
});
|
|
14785
|
+
}
|
|
14786
|
+
function defineValues(view, values, enumerable) {
|
|
14787
|
+
for (var _i = 0, _Object$keys = Object.keys(values || {}); _i < _Object$keys.length; _i++) {
|
|
14788
|
+
var name = _Object$keys[_i];
|
|
14789
|
+
defineValue(view, name, values[name], enumerable);
|
|
14790
|
+
}
|
|
14791
|
+
}
|
|
14792
|
+
|
|
14793
|
+
/** The sequences of a functional group item, private macros on request. */
|
|
14794
|
+
function macros(groups, privateMacros) {
|
|
14795
|
+
var sequences = [];
|
|
14796
|
+
var vrMap = groups._vrMap || {};
|
|
14797
|
+
for (var _i2 = 0, _Object$keys2 = Object.keys(groups); _i2 < _Object$keys2.length; _i2++) {
|
|
14798
|
+
var key = _Object$keys2[_i2];
|
|
14799
|
+
var value = groups[key];
|
|
14800
|
+
if (parsePrivateBlockKey(key, value)) {
|
|
14801
|
+
if (!privateMacros) continue;
|
|
14802
|
+
for (var _i3 = 0, _Object$keys3 = Object.keys(value); _i3 < _Object$keys3.length; _i3++) {
|
|
14803
|
+
var _vrMap$key;
|
|
14804
|
+
var elementKey = _Object$keys3[_i3];
|
|
14805
|
+
if (ELEMENT_KEY.test(elementKey) && ((_vrMap$key = vrMap[key]) === null || _vrMap$key === void 0 ? void 0 : _vrMap$key[elementKey]) === "SQ") {
|
|
14806
|
+
sequences.push(value[elementKey]);
|
|
14807
|
+
}
|
|
14808
|
+
}
|
|
14809
|
+
} else if (!isPrivateTag(key)) {
|
|
14810
|
+
sequences.push(value);
|
|
14811
|
+
} else if (privateMacros && vrMap[key] === "SQ") {
|
|
14812
|
+
sequences.push(value);
|
|
14813
|
+
}
|
|
14814
|
+
}
|
|
14815
|
+
return sequences;
|
|
14816
|
+
}
|
|
14817
|
+
function addFunctionalGroups(view, groups, privateMacros) {
|
|
14818
|
+
if (!groups) return;
|
|
14819
|
+
var _iterator = _createForOfIteratorHelper(macros(groups, privateMacros)),
|
|
14820
|
+
_step;
|
|
14821
|
+
try {
|
|
14822
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
14823
|
+
var sequence = _step.value;
|
|
14824
|
+
var item = sequence === null || sequence === void 0 ? void 0 : sequence[0];
|
|
14825
|
+
if (!item || _typeof(item) !== "object" || item.SOPInstanceUID) continue;
|
|
14826
|
+
for (var _i4 = 0, _Object$keys4 = Object.keys(item); _i4 < _Object$keys4.length; _i4++) {
|
|
14827
|
+
var name = _Object$keys4[_i4];
|
|
14828
|
+
if (name !== "_vrMap") defineValue(view, name, item[name], true);
|
|
14829
|
+
}
|
|
14830
|
+
Object.assign(view._vrMap, item._vrMap);
|
|
14831
|
+
}
|
|
14832
|
+
} catch (err) {
|
|
14833
|
+
_iterator.e(err);
|
|
14834
|
+
} finally {
|
|
14835
|
+
_iterator.f();
|
|
14836
|
+
}
|
|
14837
|
+
}
|
|
14838
|
+
|
|
14677
14839
|
/**
|
|
14678
14840
|
* Creates an information filter that tracks top-level DICOM attributes.
|
|
14679
14841
|
*
|
|
@@ -30123,7 +30285,8 @@
|
|
|
30123
30285
|
setVr: setVr,
|
|
30124
30286
|
setAttribute: setAttribute,
|
|
30125
30287
|
setPersonName: setPersonName,
|
|
30126
|
-
definePrivateAliases: definePrivateAliases
|
|
30288
|
+
definePrivateAliases: definePrivateAliases,
|
|
30289
|
+
frameDataset: frameDataset
|
|
30127
30290
|
};
|
|
30128
30291
|
var async = {
|
|
30129
30292
|
AsyncDicomReader: AsyncDicomReader
|