fix(viewport): Reset viewport state and fix CINE looping, thumbnail resolution, and dynamic tool settings (#4037)

This commit is contained in:
Alireza authored and GitHub committed 2024-04-16 11:04:48 -04:00
1 parent a6c6fff43a
commit f99a0bfb31
80 files changed
+1129 -801

No files matched your search

+2 -2
View File
@@ -50,7 +50,7 @@ function initDefaultToolGroup(extensionManager, toolGroupService, commandsManage
{ toolName: toolNames.Angle },
{ toolName: toolNames.Magnify },
{ toolName: toolNames.SegmentationDisplay },
{ toolName: toolNames.AdvancedMagnify },
{ toolName: toolNames.UltrasoundDirectional },
{ toolName: toolNames.PlanarFreehandROI },
{ toolName: toolNames.SplineROI },
@@ -59,7 +59,7 @@ function initDefaultToolGroup(extensionManager, toolGroupService, commandsManage
// enabled
enabled: [{ toolName: toolNames.ImageOverlayViewer }],
// disabled
disabled: [{ toolName: toolNames.ReferenceLines }],
disabled: [{ toolName: toolNames.ReferenceLines }, { toolName: toolNames.AdvancedMagnify }],
};
toolGroupService.createToolGroupAndAddTools(toolGroupId, tools);
+4 -11
View File
@@ -11,13 +11,6 @@ const ReferenceLinesListeners: RunCommand = [
},
];
export const toggleEnabledDisabledToolbar = {
commandName: 'toggleEnabledDisabledToolbar',
commandOptions: {
toolGroupIds: ['default', 'mpr', 'SRToolGroup', 'volume3d'],
},
};
const moreTools = [
{
id: 'MoreTools',
@@ -87,7 +80,7 @@ const moreTools = [
icon: 'tool-referenceLines',
label: 'Reference Lines',
tooltip: 'Show Reference Lines',
commands: toggleEnabledDisabledToolbar,
commands: 'toggleEnabledDisabledToolbar',
listeners: {
[ViewportGridService.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED]: ReferenceLinesListeners,
[ViewportGridService.EVENTS.VIEWPORTS_READY]: ReferenceLinesListeners,
@@ -99,7 +92,7 @@ const moreTools = [
icon: 'toggle-dicom-overlay',
label: 'Image Overlay',
tooltip: 'Toggle Image Overlay',
commands: toggleEnabledDisabledToolbar,
commands: 'toggleEnabledDisabledToolbar',
evaluate: 'evaluate.cornerstoneTool.toggle',
}),
createButton({
@@ -178,8 +171,8 @@ const moreTools = [
icon: 'icon-tool-loupe',
label: 'Loupe',
tooltip: 'Loupe',
commands: setToolActiveToolbar,
evaluate: 'evaluate.cornerstoneTool',
commands: 'toggleActiveDisabledToolbar',
evaluate: 'evaluate.cornerstoneTool.toggle.ifStrictlyDisabled',
}),
createButton({
id: 'UltrasoundDirectionalTool',
+9 -10
View File
@@ -65,19 +65,18 @@ function initDefaultToolGroup(
{ toolName: toolNames.Magnify },
{ toolName: toolNames.SegmentationDisplay },
{ toolName: toolNames.CalibrationLine },
{
toolName: toolNames.AdvancedMagnify,
configuration: {
disableOnPassive: true,
},
},
{ toolName: toolNames.UltrasoundDirectional },
{ toolName: toolNames.PlanarFreehandROI },
{ toolName: toolNames.SplineROI },
{ toolName: toolNames.LivewireContour },
],
// enabled
enabled: [{ toolName: toolNames.ImageOverlayViewer }, { toolName: toolNames.ReferenceLines }],
disabled: [
{
toolName: toolNames.AdvancedMagnify,
},
],
};
toolGroupService.createToolGroupAndAddTools(toolGroupId, tools);
@@ -224,11 +223,11 @@ function initMPRToolGroup(extensionManager, toolGroupService, commandsManager, m
},
},
},
{
toolName: toolNames.AdvancedMagnify,
},
{ toolName: toolNames.ReferenceLines },
],
// enabled
// disabled
};
toolGroupService.createToolGroupAndAddTools('mpr', tools);
+4 -18
View File
@@ -11,20 +11,6 @@ const ReferenceLinesListeners: RunCommand = [
},
];
export const toggleEnabledDisabledToolbar = {
commandName: 'toggleEnabledDisabledToolbar',
commandOptions: {
toolGroupIds: ['default', 'mpr', 'SRToolGroup', 'volume3d'],
},
};
export const toggleActiveDisabledToolbar = {
commandName: 'toggleActiveDisabledToolbar',
commandOptions: {
toolGroupIds: ['default', 'mpr', 'SRToolGroup'],
},
};
const moreTools = [
{
id: 'MoreTools',
@@ -94,7 +80,7 @@ const moreTools = [
icon: 'tool-referenceLines',
label: 'Reference Lines',
tooltip: 'Show Reference Lines',
commands: toggleEnabledDisabledToolbar,
commands: 'toggleEnabledDisabledToolbar',
listeners: {
[ViewportGridService.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED]: ReferenceLinesListeners,
[ViewportGridService.EVENTS.VIEWPORTS_READY]: ReferenceLinesListeners,
@@ -106,7 +92,7 @@ const moreTools = [
icon: 'toggle-dicom-overlay',
label: 'Image Overlay',
tooltip: 'Toggle Image Overlay',
commands: toggleEnabledDisabledToolbar,
commands: 'toggleEnabledDisabledToolbar',
evaluate: 'evaluate.cornerstoneTool.toggle',
}),
createButton({
@@ -177,8 +163,8 @@ const moreTools = [
icon: 'icon-tool-loupe',
label: 'Loupe',
tooltip: 'Loupe',
commands: toggleActiveDisabledToolbar,
evaluate: 'evaluate.cornerstoneTool.toggle',
commands: 'toggleActiveDisabledToolbar',
evaluate: 'evaluate.cornerstoneTool.toggle.ifStrictlyDisabled',
}),
createButton({
id: 'UltrasoundDirectionalTool',
+1 -1
View File
@@ -1,6 +1,6 @@
// TODO: torn, can either bake this here; or have to create a whole new button type
// Only ways that you can pass in a custom React component for render :l
import { defaults, ToolbarService } from '@ohif/core';
import { ToolbarService } from '@ohif/core';
import type { Button } from '@ohif/core/types';
const { createButton } = ToolbarService;
+1 -1
View File
@@ -79,7 +79,7 @@ function modeFactory({ modeConfiguration }) {
() => {
const viewportId = viewportGridService.getActiveViewportId();
const csViewport = cornerstoneViewportService.getCornerstoneViewport(viewportId);
cineService.playClip(csViewport.element);
cineService.playClip(csViewport.element, { viewportId });
// cineService.setIsCineEnabled(true);
unsubscribe();
@@ -24,7 +24,7 @@ const toolbarButtons: Button[] = [
label: 'Brush',
evaluate: {
name: 'evaluate.cornerstone.segmentation',
options: { toolNames: ['CircularBrush', 'SphereBrush'] },
toolNames: ['CircularBrush', 'SphereBrush'],
},
commands: _createSetToolActiveCommands('CircularBrush'),
options: [
@@ -60,9 +60,7 @@ const toolbarButtons: Button[] = [
label: 'Eraser',
evaluate: {
name: 'evaluate.cornerstone.segmentation',
options: {
toolNames: ['CircularEraser', 'SphereEraser'],
},
toolNames: ['CircularEraser', 'SphereEraser'],
},
commands: _createSetToolActiveCommands('CircularEraser'),
options: [
@@ -98,7 +96,7 @@ const toolbarButtons: Button[] = [
label: 'Eraser',
evaluate: {
name: 'evaluate.cornerstone.segmentation',
options: { toolNames: ['ThresholdCircularBrush', 'ThresholdSphereBrush'] },
toolNames: ['ThresholdCircularBrush', 'ThresholdSphereBrush'],
},
commands: _createSetToolActiveCommands('ThresholdCircularBrush'),
options: [
@@ -155,7 +153,7 @@ const toolbarButtons: Button[] = [
label: 'Shapes',
evaluate: {
name: 'evaluate.cornerstone.segmentation',
options: { toolNames: ['CircleScissor', 'SphereScissor', 'RectangleScissor'] },
toolNames: ['CircleScissor', 'SphereScissor', 'RectangleScissor'],
},
icon: 'icon-tool-shape',
commands: _createSetToolActiveCommands('CircleScissor'),
+18 -4
View File
@@ -41,7 +41,6 @@ function createTools(utilityModule) {
parentTool: 'Brush',
configuration: {
activeStrategy: 'THRESHOLD_INSIDE_CIRCLE',
dynamicRadius: 3,
},
},
{
@@ -49,7 +48,22 @@ function createTools(utilityModule) {
parentTool: 'Brush',
configuration: {
activeStrategy: 'THRESHOLD_INSIDE_SPHERE',
dynamicRadius: 3,
},
},
{
toolName: 'ThresholdCircularBrushDynamic',
parentTool: 'Brush',
configuration: {
activeStrategy: 'THRESHOLD_INSIDE_CIRCLE',
preview: {
enabled: true,
},
strategySpecificConfiguration: {
THRESHOLD: {
isDynamic: true,
dynamicRadius: 3,
},
},
},
},
{ toolName: toolNames.CircleScissors },
@@ -58,10 +72,10 @@ function createTools(utilityModule) {
{ toolName: toolNames.StackScroll },
{ toolName: toolNames.Magnify },
{ toolName: toolNames.SegmentationDisplay },
{ toolName: toolNames.AdvancedMagnify },
{ toolName: toolNames.UltrasoundDirectional },
],
disabled: [{ toolName: toolNames.ReferenceLines }],
disabled: [{ toolName: toolNames.ReferenceLines }, { toolName: toolNames.AdvancedMagnify }],
};
}
+14 -8
View File
@@ -24,7 +24,7 @@ const toolbarButtons: Button[] = [
label: 'Brush',
evaluate: {
name: 'evaluate.cornerstone.segmentation',
options: { toolNames: ['CircularBrush', 'SphereBrush'] },
toolNames: ['CircularBrush', 'SphereBrush'],
disabledText: 'Create new segmentation to enable this tool.',
},
commands: _createSetToolActiveCommands('CircularBrush'),
@@ -61,9 +61,7 @@ const toolbarButtons: Button[] = [
label: 'Eraser',
evaluate: {
name: 'evaluate.cornerstone.segmentation',
options: {
toolNames: ['CircularEraser', 'SphereEraser'],
},
toolNames: ['CircularEraser', 'SphereEraser'],
},
commands: _createSetToolActiveCommands('CircularEraser'),
options: [
@@ -99,7 +97,7 @@ const toolbarButtons: Button[] = [
label: 'Threshold Tool',
evaluate: {
name: 'evaluate.cornerstone.segmentation',
options: { toolNames: ['ThresholdCircularBrush', 'ThresholdSphereBrush'] },
toolNames: ['ThresholdCircularBrush', 'ThresholdSphereBrush'],
},
commands: _createSetToolActiveCommands('ThresholdCircularBrush'),
options: [
@@ -138,8 +136,16 @@ const toolbarButtons: Button[] = [
{ value: 'ThresholdDynamic', label: 'Dynamic' },
{ value: 'ThresholdRange', label: 'Range' },
],
commands: {
commandName: 'toggleThresholdRangeAndDynamic',
commands: ({ value, commandsManager }) => {
if (value === 'ThresholdDynamic') {
commandsManager.run('setToolActive', {
toolName: 'ThresholdCircularBrushDynamic',
});
} else {
commandsManager.run('setToolActive', {
toolName: 'ThresholdCircularBrush',
});
}
},
},
{
@@ -171,7 +177,7 @@ const toolbarButtons: Button[] = [
label: 'Shapes',
evaluate: {
name: 'evaluate.cornerstone.segmentation',
options: { toolNames: ['CircleScissor', 'SphereScissor', 'RectangleScissor'] },
toolNames: ['CircleScissor', 'SphereScissor', 'RectangleScissor'],
},
icon: 'icon-tool-shape',
commands: _createSetToolActiveCommands('CircleScissor'),
+5 -19
View File
@@ -13,21 +13,7 @@ const ReferenceLinesListeners: RunCommand = [
export const setToolActiveToolbar = {
commandName: 'setToolActiveToolbar',
commandOptions: {
toolGroupIds: ['default', 'mpr', 'SRToolGroup'],
},
};
export const toggleEnabledDisabledToolbar = {
commandName: 'toggleEnabledDisabledToolbar',
commandOptions: {
toolGroupIds: ['default', 'mpr', 'SRToolGroup'],
},
};
export const toggleActiveDisabledToolbar = {
commandName: 'toggleActiveDisabledToolbar',
commandOptions: {
toolGroupIds: ['default', 'mpr', 'SRToolGroup'],
toolGroupIds: ['default', 'mpr', 'SRToolGroup', 'volume3d'],
},
};
@@ -163,7 +149,7 @@ const toolbarButtons: Button[] = [
icon: 'tool-referenceLines',
label: 'Reference Lines',
tooltip: 'Show Reference Lines',
commands: toggleEnabledDisabledToolbar,
commands: 'toggleEnabledDisabledToolbar',
listeners: {
[ViewportGridService.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED]: ReferenceLinesListeners,
[ViewportGridService.EVENTS.VIEWPORTS_READY]: ReferenceLinesListeners,
@@ -175,7 +161,7 @@ const toolbarButtons: Button[] = [
icon: 'toggle-dicom-overlay',
label: 'Image Overlay',
tooltip: 'Toggle Image Overlay',
commands: toggleEnabledDisabledToolbar,
commands: 'toggleEnabledDisabledToolbar',
evaluate: 'evaluate.cornerstoneTool.toggle',
}),
createButton({
@@ -254,8 +240,8 @@ const toolbarButtons: Button[] = [
icon: 'icon-tool-loupe',
label: 'Loupe',
tooltip: 'Loupe',
commands: toggleActiveDisabledToolbar,
evaluate: 'evaluate.cornerstoneTool',
commands: 'toggleActiveDisabledToolbar',
evaluate: 'evaluate.cornerstoneTool.toggle.ifStrictlyDisabled',
}),
createButton({
id: 'UltrasoundDirectionalTool',
+1
View File
@@ -184,6 +184,7 @@ function modeFactory({ modeConfiguration }) {
const isValid =
modalities_list.includes('CT') &&
study.mrn !== 'M1' &&
modalities_list.includes('PT') &&
!invalidModalities.some(modality => modalities_list.includes(modality)) &&
// This is study is a 4D study with PT and CT and not a 3D study for the tmtv