Removing unused code

This commit is contained in:
Eloízio Salgado 2017-01-26 18:53:24 -02:00 committed by Emanuel F. Oliveira
parent e8244b9d75
commit 64b76c2027
2 changed files with 0 additions and 154 deletions

View File

@ -1,64 +0,0 @@
// Default Configuration to handle Metadata from WADO or DIMSE,
// currently retrieved through Meteor server
let configuration = {
// These are examples, they need to actually check the properties of the Objects
getSeries: (study, seriesNumOrUid) => {
// Use Array to find the appropriate Series
return study.seriesList.find(series => series['seriesNumber'] === value);
},
getInstance: (series, instanceNumOrUid) => {
return series.instances.find(instance => instance['instanceNumber'] === instanceNumOrUid)
}
getInstanceTagRaw: (instance, tag) => {
// (this won't actually work yet)
return instance[tag];
}
getInstanceTagNum: (instance, tag) => {
// (this won't actually work yet)
return parseFloat(instance[tag]);
}
};
// Example Nucleus configuration
//
configuration = {
getSeries: (study, seriesNumOrUid) => study.studyView.series(seriesNumOrInstanceUid),
getInstance: (series, instanceNumOrUid) => series.seriesView.instance(instanceNumOrUid),
getInstanceTagRaw: (instance, tag) => instance.instanceView.raw(tag),
getInstanceTagNum: (instance, tag) => instance.instanceView.num(tag),
getCustom(instance, custom) => instance.instanceView[custom]
}
class StudyMetadataView {
series(tag, value) {
// Retrieves Series by Series Number or SeriesInstanceUid
return configuration.getSeries(study, tag, value);
}
}
class SeriesMetadataView {
instances(tag, value) {
// Retrieves Instances by Instances Number or SOPInstanceUid
return configuration.getInstance(series, tag, value);
}
}
class InstanceMetadataView {
/* Retrieves raw value of tag from instance */
raw(tag) {
return configuration.getInstanceTagRaw(instance, tag);
}
/* Retrieves raw value of tag from instance */
num(tag) {
return configuration.getInstanceTagNum(instance, tag);
}
custom(custom) {
return configuration.getCustom(instance, custom)
}
// etc.. Date, DateTime, ...? Sequence...
}

View File

@ -1,90 +0,0 @@
import { Random } from 'meteor/random';
import { Metadata } from './metadata/Metadata';
import { InstanceMetadata } from './metadata/InstanceMetadata';
export class DisplaySet {
constructor(instances) {
this._uid = Random.id();
this._attributes = {};
this._instances = [];
if (instances instanceof Array) {
instances.forEach( instance => this.addInstance(instance));
}
}
getUID() {
return this._uid;
}
/**
* Retrieve the number of instances within the current display set.
* @returns {number} The number of instances in the current display set.
*/
getInstanceCount() {
return this._instances.length;
}
/**
* Find an instance by index.
* @param {number} index An integer representing a list index.
* @returns {InstanceMetadata} Returns a InstanceMetadata instance when found or undefined otherwise.
*/
getInstanceByIndex(index) {
let found; // undefined by default...
if (Metadata.isValidIndex(index)) {
found = this._instances[index];
}
return found;
}
/**
* Invokes the supplied callback for each instance in the current display set passing
* two arguments: instance (InstanceMetadata) and index (the integer index of the instance within the current display set)
* @param {function} callback The callback function which will be invoked for each instance in the display set.
* @returns {undefined} Nothing is returned.
*/
forEachInstance(callback) {
if (Metadata.isValidCallback(callback)) {
this._instances.forEach((instance, index) => {
callback.call(null, instance, index);
});
}
}
/**
* Append an instance to the current series.
* @param {InstanceMetadata} instance The instance to be added to the current series.
* @returns {boolean} Returns true on success, false otherwise.
*/
addInstance(instance) {
let result = false;
if (instance instanceof InstanceMetadata) {
this._instances.push(instance);
result = true;
}
return result;
}
setAttribute(attribute, value) {
this._attributes[attribute] = value;
}
getAttribute(attribute) {
return this._attributes[attribute];
}
setAttributes(attributes) {
if (typeof attributes === 'object' && attributes !== null) {
const _attributes = this._attributes;
const hasOwn = Object.prototype.hasOwnProperty;
for (let attribute in attributes) {
if (hasOwn.call(attributes, attribute)) {
_attributes[attribute] = attributes[attribute];
}
}
}
}
}