From 64b76c202792832ac655a0aa1c97a0907e311585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elo=C3=ADzio=20Salgado?= Date: Thu, 26 Jan 2017 18:53:24 -0200 Subject: [PATCH] Removing unused code --- .../client/lib/MetadataViews.js | 64 ------------- .../client/lib/classes/DisplaySet.js | 90 ------------------- 2 files changed, 154 deletions(-) delete mode 100644 Packages/ohif-viewerbase/client/lib/MetadataViews.js delete mode 100644 Packages/ohif-viewerbase/client/lib/classes/DisplaySet.js diff --git a/Packages/ohif-viewerbase/client/lib/MetadataViews.js b/Packages/ohif-viewerbase/client/lib/MetadataViews.js deleted file mode 100644 index d669c850b..000000000 --- a/Packages/ohif-viewerbase/client/lib/MetadataViews.js +++ /dev/null @@ -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... -} \ No newline at end of file diff --git a/Packages/ohif-viewerbase/client/lib/classes/DisplaySet.js b/Packages/ohif-viewerbase/client/lib/classes/DisplaySet.js deleted file mode 100644 index 0a8d05ade..000000000 --- a/Packages/ohif-viewerbase/client/lib/classes/DisplaySet.js +++ /dev/null @@ -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]; - } - } - } - } - -} \ No newline at end of file