OHIF访问本地orthanc,及Access-Control-Allow-Origin错误解决
技术选型:
在OHIF框架使用命令npm start
后,会默认执行default.js
文件(对应路径Viewers/platform/viewer/public/config/
),这个,而如果改用命令npm run dev:orthanc
,会默认执行docker_nginx-orthanc.js
文件,建议使用orthanc的配置文件,这样便于对比和调试。
根据orthanc的配置文件对servers进行配置,参考https://blog.csdn.net/qq_38853948/article/details/118188797
比如我的:
servers: {
dicomWeb: [
{
name: 'Orthanc',
wadoUriRoot: 'https://localhost:8042/wado',
qidoRoot: 'https://localhost:8042/dicom-web/',
wadoRoot: 'https://localhost:8042/dicom-web/',
qidoSupportsIncludeField: false,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: true,
},
],
},
重启OHIF服务后会发现界面并不能加载,并且后台报错了,错误如下:
是一个很典型的跨域资源共享错误,解决方案参考https://blog.csdn.net/qq_38853948/article/details/118189068
相应的servers配置也应该修改一下:
servers: {
dicomWeb: [
{
name: 'Orthanc',
wadoUriRoot: 'http://localhost:8800/wado',
qidoRoot: 'http://localhost:8800/dicom',
wadoRoot: 'http://localhost:8800/dicom-web',
qidoSupportsIncludeField: false,
imageRendering: 'wadouri',
thumbnailRendering: 'wadors',
requestionOptions: {
auth: "orthanc:orthanc",
},
enableStudyLazyLoad: true,
supportsFuzzyMatching: true,
},
],
},
重启并运行后就可以看到本地orthanc上的数据了: