feat: Add a new hanging protocol @ohif/mn (#3305)

* feat: Add a new hanging protocol @ohif/mn

* Add @ohif/seg example

* PR comments and a couple more fixes to make things cleaner

* PR comment

* Added an example to cause the PR checks to rerun
This commit is contained in:
Bill Wallace authored and GitHub committed 2023-04-18 11:55:25 -04:00
1 parent 6cf271d006
commit c508a2b6bc
17 files changed
+184 -358

No files matched your search

@@ -9,7 +9,9 @@ import * as HangingProtocol from '../../types/HangingProtocol';
import {
isDisplaySetFromUrl,
sopInstanceLocation,
} from './isDisplaySetFromUrl';
} from './custom-attribute/isDisplaySetFromUrl';
import numberOfDisplaySetsWithImages from './custom-attribute/numberOfDisplaySetsWithImages';
import seriesDescriptionsFromDisplaySets from './custom-attribute/seriesDescriptionsFromDisplaySets';
type Protocol = HangingProtocol.Protocol | HangingProtocol.ProtocolGenerator;
@@ -93,6 +95,16 @@ export default class HangingProtocolService extends PubSubService {
name: 'Gets the position of the specified sop instance',
callback: sopInstanceLocation,
},
seriesDescriptions: {
name: 'seriesDescriptions',
description: 'List of Series Descriptions',
callback: seriesDescriptionsFromDisplaySets,
},
numberOfDisplaySetsWithImages: {
name: 'numberOfDisplaySetsWithImages',
desription: 'Number of displays sets with images',
numberOfDisplaySetsWithImages,
},
};
listeners = {};
registeredImageLoadStrategies = {};
@@ -1,4 +1,4 @@
import { getSplitParam } from '../../utils';
import { getSplitParam } from '../../../utils';
/** Indicates if the given display set is the one specified in the
* displaySet parameter in the URL
@@ -31,7 +31,7 @@ const isDisplaySetFromUrl = (displaySet): boolean => {
* Returns undefined to fallback to the defaultValue
*/
function sopInstanceLocation(displaySets) {
const displaySet = displaySets[0];
const displaySet = displaySets?.[0];
if (!displaySet) return;
const initialSOPInstanceUID = getSplitParam('initialsopinstanceuid');
if (!initialSOPInstanceUID) return;
@@ -0,0 +1,5 @@
export default (study, extraData) => {
const ret = extraData?.displaySets?.filter(ds => ds.numImageFrames>0)?.length;
console.log("number of display sets with images", ret);
return ret;
};
@@ -0,0 +1 @@
export default (study, extraData) => extraData?.displaySets?.map(ds => ds.SeriesDescription);