Moving Hanging Protocols updates back to the viewers

This commit is contained in:
Eloízio Salgado committed 2017-03-02 10:18:11 -03:00
1 parent e10453b919
commit bec8f21c0a
19 files changed
+1626 -183

No files matched your search

@@ -1,26 +1,24 @@
import { Metadata } from './Metadata';
import { OHIFError } from '../OHIFError';
import { DICOMTagDescriptions } from '../../DICOMTagDescriptions';
const StudyInstanceUID = 'x0020000d';
/**
* Constants
*/
export class StudySummary {
const STUDY_INSTANCE_UID = 'x0020000d';
constructor(tagMap, propertyMap) {
/**
* Class Definition
*/
// Define the main immutable "_data" private property.
Object.defineProperties(this, {
_tags: {
configurable: false,
enumerable: false,
writable: false,
value: Object.create(null)
},
_properties: {
configurable: false,
enumerable: false,
writable: false,
value: Object.create(null)
}
});
export class StudySummary extends Metadata {
constructor(tagMap, attributeMap, uid) {
// Call the superclass constructor passing an plain object with no prototype to be used as the main "_data" attribute.
const _data = Object.create(null);
super(_data, uid);
// Initialize internal tag map if first argument is given.
if (tagMap !== void 0) {
@@ -28,67 +26,53 @@ export class StudySummary {
}
// Initialize internal property map if second argument is given.
if (propertyMap !== void 0) {
this.addProperties(addProperties);
if (attributeMap !== void 0) {
this.setCustomAttributes(attributeMap);
}
}
getStudyInstanceUID() {
// This method should return null if StudyInstanceUID is not available to keep compatibility StudyMetadata API
return this.getTagValue(StudyInstanceUID) || null;
}
addProperties(propertyMap) {
const _hasOwn = Object.prototype.hasOwnProperty;
const _properties = this._properties;
for (let property in propertyMap) {
if (_hasOwn.call(propertyMap, property)) {
_properties[property] = propertyMap[property];
}
}
return this.getTagValue(STUDY_INSTANCE_UID) || null;
}
/**
* Append tags to internal tag map.
* @param {Object} tagMap An object whose own properties will be used as tag values and appended to internal tag map.
*/
addTags(tagMap) {
const _hasOwn = Object.prototype.hasOwnProperty;
const _tags = this._tags;
const _data = this._data;
for (let tag in tagMap) {
if (_hasOwn.call(tagMap, tag)) {
const description = DICOMTagDescriptions.find(tag);
// When a description is available, use its tag as internal key...
if (description) {
_tags[description.tag] = tagMap[tag];
_data[description.tag] = tagMap[tag];
} else {
_tags[tag] = tagMap[tag];
_data[tag] = tagMap[tag];
}
}
}
}
tagExists(tagName) {
const _tags = this._tags;
const _data = this._data;
const description = DICOMTagDescriptions.find(tagName);
if (description) {
return (description.tag in _tags);
return (description.tag in _data);
}
return (tagName in _tags);
return (tagName in _data);
}
getTagValue(tagName) {
const _tags = this._tags;
const _data = this._data;
const description = DICOMTagDescriptions.find(tagName);
if (description) {
return _tags[description.tag];
return _data[description.tag];
}
return _tags[tagName];
}
propertyExists(propertyName) {
return (propertyName in this._properties);
}
getPropertyValue(propertyName) {
return this._properties[propertyName];
return _data[tagName];
}
}