@ohif/app 3.8.0-beta.63 → 3.8.0-beta.64

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.
Files changed (32) hide show
  1. package/dist/{121.bundle.f6c25e845985d96c423c.js → 121.bundle.5399d807995157d368b7.js} +4 -4
  2. package/dist/{155.bundle.9e3dd18c9a3961232504.js → 155.bundle.55fa02bfc411cc91e261.js} +12 -7
  3. package/dist/{188.bundle.528e9ad81159c776affa.js → 188.bundle.ec979013d89d90831c58.js} +2 -2
  4. package/dist/{270.bundle.fd387adff5b064fca506.js → 270.bundle.58c74e58ad67b5069718.js} +51 -28
  5. package/dist/{295.bundle.c132f53e1397ef9d432a.js → 295.bundle.c0a29ff64d86f707fc20.js} +4 -4
  6. package/dist/{339.bundle.591a0a6075220b14c249.js → 339.bundle.e31c81c7179d3d24f3dd.js} +27 -69
  7. package/dist/{68.bundle.efc5ba2a44aa2b96ee1a.js → 41.bundle.0696b28613c7d47833c9.js} +276 -486
  8. package/dist/{250.bundle.d8b502b7ef6afc79a87e.js → 448.bundle.e856d2b2bd979c7d9ac0.js} +238 -382
  9. package/dist/{530.bundle.ef1ea9d98f7b377a9d3a.js → 530.bundle.f00fd953dcd9d0afd10b.js} +2 -2
  10. package/dist/{544.bundle.05b543f28d0c124950ef.js → 544.bundle.adfe5764f59b5fe0eba7.js} +5 -17
  11. package/dist/{559.bundle.fc08eab02848a451ed34.js → 559.bundle.4f55f5df04c418b2854e.js} +6 -10
  12. package/dist/{594.bundle.3a5fa2e7d5636ddccb32.js → 594.bundle.924cdc10e7435cf3e199.js} +147 -188
  13. package/dist/{50.bundle.55ad62f1f656f5fd5a36.js → 638.bundle.62f8f8ada74bd900abfc.js} +158 -394
  14. package/dist/{317.bundle.dd0879c5035c4b90fad3.js → 699.bundle.b3b25017819be681ef3d.js} +323 -186
  15. package/dist/{963.bundle.874395d7b2d80f9e5831.js → 701.bundle.b7ebc1629fc121e13c58.js} +520 -210
  16. package/dist/{724.bundle.294a41af83a5af33f3cc.js → 724.bundle.cd011bc1838a2bde1d66.js} +89 -152
  17. package/dist/{862.bundle.c8eba798644149650775.js → 862.bundle.d2e78b70286b59569e83.js} +2 -2
  18. package/dist/{889.bundle.a776c87be9e3580f3437.js → 889.bundle.2aefa0a3eb114db0de3f.js} +180 -207
  19. package/dist/{704.bundle.842ada45436f1fb029aa.js → 90.bundle.7a9258532111121b5ee3.js} +225 -337
  20. package/dist/{905.bundle.73a711d0255cb988fa6e.js → 905.bundle.d4bdcbd451de59b2191b.js} +119 -89
  21. package/dist/{907.bundle.6932f0458b9e0143c18a.js → 907.bundle.ca236b83967a8459b778.js} +2 -14
  22. package/dist/{961.bundle.6cf1599ed3a2871c040f.js → 961.bundle.a5541d8090cb8b22f7e6.js} +2 -15
  23. package/dist/{987.bundle.e7c041a6dfb4ddb41813.js → 987.bundle.91d4867efedd5b4d84cb.js} +5 -1
  24. package/dist/{app.bundle.22ffa6050ebef98b2066.js → app.bundle.039c4dc99821370f330d.js} +1845 -927
  25. package/dist/app.bundle.css +1 -1
  26. package/dist/index.html +1 -1
  27. package/dist/{polySeg.bundle.99be036bab9b7f011b0c.js → polySeg.bundle.c1cec6312eb6c6dc3701.js} +1 -1
  28. package/dist/sw.js +1 -1
  29. package/package.json +17 -17
  30. /package/dist/{164.bundle.710b5db3fef4d536a59f.js → 164.bundle.0cfa2edabf8ef222f3ea.js} +0 -0
  31. /package/dist/{50.css → 638.css} +0 -0
  32. /package/dist/{963.css → 701.css} +0 -0
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[50,481],{
2
+ (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[638,481],{
3
3
 
4
- /***/ 71093:
4
+ /***/ 92169:
5
5
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6
6
 
7
7
  // ESM COMPAT FLAG
@@ -22,8 +22,8 @@ const SOPClassHandlerId = `${id}.sopClassHandlerModule.${SOPClassHandlerName}`;
22
22
 
23
23
  // EXTERNAL MODULE: ../../../node_modules/react/index.js
24
24
  var react = __webpack_require__(41766);
25
- // EXTERNAL MODULE: ../../core/src/index.ts + 66 modules
26
- var src = __webpack_require__(14283);
25
+ // EXTERNAL MODULE: ../../core/src/index.ts + 67 modules
26
+ var src = __webpack_require__(78198);
27
27
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/core/dist/esm/index.js + 383 modules
28
28
  var esm = __webpack_require__(50719);
29
29
  // EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/tools/dist/esm/index.js + 16 modules
@@ -315,13 +315,13 @@ function getHangingProtocolModule() {
315
315
 
316
316
  // EXTERNAL MODULE: ./state/index.js + 1 modules
317
317
  var state = __webpack_require__(15575);
318
+ // EXTERNAL MODULE: ../../ui/src/index.js + 495 modules
319
+ var ui_src = __webpack_require__(65967);
318
320
  // EXTERNAL MODULE: ../../../extensions/default/src/index.ts + 78 modules
319
- var default_src = __webpack_require__(49704);
321
+ var default_src = __webpack_require__(54090);
320
322
  // EXTERNAL MODULE: ../../../node_modules/prop-types/index.js
321
323
  var prop_types = __webpack_require__(11374);
322
324
  var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);
323
- // EXTERNAL MODULE: ../../ui/src/index.js + 489 modules
324
- var ui_src = __webpack_require__(6804);
325
325
  ;// CONCATENATED MODULE: ../../../extensions/cornerstone-dicom-seg/src/panels/callInputDialog.tsx
326
326
 
327
327
 
@@ -714,386 +714,6 @@ PanelSegmentation.propTypes = {
714
714
  }).isRequired
715
715
  }).isRequired
