Uncaught ReferenceError: dicomParser is not defined hr.onreadystatechange @ cornerstoneWADOImageLoader.js:4156
I'm doing my application with backbone, node.js and require.js.
CornerstoneWADOImageLoader
fails because it doesn't find dicomParser
, but I have defined it.
To use cornerstoneWADOImageLoader
needs jQuery, cornerstone and dicomParser.
Is anything wrong?
Also Uncaught cornerstone.enable(element);
returns this error
TypeError: element.appendChild is not a function
Code:
//boot.js
require.config({
paths: {
jquery: '/js/lib/jquery',
jqueryui: '/js/lib/jquery-ui',
'jquery.ui.widget' : '/js/lib/jquery.ui.widget',
underscore: '/js/lib/underscore',
backbone: '/js/lib/backbone',
text: '/js/lib/text',
bootstrap: '/js/lib/bootstrap.min',
require: '/js/lib/require',
marionette: '/js/lib/backbone.marionette.min',
'cornerstone': '/js/lib/cornerstone/dist/cornerstone',
'dicomParser': '/js/lib/dicomParser/dist/dicomParser',
'jpx': '/js/lib/jpx.min',
'cornerstoneWADOImageLoader':'/js/lib/cornerstoneWADOImageLoader/dist/cornerstoneWADOImageLoader'
},
shim: {
'bootstrap': ['jquery'],
'cornerstone':['jquery','dicomParser'],
'cornerstoneWADOImageLoader':['jquery','cornerstone','dicomParser','jpx']
}
},
});
require(['jquery',
'underscore',
'app',
'bootstrap'
], function ($, _, app) {
app.start();
});
///dicomView
define([
'jquery',
'underscore',
'backbone',
'text!templates/dicomViewTemplate.html',
'cornerstone',
'dicomParser',
'jpx',
'cornerstoneWADOImageLoader',
], function ($, _, Backbone, dicomViewTemplate) {
return Backbone.View.extend({
render: function () {
this.$el.append(dicomViewTemplate);
var imageId = 'wadouri:dicom/55fc82d462eea6702a4c0a65'
var element = $('#dicomImage');
cornerstone.enable(element);
cornerstone.loadImage(imageId).then(function(image) {
cornerstone.displayImage(element, image);
});
return this;
}
});
});
The issue may be related to dicomParser supporting AMD but cornerstone does not (yet depends on it). See if you can import dicomParser w/o using AMD modules (maybe via shim config)? If that doesn't work, try removing the AMD bits from dicomParser.