Pass dicomStore from Google Cloud Healthcare in a queryparams in the viewer

Hello, I have the requirement to pass the dicomStore in some way in the viewer’s URL and dynamically form the datasource, for example something like this:

http://localhost:3000/viewer?StudyInstanceUIDs=1.3.12.2.1107.5.4.3.11540117440512.19970422.140030.45&dicomStore=name

I’ve been looking in the documentation and the closest thing I found was this configuration, but I
still don’t achieve my goal

{
  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',
    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,
      };
    },
  },
},

I found the solution

{
      namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
      sourceName: 'dicomweb',
      configuration: {
        friendlyName: 'dcmjs DICOMWeb Server',
        name: 'GCP',
        qidoSupportsIncludeField: true,
        imageRendering: 'wadors',
        thumbnailRendering: 'wadors',
        enableStudyLazyLoad: true,
        supportsFuzzyMatching: true,
        supportsWildcard: false,
        dicomUploadEnabled: true,
        omitQuotationForMultipartRequest: true,
        configurationAPI: 'ohif.dataSourceConfigurationAPI.google',
        onConfiguration: (dicomWebConfig, options) => {
          const { query } = options;
          const params = new URLSearchParams(query);
          const dicomValue = params.get('dicom');
          const pathUrl = `https://healthcare.googleapis.com/v1/projects/sirexe/locations/us-central1/datasets/dataset/dicomStores/${dicomValue}/dicomWeb`;
          return {
            ...dicomWebConfig,
            wadoRoot: pathUrl,
            qidoRoot: pathUrl,
            wadoUri: pathUrl,
            wadoUriRoot: pathUrl,
          };
        },
      }
1 Like

Thanks - found the same solution and it works without:
const params = new URLSearchParams(query);

just change
const dicomValue = params.get(‘dicom’);
to
const dicomValue = query.get(‘dicom’);

Thanks for posting it