716
716
  };
717
- ;// CONCATENATED MODULE: ../../../extensions/cornerstone-dicom-seg/src/panels/SegmentationToolbox.tsx
718
-
719
-
720
-
721
- const {
722
- segmentation: segmentationUtils
723
- } = dist_esm.utilities;
724
- const TOOL_TYPES = {
725
- CIRCULAR_BRUSH: 'CircularBrush',
726
- SPHERE_BRUSH: 'SphereBrush',
727
- CIRCULAR_ERASER: 'CircularEraser',
728
- SPHERE_ERASER: 'SphereEraser',
729
- CIRCLE_SHAPE: 'CircleScissor',
730
- RECTANGLE_SHAPE: 'RectangleScissor',
731
- SPHERE_SHAPE: 'SphereScissor',
732
- THRESHOLD_CIRCULAR_BRUSH: 'ThresholdCircularBrush',
733
- THRESHOLD_SPHERE_BRUSH: 'ThresholdSphereBrush'
734
- };
735
- const ACTIONS = {
736
- SET_TOOL_CONFIG: 'SET_TOOL_CONFIG',
737
- SET_ACTIVE_TOOL: 'SET_ACTIVE_TOOL'
738
- };
739
- const initialState = {
740
- Brush: {
741
- brushSize: 15,
742
- mode: 'CircularBrush' // Can be 'CircularBrush' or 'SphereBrush'
743
- },
744
- Eraser: {
745
- brushSize: 15,
746
- mode: 'CircularEraser' // Can be 'CircularEraser' or 'SphereEraser'
747
- },
748
- Shapes: {
749
- brushSize: 15,
750
- mode: 'CircleScissor' // E.g., 'CircleScissor', 'RectangleScissor', or 'SphereScissor'
751
- },
752
- ThresholdBrush: {
753
- brushSize: 15,
754
- thresholdRange: null
755
- },
756
- activeTool: null
757
- };
758
- function toolboxReducer(state, action) {
759
- switch (action.type) {
760
- case ACTIONS.SET_TOOL_CONFIG:
761
- const {
762
- tool,
763
- config
764
- } = action.payload;
765
- return {
766
- ...state,
767
- [tool]: {
768
- ...state[tool],
769
- ...config
770
- }
771
- };
772
- case ACTIONS.SET_ACTIVE_TOOL:
773
- return {
774
- ...state,
775
- activeTool: action.payload
776
- };
777
- default:
778
- return state;
779
- }
780
- }
781
- function SegmentationToolbox({
782
- servicesManager,
783
- extensionManager
784
- }) {
785
- const {
786
- toolbarService,
787
- segmentationService,
788
- toolGroupService
789
- } = servicesManager.services;
790
- const [viewportGrid] = (0,ui_src/* useViewportGrid */.ih)();
791
- const {
792
- viewports,
793
- activeViewportId
794
- } = viewportGrid;
795
- const [toolsEnabled, setToolsEnabled] = (0,react.useState)(false);
796
- const [state, dispatch] = (0,react.useReducer)(toolboxReducer, initialState);
797
- const updateActiveTool = (0,react.useCallback)(() => {
798
- if (!viewports?.size || activeViewportId === undefined) {
799
- return;
800
- }
801
- const viewport = viewports.get(activeViewportId);
802
- if (!viewport) {
803
- return;
804
- }
805
- dispatch({
806
- type: ACTIONS.SET_ACTIVE_TOOL,
807
- payload: toolGroupService.getActiveToolForViewport(viewport.viewportId)
808
- });
809
- }, [activeViewportId, viewports, toolGroupService, dispatch]);
810
- const setToolActive = (0,react.useCallback)(toolName => {
811
- initializeThresholdValue(toolName);
812
- toolbarService.recordInteraction({
813
- interactionType: 'tool',
814
- commands: [{
815
- commandName: 'setToolActive',
816
- commandOptions: {
817
- toolName
818
- }
819
- }]
820
- });
821
- dispatch({
822
- type: ACTIONS.SET_ACTIVE_TOOL,
823
- payload: toolName
824
- });
825
- }, [toolbarService, dispatch]);
826
-
827
- /**
828
- * sets the tools enabled IF there are segmentations
829
- */
830
- (0,react.useEffect)(() => {
831
- const events = [segmentationService.EVENTS.SEGMENTATION_ADDED, segmentationService.EVENTS.SEGMENTATION_UPDATED, segmentationService.EVENTS.SEGMENTATION_REMOVED];
832
- const unsubscriptions = [];
833
- events.forEach(event => {
834
- const {
835
- unsubscribe
836
- } = segmentationService.subscribe(event, () => {
837
- const segmentations = segmentationService.getSegmentations();
838
- const activeSegmentation = segmentations?.find(seg => seg.isActive);
839
- setToolsEnabled(activeSegmentation?.segmentCount > 0);
840
- });
841
- unsubscriptions.push(unsubscribe);
842
- });
843
- updateActiveTool();
844
- return () => {
845
- unsubscriptions.forEach(unsubscribe => unsubscribe());
846
- };
847
- }, [activeViewportId, viewports, segmentationService, updateActiveTool]);
848
-
849
- /**
850
- * Update the active tool when the toolbar state changes
851
- */
852
- (0,react.useEffect)(() => {
853
- const {
854
- unsubscribe
855
- } = toolbarService.subscribe(toolbarService.EVENTS.TOOL_BAR_STATE_MODIFIED, () => {
856
- updateActiveTool();
857
- });
858
- return () => {
859
- unsubscribe();
860
- };
861
- }, [toolbarService, updateActiveTool]);
862
- (0,react.useEffect)(() => {
863
- // if the active tool is not a brush tool then do nothing
864
- if (!Object.values(TOOL_TYPES).includes(state.activeTool)) {
865
- return;
866
- }
867
-
868
- // if the tool is Segmentation and it is enabled then do nothing
869
- if (toolsEnabled) {
870
- return;
871
- }
872
-
873
- // if the tool is Segmentation and it is disabled, then switch
874
- // back to the window level tool to not confuse the user when no
875
- // segmentation is active or when there is no segment in the segmentation
876
- setToolActive('WindowLevel');
877
- }, [toolsEnabled, state.activeTool, setToolActive]);
878
- const updateBrushSize = (0,react.useCallback)((toolName, brushSize) => {
879
- toolGroupService.getToolGroupIds()?.forEach(toolGroupId => {
880
- segmentationUtils.setBrushSizeForToolGroup(toolGroupId, brushSize, toolName);
881
- });
882
- }, [toolGroupService]);
883
- function initializeThresholdValue(toolName) {
884
- if (state.ThresholdBrush.thresholdRange === null) {
885
- // set the default threshold range from the tool configuration
886
- const toolGroupIds = toolGroupService.getToolGroupIds();
887
- const toolGroupId = toolGroupIds[0];
888
- const toolGroup = toolGroupService.getToolGroup(toolGroupId);
889
- const toolConfig = toolGroup.getToolConfiguration(toolName);
890
- const defaultThresholdRange = toolConfig?.strategySpecificConfiguration?.THRESHOLD?.threshold;
891
- dispatch({
892
- type: ACTIONS.SET_TOOL_CONFIG,
893
- payload: {
894
- tool: 'ThresholdBrush',
895
- config: {
896
- thresholdRange: defaultThresholdRange
897
- }
898
- }
899
- });
900
- }
901
- }
902
- const onBrushSizeChange = (0,react.useCallback)((valueAsStringOrNumber, toolCategory) => {
903
- const value = Number(valueAsStringOrNumber);
904
- _getToolNamesFromCategory(toolCategory).forEach(toolName => {
905
- updateBrushSize(toolName, value);
906
- });
907
- dispatch({
908
- type: ACTIONS.SET_TOOL_CONFIG,
909
- payload: {
910
- tool: toolCategory,
911
- config: {
912
- brushSize: value
913
- }
914
- }
915
- });
916
- }, [toolGroupService, dispatch]);
917
- const handleRangeChange = (0,react.useCallback)(newRange => {
918
- if (newRange[0] === state.ThresholdBrush.thresholdRange?.[0] && newRange[1] === state.ThresholdBrush.thresholdRange?.[1]) {
919
- return;
920
- }
921
- const toolNames = _getToolNamesFromCategory('ThresholdBrush');
922
- toolNames.forEach(toolName => {
923
- toolGroupService.getToolGroupIds()?.forEach(toolGroupId => {
924
- const toolGroup = toolGroupService.getToolGroup(toolGroupId);
925
- toolGroup.setToolConfiguration(toolName, {
926
- strategySpecificConfiguration: {
927
- THRESHOLD: {
928
- threshold: newRange
929
- }
930
- }
931
- });
932
- });
933
- });
934
- dispatch({
935
- type: ACTIONS.SET_TOOL_CONFIG,
936
- payload: {
937
- tool: 'ThresholdBrush',
938
- config: {
939
- thresholdRange: newRange
940
- }
941
- }
942
- });
943
- }, [toolGroupService, dispatch, state.ThresholdBrush.thresholdRange]);
944
- return /*#__PURE__*/react.createElement(ui_src/* AdvancedToolbox */.om, {
945
- title: "Segmentation Tools",
946
- items: [{
947
- name: 'Brush',
948
- icon: 'icon-tool-brush',
949
- disabled: !toolsEnabled,
950
- active: state.activeTool === TOOL_TYPES.CIRCULAR_BRUSH || state.activeTool === TOOL_TYPES.SPHERE_BRUSH,
951
- onClick: () => setToolActive(TOOL_TYPES.CIRCULAR_BRUSH),
952
- options: [{
953
- name: 'Radius (mm)',
954
- id: 'brush-radius',
955
- type: 'range',
956
- min: 0.5,
957
- max: 99.5,
958
- value: state.Brush.brushSize,
959
- step: 0.5,
960
- onChange: value => onBrushSizeChange(value, 'Brush')
961
- }, {
962
- name: 'Mode',
963
- type: 'radio',
964
- id: 'brush-mode',
965
- value: state.Brush.mode,
966
- values: [{
967
- value: TOOL_TYPES.CIRCULAR_BRUSH,
968
- label: 'Circle'
969
- }, {
970
- value: TOOL_TYPES.SPHERE_BRUSH,
971
- label: 'Sphere'
972
- }],
973
- onChange: value => setToolActive(value)
974
- }]
975
- }, {
976
- name: 'Eraser',
977
- icon: 'icon-tool-eraser',
978
- disabled: !toolsEnabled,
979
- active: state.activeTool === TOOL_TYPES.CIRCULAR_ERASER || state.activeTool === TOOL_TYPES.SPHERE_ERASER,
980
- onClick: () => setToolActive(TOOL_TYPES.CIRCULAR_ERASER),
981
- options: [{
982
- name: 'Radius (mm)',
983
- type: 'range',
984
- id: 'eraser-radius',
985
- min: 0.5,
986
- max: 99.5,
987
- value: state.Eraser.brushSize,
988
- step: 0.5,
989
- onChange: value => onBrushSizeChange(value, 'Eraser')
990
- }, {
991
- name: 'Mode',
992
- type: 'radio',
993
- id: 'eraser-mode',
994
- value: state.Eraser.mode,
995
- values: [{
996
- value: TOOL_TYPES.CIRCULAR_ERASER,
997
- label: 'Circle'
998
- }, {
999
- value: TOOL_TYPES.SPHERE_ERASER,
1000
- label: 'Sphere'
1001
- }],
1002
- onChange: value => setToolActive(value)
1003
- }]
1004
- }, {
1005
- name: 'Shapes',
1006
- icon: 'icon-tool-shape',
1007
- disabled: !toolsEnabled,
1008
- active: state.activeTool === TOOL_TYPES.CIRCLE_SHAPE || state.activeTool === TOOL_TYPES.RECTANGLE_SHAPE || state.activeTool === TOOL_TYPES.SPHERE_SHAPE,
1009
- onClick: () => setToolActive(TOOL_TYPES.CIRCLE_SHAPE),
1010
- options: [{
1011
- name: 'Mode',
1012
- type: 'radio',
1013
- value: state.Shapes.mode,
1014
- id: 'shape-mode',
1015
- values: [{
1016
- value: TOOL_TYPES.CIRCLE_SHAPE,
1017
- label: 'Circle'
1018
- }, {
1019
- value: TOOL_TYPES.RECTANGLE_SHAPE,
1020
- label: 'Rectangle'
1021
- }, {
1022
- value: TOOL_TYPES.SPHERE_SHAPE,
1023
- label: 'Sphere'
1024
- }],
1025
- onChange: value => setToolActive(value)
1026
- }]
1027
- }, {
1028
- name: 'Threshold Tool',
1029
- icon: 'icon-tool-threshold',
1030
- disabled: !toolsEnabled,
1031
- active: state.activeTool === TOOL_TYPES.THRESHOLD_CIRCULAR_BRUSH || state.activeTool === TOOL_TYPES.THRESHOLD_SPHERE_BRUSH,
1032
- onClick: () => setToolActive(TOOL_TYPES.THRESHOLD_CIRCULAR_BRUSH),
1033
- options: [{
1034
- name: 'Radius (mm)',
1035
- id: 'threshold-radius',
1036
- type: 'range',
1037
- min: 0.5,
1038
- max: 99.5,
1039
- value: state.ThresholdBrush.brushSize,
1040
- step: 0.5,
1041
- onChange: value => onBrushSizeChange(value, 'ThresholdBrush')
1042
- }, {
1043
- name: 'Mode',
1044
- type: 'radio',
1045
- id: 'threshold-mode',
1046
- value: state.activeTool,
1047
- values: [{
1048
- value: TOOL_TYPES.THRESHOLD_CIRCULAR_BRUSH,
1049
- label: 'Circle'
1050
- }, {
1051
- value: TOOL_TYPES.THRESHOLD_SPHERE_BRUSH,
1052
- label: 'Sphere'
1053
- }],
1054
- onChange: value => setToolActive(value)
1055
- }, {
1056
- type: 'custom',
1057
- id: 'segmentation-threshold-range',
1058
- children: () => {
1059
- return /*#__PURE__*/react.createElement("div", null, /*#__PURE__*/react.createElement("div", {
1060
- className: "bg-secondary-light h-[1px]"
1061
- }), /*#__PURE__*/react.createElement("div", {
1062
- className: "mt-1 text-[13px] text-white"
1063
- }, "Threshold"), /*#__PURE__*/react.createElement(ui_src/* InputDoubleRange */.Z5, {
1064
- values: state.ThresholdBrush.thresholdRange,
1065
- onChange: handleRangeChange,
1066
- minValue: -1000 // Todo: these should be configurable
1067
- ,
1068
- maxValue: 1000,
1069
- step: 1,
1070
- showLabel: true,
1071
- allowNumberEdit: true,
1072
- showAdjustmentArrows: false
1073
- }));
1074
- }
1075
- }]
1076
- }]
1077
- });
1078
- }
1079
- function _getToolNamesFromCategory(category) {
1080
- let toolNames = [];
1081
- switch (category) {
1082
- case 'Brush':
1083
- toolNames = ['CircularBrush', 'SphereBrush'];
1084
- break;
1085
- case 'Eraser':
1086
- toolNames = ['CircularEraser', 'SphereEraser'];
1087
- break;
1088
- case 'ThresholdBrush':
1089
- toolNames = ['ThresholdCircularBrush', 'ThresholdSphereBrush'];
1090
- break;
1091
- default:
1092
- break;
1093
- }
1094
- return toolNames;
1095
- }
1096
- /* harmony default export */ const panels_SegmentationToolbox = (SegmentationToolbox);
1097
717
  ;// CONCATENATED MODULE: ../../../extensions/cornerstone-dicom-seg/src/getPanelModule.tsx
