@ohif/extension-default 3.14.0-beta.10 → 3.14.0-beta.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ohif-extension-default.css +1 -1
- package/dist/ohif-extension-default.umd.js +1 -1
- package/package.json +14 -10
- package/src/Actions/createReportAsync.tsx +45 -0
- package/src/Components/DataSourceConfigurationComponent.tsx +142 -0
- package/src/Components/DataSourceConfigurationModalComponent.tsx +200 -0
- package/src/Components/ItemListComponent.tsx +95 -0
- package/src/Components/LineChartViewport/LineChartViewport.tsx +31 -0
- package/src/Components/LineChartViewport/index.ts +1 -0
- package/src/Components/MoreDropdownMenu.tsx +112 -0
- package/src/Components/ProgressDropdownWithService.tsx +101 -0
- package/src/Components/SidePanelWithServices.tsx +122 -0
- package/src/CustomizableContextMenu/ContextMenuController.tsx +216 -0
- package/src/CustomizableContextMenu/ContextMenuItemsBuilder.test.js +29 -0
- package/src/CustomizableContextMenu/ContextMenuItemsBuilder.ts +176 -0
- package/src/CustomizableContextMenu/index.ts +5 -0
- package/src/CustomizableContextMenu/types.ts +126 -0
- package/src/DataSourceConfigurationAPI/GoogleCloudDataSourceConfigurationAPI.ts +236 -0
- package/src/DicomJSONDataSource/index.js +326 -0
- package/src/DicomLocalDataSource/index.js +273 -0
- package/src/DicomTagBrowser/DicomTagBrowser.css +49 -0
- package/src/DicomTagBrowser/DicomTagBrowser.tsx +454 -0
- package/src/DicomTagBrowser/DicomTagTable.tsx +311 -0
- package/src/DicomWebDataSource/dcm4cheeReject.js +45 -0
- package/src/DicomWebDataSource/exampleInstances.js +280 -0
- package/src/DicomWebDataSource/index.ts +808 -0
- package/src/DicomWebDataSource/qido.js +215 -0
- package/src/DicomWebDataSource/retrieveBulkData.test.ts +35 -0
- package/src/DicomWebDataSource/retrieveBulkData.ts +31 -0
- package/src/DicomWebDataSource/retrieveRendered.test.ts +147 -0
- package/src/DicomWebDataSource/retrieveRendered.ts +141 -0
- package/src/DicomWebDataSource/retrieveStudyMetadata.js +108 -0
- package/src/DicomWebDataSource/retrieveStudyMetadata.test.js +75 -0
- package/src/DicomWebDataSource/retrieveThumbnail.ts +346 -0
- package/src/DicomWebDataSource/serviceUrls.test.ts +143 -0
- package/src/DicomWebDataSource/utils/StaticWadoClient.ts +272 -0
- package/src/DicomWebDataSource/utils/cleanDenaturalizedDataset.ts +78 -0
- package/src/DicomWebDataSource/utils/findIndexOfString.ts +47 -0
- package/src/DicomWebDataSource/utils/fixBulkDataURI.test.ts +68 -0
- package/src/DicomWebDataSource/utils/fixBulkDataURI.ts +78 -0
- package/src/DicomWebDataSource/utils/fixMultiValueKeys.ts +12 -0
- package/src/DicomWebDataSource/utils/fixMultipart.ts +70 -0
- package/src/DicomWebDataSource/utils/getImageId.js +54 -0
- package/src/DicomWebDataSource/utils/getWADORSImageId.js +51 -0
- package/src/DicomWebDataSource/utils/index.ts +9 -0
- package/src/DicomWebDataSource/utils/retrieveMetadataFiltered.js +61 -0
- package/src/DicomWebDataSource/wado/retrieveMetadata.js +41 -0
- package/src/DicomWebDataSource/wado/retrieveMetadataLoader.js +64 -0
- package/src/DicomWebDataSource/wado/retrieveMetadataLoaderAsync.js +159 -0
- package/src/DicomWebDataSource/wado/retrieveMetadataLoaderSync.js +58 -0
- package/src/DicomWebProxyDataSource/index.ts +90 -0
- package/src/MergeDataSource/index.test.ts +212 -0
- package/src/MergeDataSource/index.ts +319 -0
- package/src/MergeDataSource/types.ts +46 -0
- package/src/Panels/DataSourceSelector.tsx +55 -0
- package/src/Panels/StudyBrowser/PanelStudyBrowser.tsx +612 -0
- package/src/Panels/StudyBrowser/PanelStudyBrowserHeader.tsx +88 -0
- package/src/Panels/StudyBrowser/constants/actionIcons.ts +12 -0
- package/src/Panels/StudyBrowser/constants/index.ts +4 -0
- package/src/Panels/StudyBrowser/constants/viewPresets.ts +16 -0
- package/src/Panels/StudyBrowser/resolveThumbnailDetails.test.ts +197 -0
- package/src/Panels/StudyBrowser/resolveThumbnailDetails.ts +132 -0
- package/src/Panels/StudyBrowser/types/actionIcon.ts +9 -0
- package/src/Panels/StudyBrowser/types/index.ts +4 -0
- package/src/Panels/StudyBrowser/types/viewPreset.ts +7 -0
- package/src/Panels/WrappedPanelStudyBrowser.tsx +61 -0
- package/src/Panels/createReportDialogPrompt.tsx +128 -0
- package/src/Panels/debounce.js +25 -0
- package/src/Panels/getImageSrcFromImageId.js +16 -0
- package/src/Panels/getStudiesForPatientByMRN.js +19 -0
- package/src/Panels/index.js +5 -0
- package/src/Panels/requestDisplaySetCreationForStudy.js +19 -0
- package/src/SOPClassHandlers/chartSOPClassHandler.test.ts +81 -0
- package/src/SOPClassHandlers/chartSOPClassHandler.ts +127 -0
- package/src/Toolbar/ToolBoxWrapper.tsx +64 -0
- package/src/Toolbar/ToolButtonListWrapper.tsx +77 -0
- package/src/Toolbar/ToolButtonWrapper.tsx +32 -0
- package/src/Toolbar/ToolRowWrapper.tsx +41 -0
- package/src/Toolbar/Toolbar.tsx +98 -0
- package/src/Toolbar/ToolbarDivider.tsx +5 -0
- package/src/Toolbar/ToolbarLayoutSelector.tsx +195 -0
- package/src/Toolbar/index.ts +7 -0
- package/src/ViewerLayout/HeaderPatientInfo/HeaderPatientInfo.tsx +96 -0
- package/src/ViewerLayout/HeaderPatientInfo/index.js +3 -0
- package/src/ViewerLayout/HeaderUndoRedo.tsx +47 -0
- package/src/ViewerLayout/ResizablePanelsHook.tsx +334 -0
- package/src/ViewerLayout/ViewerHeader.tsx +124 -0
- package/src/ViewerLayout/constants/panels.ts +42 -0
- package/src/ViewerLayout/index.tsx +227 -0
- package/src/ViewerLayout/useUndoRedoState.ts +75 -0
- package/src/__tests__/commandsModuleToggleOneUp.test.ts +147 -0
- package/src/commandsModule.ts +970 -0
- package/src/customizations/aboutModalCustomization.tsx +42 -0
- package/src/customizations/appearanceModalCustomization.tsx +143 -0
- package/src/customizations/contextMenuCustomization.ts +25 -0
- package/src/customizations/contextMenuUICustomization.ts +5 -0
- package/src/customizations/customRoutesCustomization.ts +6 -0
- package/src/customizations/dataSourceConfigurationCustomization.ts +19 -0
- package/src/customizations/datasourcesCustomization.tsx +14 -0
- package/src/customizations/defaultContextMenuCustomization.ts +22 -0
- package/src/customizations/hangingProtocolsCustomization.ts +15 -0
- package/src/customizations/headerRightSideCustomization.ts +19 -0
- package/src/customizations/helloPageCustomization.tsx +14 -0
- package/src/customizations/hideHeaderUndoRedoCustomization.ts +22 -0
- package/src/customizations/hotkeyBindingsCustomization.ts +5 -0
- package/src/customizations/instanceSortingCriteriaCustomization.ts +6 -0
- package/src/customizations/labellingFlowCustomization.tsx +5 -0
- package/src/customizations/loadingIndicatorProgressCustomization.tsx +5 -0
- package/src/customizations/loadingIndicatorTotalPercentCustomization.tsx +5 -0
- package/src/customizations/menuContentCustomization.tsx +67 -0
- package/src/customizations/metadataContextCustomization.test.ts +22 -0
- package/src/customizations/metadataContextCustomization.ts +28 -0
- package/src/customizations/metadataDisplaySetCustomization.ts +55 -0
- package/src/customizations/missingReferenceDisplaySetHandler.ts +5 -0
- package/src/customizations/multimonitorCustomization.ts +63 -0
- package/src/customizations/notificationCustomization.ts +29 -0
- package/src/customizations/onDropHandlerCustomization.ts +5 -0
- package/src/customizations/onboardingCustomization.ts +200 -0
- package/src/customizations/overlayItemCustomization.tsx +33 -0
- package/src/customizations/progressDropdownCustomization.ts +5 -0
- package/src/customizations/progressLoadingBarCustomization.tsx +5 -0
- package/src/customizations/reportDialogCustomization.test.ts +701 -0
- package/src/customizations/reportDialogCustomization.tsx +661 -0
- package/src/customizations/sortingCriteriaCustomization.ts +14 -0
- package/src/customizations/studyBrowserCustomization.test.ts +69 -0
- package/src/customizations/studyBrowserCustomization.ts +95 -0
- package/src/customizations/thumbnailDetailsCustomization.ts +91 -0
- package/src/customizations/userPreferencesCustomization.tsx +342 -0
- package/src/customizations/workListCustomization.ts +107 -0
- package/src/displaySetSplitting/makeDisplaySetFromInstanceGroup.test.ts +181 -0
- package/src/displaySetSplitting/makeDisplaySetFromInstanceGroup.ts +240 -0
- package/src/displaySetSplitting/makeImageSetDisplaySet.ts +276 -0
- package/src/displaySetSplitting/stackSopClassUids.ts +60 -0
- package/src/displaySetSplitting/urlSplitModules.test.ts +333 -0
- package/src/findViewportsByPosition.ts +102 -0
- package/src/getCustomizationModule.tsx +109 -0
- package/src/getDataSourcesModule.js +44 -0
- package/src/getDisplaySetMessages.ts +54 -0
- package/src/getDisplaySetsFromUnsupportedSeries.js +63 -0
- package/src/getDisplaySetsFromUnsupportedSeries.test.js +14 -0
- package/src/getHangingProtocolModule.js +155 -0
- package/src/getLayoutTemplateModule.js +28 -0
- package/src/getPTImageIdInstanceMetadata.test.ts +102 -0
- package/src/getPTImageIdInstanceMetadata.ts +124 -0
- package/src/getPanelModule.tsx +29 -0
- package/src/getSopClassHandlerModule.js +152 -0
- package/src/getSopClassHandlerModule.test.js +78 -0
- package/src/getToolbarModule.tsx +63 -0
- package/src/getViewportModule.tsx +12 -0
- package/src/hangingprotocols/hpCompare.ts +189 -0
- package/src/hangingprotocols/hpEcgCustomization.test.ts +104 -0
- package/src/hangingprotocols/hpMNGrid.test.ts +120 -0
- package/src/hangingprotocols/hpMNGrid.ts +419 -0
- package/src/hangingprotocols/hpMammo.ts +202 -0
- package/src/hangingprotocols/hpScale.ts +132 -0
- package/src/hangingprotocols/index.ts +16 -0
- package/src/hangingprotocols/protocolMatchChanges.test.ts +73 -0
- package/src/hangingprotocols/utils/isNewestOfModality.ts +19 -0
- package/src/hangingprotocols/utils/laterality.ts +9 -0
- package/src/hangingprotocols/utils/mammoDisplaySetSelector.ts +214 -0
- package/src/hangingprotocols/utils/registerHangingProtocolAttributes.ts +14 -0
- package/src/hangingprotocols/utils/seriesSelectors.ts +62 -0
- package/src/hangingprotocols/utils/studySelectors.ts +14 -0
- package/src/hangingprotocols/utils/viewCode.test.js +25 -0
- package/src/hangingprotocols/utils/viewCode.ts +17 -0
- package/src/hangingprotocols/utils/viewportOptions.ts +18 -0
- package/src/hooks/usePatientInfo.tsx +63 -0
- package/src/id.js +5 -0
- package/src/index.ts +113 -0
- package/src/init.ts +169 -0
- package/src/stores/index.ts +7 -0
- package/src/stores/useDisplaySetSelectorStore.ts +83 -0
- package/src/stores/useHangingProtocolStageIndexStore.ts +76 -0
- package/src/stores/useToggleHangingProtocolStore.ts +76 -0
- package/src/stores/useToggleOneUpViewportGridStore.ts +19 -0
- package/src/stores/useUIStateStore.ts +87 -0
- package/src/stores/useViewportGridStore.ts +89 -0
- package/src/stores/useViewportsByPositionStore.ts +100 -0
- package/src/types/AppTypes.ts +20 -0
- package/src/types/commandModuleTypes.tsx +6 -0
- package/src/utils/Toolbox.tsx +123 -0
- package/src/utils/_shared/PROMPT_RESPONSES.ts +10 -0
- package/src/utils/addIcon.ts +6 -0
- package/src/utils/appendFrameQueryToImageId.js +9 -0
- package/src/utils/callInputDialog.tsx +126 -0
- package/src/utils/colorPickerDialog.css +4 -0
- package/src/utils/colorPickerDialog.tsx +45 -0
- package/src/utils/createRenderedRetrieve.js +32 -0
- package/src/utils/createRenderedRetrieve.test.js +46 -0
- package/src/utils/dicomWriter.test.ts +228 -0
- package/src/utils/dicomWriter.ts +110 -0
- package/src/utils/getBulkdataValue.js +45 -0
- package/src/utils/getBulkdataValue.test.js +105 -0
- package/src/utils/getDirectURL.test.ts +207 -0
- package/src/utils/getDirectURL.ts +65 -0
- package/src/utils/getSRSeriesAndInstanceNumber.js +48 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/layerConfigurationUtils.ts +202 -0
- package/src/utils/promptLabelAnnotation.js +47 -0
- package/src/utils/promptSaveReport.test.ts +106 -0
- package/src/utils/promptSaveReport.tsx +117 -0
- package/src/utils/registerNaturalizedDatasetForLocalWadouri.js +146 -0
- package/src/utils/registerNaturalizedDatasetForLocalWadouri.test.js +177 -0
- package/src/utils/registerStoredInstanceImageId.test.ts +73 -0
- package/src/utils/registerStoredInstanceImageId.ts +66 -0
- package/src/utils/reuseCachedLayouts.ts +92 -0
- package/src/utils/secureConfigFetch.js +115 -0
- package/src/utils/secureConfigFetch.test.js +163 -0
- package/src/utils/seriesDescriptionHistory.ts +83 -0
- package/src/utils/validations/areAllImageComponentsEqual.ts +24 -0
- package/src/utils/validations/areAllImageDimensionsEqual.test.ts +41 -0
- package/src/utils/validations/areAllImageDimensionsEqual.ts +27 -0
- package/src/utils/validations/areAllImagePositionsEqual.ts +75 -0
- package/src/utils/validations/areAllImageSpacingEqual.ts +66 -0
- package/src/utils/validations/checkMultiframe.ts +25 -0
- package/src/utils/validations/checkSingleFrames.ts +36 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Types } from '@ohif/core';
|
|
2
|
+
|
|
3
|
+
type MatchingRule = Types.HangingProtocol.MatchingRule;
|
|
4
|
+
|
|
5
|
+
// This display set will select the specified items by preference
|
|
6
|
+
// It has no effect if nothing is specified in the URL.
|
|
7
|
+
const displaySetFromUrl: MatchingRule = {
|
|
8
|
+
attribute: 'isDisplaySetFromUrl',
|
|
9
|
+
weight: 20,
|
|
10
|
+
constraint: {
|
|
11
|
+
equals: true,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// A segmentation that the viewer creates has numImageFrames.
|
|
16
|
+
const notSegmentation: MatchingRule = {
|
|
17
|
+
attribute: 'Modality',
|
|
18
|
+
constraint: {
|
|
19
|
+
doesNotInclude: ['SEG'],
|
|
20
|
+
},
|
|
21
|
+
required: true,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** Display sets with at least one image frame. */
|
|
25
|
+
export const seriesWithImages: MatchingRule[] = [
|
|
26
|
+
{
|
|
27
|
+
attribute: 'numImageFrames',
|
|
28
|
+
constraint: {
|
|
29
|
+
greaterThanOrEqual: { value: 1 },
|
|
30
|
+
},
|
|
31
|
+
weight: 1,
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
notSegmentation,
|
|
35
|
+
displaySetFromUrl,
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Display sets that a viewport can show: the image display sets, and the
|
|
40
|
+
* display sets whose SOP class handler sets numImageFrames to 0, for example
|
|
41
|
+
* an ECG, a whole slide image or a PDF. An SR, PR or SEG from the server has
|
|
42
|
+
* no numImageFrames, so it does not match. Image display sets sort first.
|
|
43
|
+
*/
|
|
44
|
+
export const seriesViewable: MatchingRule[] = [
|
|
45
|
+
{
|
|
46
|
+
attribute: 'numImageFrames',
|
|
47
|
+
constraint: {
|
|
48
|
+
greaterThanOrEqual: { value: 0 },
|
|
49
|
+
},
|
|
50
|
+
weight: 1,
|
|
51
|
+
required: true,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
attribute: 'numImageFrames',
|
|
55
|
+
constraint: {
|
|
56
|
+
greaterThanOrEqual: { value: 1 },
|
|
57
|
+
},
|
|
58
|
+
weight: 10,
|
|
59
|
+
},
|
|
60
|
+
notSegmentation,
|
|
61
|
+
displaySetFromUrl,
|
|
62
|
+
];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Types } from '@ohif/core';
|
|
2
|
+
|
|
3
|
+
type MatchingRule = Types.HangingProtocol.MatchingRule;
|
|
4
|
+
|
|
5
|
+
export const studyWithImages: MatchingRule[] = [
|
|
6
|
+
{
|
|
7
|
+
id: 'OneOrMoreSeries',
|
|
8
|
+
weight: 25,
|
|
9
|
+
attribute: 'numberOfDisplaySetsWithImages',
|
|
10
|
+
constraint: {
|
|
11
|
+
greaterThan: 0,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import viewCode from './viewCode';
|
|
2
|
+
|
|
3
|
+
describe('viewCode', () => {
|
|
4
|
+
it.each([undefined, {}, { instance: {} }, { instance: { ViewCodeSequence: [] } }])(
|
|
5
|
+
'returns undefined when a display set has no view-code metadata: %p',
|
|
6
|
+
displaySet => {
|
|
7
|
+
expect(viewCode(displaySet)).toBeUndefined();
|
|
8
|
+
}
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
it('returns the coding scheme and value from the display set instance', () => {
|
|
12
|
+
expect(
|
|
13
|
+
viewCode({
|
|
14
|
+
instance: {
|
|
15
|
+
ViewCodeSequence: [
|
|
16
|
+
{
|
|
17
|
+
CodingSchemeDesignator: 'SRT',
|
|
18
|
+
CodeValue: 'R-10242',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
).toBe('SRT:R-10242');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Types } from '@ohif/core';
|
|
2
|
+
|
|
3
|
+
type CodeSequenceItem = { CodingSchemeDesignator?: string; CodeValue?: string };
|
|
4
|
+
|
|
5
|
+
export default (displaySet: Types.DisplaySet) => {
|
|
6
|
+
const ViewCodeSequence = (
|
|
7
|
+
displaySet?.instance?.ViewCodeSequence as CodeSequenceItem[] | undefined
|
|
8
|
+
)?.[0];
|
|
9
|
+
if (!ViewCodeSequence) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
const { CodingSchemeDesignator, CodeValue } = ViewCodeSequence;
|
|
13
|
+
if (!CodingSchemeDesignator || !CodeValue) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
return `${CodingSchemeDesignator}:${CodeValue}`;
|
|
17
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** A default viewport options */
|
|
2
|
+
export const viewportOptions = {
|
|
3
|
+
toolGroupId: 'default',
|
|
4
|
+
allowUnmatchedView: true,
|
|
5
|
+
syncGroups: [
|
|
6
|
+
{
|
|
7
|
+
type: 'hydrateseg',
|
|
8
|
+
id: 'sameFORId',
|
|
9
|
+
source: true,
|
|
10
|
+
target: true,
|
|
11
|
+
options: {
|
|
12
|
+
matchingRules: ['sameFOR'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const hydrateSegDefault = viewportOptions;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { utils, useSystem } from '@ohif/core';
|
|
3
|
+
|
|
4
|
+
const { formatPN, formatDate } = utils;
|
|
5
|
+
|
|
6
|
+
function usePatientInfo() {
|
|
7
|
+
const { servicesManager } = useSystem();
|
|
8
|
+
const { displaySetService } = servicesManager.services;
|
|
9
|
+
|
|
10
|
+
const [patientInfo, setPatientInfo] = useState({
|
|
11
|
+
PatientName: '',
|
|
12
|
+
PatientID: '',
|
|
13
|
+
PatientSex: '',
|
|
14
|
+
PatientDOB: '',
|
|
15
|
+
});
|
|
16
|
+
const [isMixedPatients, setIsMixedPatients] = useState(false);
|
|
17
|
+
|
|
18
|
+
const checkMixedPatients = (PatientID: string) => {
|
|
19
|
+
const displaySets = displaySetService.getActiveDisplaySets();
|
|
20
|
+
let isMixedPatients = false;
|
|
21
|
+
displaySets.forEach(displaySet => {
|
|
22
|
+
const instance = displaySet?.instances?.[0] || displaySet?.instance;
|
|
23
|
+
if (!instance) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (instance.PatientID !== PatientID) {
|
|
27
|
+
isMixedPatients = true;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
setIsMixedPatients(isMixedPatients);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const updatePatientInfo = ({ displaySetsAdded }) => {
|
|
34
|
+
if (!displaySetsAdded.length) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const displaySet = displaySetsAdded[0];
|
|
38
|
+
const instance = displaySet?.instances?.[0] || displaySet?.instance;
|
|
39
|
+
if (!instance) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
setPatientInfo({
|
|
44
|
+
PatientID: instance.PatientID || null,
|
|
45
|
+
PatientName: instance.PatientName ? formatPN(instance.PatientName) : null,
|
|
46
|
+
PatientSex: instance.PatientSex || null,
|
|
47
|
+
PatientDOB: formatDate(instance.PatientBirthDate) || null,
|
|
48
|
+
});
|
|
49
|
+
checkMixedPatients(instance.PatientID || null);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const subscription = displaySetService.subscribe(
|
|
54
|
+
displaySetService.EVENTS.DISPLAY_SETS_ADDED,
|
|
55
|
+
props => updatePatientInfo(props)
|
|
56
|
+
);
|
|
57
|
+
return () => subscription.unsubscribe();
|
|
58
|
+
}, []);
|
|
59
|
+
|
|
60
|
+
return { patientInfo, isMixedPatients };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default usePatientInfo;
|
package/src/id.js
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Types } from '@ohif/core';
|
|
2
|
+
|
|
3
|
+
import getDataSourcesModule from './getDataSourcesModule';
|
|
4
|
+
import getLayoutTemplateModule from './getLayoutTemplateModule';
|
|
5
|
+
import getPanelModule from './getPanelModule';
|
|
6
|
+
import getSopClassHandlerModule from './getSopClassHandlerModule';
|
|
7
|
+
import getToolbarModule from './getToolbarModule';
|
|
8
|
+
import getCommandsModule from './commandsModule';
|
|
9
|
+
import getHangingProtocolModule from './getHangingProtocolModule';
|
|
10
|
+
import getStudiesForPatientByMRN from './Panels/getStudiesForPatientByMRN';
|
|
11
|
+
import getCustomizationModule from './getCustomizationModule';
|
|
12
|
+
import getViewportModule from './getViewportModule';
|
|
13
|
+
import { id } from './id';
|
|
14
|
+
import preRegistration from './init';
|
|
15
|
+
import { createReportDialogPrompt } from './Panels';
|
|
16
|
+
|
|
17
|
+
import { ContextMenuController, CustomizableContextMenuTypes } from './CustomizableContextMenu';
|
|
18
|
+
import * as dicomWebUtils from './DicomWebDataSource/utils';
|
|
19
|
+
import createReportAsync from './Actions/createReportAsync';
|
|
20
|
+
import StaticWadoClient from './DicomWebDataSource/utils/StaticWadoClient';
|
|
21
|
+
import { cleanDenaturalizedDataset } from './DicomWebDataSource/utils';
|
|
22
|
+
import { useViewportsByPositionStore } from './stores/useViewportsByPositionStore';
|
|
23
|
+
import { useViewportGridStore } from './stores/useViewportGridStore';
|
|
24
|
+
import { useUIStateStore } from './stores/useUIStateStore';
|
|
25
|
+
import { useDisplaySetSelectorStore } from './stores/useDisplaySetSelectorStore';
|
|
26
|
+
import { useHangingProtocolStageIndexStore } from './stores/useHangingProtocolStageIndexStore';
|
|
27
|
+
import { useToggleHangingProtocolStore } from './stores/useToggleHangingProtocolStore';
|
|
28
|
+
import { useToggleOneUpViewportGridStore } from './stores/useToggleOneUpViewportGridStore';
|
|
29
|
+
import { callInputDialogAutoComplete, callInputDialog } from './utils/callInputDialog';
|
|
30
|
+
import { releaseLocalWadouriRegistrations } from './utils/registerNaturalizedDatasetForLocalWadouri';
|
|
31
|
+
import colorPickerDialog from './utils/colorPickerDialog';
|
|
32
|
+
|
|
33
|
+
import promptSaveReport from './utils/promptSaveReport';
|
|
34
|
+
import promptLabelAnnotation from './utils/promptLabelAnnotation';
|
|
35
|
+
import usePatientInfo from './hooks/usePatientInfo';
|
|
36
|
+
import { PanelStudyBrowserHeader } from './Panels/StudyBrowser/PanelStudyBrowserHeader';
|
|
37
|
+
import * as utils from './utils';
|
|
38
|
+
import { Toolbox } from './utils';
|
|
39
|
+
import MoreDropdownMenu from './Components/MoreDropdownMenu';
|
|
40
|
+
import requestDisplaySetCreationForStudy from './Panels/requestDisplaySetCreationForStudy';
|
|
41
|
+
import { Toolbar } from './Toolbar/Toolbar';
|
|
42
|
+
|
|
43
|
+
const defaultExtension: Types.Extensions.Extension = {
|
|
44
|
+
/**
|
|
45
|
+
* Only required property. Should be a unique value across all extensions.
|
|
46
|
+
*/
|
|
47
|
+
id,
|
|
48
|
+
preRegistration,
|
|
49
|
+
onModeExit() {
|
|
50
|
+
useViewportGridStore.getState().clearViewportGridState();
|
|
51
|
+
useUIStateStore.getState().clearUIState();
|
|
52
|
+
useDisplaySetSelectorStore.getState().clearDisplaySetSelectorMap();
|
|
53
|
+
useHangingProtocolStageIndexStore.getState().clearHangingProtocolStageIndexMap();
|
|
54
|
+
useToggleHangingProtocolStore.getState().clearToggleHangingProtocol();
|
|
55
|
+
useViewportsByPositionStore.getState().clearViewportsByPosition();
|
|
56
|
+
// Free the Part 10 Blobs (and any parsed copies) retained for locally
|
|
57
|
+
// generated instances (SEG etc.) registered with the wadouri loader.
|
|
58
|
+
releaseLocalWadouriRegistrations();
|
|
59
|
+
},
|
|
60
|
+
getDataSourcesModule,
|
|
61
|
+
getViewportModule,
|
|
62
|
+
getLayoutTemplateModule,
|
|
63
|
+
getPanelModule,
|
|
64
|
+
getHangingProtocolModule,
|
|
65
|
+
getSopClassHandlerModule,
|
|
66
|
+
getToolbarModule,
|
|
67
|
+
getCommandsModule,
|
|
68
|
+
getUtilityModule({ servicesManager }) {
|
|
69
|
+
return [
|
|
70
|
+
{
|
|
71
|
+
name: 'common',
|
|
72
|
+
exports: {
|
|
73
|
+
getStudiesForPatientByMRN,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
getCustomizationModule,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default defaultExtension;
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
ContextMenuController,
|
|
86
|
+
CustomizableContextMenuTypes,
|
|
87
|
+
getStudiesForPatientByMRN,
|
|
88
|
+
dicomWebUtils,
|
|
89
|
+
createReportAsync,
|
|
90
|
+
StaticWadoClient,
|
|
91
|
+
cleanDenaturalizedDataset,
|
|
92
|
+
// Export all stores
|
|
93
|
+
useDisplaySetSelectorStore,
|
|
94
|
+
useHangingProtocolStageIndexStore,
|
|
95
|
+
useToggleHangingProtocolStore,
|
|
96
|
+
useToggleOneUpViewportGridStore,
|
|
97
|
+
useUIStateStore,
|
|
98
|
+
useViewportGridStore,
|
|
99
|
+
useViewportsByPositionStore,
|
|
100
|
+
callInputDialogAutoComplete,
|
|
101
|
+
promptSaveReport,
|
|
102
|
+
promptLabelAnnotation,
|
|
103
|
+
colorPickerDialog,
|
|
104
|
+
usePatientInfo,
|
|
105
|
+
PanelStudyBrowserHeader,
|
|
106
|
+
utils,
|
|
107
|
+
Toolbox,
|
|
108
|
+
MoreDropdownMenu,
|
|
109
|
+
requestDisplaySetCreationForStudy,
|
|
110
|
+
callInputDialog,
|
|
111
|
+
createReportDialogPrompt,
|
|
112
|
+
Toolbar,
|
|
113
|
+
};
|
package/src/init.ts
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { DicomMetadataStore, classes } from '@ohif/core';
|
|
2
|
+
import { calculateSUVScalingFactors } from '@cornerstonejs/calculate-suv';
|
|
3
|
+
import { ActiveThemeProvider } from '@ohif/ui-next';
|
|
4
|
+
|
|
5
|
+
import getPTImageIdInstanceMetadata from './getPTImageIdInstanceMetadata';
|
|
6
|
+
import { registerHangingProtocolAttributes } from './hangingprotocols';
|
|
7
|
+
import { HotkeysManager } from '@ohif/core';
|
|
8
|
+
|
|
9
|
+
const metadataProvider = classes.MetadataProvider;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param {Object} servicesManager
|
|
14
|
+
* @param {Object} configuration
|
|
15
|
+
*/
|
|
16
|
+
export default function init({
|
|
17
|
+
servicesManager,
|
|
18
|
+
commandsManager,
|
|
19
|
+
hotkeysManager,
|
|
20
|
+
serviceProvidersManager,
|
|
21
|
+
appConfig,
|
|
22
|
+
}: withAppTypes): void {
|
|
23
|
+
const hasThemeModule =
|
|
24
|
+
Array.isArray(appConfig.customizationService) &&
|
|
25
|
+
appConfig.customizationService.some(
|
|
26
|
+
ref => typeof ref === 'string' && ref.includes('customizationModule.theme')
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
if (hasThemeModule) {
|
|
30
|
+
serviceProvidersManager.registerProvider('activeTheme', ActiveThemeProvider);
|
|
31
|
+
}
|
|
32
|
+
const { toolbarService, cineService, viewportGridService } = servicesManager.services;
|
|
33
|
+
|
|
34
|
+
toolbarService.registerEventForToolbarUpdate(cineService, [
|
|
35
|
+
cineService.EVENTS.CINE_STATE_CHANGED,
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
toolbarService.registerEventForToolbarUpdate(hotkeysManager, [
|
|
39
|
+
HotkeysManager.EVENTS.HOTKEY_PRESSED,
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
// Add
|
|
43
|
+
DicomMetadataStore.subscribe(DicomMetadataStore.EVENTS.INSTANCES_ADDED, handleScalingModules);
|
|
44
|
+
|
|
45
|
+
// If the metadata for PET has changed by the user (e.g. manually changing the PatientWeight)
|
|
46
|
+
// we need to recalculate the SUV Scaling Factors
|
|
47
|
+
DicomMetadataStore.subscribe(DicomMetadataStore.EVENTS.SERIES_UPDATED, handleScalingModules);
|
|
48
|
+
|
|
49
|
+
// Adds extra custom attributes for use by hanging protocols
|
|
50
|
+
registerHangingProtocolAttributes({ servicesManager });
|
|
51
|
+
|
|
52
|
+
// Function to process and subscribe to events for a given set of commands and listeners
|
|
53
|
+
const eventSubscriptions = [];
|
|
54
|
+
const subscribeToEvents = listeners => {
|
|
55
|
+
Object.entries(listeners).forEach(([event, commands]) => {
|
|
56
|
+
const supportedEvents = [
|
|
57
|
+
viewportGridService.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED,
|
|
58
|
+
viewportGridService.EVENTS.VIEWPORTS_READY,
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
if (supportedEvents.includes(event)) {
|
|
62
|
+
const subscriptionKey = `${event}_${JSON.stringify(commands)}`;
|
|
63
|
+
|
|
64
|
+
if (eventSubscriptions.includes(subscriptionKey)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
viewportGridService.subscribe(event, eventData => {
|
|
69
|
+
const viewportId = eventData?.viewportId ?? viewportGridService.getActiveViewportId();
|
|
70
|
+
|
|
71
|
+
commandsManager.run(commands, { viewportId });
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
eventSubscriptions.push(subscriptionKey);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
toolbarService.subscribe(toolbarService.EVENTS.TOOL_BAR_MODIFIED, state => {
|
|
80
|
+
const { buttons } = state;
|
|
81
|
+
for (const [id, button] of Object.entries(buttons)) {
|
|
82
|
+
const { buttonSection, items, listeners } = button.props || {};
|
|
83
|
+
|
|
84
|
+
// Handle group items' listeners
|
|
85
|
+
if (buttonSection && items) {
|
|
86
|
+
items.forEach(item => {
|
|
87
|
+
if (item.listeners) {
|
|
88
|
+
subscribeToEvents(item.listeners);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Handle button listeners
|
|
94
|
+
if (listeners) {
|
|
95
|
+
subscribeToEvents(listeners);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const handleScalingModules = ({ SeriesInstanceUID, StudyInstanceUID }) => {
|
|
102
|
+
const { instances } = DicomMetadataStore.getSeries(StudyInstanceUID, SeriesInstanceUID);
|
|
103
|
+
|
|
104
|
+
if (!instances?.length) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const modality = instances[0].Modality;
|
|
109
|
+
|
|
110
|
+
const allowedModality = ['PT', 'RTDOSE'];
|
|
111
|
+
|
|
112
|
+
if (!allowedModality.includes(modality)) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const imageIds = instances.map(instance => instance.imageId);
|
|
117
|
+
const instanceMetadataArray = [];
|
|
118
|
+
|
|
119
|
+
if (modality === 'RTDOSE') {
|
|
120
|
+
const DoseGridScaling = instances[0].DoseGridScaling;
|
|
121
|
+
const DoseSummation = instances[0].DoseSummation;
|
|
122
|
+
const DoseType = instances[0].DoseType;
|
|
123
|
+
const DoseUnit = instances[0].DoseUnit;
|
|
124
|
+
const NumberOfFrames = instances[0].NumberOfFrames;
|
|
125
|
+
const imageId = imageIds[0];
|
|
126
|
+
|
|
127
|
+
// add scaling module to the metadata
|
|
128
|
+
// since RTDOSE is always a multiframe we should add the scaling module to each frame
|
|
129
|
+
for (let i = 0; i < NumberOfFrames; i++) {
|
|
130
|
+
const frameIndex = i + 1;
|
|
131
|
+
|
|
132
|
+
// Todo: we should support other things like wadouri, local etc
|
|
133
|
+
const newImageId = `${imageId.replace(/\/frames\/\d+$/, '')}/frames/${frameIndex}`;
|
|
134
|
+
metadataProvider.addCustomMetadata(newImageId, 'scalingModule', {
|
|
135
|
+
DoseGridScaling,
|
|
136
|
+
DoseSummation,
|
|
137
|
+
DoseType,
|
|
138
|
+
DoseUnit,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// try except block to prevent errors when the metadata is not correct
|
|
146
|
+
try {
|
|
147
|
+
imageIds.forEach(imageId => {
|
|
148
|
+
const instanceMetadata = getPTImageIdInstanceMetadata(imageId);
|
|
149
|
+
if (instanceMetadata) {
|
|
150
|
+
instanceMetadataArray.push(instanceMetadata);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
if (!instanceMetadataArray.length) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const suvScalingFactors = calculateSUVScalingFactors(instanceMetadataArray);
|
|
159
|
+
instanceMetadataArray.forEach((instanceMetadata, index) => {
|
|
160
|
+
metadataProvider.addCustomMetadata(
|
|
161
|
+
imageIds[index],
|
|
162
|
+
'scalingModule',
|
|
163
|
+
suvScalingFactors[index]
|
|
164
|
+
);
|
|
165
|
+
});
|
|
166
|
+
} catch (error) {
|
|
167
|
+
console.log(error);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { useDisplaySetSelectorStore } from './useDisplaySetSelectorStore';
|
|
2
|
+
export { useHangingProtocolStageIndexStore } from './useHangingProtocolStageIndexStore';
|
|
3
|
+
export { useToggleHangingProtocolStore } from './useToggleHangingProtocolStore';
|
|
4
|
+
export { useToggleOneUpViewportGridStore } from './useToggleOneUpViewportGridStore';
|
|
5
|
+
export { useUIStateStore } from './useUIStateStore';
|
|
6
|
+
export { useViewportGridStore } from './useViewportGridStore';
|
|
7
|
+
export { useViewportsByPositionStore } from './useViewportsByPositionStore';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { devtools } from 'zustand/middleware';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Identifier for the display set selector store type.
|
|
6
|
+
*/
|
|
7
|
+
const PRESENTATION_TYPE_ID = 'displaySetSelectorId';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Flag to enable or disable debug mode for the store.
|
|
11
|
+
* Set to `true` to enable zustand devtools.
|
|
12
|
+
*/
|
|
13
|
+
const DEBUG_STORE = false;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* State shape for the Display Set Selector store.
|
|
17
|
+
*/
|
|
18
|
+
type DisplaySetSelectorState = {
|
|
19
|
+
/**
|
|
20
|
+
* Type identifier for the store.
|
|
21
|
+
*/
|
|
22
|
+
type: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Stores a mapping from `<activeStudyUID>:<displaySetSelectorId>:<matchOffset>` to `displaySetInstanceUID`.
|
|
26
|
+
*/
|
|
27
|
+
displaySetSelectorMap: Record<string, Array<string>>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Sets the display set selector for a given key.
|
|
31
|
+
*
|
|
32
|
+
* @param key - The key.
|
|
33
|
+
* @param value - The `displaySetInstanceUID` to associate with the key.
|
|
34
|
+
*/
|
|
35
|
+
setDisplaySetSelector: (key: string, value: Array<string>) => void;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Clears the entire display set selector map.
|
|
39
|
+
*/
|
|
40
|
+
clearDisplaySetSelectorMap: () => void;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Creates the Display Set Selector store.
|
|
45
|
+
*
|
|
46
|
+
* @param set - The zustand set function.
|
|
47
|
+
* @returns The display set selector store state and actions.
|
|
48
|
+
*/
|
|
49
|
+
const createDisplaySetSelectorStore = (set): DisplaySetSelectorState => ({
|
|
50
|
+
type: PRESENTATION_TYPE_ID,
|
|
51
|
+
displaySetSelectorMap: {},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Sets the display set selector for a given key.
|
|
55
|
+
*/
|
|
56
|
+
setDisplaySetSelector: (key: string, value: Array<string>) =>
|
|
57
|
+
set(
|
|
58
|
+
state => ({
|
|
59
|
+
displaySetSelectorMap: {
|
|
60
|
+
...state.displaySetSelectorMap,
|
|
61
|
+
[key]: value,
|
|
62
|
+
},
|
|
63
|
+
}),
|
|
64
|
+
false,
|
|
65
|
+
'setDisplaySetSelector'
|
|
66
|
+
),
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Clears the entire display set selector map.
|
|
70
|
+
*/
|
|
71
|
+
clearDisplaySetSelectorMap: () =>
|
|
72
|
+
set({ displaySetSelectorMap: {} }, false, 'clearDisplaySetSelectorMap'),
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Zustand store for managing display set selectors.
|
|
77
|
+
* Applies devtools middleware when DEBUG_STORE is enabled.
|
|
78
|
+
*/
|
|
79
|
+
export const useDisplaySetSelectorStore = create<DisplaySetSelectorState>()(
|
|
80
|
+
DEBUG_STORE
|
|
81
|
+
? devtools(createDisplaySetSelectorStore, { name: 'DisplaySetSelectorStore' })
|
|
82
|
+
: createDisplaySetSelectorStore
|
|
83
|
+
);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { devtools } from 'zustand/middleware';
|
|
3
|
+
import { Types } from '@ohif/core';
|
|
4
|
+
|
|
5
|
+
const PRESENTATION_TYPE_ID = 'hangingProtocolStageIndexId';
|
|
6
|
+
const DEBUG_STORE = false;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the state and actions for managing hanging protocol stage indexes.
|
|
10
|
+
*/
|
|
11
|
+
type HangingProtocolStageIndexState = {
|
|
12
|
+
/**
|
|
13
|
+
* Stores a mapping from key to `HPInfo`.
|
|
14
|
+
*/
|
|
15
|
+
hangingProtocolStageIndexMap: Record<string, Types.HangingProtocol.HPInfo>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Sets the hanging protocol stage index for a given key.
|
|
19
|
+
*
|
|
20
|
+
* @param key - The key.
|
|
21
|
+
* @param value - The `HPInfo` to associate with the key.
|
|
22
|
+
*/
|
|
23
|
+
setHangingProtocolStageIndex: (key: string, value: Types.HangingProtocol.HPInfo) => void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Clears all hanging protocol stage indexes.
|
|
27
|
+
*/
|
|
28
|
+
clearHangingProtocolStageIndexMap: () => void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Type identifier for the store.
|
|
32
|
+
*/
|
|
33
|
+
type: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Creates the Hanging Protocol Stage Index store.
|
|
38
|
+
*
|
|
39
|
+
* @param set - The zustand set function.
|
|
40
|
+
* @returns The hanging protocol stage index store state and actions.
|
|
41
|
+
*/
|
|
42
|
+
const createHangingProtocolStageIndexStore = (set): HangingProtocolStageIndexState => ({
|
|
43
|
+
hangingProtocolStageIndexMap: {},
|
|
44
|
+
type: PRESENTATION_TYPE_ID,
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Sets the hanging protocol stage index for a given key.
|
|
48
|
+
*/
|
|
49
|
+
setHangingProtocolStageIndex: (key, value) =>
|
|
50
|
+
set(
|
|
51
|
+
state => ({
|
|
52
|
+
hangingProtocolStageIndexMap: {
|
|
53
|
+
...state.hangingProtocolStageIndexMap,
|
|
54
|
+
[key]: value,
|
|
55
|
+
},
|
|
56
|
+
}),
|
|
57
|
+
false,
|
|
58
|
+
'setHangingProtocolStageIndex'
|
|
59
|
+
),
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Clears all hanging protocol stage indexes.
|
|
63
|
+
*/
|
|
64
|
+
clearHangingProtocolStageIndexMap: () =>
|
|
65
|
+
set({ hangingProtocolStageIndexMap: {} }, false, 'clearHangingProtocolStageIndexMap'),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Zustand store for managing hanging protocol stage indexes.
|
|
70
|
+
* Applies devtools middleware when DEBUG_STORE is enabled.
|
|
71
|
+
*/
|
|
72
|
+
export const useHangingProtocolStageIndexStore = create<HangingProtocolStageIndexState>()(
|
|
73
|
+
DEBUG_STORE
|
|
74
|
+
? devtools(createHangingProtocolStageIndexStore, { name: 'HangingProtocolStageIndexStore' })
|
|
75
|
+
: createHangingProtocolStageIndexStore
|
|
76
|
+
);
|