reorganize packages, start converting overall app to react (very broken at the moment)

This commit is contained in:
Erik Ziegler committed 2018-12-12 18:06:25 +01:00
1 parent 024fe1a448
commit 5f30f7bd35
479 files changed
+5364 -11611

No files matched your search

-4
View File
@@ -1,4 +0,0 @@
import './lib';
import './utils';
import './schema.js';
-2
View File
@@ -1,2 +0,0 @@
import './object.js';
import './DICOMWeb/';
+5
View File
@@ -0,0 +1,5 @@
import { OHIF } from 'meteor/ohif:core';
OHIF.servers = {
collections: {}
};
@@ -1,5 +1,5 @@
import { ReactiveVar } from 'meteor/reactive-var';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
export class CommandsManager {
@@ -3,7 +3,7 @@ import { ReactiveVar } from 'meteor/reactive-var';
import { Tracker } from 'meteor/tracker';
import { Session } from 'meteor/session';
import { OHIF } from 'meteor/ohif:core';
import { HotkeysContext } from 'meteor/ohif:hotkeys/client/classes/HotkeysContext';
import { HotkeysContext } from './HotkeysContext';
export class HotkeysManager {
constructor() {
@@ -0,0 +1,354 @@
import { cornerstoneMath } from 'meteor/ohif:cornerstone';
import { parsingUtils } from '../lib/parsingUtils';
const FUNCTION = 'function';
export class MetadataProvider {
constructor() {
// Define the main "metadataLookup" private property as an immutable property.
Object.defineProperty(this, 'metadataLookup', {
configurable: false,
enumerable: false,
writable: false,
value: new Map()
});
// Local reference to provider function bound to current instance.
Object.defineProperty(this, '_provider', {
configurable: false,
enumerable: false,
writable: true,
value: null
});
}
/**
* Cornerstone Metadata provider to store image meta data
* Data from instances, series, and studies are associated with
* imageIds to facilitate usage of this information by Cornerstone's Tools
*
* e.g. the imagePlane metadata object contains instance information about
* row/column pixel spacing, patient position, and patient orientation. It
* is used in CornerstoneTools to position reference lines and orientation markers.
*
* @param {String} imageId The Cornerstone ImageId
* @param {Object} data An object containing instance, series, and study metadata
*/
addMetadata(imageId, data) {
const instanceMetadata = data.instance;
const seriesMetadata = data.series;
const studyMetadata = data.study;
const numImages = data.numImages;
const metadata = {};
metadata.frameNumber = data.frameNumber;
metadata.study = {
accessionNumber: studyMetadata.accessionNumber,
patientId: studyMetadata.patientId,
studyInstanceUid: studyMetadata.studyInstanceUid,
studyDate: studyMetadata.studyDate,
studyTime: studyMetadata.studyTime,
studyDescription: studyMetadata.studyDescription,
institutionName: studyMetadata.institutionName,
patientHistory: studyMetadata.patientHistory
};
metadata.series = {
seriesDescription: seriesMetadata.seriesDescription,
seriesNumber: seriesMetadata.seriesNumber,
seriesDate: seriesMetadata.seriesDate,
seriesTime: seriesMetadata.seriesTime,
modality: seriesMetadata.modality,
seriesInstanceUid: seriesMetadata.seriesInstanceUid,
numImages: numImages
};
metadata.instance = instanceMetadata;
metadata.patient = {
name: studyMetadata.patientName,
id: studyMetadata.patientId,
birthDate: studyMetadata.patientBirthDate,
sex: studyMetadata.patientSex,
age: studyMetadata.patientAge
};
// If there is sufficient information, populate
// the imagePlane object for easier use in the Viewer
metadata.imagePlane = this.getImagePlane(instanceMetadata);
// Add the metadata to the imageId lookup object
this.metadataLookup.set(imageId, metadata);
}
/**
* Return the metadata for the given imageId
* @param {String} imageId The Cornerstone ImageId
* @returns image metadata
*/
getMetadata(imageId) {
return this.metadataLookup.get(imageId);
}
/**
* Adds a set of metadata to the Cornerstone metadata provider given a specific
* imageId, type, and dataset
*
* @param imageId
* @param type (e.g. series, instance, tagDisplay)
* @param data
*/
addSpecificMetadata(imageId, type, data) {
const metadata = {};
metadata[type] = data;
const oldMetadata = this.metadataLookup.get(imageId);
this.metadataLookup.set(imageId, Object.assign(oldMetadata, metadata));
}
getFromImage(image, type, tag, attrName, defaultValue) {
let value;
if (image.data) {
value = this.getFromDataSet(image.data, type, tag);
} else {
value = image.instance[attrName];
}
return value === null ? defaultValue : value;
}
getFromDataSet(dataSet, type, tag) {
if (!dataSet) {
return;
}
const fn = dataSet[type];
if (!fn) {
return;
}
return fn.call(dataSet, tag);
}
getFrameIncrementPointer(image) {
const dataSet = image.data;
let frameInstancePointer = '';
if (parsingUtils.isValidDataSet(dataSet)) {
const frameInstancePointerNames = {
x00181063: 'frameTime',
x00181065: 'frameTimeVector'
};
// (0028,0009) = Frame Increment Pointer
const frameInstancePointerTag = parsingUtils.attributeTag(dataSet, 'x00280009');
frameInstancePointer = frameInstancePointerNames[frameInstancePointerTag];
} else {
frameInstancePointer = image.instance.frameIncrementPointer;
}
return frameInstancePointer || '';
}
getFrameTimeVector(image) {
const dataSet = image.data;
if (parsingUtils.isValidDataSet(dataSet)) {
// Frame Increment Pointer points to Frame Time Vector (0018,1065) field
return parsingUtils.floatArray(dataSet, 'x00181065');
}
return image.instance.frameTimeVector;
}
getFrameTime(image) {
const dataSet = image.data;
if (parsingUtils.isValidDataSet(dataSet)) {
// Frame Increment Pointer points to Frame Time (0018,1063) field or is not defined (for addtional flexibility).
// Yet another value is possible for this field (5200,9230 for Multi-frame Functional Groups)
// but that case is currently not supported.
return dataSet.floatString('x00181063', -1);
}
return image.instance.frameTime;
}
/**
* Updates the related metadata for missing fields given a specified image
*
* @param image
*/
updateMetadata(image) {
const imageMetadata = this.metadataLookup.get(image.imageId);
if (!imageMetadata) {
return;
}
imageMetadata.patient.age = imageMetadata.patient.age || this.getFromDataSet(image.data, 'string', 'x00101010');
imageMetadata.instance.rows = imageMetadata.instance.rows || image.rows;
imageMetadata.instance.columns = imageMetadata.instance.columns || image.columns;
imageMetadata.instance.sopClassUid = imageMetadata.instance.sopClassUid || this.getFromDataSet(image.data, 'string', 'x00080016');
imageMetadata.instance.sopInstanceUid = imageMetadata.instance.sopInstanceUid || this.getFromDataSet(image.data, 'string', 'x00080018');
imageMetadata.instance.pixelSpacing = imageMetadata.instance.pixelSpacing || this.getFromDataSet(image.data, 'string', 'x00280030');
imageMetadata.instance.frameOfReferenceUID = imageMetadata.instance.frameOfReferenceUID || this.getFromDataSet(image.data, 'string', 'x00200052');
imageMetadata.instance.imageOrientationPatient = imageMetadata.instance.imageOrientationPatient || this.getFromDataSet(image.data, 'string', 'x00200037');
imageMetadata.instance.imagePositionPatient = imageMetadata.instance.imagePositionPatient || this.getFromDataSet(image.data, 'string', 'x00200032');
imageMetadata.instance.sliceThickness = imageMetadata.instance.sliceThickness || this.getFromDataSet(image.data, 'string', 'x00180050');
imageMetadata.instance.sliceLocation = imageMetadata.instance.sliceLocation || this.getFromDataSet(image.data, 'string', 'x00201041');
imageMetadata.instance.tablePosition = imageMetadata.instance.tablePosition || this.getFromDataSet(image.data, 'string', 'x00189327');
imageMetadata.instance.spacingBetweenSlices = imageMetadata.instance.spacingBetweenSlices || this.getFromDataSet(image.data, 'string', 'x00180088');
imageMetadata.instance.lossyImageCompression = imageMetadata.instance.lossyImageCompression || this.getFromDataSet(image.data, 'string', 'x00282110');
imageMetadata.instance.lossyImageCompressionRatio = imageMetadata.instance.lossyImageCompressionRatio || this.getFromDataSet(image.data, 'string', 'x00282112');
imageMetadata.instance.frameIncrementPointer = imageMetadata.instance.frameIncrementPointer || this.getFromDataSet(image.data, 'string', 'x00280009');
imageMetadata.instance.frameTime = imageMetadata.instance.frameTime || this.getFromDataSet(image.data, 'string', 'x00181063');
imageMetadata.instance.frameTimeVector = imageMetadata.instance.frameTimeVector || this.getFromDataSet(image.data, 'string', 'x00181065');
if ((image.data || image.instance) && !imageMetadata.instance.multiframeMetadata) {
imageMetadata.instance.multiframeMetadata = this.getMultiframeModuleMetadata(image);
}
imageMetadata.imagePlane = imageMetadata.imagePlane || this.getImagePlane(imageMetadata.instance);
}
/**
* Constructs and returns the imagePlane given the metadata instance
*
* @param metadataInstance The metadata instance (InstanceMetadata class) containing information to construct imagePlane
* @returns imagePlane The constructed imagePlane to be used in viewer easily
*/
getImagePlane(instance) {
if (!instance.rows || !instance.columns || !instance.pixelSpacing ||
!instance.frameOfReferenceUID || !instance.imageOrientationPatient ||
!instance.imagePositionPatient) {
return;
}
const imageOrientation = instance.imageOrientationPatient.split('\\');
const imagePosition = instance.imagePositionPatient.split('\\');
let columnPixelSpacing = 1.0;
let rowPixelSpacing = 1.0;
if (instance.pixelSpacing) {
const split = instance.pixelSpacing.split('\\');
rowPixelSpacing = parseFloat(split[0]);
columnPixelSpacing = parseFloat(split[1]);
}
return {
frameOfReferenceUID: instance.frameOfReferenceUID,
rows: instance.rows,
columns: instance.columns,
rowCosines:
new cornerstoneMath.Vector3(parseFloat(imageOrientation[0]), parseFloat(imageOrientation[1]), parseFloat(imageOrientation[2])),
columnCosines:
new cornerstoneMath.Vector3(parseFloat(imageOrientation[3]), parseFloat(imageOrientation[4]), parseFloat(imageOrientation[5])),
imagePositionPatient:
new cornerstoneMath.Vector3(parseFloat(imagePosition[0]), parseFloat(imagePosition[1]), parseFloat(imagePosition[2])),
rowPixelSpacing,
columnPixelSpacing,
};
}
/**
* This function extracts miltiframe information from a dicomParser.DataSet object.
*
* @param dataSet {Object} An instance of dicomParser.DataSet object where multiframe information can be found.
* @return {Object} An object containing multiframe image metadata (frameIncrementPointer, frameTime, frameTimeVector, etc).
*/
getMultiframeModuleMetadata(image) {
const imageInfo = {
isMultiframeImage: false,
frameIncrementPointer: null,
numberOfFrames: 0,
frameTime: 0,
frameTimeVector: null,
averageFrameRate: 0 // backwards compatibility only... it might be useless in the future
};
let frameTime;
const numberOfFrames = this.getFromImage(image, 'intString', 'x00280008', 'numberOfFrames', -1);
if (numberOfFrames > 0) {
// set multi-frame image indicator
imageInfo.isMultiframeImage = true;
imageInfo.numberOfFrames = numberOfFrames;
// (0028,0009) = Frame Increment Pointer
const frameIncrementPointer = this.getFrameIncrementPointer(image);
if (frameIncrementPointer === 'frameTimeVector') {
// Frame Increment Pointer points to Frame Time Vector (0018,1065) field
const frameTimeVector = this.getFrameTimeVector(image);
if (frameTimeVector instanceof Array && frameTimeVector.length > 0) {
imageInfo.frameIncrementPointer = frameIncrementPointer;
imageInfo.frameTimeVector = frameTimeVector;
frameTime = frameTimeVector.reduce((a, b) => a + b) / frameTimeVector.length;
imageInfo.averageFrameRate = 1000 / frameTime;
}
} else if (frameIncrementPointer === 'frameTime' || frameIncrementPointer === '') {
frameTime = this.getFrameTime(image);
if (frameTime > 0) {
imageInfo.frameIncrementPointer = frameIncrementPointer;
imageInfo.frameTime = frameTime;
imageInfo.averageFrameRate = 1000 / frameTime;
}
}
}
return imageInfo;
}
/**
* Get a bound reference to the provider function.
*/
getProvider() {
let provider = this._provider;
if (typeof this._provider !== FUNCTION) {
provider = this.provider.bind(this);
this._provider = provider;
}
return provider;
}
/**
* Looks up metadata for Cornerstone Tools given a specified type and imageId
* A type may be, e.g. 'study', or 'patient', or 'imagePlane'. These types
* are keys in the stored metadata objects.
*
* @param type
* @param imageId
* @returns {Object} Relevant metadata of the specified type
*/
provider(type, imageId) {
// TODO: Cornerstone Tools use 'imagePlaneModule', but OHIF use 'imagePlane'. It must be consistent.
if (type === 'imagePlaneModule') {
type = 'imagePlane';
}
const imageMetadata = this.metadataLookup.get(imageId);
if (!imageMetadata) {
return;
}
if (imageMetadata.hasOwnProperty(type)) {
return imageMetadata[type];
}
}
}
@@ -0,0 +1,11 @@
import MetadataProvider from './MetadataProvider.js';
import CommandsManager from './CommandsManager.js';
import HotkeysContext from './HotkeysContext.js';
import HotkeysManager from './HotkeysManager.js';
export {
MetadataProvider,
CommandsManager,
HotkeysContext,
HotkeysManager
};
@@ -0,0 +1,11 @@
import { Mongo } from 'meteor/mongo';
import { OHIF } from 'meteor/ohif:core';
// CurrentServer is a single document collection to describe which of the Servers is being used
const CurrentServer = new Mongo.Collection(null);
CurrentServer._debugName = 'CurrentServer';
OHIF.servers = OHIF.servers || {};
OHIF.servers.collections = OHIF.servers.collections || {};
OHIF.servers.collections.currentServer = CurrentServer;
export { CurrentServer };
@@ -0,0 +1,4 @@
import { CurrentServer } from './currentServer.js';
import { Servers } from './servers.js';
export { CurrentServer, Servers };
@@ -0,0 +1,17 @@
import { Mongo } from 'meteor/mongo';
import { OHIF } from 'meteor/ohif:core';
// import { Servers as ServerSchema } from 'meteor/ohif:servers/both/schema/servers.js';
let collectionName = 'servers';
if (Meteor.settings && Meteor.settings.public && Meteor.settings.public.clientOnly === true) {
collectionName = null;
}
// Servers describe the DICOM servers configurations
const Servers = new Mongo.Collection(collectionName);
// TODO: Make the Schema match what we are currently sticking into the Collection
//Servers.attachSchema(ServerSchema);
Servers._debugName = 'Servers';
OHIF.servers.collections.servers = Servers;
export { Servers };
@@ -1,5 +1,5 @@
import { OHIF } from 'meteor/ohif:core';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
// Create an object to store all the application mixins
OHIF.mixins = {};
@@ -1,5 +1,5 @@
import { Template } from 'meteor/templating';
import { $ } from 'meteor/jquery';
import $ from 'jquery';
import { OHIF } from 'meteor/ohif:core';
/*
@@ -1,6 +1,6 @@
import { OHIF } from 'meteor/ohif:core';
import { Template } from 'meteor/templating';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
/*
* inputCheckbox: controls a checkbox input
@@ -2,8 +2,8 @@ import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Blaze } from 'meteor/blaze';
import { ReactiveVar } from 'meteor/reactive-var';
import { $ } from 'meteor/jquery';
import { _ } from 'meteor/underscore';
import $ from 'jquery';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
/*
@@ -2,8 +2,8 @@ import { OHIF } from 'meteor/ohif:core';
import { Template } from 'meteor/templating';
import { Tracker } from 'meteor/tracker';
import { Spacebars } from 'meteor/spacebars';
import { _ } from 'meteor/underscore';
import { $ } from 'meteor/jquery';
import _ from 'underscore';
import $ from 'jquery';
/*
* form: controls a form and its registered inputs
@@ -2,8 +2,8 @@ import { OHIF } from 'meteor/ohif:core';
import { Template } from 'meteor/templating';
import { Tracker } from 'meteor/tracker';
import { Meteor } from 'meteor/meteor';
import { _ } from 'meteor/underscore';
import { $ } from 'meteor/jquery';
import _ from 'underscore';
import $ from 'jquery';
/*
* formItem: create a generic controller for form items
@@ -1,7 +1,7 @@
import { OHIF } from 'meteor/ohif:core';
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
/*
* group: controls a group and its registered items
@@ -1,7 +1,7 @@
import { OHIF } from 'meteor/ohif:core';
import { Template } from 'meteor/templating';
import { _ } from 'meteor/underscore';
import { $ } from 'meteor/jquery';
import _ from 'underscore';
import $ from 'jquery';
/*
* groupRadio: controls all the radio inputs inside the group
@@ -1,6 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { $ } from 'meteor/jquery';
import $ from 'jquery';
import { OHIF } from 'meteor/ohif:core';
/*
@@ -3,7 +3,7 @@ import { Blaze } from 'meteor/blaze';
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { Tracker } from 'meteor/tracker';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
// Helper function to get the component's current schema
const getCurrentSchemaDefs = (parentComponent, key) => {
@@ -1,8 +1,8 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { Tracker } from 'meteor/tracker';
import { _ } from 'meteor/underscore';
import { $ } from 'meteor/jquery';
import _ from 'underscore';
import $ from 'jquery';
import { OHIF } from 'meteor/ohif:core';
/*
@@ -1,6 +1,6 @@
import { Template } from 'meteor/templating';
import { Blaze } from 'meteor/blaze';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
// Create a new custom template for the base component
@@ -1,5 +1,5 @@
import { Template } from 'meteor/templating';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
Template.dialogForm.onCreated(() => {
@@ -1,4 +1,4 @@
@import "{ohif:design}/app"
@import "{ohif:viewerbase}/app"
.modal .loading-text
theme('color', '$textSecondaryColor')
@@ -1,6 +1,6 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
Template.dialogProgress.onCreated(() => {
const instance = Template.instance();
@@ -1,6 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
Template.dialogSimple.onCreated(() => {
@@ -1,7 +1,7 @@
import { Blaze } from 'meteor/blaze';
import { Template } from 'meteor/templating';
import { _ } from 'meteor/underscore';
import { $ } from 'meteor/jquery';
import _ from 'underscore';
import $ from 'jquery';
const MARGIN_RIGHT = 15;
const MARGIN_BOTTOM = 15;
@@ -1,4 +1,4 @@
@require '{ohif:design}/app'
@require '{ohif:viewerbase}/app'
.dropdown
cursor: default
@@ -1,4 +1,4 @@
@require '{ohif:design}/app'
@require '{ohif:viewerbase}/app'
.notification-area
position: fixed
@@ -1,5 +1,5 @@
import { Template } from 'meteor/templating';
import { $ } from 'meteor/jquery';
import $ from 'jquery';
import { OHIF } from 'meteor/ohif:core';
Template.header.onCreated(() => {
@@ -1,4 +1,4 @@
@import "{ohif:design}/app"
@import "{ohif:viewerbase}/app"
body>.header
height: $topBarHeight
@@ -1,7 +1,7 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { $ } from 'meteor/jquery';
import { _ } from 'meteor/underscore';
import $ from 'jquery';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
Template.hotkeysForm.onCreated(() => {
@@ -6,4 +6,3 @@ import './pages';
import './paginationArea';
import './playground';
import './scrollArea';
import './userLogin';
@@ -1,4 +1,4 @@
@require '{ohif:design}/app'
@require '{ohif:viewerbase}/app'
.page-error .error-stack
display: table
@@ -1,4 +1,4 @@
@require '{ohif:design}/app'
@require '{ohif:viewerbase}/app'
.page-message
theme('color', '$textPrimaryColor')
@@ -1,6 +1,6 @@
import { Template } from 'meteor/templating';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { $ } from 'meteor/jquery';
import $ from 'jquery';
Template.paginationArea.onCreated(function() {
const instance = Template.instance();
@@ -1,4 +1,4 @@
@require '{ohif:design}/app'
@require '{ohif:viewerbase}/app'
.pagination-area
font-size: 13px
@@ -1,5 +1,5 @@
import { Template } from 'meteor/templating';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
Template.scrollArea.onCreated(() => {
@@ -1,4 +1,4 @@
@require '{ohif:design}/app'
@require '{ohif:viewerbase}/app'
$scrollNavSize = 24px
+5
View File
@@ -0,0 +1,5 @@
import { OHIF } from 'meteor/ohif:core';
import { MetadataProvider } from './classes/MetadataProvider';
OHIF.cornerstone.MetadataProvider = MetadataProvider;
+1 -1
View File
@@ -1,4 +1,4 @@
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { Template } from 'meteor/templating';
/**
+1 -1
View File
@@ -1,4 +1,4 @@
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
+1 -1
View File
@@ -1,4 +1,4 @@
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { Template } from 'meteor/templating';
/**
+1 -1
View File
@@ -1,4 +1,4 @@
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { Template } from 'meteor/templating';
/**
+1 -1
View File
@@ -1,5 +1,5 @@
import { OHIF } from 'meteor/ohif:core';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { Template } from 'meteor/templating';
/**
+1 -1
View File
@@ -1,4 +1,4 @@
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { Template } from 'meteor/templating';
/**
+1 -1
View File
@@ -1,5 +1,5 @@
import { OHIF } from 'meteor/ohif:core';
import { HotkeysManager } from '/client/classes/HotkeysManager';
import { HotkeysManager } from './classes/HotkeysManager';
import 'jquery.hotkeys';
// Create hotkeys namespace using a HotkeysManager class instance
+12
View File
@@ -0,0 +1,12 @@
import { Meteor } from 'meteor/meteor';
import writeScript from './lib/writeScript';
// Check if browser is IE and add the polyfill scripts
if (navigator && /MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
Meteor.startup(() => {
window.onload = () => {
// Fix SVG+USE issues by calling the SVG polyfill
writeScript('svgxuse.min.js');
};
});
}
+5 -4
View File
@@ -4,8 +4,9 @@ import './commands';
import './hotkeys';
import './components';
import './ui';
import './routes.js';
import './header.js';
import './hotkeys.js';
import './hotkeys.js';
import './schema.js';
import './utils/';
import './startup.js';
import './classes/';
import './cornerstone.js';
@@ -0,0 +1,10 @@
import { Meteor } from 'meteor/meteor';
export default function(path) {
if (path) {
// Remove the leading "/"
path = path.replace(/^\//, '');
}
return Meteor.absoluteUrl(path);
}
+1 -1
View File
@@ -1,5 +1,5 @@
import { OHIF } from 'meteor/ohif:core';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
OHIF.cornerstone = {};
@@ -0,0 +1,17 @@
import { OHIF } from 'meteor/ohif:core';
import { Servers, CurrentServer } from '../collections';
/**
* Retrieves the current server configuration used to retrieve studies
*/
OHIF.servers.getCurrentServer = () => {
const currentServer = CurrentServer.findOne();
if (!currentServer) {
return;
}
const serverConfiguration = Servers.findOne({ _id: currentServer.serverId });
return serverConfiguration;
};
+3
View File
@@ -5,3 +5,6 @@ import './ui.js';
import './utils.js';
import './viewer.js';
import './user.js';
import './object.js';
import './DICOMWeb/';
import './getCurrentServer.js';
@@ -0,0 +1,79 @@
import { dicomParser } from 'meteor/ohif:cornerstone';
/**
* A small set of utilities to help parsing DICOM element values.
* In the future the functionality provided by this library might
* be incorporated into dicomParser library.
*/
export const parsingUtils = {
/**
* Check if supplied argument is a valid instance of the dicomParser.DataSet class.
* @param data {Object} An instance of the dicomParser.DataSet class.
* @returns {Boolean} Returns true if data is a valid instance of the dicomParser.DataSet class.
*/
isValidDataSet: function(data) {
return (data instanceof dicomParser.DataSet);
},
/**
* Parses an element tag according to the 'AT' VR definition.
* @param data {Object} An instance of the dicomParser.DataSet class.
* @param tag {String} A DICOM tag with in the format xGGGGEEEE.
* @returns {String} A string representation of a data element tag or null if the field is not present or data is not long enough.
*/
attributeTag: function(data, tag) {
if (this.isValidDataSet(data) && tag in data.elements) {
let element = data.elements[tag];
if (element && element.length === 4) {
let parser = data.byteArrayParser.readUint16,
bytes = data.byteArray,
offset = element.dataOffset;
return 'x' + ('00000000' + (parser(bytes, offset) * 256 * 256 + parser(bytes, offset + 2)).toString(16)).substr(-8);
}
}
return null;
},
/**
* Parses the string representation of a multi-valued element into an array of strings. If the parser
* parameter is passed and is a function, it will be applied to each element of the resulting array.
* @param data {Object} An instance of the dicomParser.DataSet class.
* @param tag {String} A DICOM tag with in the format xGGGGEEEE.
* @param parser {Function} An optional parser function that can be applied to each element of the array.
* @returns {Array} An array of floating point numbers or null if the field is not present or data is not long enough.
*/
multiValue: function(data, tag, parser) {
if (this.isValidDataSet(data) && tag in data.elements) {
let element = data.elements[tag];
if (element && element.length > 0) {
let string = dicomParser.readFixedString(data.byteArray, element.dataOffset, element.length);
if (typeof string === 'string' && string.length > 0) {
if (typeof parser !== 'function') {
parser = null;
}
return string.split('\\').map(function(value) {
value = value.trim();
return parser !== null ? parser(value) : value;
});
}
}
}
return null;
},
/**
* Parses a string to an array of floats for a multi-valued element.
* @param data {Object} An instance of the dicomParser.DataSet class.
* @param tag {String} A DICOM tag with in the format xGGGGEEEE.
* @returns {Array} An array of floating point numbers or null if the field is not present or data is not long enough.
*/
floatArray: function(data, tag) {
return this.multiValue(data, tag, parseFloat);
}
};
+2 -2
View File
@@ -1,6 +1,6 @@
import { OHIF } from 'meteor/ohif:core';
import { _ } from 'meteor/underscore';
import { $ } from 'meteor/jquery';
import _ from 'underscore';
import $ from 'jquery';
OHIF.string = {};
@@ -0,0 +1,14 @@
/* jshint -W060 */
import absoluteUrl from './absoluteUrl';
export default function(fileName, callback) {
const script = document.createElement('script');
script.src = absoluteUrl(`/packages/ohif_polyfill/public/js/${fileName}`);
script.onload = () => {
if (typeof callback === 'function') {
callback(script);
}
};
document.body.appendChild(script);
}
-27
View File
@@ -1,27 +0,0 @@
import { Meteor } from 'meteor/meteor';
import { $ } from 'meteor/jquery';
import { Router } from 'meteor/clinical:router';
Router.onRun(function() {
$(document.body).trigger('ohif.navigated');
this.next();
});
if (Meteor.isDevelopment) {
Router.route('/playground', function() {
this.render('componentPlayground');
});
}
import { hotkeys } from 'meteor/ohif:hotkeys';
Router.onBeforeAction(function() {
const lastRoute = Session.get('lastRoute');
const currentRoute = this.router.current().route.getName();
if (currentRoute !== lastRoute) {
hotkeys.switchToContext(null);
Session.set('lastRoute', currentRoute);
}
this.next();
});
@@ -1,4 +1,5 @@
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { Match } from 'meteor/check';
/*
Extend the available options on schema definitions:
+314
View File
@@ -0,0 +1,314 @@
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
const serverNameDefinitions = {
type: String,
label: 'Server Name',
max: 100
};
const serverTypeDefinitions = {
type: String,
label: 'Server Type',
allowedValues: ['dicomWeb', 'dimse'],
valuesLabels: ['DICOM Web', 'DIMSE'],
optional: true
};
const wadoUriRootDefinitions = {
type: String,
label: 'WADO URI root',
max: 1000
};
const availableMouseButtonTools = ['wwwc', 'zoom', 'pan', 'stackScroll'];
export const DICOMWebRequestOptions = new SimpleSchema({
auth: {
type: String,
label: 'Authentication',
defaultValue: 'orthanc:orthanc',
optional: true
},
requestFromBrowser: {
type: Boolean,
label: 'Make DICOMWeb requests from the Browser',
defaultValue: false,
optional: true
},
logRequests: {
type: Boolean,
defaultValue: true,
label: 'Requests'
},
logResponses: {
type: Boolean,
defaultValue: false,
label: 'Responses'
},
logTiming: {
type: Boolean,
defaultValue: true,
label: 'Timing'
}
});
export const DICOMWebServer = new SimpleSchema({
name: serverNameDefinitions,
type: serverTypeDefinitions,
wadoUriRoot: wadoUriRootDefinitions,
wadoRoot: {
type: String,
label: 'WADO root',
max: 1000
},
imageRendering: {
type: String,
label: 'Image rendering',
allowedValues: ['wadouri', 'wadors'],
valuesLabels: ['WADO URI', 'WADO RS'],
defaultValue: 'wadouri'
},
thumbnailRendering: {
type: String,
label: 'Thumbnail rendering',
allowedValues: ['wadouri', 'wadors'],
valuesLabels: ['WADO URI', 'WADO RS'],
defaultValue: 'wadouri'
},
qidoRoot: {
type: String,
label: 'QIDO root',
max: 1000
},
qidoSupportsIncludeField: {
type: Boolean,
label: 'QIDO supports "includefield" query key',
defaultValue: false
},
requestOptions: {
type: DICOMWebRequestOptions,
label: 'Request Options'
}
});
export const DIMSEPeer = new SimpleSchema({
aeTitle: {
type: String,
label: 'AE Title'
},
hostAE: {
type: String,
label: 'AE Host',
optional: true
},
host: {
type: String,
label: 'Host Domain/IP',
regEx: SimpleSchema.RegEx.WeakDomain
},
port: {
type: Number,
label: 'Port',
min: 1,
defaultValue: 11112,
max: 65535
},
default: {
type: Boolean,
label: 'Default',
defaultValue: false
},
server: {
type: Boolean,
label: 'Server',
defaultValue: false
},
supportsInstanceRetrievalByStudyUid: {
type: Boolean,
label: 'Supports instance retrieval by StudyUid',
defaultValue: true
}
});
export const DIMSEServer = new SimpleSchema({
name: serverNameDefinitions,
type: serverTypeDefinitions,
wadoUriRoot: wadoUriRootDefinitions,
requestOptions: {
type: DICOMWebRequestOptions,
label: 'Request Options'
},
peers: {
type: [DIMSEPeer],
label: 'Peer List',
minCount: 1
}
});
export const UISettings = new SimpleSchema({
studyListFunctionsEnabled: {
type: Boolean,
label: 'Study List Functions Enabled?',
defaultValue: true
},
leftSidebarOpen: {
type: Boolean,
label: 'Left sidebar open by default?',
defaultValue: false
},
leftSidebarDragAndDrop: {
type: Boolean,
label: 'Left sidebar allows thumbnail drag and drop. If false, images will be loaded on single click.',
defaultValue: true
},
displaySetNavigationLoopOverSeries: {
type: Boolean,
label: 'The UP/DOWN display set navigation buttons will start over when reach the last display set in viewport?',
defaultValue: true
},
displaySetNavigationMultipleViewports: {
type: Boolean,
label: 'The UP/DOWN display set navigation buttons will iterate over all the viewports at once?',
defaultValue: false
},
displayEchoUltrasoundWorkflow: {
type: Boolean,
label: 'Enable cine dialog enhancements for multiframe images.',
defaultValue: false
},
autoPositionMeasurementsTextCallOuts: {
type: String,
label: 'Auto position text call-outs for measurements when creating them.',
defaultValue: 'TRBL'
},
studyListDateFilterNumDays: {
type: Number,
label: 'Number of days to be used on Study List date filter',
min: 1
},
showStackLoadingProgressBar: {
type: Boolean,
label: 'Show a progress bar closest to the thumbnail showing how much the stack has loaded',
defaultValue: true
},
cornerstoneRenderer: {
type: String,
label: 'Cornerstone default image renderer',
defaultValue: 'webgl'
},
sortSeriesByIncomingOrder: {
type: Boolean,
label: 'Define if the series\' images shall be sorted by incoming order. Sort by Instance Number by default.',
defaultValue: false
},
useMiddleSeriesInstanceAsThumbnail: {
type: Boolean,
label: 'Define if the middle instance of a series will be used as thumbnail. If not, the first instance will be used.',
defaultValue: true
}
});
export const PrefetchSchema = new SimpleSchema({
order: {
type: String,
label: 'Prefetch Order',
allowedValues: ['topdown', 'downward', 'closest'],
optional: false
},
displaySetCount: {
type: Number,
label: 'Display Set Count',
min: 1,
defaultValue: 1
}
});
export const MouseButtonToolSchema = new SimpleSchema({
left: {
type: String,
label: 'Left Mouse Button',
allowedValues: availableMouseButtonTools,
optional: true
},
right: {
type: String,
label: 'Right Mouse Button',
allowedValues: availableMouseButtonTools,
optional: true
},
middle: {
type: String,
label: 'Middle Mouse Button',
allowedValues: availableMouseButtonTools,
optional: true
}
});
export const PublicServerConfig = new SimpleSchema({
verifyEmail: {
type: Boolean,
label: 'Verify Email',
defaultValue: false
},
demoUserEnabled: {
type: Boolean,
label: 'Creates demo user on startup and show TestDrive button',
defaultValue: true
},
userAuthenticationRoutesEnabled: {
type: Boolean,
label: 'Enables routing to /login page.',
defaultValue: false,
},
ui: {
type: UISettings,
label: 'UI Settings'
},
prefetch: {
type: PrefetchSchema,
label: 'Prefetch settings'
},
defaultMouseButtonTools: {
type: MouseButtonToolSchema,
label: 'Default Mouse Button Tools'
}
});
export const Servers = new SimpleSchema({
dicomWeb: {
type: [DICOMWebServer],
label: 'DICOMWeb Servers',
optional: true
},
dimse: {
type: [DIMSEServer],
label: 'DIMSE Servers',
optional: true
}
});
export const ServerConfiguration = new SimpleSchema({
servers: {
type: Servers,
label: 'Servers'
},
defaultServiceType: {
type: String,
label: 'Default Service Type',
defaultValue: 'dicomWeb'
},
dropCollections: {
type: Boolean,
label: 'Drop database collections',
defaultValue: false
},
public: {
type: PublicServerConfig,
label: 'Public Server Configuration',
},
origin: {
type: String,
label: 'Origin',
optional: true
}
});
+22
View File
@@ -0,0 +1,22 @@
// Check the servers on meteor startup
import { Meteor } from "meteor/meteor";
import { Servers, CurrentServer } from './collections';
const servers = Meteor.settings.public.servers;
Object.keys(servers).forEach((serverType) => {
const endpoints = servers[serverType];
endpoints.forEach((endpoint) => {
const server = Object.assign({}, endpoint);
server.type = serverType;
Servers.insert(server);
});
});
const newServer = Servers.findOne();
CurrentServer.insert({
serverId: newServer._id
});
@@ -1,5 +1,5 @@
import { $ } from 'meteor/jquery';
import { _ } from 'meteor/underscore';
import $ from 'jquery';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
// Allow attaching to jQuery selectors
@@ -1,7 +1,7 @@
import { Template } from 'meteor/templating';
import { Blaze } from 'meteor/blaze';
import { _ } from 'meteor/underscore';
import { $ } from 'meteor/jquery';
import _ from 'underscore';
import $ from 'jquery';
import { OHIF } from 'meteor/ohif:core';
let zIndexBackdrop = 1060;
@@ -1,6 +1,6 @@
import { Template } from 'meteor/templating';
import { Blaze } from 'meteor/blaze';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
OHIF.ui.unsavedChangesDialog = function(callback, options) {
@@ -1,4 +1,4 @@
import { $ } from 'meteor/jquery';
import $ from 'jquery';
// Temporarily show and hide the element to enable dimension calculations
$.fn.tempShow = function(callback) {
@@ -1,5 +1,5 @@
import { Tracker } from 'meteor/tracker';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
class Dropdown {
@@ -1,8 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Blaze } from 'meteor/blaze';
import { $ } from 'meteor/jquery';
import { _ } from 'meteor/underscore';
import $ from 'jquery';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
const Notifications = {
@@ -1,4 +1,4 @@
import { _ } from 'meteor/underscore';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
// Allow attaching to jQuery selectors
@@ -1,4 +1,4 @@
@import "{ohif:design}/app"
@import "{ohif:viewerbase}/app"
.resizable
transform(scale(1))
@@ -1,6 +1,6 @@
import { Tracker } from 'meteor/tracker';
import { OHIF } from 'meteor/ohif:core';
import { _ } from 'meteor/underscore';
import _ from 'underscore';
const FUNCTION = 'function';
const STRING = 'string';
+2 -8
View File
@@ -1,12 +1,12 @@
import { Meteor } from 'meteor/meteor';
import './log.js';
import log from './log.js';
/*
* Defines the base OHIF object
*/
const OHIF = {
log: {},
log,
ui: {},
utils: {},
viewer: {},
@@ -15,10 +15,4 @@ const OHIF = {
DICOMWeb: {}, // Temporarily added
};
// Expose the OHIF object to the client if it is on development mode
// @TODO: remove this after applying namespace to this package
if (Meteor.isClient) {
window.OHIF = OHIF;
}
export { OHIF };
+7 -13
View File
@@ -1,7 +1,9 @@
Npm.depends({
'isomorphic-base64': '1.0.2',
'jquery.hotkeys': '0.1.0',
loglevel: '1.4.1'
loglevel: '1.4.1',
jquery: '3.3.1',
underscore: "1.9.1"
});
Package.describe({
@@ -14,16 +16,12 @@ Package.onUse(function(api) {
api.versionsFrom('1.7');
api.use('ecmascript');
api.use('jquery');
api.use('stylus');
api.use('underscore');
api.use('templating');
api.use('reactive-var');
api.use('session');
api.use('cultofcoders:persistent-session');
// Router dependencies
api.use('clinical:router@2.0.19', 'client');
api.use('ohif:cornerstone');
// Component's library dependencies
api.use('natestrauser:select2@4.0.1', 'client');
@@ -42,14 +40,10 @@ Package.onUse(function(api) {
api.mainModule('main.js', ['client', 'server']);
api.use([
'accounts-base',
'accounts-password'
], 'server');
// Assets to be imported dynamically
api.addAssets('public/js/svgxuse.min.js', 'client');
// Client imports and routes
api.addFiles('client/index.js', 'client');
// Client and server imports
api.addFiles('both/index.js', ['client', 'server']);
});
+12
View File
@@ -0,0 +1,12 @@
/*!
* @copyright Copyright (c) 2017 IcoMoon.io
* @license Licensed under MIT license
* See https://github.com/Keyamoon/svgxuse
* @version 1.2.6
*/
(function(){if("undefined"!==typeof window&&window.addEventListener){var e=Object.create(null),l,d=function(){clearTimeout(l);l=setTimeout(n,100)},m=function(){},t=function(){window.addEventListener("resize",d,!1);window.addEventListener("orientationchange",d,!1);if(window.MutationObserver){var k=new MutationObserver(d);k.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0});m=function(){try{k.disconnect(),window.removeEventListener("resize",d,!1),window.removeEventListener("orientationchange",
d,!1)}catch(v){}}}else document.documentElement.addEventListener("DOMSubtreeModified",d,!1),m=function(){document.documentElement.removeEventListener("DOMSubtreeModified",d,!1);window.removeEventListener("resize",d,!1);window.removeEventListener("orientationchange",d,!1)}},u=function(k){function e(a){if(void 0!==a.protocol)var c=a;else c=document.createElement("a"),c.href=a;return c.protocol.replace(/:/g,"")+c.host}if(window.XMLHttpRequest){var d=new XMLHttpRequest;var m=e(location);k=e(k);d=void 0===
d.withCredentials&&""!==k&&k!==m?XDomainRequest||void 0:XMLHttpRequest}return d};var n=function(){function d(){--q;0===q&&(m(),t())}function l(a){return function(){!0!==e[a.base]&&(a.useEl.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","#"+a.hash),a.useEl.hasAttribute("href")&&a.useEl.setAttribute("href","#"+a.hash))}}function p(a){return function(){var c=document.body,b=document.createElement("x");a.onload=null;b.innerHTML=a.responseText;if(b=b.getElementsByTagName("svg")[0])b.setAttribute("aria-hidden",
"true"),b.style.position="absolute",b.style.width=0,b.style.height=0,b.style.overflow="hidden",c.insertBefore(b,c.firstChild);d()}}function n(a){return function(){a.onerror=null;a.ontimeout=null;d()}}var a,c,q=0;m();var f=document.getElementsByTagName("use");for(c=0;c<f.length;c+=1){try{var g=f[c].getBoundingClientRect()}catch(w){g=!1}var h=(a=f[c].getAttribute("href")||f[c].getAttributeNS("http://www.w3.org/1999/xlink","href")||f[c].getAttribute("xlink:href"))&&a.split?a.split("#"):["",""];var b=
h[0];h=h[1];var r=g&&0===g.left&&0===g.right&&0===g.top&&0===g.bottom;g&&0===g.width&&0===g.height&&!r?(f[c].hasAttribute("href")&&f[c].setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a),b.length&&(a=e[b],!0!==a&&setTimeout(l({useEl:f[c],base:b,hash:h}),0),void 0===a&&(h=u(b),void 0!==h&&(a=new h,e[b]=a,a.onload=p(a),a.onerror=n(a),a.ontimeout=n(a),a.open("GET",b),a.send(),q+=1)))):r?b.length&&e[b]&&setTimeout(l({useEl:f[c],base:b,hash:h}),0):void 0===e[b]?e[b]=!0:e[b].onload&&(e[b].abort(),
delete e[b].onload,e[b]=!0)}f="";q+=1;d()};var p=function(){window.removeEventListener("load",p,!1);l=setTimeout(n,0)};"complete"!==document.readyState?window.addEventListener("load",p,!1):p()}})();
-2
View File
@@ -1,2 +0,0 @@
import './mongo.js';
import './user.js';