1098
718
 
1099
719
 
@@ -1103,7 +723,8 @@ const getPanelModule = ({
1103
723
  commandsManager,
1104
724
  servicesManager,
1105
725
  extensionManager,
1106
- configuration
726
+ configuration,
727
+ title
1107
728
  }) => {
1108
729
  const {
1109
730
  customizationService
@@ -1122,11 +743,12 @@ const getPanelModule = ({
1122
743
  });
1123
744
  };
1124
745
  const wrappedPanelSegmentationWithTools = configuration => {
1125
- const [appConfig] = (0,state/* useAppConfig */.r)();
1126
- return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(panels_SegmentationToolbox, {
746
+ return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(ui_src/* Toolbox */.OO, {
1127
747
  commandsManager: commandsManager,
1128
748
  servicesManager: servicesManager,
1129
749
  extensionManager: extensionManager,
750
+ buttonSectionId: "segmentationToolbox",
751
+ title: "Segmentation Tools",
1130
752
  configuration: {
1131
753
  ...configuration
1132
754
  }
@@ -1329,6 +951,9 @@ function getUpdatedViewportsForSegmentation({
1329
951
 
1330
952
 
1331
953
 
954
+ const {
955
+ segmentation: segmentationUtils
956
+ } = dist_esm.utilities;
1332
957
  const {
1333
958
  datasetToBlob
1334
959
  } = dcmjs_es/* default.data */.Ay.data;
@@ -1359,7 +984,8 @@ const commandsModule = ({
1359
984
  segmentationService,
1360
985
  uiDialogService,
1361
986
  displaySetService,
1362
- viewportGridService
987
+ viewportGridService,
988
+ toolGroupService
1363
989
  } = servicesManager.services;
1364
990
  const actions = {
1365
991
  /**
@@ -1680,6 +1306,62 @@ const commandsModule = ({
1680
1306
  } catch (e) {
1681
1307
  console.warn(e);
1682
1308
  }
1309
+ },
1310
+ setBrushSize: ({
1311
+ value,
1312
+ toolNames
1313
+ }) => {
1314
+ const brushSize = Number(value);
1315
+ toolGroupService.getToolGroupIds()?.forEach(toolGroupId => {
1316
+ if (toolNames?.length === 0) {
1317
+ segmentationUtils.setBrushSizeForToolGroup(toolGroupId, brushSize);
1318
+ } else {
1319
+ toolNames?.forEach(toolName => {
1320
+ segmentationUtils.setBrushSizeForToolGroup(toolGroupId, brushSize, toolName);
1321
+ });
1322
+ }
1323
+ });
1324
+ },
1325
+ setThresholdRange: ({
1326
+ value,
1327
+ toolNames = ['ThresholdCircularBrush', 'ThresholdSphereBrush']
1328
+ }) => {
1329
+ toolGroupService.getToolGroupIds()?.forEach(toolGroupId => {
1330
+ const toolGroup = toolGroupService.getToolGroup(toolGroupId);
1331
+ toolNames?.forEach(toolName => {
1332
+ toolGroup.setToolConfiguration(toolName, {
1333
+ strategySpecificConfiguration: {
1334
+ THRESHOLD: {
1335
+ threshold: value
1336
+ }
1337
+ }
1338
+ });
1339
+ });
1340
+ });
1341
+ },
1342
+ toggleThresholdRangeAndDynamic() {
1343
+ const toolGroupIds = toolGroupService.getToolGroupIds();
1344
+ if (!toolGroupIds) {
1345
+ return;
1346
+ }
1347
+ toolGroupIds.forEach(toolGroupId => {
1348
+ const toolGroup = toolGroupService.getToolGroup(toolGroupId);
1349
+ const brushInstances = segmentationUtils.getBrushToolInstances(toolGroup.id);
1350
+ brushInstances.forEach(({
1351
+ configuration
1352
+ }) => {
1353
+ const {
1354
+ activeStrategy,
1355
+ strategySpecificConfiguration
1356
+ } = configuration;
1357
+ if (activeStrategy.startsWith('THRESHOLD')) {
1358
+ const thresholdConfig = strategySpecificConfiguration.THRESHOLD;
1359
+ if (thresholdConfig) {
1360
+ thresholdConfig.isDynamic = !thresholdConfig.isDynamic;
1361
+ }
1362
+ }
1363
+ });
1364
+ });
1683
1365
  }
1684
1366
  };
1685
1367
  const definitions = {
@@ -1706,18 +1388,97 @@ const commandsModule = ({
1706
1388
  },
1707
1389
  downloadRTSS: {
1708
1390
  commandFn: actions.downloadRTSS
1391
+ },
1392
+ setBrushSize: {
1393
+ commandFn: actions.setBrushSize
1394
+ },
1395
+ setThresholdRange: {
1396
+ commandFn: actions.setThresholdRange
1397
+ },
1398
+ toggleThresholdRangeAndDynamic: {
1399
+ commandFn: actions.toggleThresholdRangeAndDynamic
1709
1400
  }
1710
1401
  };
1711
1402
  return {
1712
1403
  actions,
1713
- definitions
1404
+ definitions,
1405
+ defaultContext: 'SEGMENTATION'
1714
1406
  };
1715
1407
  };
1716
1408
  /* harmony default export */ const src_commandsModule = (commandsModule);
1409
+ ;// CONCATENATED MODULE: ../../../extensions/cornerstone-dicom-seg/src/getToolbarModule.ts
1410
+ function getToolbarModule({
1411
+ commandsManager,
1412
+ servicesManager
1413
+ }) {
1414
+ const {
1415
+ segmentationService,
1416
+ toolGroupService
1417
+ } = servicesManager.services;
1418
+ return [{
1419
+ name: 'evaluate.cornerstone.segmentation',
1420
+ evaluate: ({
1421
+ viewportId,
1422
+ button,
1423
+ toolNames
1424
+ }) => {
1425
+ // Todo: we need to pass in the button section Id since we are kind of
1426
+ // forcing the button to have black background since initially
1427
+ // it is designed for the toolbox not the toolbar on top
1428
+ // we should then branch the buttonSectionId to have different styles
1429
+ const segmentations = segmentationService.getSegmentations();
1430
+ if (!segmentations?.length) {
1431
+ return {
1432
+ disabled: true,
1433
+ className: '!text-common-bright !bg-black opacity-50'
1434
+ };
1435
+ }
1436
+ const toolGroup = toolGroupService.getToolGroupForViewport(viewportId);
1437
+ if (!toolGroup) {
1438
+ return;
1439
+ }
1440
+ const toolName = getToolNameForButton(button);
1441
+ if (!toolGroup || !toolGroup.hasTool(toolName)) {
1442
+ return {
1443
+ disabled: true,
1444
+ className: '!text-common-bright ohif-disabled'
1445
+ };
1446
+ }
1447
+ const isPrimaryActive = toolNames ? toolNames.includes(toolGroup.getActivePrimaryMouseButtonTool()) : toolGroup.getActivePrimaryMouseButtonTool() === toolName;
1448
+ return {
1449
+ disabled: false,
1450
+ className: isPrimaryActive ? '!text-black !bg-primary-light hover:bg-primary-light hover-text-black hover:cursor-pointer' : '!text-common-bright !bg-black hover:bg-primary-light hover:cursor-pointer hover:text-black',
1451
+ // Todo: isActive right now is used for nested buttons where the primary
1452
+ // button needs to be fully rounded (vs partial rounded) when active
1453
+ // otherwise it does not have any other use
1454
+ isActive: isPrimaryActive
1455
+ };
1456
+ }
1457
+ }];
1458
+ }
1459
+ function getToolNameForButton(button) {
1460
+ const {
1461
+ props
1462
+ } = button;
1463
+ const commands = props?.commands || button.commands;
1464
+ if (commands && commands.length) {
1465
+ const command = commands[0];
1466
+ const {
1467
+ commandOptions
1468
+ } = command;
1469
+ const {
1470
+ toolName
1471
+ } = commandOptions || {
1472
+ toolName: props?.id ?? button.id
1473
+ };
1474
+ return toolName;
1475
+ }
1476
+ return null;
1477
+ }
1717
1478
  ;// CONCATENATED MODULE: ../../../extensions/cornerstone-dicom-seg/src/init.ts
1718
1479
 
1719
1480
  function init({
1720
- configuration = {}
1481
+ servicesManager
1721
1482
  }) {
1722
1483
  (0,dist_esm.addTool)(dist_esm.BrushTool);
1723
1484
  }
@@ -1730,6 +1491,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
1730
1491
 
1731
1492
 
1732
1493
 
1494
+
1733
1495
  const Component = /*#__PURE__*/react.lazy(() => {
1734
1496
  return __webpack_require__.e(/* import() */ 295).then(__webpack_require__.bind(__webpack_require__, 58295));
1735
1497
  });
@@ -1757,9 +1519,11 @@ const extension = {
1757
1519
  */
1758
1520
  getPanelModule: src_getPanelModule,
1759
1521
  getCommandsModule: src_commandsModule,
1522
+ getToolbarModule: getToolbarModule,
1760
1523
  getViewportModule({
1761
1524
  servicesManager,
1762
- extensionManager
1525
+ extensionManager,
1526
+ commandsManager
1763
1527
  }) {
1764
1528
  const ExtendedOHIFCornerstoneSEGViewport = props => {
1765
1529
  return /*#__PURE__*/react.createElement(OHIFCornerstoneSEGViewport, _extends({