Enabling devTools debugging on cornerstone libraries
This commit is contained in:
parent
b0d6701558
commit
99b88f08b3
@ -37,6 +37,7 @@ ohif:design
|
||||
ohif:core
|
||||
ohif:header
|
||||
ohif:cornerstone
|
||||
ohif:cornerstone-settings
|
||||
ohif:viewerbase
|
||||
ohif:studies
|
||||
ohif:study-list
|
||||
|
||||
@ -35,6 +35,7 @@ ohif:commands
|
||||
ohif:hotkeys
|
||||
ohif:header
|
||||
ohif:cornerstone
|
||||
ohif:cornerstone-settings
|
||||
ohif:viewerbase
|
||||
ohif:study-list
|
||||
ohif:dicom-services
|
||||
|
||||
2
Packages/ohif-cornerstone-settings/client/main.js
Normal file
2
Packages/ohif-cornerstone-settings/client/main.js
Normal file
@ -0,0 +1,2 @@
|
||||
// Include cornerstone's settings imports
|
||||
require('../imports/client');
|
||||
@ -1,4 +1,5 @@
|
||||
import { OHIF } from '../namespace';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
import './renderer.js';
|
||||
|
||||
import { MetadataProvider } from './lib/classes/MetadataProvider';
|
||||
@ -1,4 +1,4 @@
|
||||
import * as cornerstoneMath from 'cornerstone-math';
|
||||
import { cornerstoneMath } from 'meteor/ohif:cornerstone';
|
||||
import { parsingUtils } from '../parsingUtils';
|
||||
|
||||
const FUNCTION = 'function';
|
||||
@ -112,7 +112,7 @@ export class MetadataProvider {
|
||||
getFromImage(image, type, tag, attrName, defaultValue) {
|
||||
let value;
|
||||
|
||||
if(image.data) {
|
||||
if (image.data) {
|
||||
value = this.getFromDataSet(image.data, type, tag);
|
||||
} else {
|
||||
value = image.instance[attrName];
|
||||
@ -140,15 +140,15 @@ export class MetadataProvider {
|
||||
|
||||
if (parsingUtils.isValidDataSet(dataSet)) {
|
||||
const frameInstancePointerNames = {
|
||||
'x00181063': 'frameTime',
|
||||
'x00181065': 'frameTimeVector'
|
||||
}
|
||||
x00181063: 'frameTime',
|
||||
x00181065: 'frameTimeVector'
|
||||
};
|
||||
|
||||
// (0028,0009) = Frame Increment Pointer
|
||||
const frameInstancePointerTag = parsingUtils.attributeTag(dataSet, 'x00280009');
|
||||
frameInstancePointer = frameInstancePointerNames[frameInstancePointerTag];
|
||||
} else {
|
||||
frameInstancePointer = image.instance['frameIncrementPointer'];
|
||||
frameInstancePointer = image.instance.frameIncrementPointer;
|
||||
}
|
||||
|
||||
return frameInstancePointer || '';
|
||||
@ -162,7 +162,7 @@ export class MetadataProvider {
|
||||
return parsingUtils.floatArray(dataSet, 'x00181065');
|
||||
}
|
||||
|
||||
return image.instance['frameTimeVector'];
|
||||
return image.instance.frameTimeVector;
|
||||
}
|
||||
|
||||
getFrameTime(image) {
|
||||
@ -175,7 +175,7 @@ export class MetadataProvider {
|
||||
return dataSet.floatString('x00181063', -1);
|
||||
}
|
||||
|
||||
return image.instance['frameTime'];
|
||||
return image.instance.frameTime;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -322,6 +322,7 @@ export class MetadataProvider {
|
||||
provider = this.provider.bind(this);
|
||||
this._provider = provider;
|
||||
}
|
||||
|
||||
return provider;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import * as dicomParser from 'dicom-parser';
|
||||
import { dicomParser } from 'meteor/ohif:cornerstone';
|
||||
|
||||
/**
|
||||
* A small set of utilities to help parsing DICOM element values.
|
||||
@ -33,6 +33,7 @@ export const parsingUtils = {
|
||||
return 'x' + ('00000000' + (parser(bytes, offset) * 256 * 256 + parser(bytes, offset + 2)).toString(16)).substr(-8);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
@ -53,6 +54,7 @@ export const parsingUtils = {
|
||||
if (typeof parser !== 'function') {
|
||||
parser = null;
|
||||
}
|
||||
|
||||
return string.split('\\').map(function(value) {
|
||||
value = value.trim();
|
||||
return parser !== null ? parser(value) : value;
|
||||
@ -60,6 +62,7 @@ export const parsingUtils = {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { Meteor, OHIF } from '../namespace';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
const rendererPath = 'settings.public.ui.cornerstoneRenderer';
|
||||
OHIF.cornerstone.renderer = OHIF.utils.ObjectPath.get(Meteor, rendererPath) || '';
|
||||
15
Packages/ohif-cornerstone-settings/package.js
Normal file
15
Packages/ohif-cornerstone-settings/package.js
Normal file
@ -0,0 +1,15 @@
|
||||
Package.describe({
|
||||
name: 'ohif:cornerstone-settings',
|
||||
summary: 'Cornerstone Settings package',
|
||||
version: '0.0.1'
|
||||
});
|
||||
|
||||
Package.onUse(function(api) {
|
||||
api.versionsFrom('1.5');
|
||||
|
||||
api.use('ecmascript');
|
||||
api.use('ohif:cornerstone');
|
||||
api.use('ohif:core');
|
||||
|
||||
api.mainModule('client/main.js', 'client');
|
||||
});
|
||||
@ -1,32 +1,18 @@
|
||||
/**
|
||||
* Import namespace...
|
||||
*/
|
||||
|
||||
import { OHIF } from './namespace.js';
|
||||
|
||||
/**
|
||||
* Import scripts that will populate the Cornerstone namespace as a side effect only import. This is effectively the public API...
|
||||
*/
|
||||
|
||||
import * as cornerstone from 'cornerstone-core';
|
||||
import * as cornerstoneTools from 'cornerstone-tools';
|
||||
import * as cornerstoneMath from 'cornerstone-math';
|
||||
import * as cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
|
||||
import * as dicomParser from 'dicom-parser';
|
||||
import Hammer from 'hammerjs';
|
||||
import * as cornerstone from 'cornerstone-core/dist/cornerstone.js';
|
||||
import * as cornerstoneMath from 'cornerstone-math/dist/cornerstoneMath.js';
|
||||
import * as cornerstoneTools from 'cornerstone-tools/dist/cornerstoneTools.js';
|
||||
import * as cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader/dist/cornerstoneWADOImageLoader.js';
|
||||
import * as dicomParser from 'dicom-parser/dist/dicomParser.js';
|
||||
|
||||
import './client/'; // which is actually: import './client/index.js';
|
||||
|
||||
// Inject the current cornerstone version into the
|
||||
// WADO Image Loader and Tools libraries
|
||||
//
|
||||
// Note: You would also need to do this with Cornerstone Web Image Loader
|
||||
cornerstoneTools.external.Hammer = Hammer;
|
||||
cornerstoneTools.external.cornerstone = cornerstone;
|
||||
cornerstoneTools.external.cornerstoneMath = cornerstoneMath;
|
||||
cornerstoneWADOImageLoader.external.cornerstone = cornerstone;
|
||||
cornerstoneWADOImageLoader.external.dicomParser = dicomParser;
|
||||
|
||||
// Export scripts that will populate the Cornerstone namespace as a side effect only import.
|
||||
// This is effectively the public API...
|
||||
export {
|
||||
cornerstone,
|
||||
cornerstoneTools,
|
||||
@ -34,5 +20,3 @@ export {
|
||||
cornerstoneWADOImageLoader,
|
||||
dicomParser
|
||||
};
|
||||
|
||||
export { OHIF };
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
/**
|
||||
* Import main dependency
|
||||
*/
|
||||
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
/**
|
||||
* Append Cornerstone namespace
|
||||
*/
|
||||
|
||||
const Cornerstone = {
|
||||
...OHIF.cornerstone
|
||||
};
|
||||
|
||||
/**
|
||||
* Append Cornerstone namespace to OHIF namespace
|
||||
*/
|
||||
|
||||
OHIF.cornerstone = Cornerstone;
|
||||
|
||||
/**
|
||||
* Export relevant objects
|
||||
*/
|
||||
|
||||
export { Meteor, OHIF };
|
||||
@ -17,7 +17,6 @@ Package.onUse(function(api) {
|
||||
api.versionsFrom('1.5');
|
||||
|
||||
api.use('ecmascript');
|
||||
api.use('ohif:core');
|
||||
|
||||
api.addAssets('public/js/cornerstoneWADOImageLoaderCodecs.es5.js', 'client');
|
||||
api.addAssets('public/js/cornerstoneWADOImageLoaderWebWorker.es5.js', 'client');
|
||||
|
||||
@ -20,9 +20,10 @@ Package.onUse(function(api) {
|
||||
|
||||
// Our custom packages
|
||||
api.use('ohif:design');
|
||||
api.use('ohif:core');
|
||||
api.use('ohif:studies');
|
||||
api.use('ohif:cornerstone');
|
||||
api.use('ohif:core');
|
||||
api.use('ohif:cornerstone-settings');
|
||||
api.use('ohif:studies');
|
||||
api.use('ohif:measurements');
|
||||
|
||||
api.addFiles('both/index.js', [ 'client', 'server' ]);
|
||||
|
||||
@ -434,7 +434,9 @@ export const toolManager = {
|
||||
newCornerstoneToolMiddle.activate(element, 2); // 2 means middle mouse button
|
||||
newCornerstoneToolRight.activate(element, 5); // 5 means left mouse button and right mouse button
|
||||
} else {
|
||||
newCornerstoneToolLeft.mouse.activate(element, 1); // 1 means left mouse button
|
||||
setTimeout(() => newCornerstoneToolLeft.mouse.activate(element, 1));
|
||||
// >>>> TODO Find out why it's working only with a timeout
|
||||
// newCornerstoneToolLeft.mouse.activate(element, 1); // 1 means left mouse button
|
||||
newCornerstoneToolMiddle.activate(element, 2); // 2 means middle mouse button
|
||||
newCornerstoneToolRight.activate(element, 4); // 4 means right mouse button
|
||||
}
|
||||
|
||||
@ -20,7 +20,9 @@ Package.onUse(function(api) {
|
||||
// OHIF dependencies
|
||||
api.use([
|
||||
'ohif:design',
|
||||
'ohif:cornerstone',
|
||||
'ohif:core',
|
||||
'ohif:cornerstone-settings',
|
||||
'ohif:hotkeys',
|
||||
'ohif:log'
|
||||
]);
|
||||
|
||||
@ -23,6 +23,7 @@ ohif:core
|
||||
ohif:header
|
||||
ohif:design
|
||||
ohif:cornerstone
|
||||
ohif:cornerstone-settings
|
||||
ohif:viewerbase
|
||||
ohif:metadata
|
||||
ohif:study-list
|
||||
|
||||
Loading…
Reference in New Issue
Block a user