Move files around to confuse James and Erik
This commit is contained in:
parent
b5070dd518
commit
715377c565
@ -6,7 +6,7 @@ import {
|
||||
processResults,
|
||||
processSeriesResults,
|
||||
} from './qido.js';
|
||||
import { dicomMetadataStore, IWebApiDataSource, utils } from '@ohif/core';
|
||||
import { DicomMetadataStore, IWebApiDataSource, utils } from '@ohif/core';
|
||||
|
||||
import getImageId from './utils/getImageId';
|
||||
import * as dcmjs from 'dcmjs';
|
||||
@ -89,7 +89,7 @@ function createDicomWebApi(dicomWebConfig) {
|
||||
series: {
|
||||
// TODO: change queryParams to `StudyInstanceUID` for now?
|
||||
// Conduct query, return a promise like others
|
||||
// Await this call and add to dicomMetadataStore after receiving result
|
||||
// Await this call and add to DicomMetadataStore after receiving result
|
||||
metadata: (queryParams, callback) => {
|
||||
let { StudyInstanceUIDs } = urlUtil.parse(queryParams, true);
|
||||
|
||||
@ -104,7 +104,7 @@ function createDicomWebApi(dicomWebConfig) {
|
||||
const storeInstances = instances => {
|
||||
const naturalizedInstances = instances.map(naturalizeDataset);
|
||||
|
||||
dicomMetadataStore.addInstances(naturalizedInstances);
|
||||
DicomMetadataStore.addInstances(naturalizedInstances);
|
||||
callback(naturalizedInstances);
|
||||
};
|
||||
|
||||
@ -146,7 +146,7 @@ function createDicomWebApi(dicomWebConfig) {
|
||||
function storeInstances(instances) {
|
||||
const naturalizedInstances = instances.map(naturalizeDataset);
|
||||
|
||||
dicomMetadataStore.addInstances(naturalizedInstances);
|
||||
DicomMetadataStore.addInstances(naturalizedInstances);
|
||||
}
|
||||
|
||||
seriesPromises.forEach(async seriesPromise => {
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
import RetrieveMetadataLoader from './retrieveMetadataLoader';
|
||||
//import { sortStudySeries, sortingCriteria } from '../../sortStudy';
|
||||
import getSeriesInfo from './utils/getSeriesInfo';
|
||||
// import {
|
||||
// createStudyFromSOPInstanceList,
|
||||
// addInstancesToStudy,
|
||||
// } from './studyInstanceHelpers';
|
||||
|
||||
/**
|
||||
* Map seriesList to an array of seriesInstanceUid
|
||||
@ -15,19 +11,6 @@ function mapStudySeries(seriesList) {
|
||||
return seriesList.map(series => getSeriesInfo(series).seriesInstanceUid);
|
||||
}
|
||||
|
||||
// function attachSeriesLoader(server, study, seriesLoader) {
|
||||
// study.seriesLoader = Object.freeze({
|
||||
// hasNext() {
|
||||
// return seriesLoader.hasNext();
|
||||
// },
|
||||
// async next() {
|
||||
// const series = await seriesLoader.next();
|
||||
// await addInstancesToStudy(server, study, series.sopInstances);
|
||||
// return study.seriesMap[series.seriesInstanceUID];
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* Creates an immutable series loader object which loads each series sequentially using the iterator interface
|
||||
* @param {DICOMWebClient} dicomWebClient The DICOMWebClient instance to be used for series load
|
||||
|
||||
@ -2,7 +2,7 @@ import React, { useState, useEffect, useCallback } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
//
|
||||
import { StudyBrowser, useImageViewer } from '@ohif/ui';
|
||||
import { dicomMetadataStore } from '@ohif/core';
|
||||
import { DicomMetadataStore } from '@ohif/core';
|
||||
// This has to import from somewhere else...
|
||||
|
||||
function PanelStudyBrowser({
|
||||
@ -46,8 +46,10 @@ function PanelStudyBrowser({
|
||||
}
|
||||
|
||||
StudyInstanceUIDs.forEach(sid => fetchStudiesForPatient(sid));
|
||||
}, [StudyInstanceUIDs, getStudiesForPatientByStudyInstanceUID]);
|
||||
|
||||
}, [
|
||||
StudyInstanceUIDs,
|
||||
getStudiesForPatientByStudyInstanceUID,
|
||||
]);
|
||||
|
||||
const updateThumbnailMap = (displaySetInstanceUID, imageSrc) => {
|
||||
setThumbnailImageSrcMap(
|
||||
|
||||
@ -2,7 +2,7 @@ async function getStudiesForPatientByStudyInstanceUID(
|
||||
dataSource,
|
||||
StudyInstanceUID
|
||||
) {
|
||||
// TODO: The `dicomMetadataStore` should short-circuit both of these requests
|
||||
// TODO: The `DicomMetadataStore` should short-circuit both of these requests
|
||||
// Data _could_ be here from route query, or if using JSON data source
|
||||
// We could also force this to "await" these values being available in the DICOMStore?
|
||||
// Kind of like promise fulfillment in cornerstone-wado-image-loader when there are multiple
|
||||
@ -18,6 +18,6 @@ async function getStudiesForPatientByStudyInstanceUID(
|
||||
patientId: getStudyResult[0].mrn,
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default getStudiesForPatientByStudyInstanceUID;
|
||||
|
||||
@ -77,7 +77,6 @@ function ViewerLayout({
|
||||
label: tool.label,
|
||||
type: 'setToolActive',
|
||||
onClick: () => {
|
||||
debugger;
|
||||
commandsManager.runCommand(tool.commandName, commandOptions);
|
||||
},
|
||||
});
|
||||
@ -104,8 +103,6 @@ function ViewerLayout({
|
||||
// }
|
||||
});
|
||||
|
||||
debugger;
|
||||
|
||||
setToolBarLayout(toolBarLayout);
|
||||
};
|
||||
|
||||
@ -134,7 +131,7 @@ function ViewerLayout({
|
||||
moreTools={toolBarLayout[0].moreTools}
|
||||
/>
|
||||
<div
|
||||
className="flex flex-row flex-no-wrap items-stretch overflow-hidden w-full"
|
||||
className="flex flex-row flex-no-wrap items-stretch w-full overflow-hidden"
|
||||
style={{ height: 'calc(100vh - 57px' }}
|
||||
>
|
||||
{/* LEFT SIDEPANELS */}
|
||||
@ -145,10 +142,10 @@ function ViewerLayout({
|
||||
/>
|
||||
{/* TOOLBAR + GRID */}
|
||||
<div className="flex flex-col flex-1 h-full">
|
||||
<div className="flex flex-2 w-100 border-b border-transparent h-12">
|
||||
<div className="flex h-12 border-b border-transparent flex-2 w-100">
|
||||
<Toolbar type="secondary" tools={toolBarLayout[1].tools} />
|
||||
</div>
|
||||
<div className="flex flex-1 h-full overflow-hidden bg-black items-center justify-center pb-2 pt-1">
|
||||
<div className="flex items-center justify-center flex-1 h-full pt-1 pb-2 overflow-hidden bg-black">
|
||||
<ViewportGridComp
|
||||
servicesManager={servicesManager}
|
||||
viewportComponents={viewportComponents}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
import { dicomMetadataStore } from '@ohif/core';
|
||||
import { DicomMetadataStore } from '@ohif/core';
|
||||
// TODO: Use above to inject so dependent datasources don't need to import or
|
||||
// depend on @ohif/core?
|
||||
|
||||
/**
|
||||
* Factory function that creates a new "Web API" data source.
|
||||
@ -10,7 +12,12 @@ import { dicomMetadataStore } from '@ohif/core';
|
||||
* It's worth noting that a single implementation of this interface
|
||||
* can define different underlying sources for "read" and "write" operations.
|
||||
*/
|
||||
function create({ query, retrieve, getImageIdsForDisplaySet }) {
|
||||
function create({
|
||||
query,
|
||||
retrieve,
|
||||
retrieveSeriesMetadata,
|
||||
getImageIdsForDisplaySet,
|
||||
}) {
|
||||
const defaultQuery = {
|
||||
studies: {
|
||||
/**
|
||||
@ -41,6 +48,7 @@ function create({ query, retrieve, getImageIdsForDisplaySet }) {
|
||||
query: query || defaultQuery,
|
||||
retrieve: retrieve || defaultRetrieve,
|
||||
getImageIdsForDisplaySet,
|
||||
retrieveSeriesMetadata,
|
||||
// then go get all series level metadata.
|
||||
// Store this in the DICOM MetadataStore.
|
||||
};
|
||||
|
||||
@ -4,7 +4,7 @@ import dicomParser from 'dicom-parser';
|
||||
import getPixelSpacingInformation from '../utils/metadataProvider/getPixelSpacingInformation';
|
||||
import fetchPaletteColorLookupTableData from '../utils/metadataProvider/fetchPaletteColorLookupTableData';
|
||||
import fetchOverlayData from '../utils/metadataProvider/fetchOverlayData';
|
||||
import dicomMetadataStore from '../dicomMetadataStore';
|
||||
import DicomMetadataStore from '../services/DicomMetadataStore';
|
||||
|
||||
class MetadataProvider {
|
||||
constructor() {
|
||||
@ -123,7 +123,7 @@ class MetadataProvider {
|
||||
|
||||
const { StudyInstanceUID, SeriesInstanceUID, SOPInstanceUID } = uids;
|
||||
|
||||
return dicomMetadataStore.getInstance(
|
||||
return DicomMetadataStore.getInstance(
|
||||
StudyInstanceUID,
|
||||
SeriesInstanceUID,
|
||||
SOPInstanceUID
|
||||
|
||||
@ -19,18 +19,19 @@ import string from './string.js';
|
||||
import studies from './studies/';
|
||||
import ui from './ui';
|
||||
import user from './user.js';
|
||||
import dicomMetadataStore from './dicomMetadataStore';
|
||||
import { ViewModelProvider, useViewModel } from './ViewModelContext';
|
||||
import utils, { hotkeys } from './utils/';
|
||||
|
||||
import {
|
||||
MeasurementService,
|
||||
UIDialogService,
|
||||
UIModalService,
|
||||
UINotificationService,
|
||||
UIViewportDialogService,
|
||||
//
|
||||
DicomMetadataStore,
|
||||
DisplaySetService,
|
||||
ToolBarSerivce,
|
||||
MeasurementService,
|
||||
} from './services';
|
||||
|
||||
import IWebApiDataSource from './DataSources/IWebApiDataSource';
|
||||
@ -71,7 +72,7 @@ const OHIF = {
|
||||
MeasurementService,
|
||||
ToolBarSerivce,
|
||||
IWebApiDataSource,
|
||||
dicomMetadataStore,
|
||||
DicomMetadataStore,
|
||||
//
|
||||
ViewModelProvider,
|
||||
useViewModel,
|
||||
@ -112,7 +113,7 @@ export {
|
||||
MeasurementService,
|
||||
ToolBarSerivce,
|
||||
IWebApiDataSource,
|
||||
dicomMetadataStore,
|
||||
DicomMetadataStore,
|
||||
ViewModelProvider,
|
||||
useViewModel,
|
||||
};
|
||||
|
||||
@ -1,26 +1,6 @@
|
||||
import {
|
||||
createStudyFromSOPInstanceList,
|
||||
addInstancesToStudy,
|
||||
} from './studies/services/wado/studyInstanceHelpers';
|
||||
|
||||
class StudyMetadata {
|
||||
constructor(StudyInstanceUID) {
|
||||
this.StudyInstanceUID = StudyInstanceUID;
|
||||
this.series = [];
|
||||
}
|
||||
|
||||
addSeries(instances) {
|
||||
this.series.push(new SeriesMetadata(instances));
|
||||
}
|
||||
}
|
||||
|
||||
class SeriesMetadata {
|
||||
constructor(instances) {
|
||||
const { SeriesInstanceUID } = instances[0];
|
||||
this.SeriesInstanceUID = SeriesInstanceUID;
|
||||
this.instances = instances;
|
||||
}
|
||||
}
|
||||
import pubSubServiceInterface from '../_shared/pubSubServiceInterface';
|
||||
import StudyMetadata from './StudyMetadata';
|
||||
import EVENTS from './EVENTS';
|
||||
|
||||
const _model = {
|
||||
studies: [],
|
||||
@ -74,7 +54,9 @@ function _getInstance(StudyInstanceUID, SeriesInstanceUID, SOPInstanceUID) {
|
||||
);
|
||||
}
|
||||
|
||||
const dicomMetadataStore = {
|
||||
const BaseImplementation = {
|
||||
EVENTS,
|
||||
listeners: {},
|
||||
addInstances(instances) {
|
||||
const { StudyInstanceUID } = instances[0];
|
||||
|
||||
@ -116,10 +98,14 @@ const dicomMetadataStore = {
|
||||
getInstance: _getInstance,
|
||||
};
|
||||
|
||||
//
|
||||
const DicomMetadataStore = Object.assign(
|
||||
{},
|
||||
BaseImplementation,
|
||||
pubSubServiceInterface
|
||||
);
|
||||
|
||||
// TODO => Add instances
|
||||
//_addInstance(input) // arraybuffer, or other stuff
|
||||
|
||||
export { dicomMetadataStore };
|
||||
export default dicomMetadataStore;
|
||||
export { DicomMetadataStore };
|
||||
export default DicomMetadataStore;
|
||||
6
platform/core/src/services/DicomMetadataStore/EVENTS.js
Normal file
6
platform/core/src/services/DicomMetadataStore/EVENTS.js
Normal file
@ -0,0 +1,6 @@
|
||||
const EVENTS = {
|
||||
DISPLAY_SETS_ADDED: 'event::displaySetService:displaySetsAdded',
|
||||
DISPLAY_SETS_CHANGED: 'event::displaySetService:displaySetsChanged',
|
||||
};
|
||||
|
||||
export default EVENTS;
|
||||
@ -0,0 +1,9 @@
|
||||
class SeriesMetadata {
|
||||
constructor(instances) {
|
||||
const { SeriesInstanceUID } = instances[0];
|
||||
this.SeriesInstanceUID = SeriesInstanceUID;
|
||||
this.instances = instances;
|
||||
}
|
||||
}
|
||||
|
||||
export default SeriesMetadata;
|
||||
@ -0,0 +1,14 @@
|
||||
import SeriesMetadata from './SeriesMetadata';
|
||||
|
||||
class StudyMetadata {
|
||||
constructor(StudyInstanceUID) {
|
||||
this.StudyInstanceUID = StudyInstanceUID;
|
||||
this.series = [];
|
||||
}
|
||||
|
||||
addSeries(instances) {
|
||||
this.series.push(new SeriesMetadata(instances));
|
||||
}
|
||||
}
|
||||
|
||||
export default StudyMetadata;
|
||||
4
platform/core/src/services/DicomMetadataStore/index.js
Normal file
4
platform/core/src/services/DicomMetadataStore/index.js
Normal file
@ -0,0 +1,4 @@
|
||||
import DicomMetadataStore from './DicomMetadataStore';
|
||||
|
||||
export { DicomMetadataStore };
|
||||
export default DicomMetadataStore;
|
||||
@ -1,17 +1,13 @@
|
||||
import pubSubServiceInterface from '../pubSubServiceInterface';
|
||||
|
||||
const EVENTS = {
|
||||
DISPLAY_SETS_ADDED: 'event::displaySetService:displaySetsAdded',
|
||||
DISPLAY_SETS_CHANGED: 'event::displaySetService:displaySetsChanged',
|
||||
};
|
||||
import pubSubServiceInterface from '../_shared/pubSubServiceInterface';
|
||||
import EVENTS from './EVENTS';
|
||||
|
||||
const displaySetCache = [];
|
||||
|
||||
export default class DisplaySetService {
|
||||
constructor() {
|
||||
this.displaySets = {};
|
||||
this.EVENTS = EVENTS;
|
||||
this.listeners = {};
|
||||
this.EVENTS = EVENTS;
|
||||
|
||||
Object.assign(this, pubSubServiceInterface);
|
||||
}
|
||||
@ -50,27 +46,11 @@ export default class DisplaySetService {
|
||||
* @param {string} displaySetInstanceUID
|
||||
* @returns {object} displaySet
|
||||
*/
|
||||
getDisplaySetByUID = displaySetInstanceUid => displaySetCache.find(
|
||||
getDisplaySetByUID = displaySetInstanceUid =>
|
||||
displaySetCache.find(
|
||||
displaySet => displaySet.displaySetInstanceUID === displaySetInstanceUid
|
||||
);
|
||||
|
||||
/**
|
||||
* Broadcasts displaySetService changes.
|
||||
*
|
||||
* @param {string} eventName The event name
|
||||
* @return void
|
||||
*/
|
||||
_broadcastChange = (eventName, callbackProps) => {
|
||||
const hasListeners = Object.keys(this.listeners).length > 0;
|
||||
const hasCallbacks = Array.isArray(this.listeners[eventName]);
|
||||
|
||||
if (hasListeners && hasCallbacks) {
|
||||
this.listeners[eventName].forEach(listener => {
|
||||
listener.callback(callbackProps);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
makeDisplaySets = (input, batch = false) => {
|
||||
if (!input || !input.length) {
|
||||
throw new Error('No instances were provided.');
|
||||
@ -98,12 +78,9 @@ export default class DisplaySetService {
|
||||
}
|
||||
|
||||
if (displaySetsAdded && displaySetsAdded.length) {
|
||||
this._broadcastChange(EVENTS.DISPLAY_SETS_ADDED, displaySetsAdded);
|
||||
this._broadcastEvent(EVENTS.DISPLAY_SETS_ADDED, displaySetsAdded);
|
||||
|
||||
this._broadcastChange(
|
||||
EVENTS.DISPLAY_SETS_CHANGED,
|
||||
this.activeDisplaySets
|
||||
);
|
||||
this._broadcastEvent(EVENTS.DISPLAY_SETS_CHANGED, this.activeDisplaySets);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
6
platform/core/src/services/DisplaySetService/EVENTS.js
Normal file
6
platform/core/src/services/DisplaySetService/EVENTS.js
Normal file
@ -0,0 +1,6 @@
|
||||
const EVENTS = {
|
||||
DISPLAY_SETS_ADDED: 'event::displaySetService:displaySetsAdded',
|
||||
DISPLAY_SETS_CHANGED: 'event::displaySetService:displaySetsChanged',
|
||||
};
|
||||
|
||||
export default EVENTS;
|
||||
@ -1,6 +1,6 @@
|
||||
import log from '../../log';
|
||||
import guid from '../../utils/guid';
|
||||
import pubSubServiceInterface from '../pubSubServiceInterface';
|
||||
import pubSubServiceInterface from '../_shared/pubSubServiceInterface';
|
||||
|
||||
/**
|
||||
* Measurement source schema
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import pubSubServiceInterface from '../pubSubServiceInterface';
|
||||
import pubSubServiceInterface from '../_shared/pubSubServiceInterface';
|
||||
|
||||
const EVENTS = {
|
||||
TOOL_BAR_MODIFIED: 'event::toolBarService:toolBarModified',
|
||||
|
||||
3
platform/core/src/services/_shared/index.js
Normal file
3
platform/core/src/services/_shared/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
import pubSubServiceInterface from './pubSubServiceInterface';
|
||||
|
||||
export { pubSubServiceInterface };
|
||||
@ -1,7 +1,13 @@
|
||||
import guid from '../../utils/guid';
|
||||
|
||||
/**
|
||||
* Consumer must implement:
|
||||
* this.listeners = {}
|
||||
* this.EVENTS = { "EVENT_KEY": "EVENT_VALUE" }
|
||||
*/
|
||||
export default {
|
||||
subscribe,
|
||||
_broadcastEvent,
|
||||
_unsubscribe,
|
||||
_isValidEvent,
|
||||
};
|
||||
@ -62,3 +68,21 @@ function _unsubscribe(eventName, listenerId) {
|
||||
function _isValidEvent(eventName) {
|
||||
return Object.values(this.EVENTS).includes(eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts displaySetService changes.
|
||||
*
|
||||
* @param {string} eventName - The event name
|
||||
* @param {func} callbackProps - Properties to pass callback
|
||||
* @return void
|
||||
*/
|
||||
function _broadcastEvent(eventName, callbackProps) {
|
||||
const hasListeners = Object.keys(this.listeners).length > 0;
|
||||
const hasCallbacks = Array.isArray(this.listeners[eventName]);
|
||||
|
||||
if (hasListeners && hasCallbacks) {
|
||||
this.listeners[eventName].forEach(listener => {
|
||||
listener.callback(callbackProps);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ import UIDialogService from './UIDialogService';
|
||||
import UIModalService from './UIModalService';
|
||||
import UINotificationService from './UINotificationService';
|
||||
import UIViewportDialogService from './UIViewportDialogService';
|
||||
import DicomMetadataStore from './DicomMetadataStore';
|
||||
import DisplaySetService from './DisplaySetService';
|
||||
import ToolBarSerivce from './ToolBarService';
|
||||
|
||||
@ -14,6 +15,7 @@ export {
|
||||
UIModalService,
|
||||
UINotificationService,
|
||||
UIViewportDialogService,
|
||||
DicomMetadataStore,
|
||||
DisplaySetService,
|
||||
ToolBarSerivce,
|
||||
};
|
||||
|
||||
@ -38,6 +38,7 @@ function DataSourceWrapper(props) {
|
||||
const firstAppConfigDataSource = appConfig.dataSources[0];
|
||||
const dataSourceConfig = firstAppConfigDataSource.configuration;
|
||||
const firstWebApiDataSource = webApiDataSources[0];
|
||||
debugger;
|
||||
const dataSource = firstWebApiDataSource.createDataSource(dataSourceConfig);
|
||||
|
||||
// Route props --> studies.mapParams
|
||||
@ -48,7 +49,6 @@ function DataSourceWrapper(props) {
|
||||
// Or no data fetching here, and just hand down my source
|
||||
const [data, setData] = useState();
|
||||
useEffect(() => {
|
||||
|
||||
// 204: no content
|
||||
async function getData() {
|
||||
const searchResults = await dataSource.query.studies.search(
|
||||
@ -61,7 +61,6 @@ function DataSourceWrapper(props) {
|
||||
getData();
|
||||
} catch (ex) {
|
||||
console.warn(ex);
|
||||
|
||||
}
|
||||
console.log('DataSourceWrapper: useEffect');
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
|
||||
Loading…
Reference in New Issue
Block a user