fix(hp): Make the updated hanging protocol compatible with modes (#2971)

There had been a change made to make the hanging protocols
auto initialize, but that caused problems on mode init
because the couldn't specify the hanging protocols any longer.
THis change restores that, and also improves the API a little
bit by allowing the display set selectors to be specified by id
instead of positionally.

fix(hp):PR Review Comments

fix(hp):Unit test and docs
This commit is contained in:
Bill Wallace authored and GitHub committed 2022-10-05 08:32:54 -04:00
1 parent 1bcc9ccd89
commit e401358887
16 files changed
+228 -209

No files matched your search

+2 -2
View File
@@ -77,7 +77,7 @@ function modeFactory() {
},
],
extensions: extensionDependencies,
hangingProtocols: [],
hangingProtocol: [],
sopClassHandlers: [],
hotkeys: [],
};
@@ -272,7 +272,7 @@ function modeFactory({ modeConfiguration }) {
},
],
extensions: extensionDependencies,
hangingProtocols: ['@ohif/extension-default.hangingProtocolModule.petCT'],
hangingProtocol: ['@ohif/extension-default.hangingProtocolModule.petCT'],
sopClassHandlers: ['@ohif/extension-default.sopClassHandlerModule.stack'],
// ...
};
@@ -56,6 +56,11 @@ There are two events that get publish in `HangingProtocolService`:
- `addProtocol`: adds provided protocol to the list of registered protocols
for matching
- `setActiveProtocols`: Choose the protocols which are active. Can take a
single protocol id or a list. When a single one is provided, that one will be
applied whether or not the required rules match. Called automatically on mode
init.
- `run({studies, activeStudy, displaySets }, protocolId)`: runs the HPService with the provided
studyMetaData and optional protocolId. If protocol is not given, HP Matching
engine will search all the registered protocols for the best matching one
@@ -65,7 +70,14 @@ There are two events that get publish in `HangingProtocolService`:
Default initialization of the modes handles running the `HangingProtocolService`
## Hanging Protocol Instance Definition
A hanging protocol has an id provided in the module which is used to identify
the protocol. Mostly these should include the module name so that they
do not overlap, with the suggested id being `${moduleId}.${simpleName}`. The
'default' name is used as the hanging protocol id when no other protocol applies,
and can be set as the last module listed containing 'default'.
See the typescript definitions for more details on the structure.
## Custom Attribute
In some situations, you might want to match based on a custom attribute and not the DICOM tags. For instance,
@@ -81,17 +93,17 @@ const deafultProtocol = {
/** ... **/
protocolMatchingRules: [
{
id: 'vSjk7NCYjtdS3XZAw',
weight: 3,
attribute: 'timepoint',
constraint: {
equals: {
value: 'first',
},
equals: 'first',
},
required: false,
},
],
displaySetSelectors: {
/** ... */
}
stages: [
/** ... **/
],