Bug Fix: OHIF Study Metadata API implementation not correctly reading Study and Series level data + Adding ES5.1 properties to Study Metadata API abstract classes to prevent protected attribute override
This commit is contained in:
1 parent
5d5df29e09
commit
2b22aecc15
8 files changed
+140
-38
No files matched your search
@@ -11,8 +11,21 @@ export class InstanceMetadata extends Metadata {
|
||||
|
||||
constructor(data) {
|
||||
super(data);
|
||||
this._sopInstanceUID = null;
|
||||
this._imageId = null;
|
||||
// Initialize Private Properties
|
||||
Object.defineProperties(this, {
|
||||
_sopInstanceUID: {
|
||||
configurable: true, // configurable so that it can be redefined in sub-classes...
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
value: null
|
||||
},
|
||||
_imageId: {
|
||||
configurable: true, // configurable so that it can be redefined in sub-classes...
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
value: null
|
||||
}
|
||||
});
|
||||
// Initialize Public Properties
|
||||
this._definePublicProperties();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
const STRING = 'string';
|
||||
const NUMBER = 'number';
|
||||
const FUNCTION = 'function';
|
||||
const OBJECT = 'object';
|
||||
|
||||
export class Metadata {
|
||||
|
||||
@@ -14,7 +15,14 @@ export class Metadata {
|
||||
*/
|
||||
|
||||
constructor(data) {
|
||||
this._data = data;
|
||||
// Define the main "_data" private property as an immutable property.
|
||||
// IMPORTANT: This property can only be set during instance construction.
|
||||
Object.defineProperty(this, '_data', {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: data
|
||||
});
|
||||
}
|
||||
|
||||
getData() {
|
||||
@@ -24,7 +32,7 @@ export class Metadata {
|
||||
getDataProperty(propertyName) {
|
||||
let propertyValue;
|
||||
const _data = this._data;
|
||||
if (_data instanceof Object || typeof _data === 'object' && _data !== null) {
|
||||
if (_data instanceof Object || typeof _data === OBJECT && _data !== null) {
|
||||
propertyValue = _data[propertyName];
|
||||
}
|
||||
return propertyValue;
|
||||
|
||||
@@ -5,8 +5,21 @@ export class SeriesMetadata extends Metadata {
|
||||
|
||||
constructor(data) {
|
||||
super(data);
|
||||
this._seriesInstanceUID = null;
|
||||
this._instances = []; // InstanceMetadata[]
|
||||
// Initialize Private Properties
|
||||
Object.defineProperties(this, {
|
||||
_seriesInstanceUID: {
|
||||
configurable: true, // configurable so that it can be redefined in sub-classes...
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
value: null
|
||||
},
|
||||
_instances: {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: []
|
||||
}
|
||||
});
|
||||
// Initialize Public Properties
|
||||
this._definePublicProperties();
|
||||
}
|
||||
|
||||
@@ -6,9 +6,27 @@ export class StudyMetadata extends Metadata {
|
||||
|
||||
constructor(data) {
|
||||
super(data);
|
||||
this._studyInstanceUID = null;
|
||||
this._series = []; // SeriesMetadata[]
|
||||
this._displaySets = [];
|
||||
// Initialize Private Properties
|
||||
Object.defineProperties(this, {
|
||||
__studyInstanceUID: {
|
||||
configurable: true, // configurable so that it can be redefined in sub-classes...
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
value: null
|
||||
},
|
||||
_series: {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: []
|
||||
},
|
||||
_displaySets: {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
value: []
|
||||
}
|
||||
});
|
||||
// Initialize Public Properties
|
||||
this._definePublicProperties();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user