feat(DataSource): Allow for dynamic data source configuration and creation (#3543)
This commit is contained in:
1 parent
6d88978710
commit
7bbc213f58
36 files changed
+640
-298
No files matched your search
@@ -33,10 +33,10 @@ window.config = {
|
||||
showStudyList: true,
|
||||
dataSources: [
|
||||
{
|
||||
friendlyName: 'dcmjs DICOMWeb Server',
|
||||
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
|
||||
sourceName: 'dicomweb',
|
||||
configuration: {
|
||||
friendlyName: 'dcmjs DICOMWeb Server',
|
||||
name: 'DCM4CHEE',
|
||||
wadoUriRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado',
|
||||
qidoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs',
|
||||
@@ -83,10 +83,10 @@ window.config = ({ servicesManager } = {}) => {
|
||||
routerBasename: '/',
|
||||
dataSources: [
|
||||
{
|
||||
friendlyName: 'dcmjs DICOMWeb Server',
|
||||
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
|
||||
sourceName: 'dicomweb',
|
||||
configuration: {
|
||||
friendlyName: 'dcmjs DICOMWeb Server',
|
||||
name: 'DCM4CHEE',
|
||||
wadoUriRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado',
|
||||
qidoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs',
|
||||
@@ -138,7 +138,38 @@ Example 2, to restricts to either hosptial.com or othersite.com.<br/>
|
||||
`regex: /(https:\/\/hospital.com(\/[0-9A-Za-z.]+)*)|(https:\/\/othersite.com(\/[0-9A-Za-z.]+)*)/` <br/>
|
||||
Example usage:<br/>
|
||||
`http://localhost:3000/?configUrl=http://localhost:3000/config/example.json`<br/>
|
||||
|
||||
- `onConfiguration`: Currently only available for DicomWebDataSource, this option allows the interception of the data source configuration for dynamic values e.g. values coming from url params or query params. Here is an example of building the dicomweb datasource configuration object with values that are based on the route url params:
|
||||
```
|
||||
{
|
||||
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
|
||||
sourceName: 'gcpdicomweb',
|
||||
configuration: {
|
||||
friendlyName: 'GCP DICOMWeb Server',
|
||||
name: 'gcpdicomweb',
|
||||
qidoSupportsIncludeField: false,
|
||||
imageRendering: 'wadors',
|
||||
thumbnailRendering: 'wadors',
|
||||
enableStudyLazyLoad: true,
|
||||
supportsFuzzyMatching: false,
|
||||
supportsWildcard: false,
|
||||
singlepart: 'bulkdata,video,pdf',
|
||||
useBulkDataURI: false,
|
||||
onConfiguration: (dicomWebConfig, options) => {
|
||||
const { params } = options;
|
||||
const { project, location, dataset, dicomStore } = params;
|
||||
const pathUrl = `https://healthcare.googleapis.com/v1/projects/${project}/locations/${location}/datasets/${dataset}/dicomStores/${dicomStore}/dicomWeb`;
|
||||
return {
|
||||
...dicomWebConfig,
|
||||
wadoRoot: pathUrl,
|
||||
qidoRoot: pathUrl,
|
||||
wadoUri: pathUrl,
|
||||
wadoUriRoot: pathUrl,
|
||||
};
|
||||
},
|
||||
},
|
||||
},
|
||||
```
|
||||
This configuration would allow the user to build a dicomweb configuration from a GCP healthcare api path e.g. http://localhost:3000/projects/your-gcp-project/locations/us-central1/datasets/your-dataset/dicomStores/your-dicom-store/study/1.3.6.1.4.1.1234.5.2.1.1234.1234.123123123123123123123123123123
|
||||
|
||||
|
||||
<!-- **Embedded Use Note:**
|
||||
|
||||
@@ -131,10 +131,10 @@ window.config = {
|
||||
showStudyList: true,
|
||||
dataSources: [
|
||||
{
|
||||
friendlyName: 'dcmjs DICOMWeb Server',
|
||||
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
|
||||
sourceName: 'dicomweb',
|
||||
configuration: {
|
||||
friendlyName: 'dcmjs DICOMWeb Server',
|
||||
name: 'DCM4CHEE',
|
||||
wadoUriRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado',
|
||||
qidoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs',
|
||||
|
||||
@@ -100,3 +100,66 @@ In `OHIF-v3` we have a central location for the metadata of studies, and they ar
|
||||
located in `DicomMetadataStore`. Your custom datasource can communicate with
|
||||
`DicomMetadataStore` to store, and fetch Study/Series/Instance metadata. We will
|
||||
learn more about `DicomMetadataStore` in services.
|
||||
|
||||
## Adding a Data Source Outside a Module
|
||||
|
||||
A data source can be added outside a module via `ExtensionManager.addDataSource`.
|
||||
The following snippet of code demonstrates how `addDataSource` can be used to add
|
||||
a new DICOMWeb data source for the Google Cloud Healthcare API and set it as the
|
||||
active data source.
|
||||
|
||||
```js
|
||||
extensionManager.addDataSource({
|
||||
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
|
||||
sourceName: 'google',
|
||||
configuration: {
|
||||
friendlyName: 'dcmjs DICOMWeb Server',
|
||||
name: 'GCP',
|
||||
wadoUriRoot:
|
||||
'https://healthcare.googleapis.com/v1/projects/ohif-cloud-healthcare/locations/us-east4/datasets/ohif-qa-dataset/dicomStores/ohif-qa-2/dicomWeb',
|
||||
qidoRoot:
|
||||
'https://healthcare.googleapis.com/v1/projects/ohif-cloud-healthcare/locations/us-east4/datasets/ohif-qa-dataset/dicomStores/ohif-qa-2/dicomWeb',
|
||||
wadoRoot:
|
||||
'https://healthcare.googleapis.com/v1/projects/ohif-cloud-healthcare/locations/us-east4/datasets/ohif-qa-dataset/dicomStores/ohif-qa-2/dicomWeb',
|
||||
qidoSupportsIncludeField: true,
|
||||
imageRendering: 'wadors',
|
||||
thumbnailRendering: 'wadors',
|
||||
enableStudyLazyLoad: true,
|
||||
supportsFuzzyMatching: true,
|
||||
supportsWildcard: false,
|
||||
dicomUploadEnabled: true,
|
||||
omitQuotationForMultipartRequest: true,
|
||||
},
|
||||
{activate:true}
|
||||
});
|
||||
```
|
||||
|
||||
## Updating a Data Source's Configuration
|
||||
|
||||
An existing data source can have its configuration updated using the
|
||||
`ExtensionManager.updateDataSourceConfiguration` method. The following snippet of
|
||||
code demonstrates how `updateDataSourceConfiguration` can be use to update the
|
||||
configuration of an existing DICOMWeb data source (named `dicomweb`) with the
|
||||
configuration for a Google Cloud Healthcare API data source.
|
||||
|
||||
```js
|
||||
extensionManager.updateDataSourceConfiguration( "dicomweb",
|
||||
{
|
||||
name: 'GCP',
|
||||
wadoUriRoot:
|
||||
'https://healthcare.googleapis.com/v1/projects/ohif-cloud-healthcare/locations/us-east4/datasets/ohif-qa-dataset/dicomStores/ohif-qa-2/dicomWeb',
|
||||
qidoRoot:
|
||||
'https://healthcare.googleapis.com/v1/projects/ohif-cloud-healthcare/locations/us-east4/datasets/ohif-qa-dataset/dicomStores/ohif-qa-2/dicomWeb',
|
||||
wadoRoot:
|
||||
'https://healthcare.googleapis.com/v1/projects/ohif-cloud-healthcare/locations/us-east4/datasets/ohif-qa-dataset/dicomStores/ohif-qa-2/dicomWeb',
|
||||
qidoSupportsIncludeField: true,
|
||||
imageRendering: 'wadors',
|
||||
thumbnailRendering: 'wadors',
|
||||
enableStudyLazyLoad: true,
|
||||
supportsFuzzyMatching: true,
|
||||
supportsWildcard: false,
|
||||
dicomUploadEnabled: true,
|
||||
omitQuotationForMultipartRequest: true,
|
||||
},
|
||||
);
|
||||
```
|
||||
@@ -21,13 +21,23 @@ const extensionManager = new ExtensionManager({
|
||||
appConfig,
|
||||
});
|
||||
```
|
||||
## Events
|
||||
The following events get published by the `ExtensionManager`:
|
||||
|
||||
The `ExtensionManager` only has a few public members:
|
||||
| Event | Description |
|
||||
| ---------------------------- | ------------------------------------------------------ |
|
||||
| ACTIVE_DATA_SOURCE_CHANGED | Fired when the active data source is changed - either replaced with an entirely different one or the existing active data source gets its definition changed via `updateDataSourceConfiguration`. |
|
||||
|
||||
## API
|
||||
The `ExtensionManager` only has the following public API:
|
||||
|
||||
- `setActiveDataSource` - Sets the active data source for the application
|
||||
- `getDataSources` - Returns the registered data sources
|
||||
- `getActiveDataSource` - Returns the currently active data source
|
||||
- `getModuleEntry` - Returns the module entry by the give id.
|
||||
- `addDataSource` - Dynamically adds a data source and optionally sets it as the active data source
|
||||
- `updateDataSourceConfiguration` - Updates the configuration of a specified data source (name).
|
||||
- `getDataSourceDef` - Gets the data source definition for a particular data source name.
|
||||
|
||||
## Accessing Modules
|
||||
|
||||
|
||||
Reference in new issue
Block a user