fix(crosshairs): reset angle, position, and slabthickness for crosshairs when reset viewport tool is used (#4113)
Co-authored-by: Alireza <ar.sedghi@gmail.com>
This commit is contained in:
1 parent
1124c409e9
commit
73d9e99d5d
17 files changed
+200
-49
No files matched your search
@@ -77,9 +77,12 @@ function initDefaultToolGroup(
|
||||
{ toolName: toolNames.Magnify },
|
||||
{ toolName: toolNames.SegmentationDisplay },
|
||||
{ toolName: toolNames.CalibrationLine },
|
||||
{ toolName: toolNames.PlanarFreehandContourSegmentation, configuration: {
|
||||
displayOnePointAsCrosshairs: true,
|
||||
} },
|
||||
{
|
||||
toolName: toolNames.PlanarFreehandContourSegmentation,
|
||||
configuration: {
|
||||
displayOnePointAsCrosshairs: true,
|
||||
},
|
||||
},
|
||||
{ toolName: toolNames.UltrasoundDirectional },
|
||||
{ toolName: toolNames.PlanarFreehandROI },
|
||||
{ toolName: toolNames.SplineROI },
|
||||
@@ -150,9 +153,12 @@ function initSRToolGroup(extensionManager, toolGroupService) {
|
||||
{ toolName: SRToolNames.SRCircleROI },
|
||||
{ toolName: SRToolNames.SRPlanarFreehandROI },
|
||||
{ toolName: SRToolNames.SRRectangleROI },
|
||||
{ toolName: SRToolNames.SRPlanarFreehandContourSegmentation, configuration: {
|
||||
displayOnePointAsCrosshairs: true,
|
||||
} },
|
||||
{
|
||||
toolName: SRToolNames.SRPlanarFreehandContourSegmentation,
|
||||
configuration: {
|
||||
displayOnePointAsCrosshairs: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
enabled: [
|
||||
{
|
||||
@@ -230,15 +236,23 @@ function initMPRToolGroup(extensionManager, toolGroupService, commandsManager, m
|
||||
{ toolName: toolNames.CobbAngle },
|
||||
{ toolName: toolNames.PlanarFreehandROI },
|
||||
{ toolName: toolNames.SegmentationDisplay },
|
||||
{ toolName: toolNames.PlanarFreehandContourSegmentation, configuration: {
|
||||
displayOnePointAsCrosshairs: true,
|
||||
} },
|
||||
{
|
||||
toolName: toolNames.PlanarFreehandContourSegmentation,
|
||||
configuration: {
|
||||
displayOnePointAsCrosshairs: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
disabled: [
|
||||
{
|
||||
toolName: toolNames.Crosshairs,
|
||||
configuration: {
|
||||
viewportIndicators: false,
|
||||
viewportIndicators: true,
|
||||
viewportIndicatorsConfig: {
|
||||
circleRadius: 5,
|
||||
xOffset: 0.95,
|
||||
yOffset: 0.05,
|
||||
},
|
||||
disableOnPassive: true,
|
||||
autoPan: {
|
||||
enabled: false,
|
||||
|
||||
@@ -55,7 +55,7 @@ function modeFactory({ modeConfiguration }) {
|
||||
const { toolNames, Enums } = utilityModule.exports;
|
||||
|
||||
measurementService.clearMeasurements();
|
||||
initToolGroups({ toolNames, Enums, toolGroupService, commandsManager });
|
||||
initToolGroups({ toolNames, Enums, toolGroupService, commandsManager, servicesManager });
|
||||
|
||||
toolbarService.addButtons([...toolbarButtons, ...segmentationButtons]);
|
||||
toolbarService.createButtonSection('secondary', ['ProgressDropdown']);
|
||||
|
||||
@@ -5,7 +5,20 @@ const toolGroupIds = {
|
||||
CT: 'dynamic4D-ct',
|
||||
};
|
||||
|
||||
function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
const colours = {
|
||||
'viewport-0': 'rgb(200, 0, 0)',
|
||||
'viewport-1': 'rgb(200, 200, 0)',
|
||||
'viewport-2': 'rgb(0, 200, 0)',
|
||||
};
|
||||
|
||||
const colorsByOrientation = {
|
||||
axial: 'rgb(200, 0, 0)',
|
||||
sagittal: 'rgb(200, 200, 0)',
|
||||
coronal: 'rgb(0, 200, 0)',
|
||||
};
|
||||
|
||||
function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, servicesManager) {
|
||||
const { cornerstoneViewportService } = servicesManager.services;
|
||||
const tools = {
|
||||
active: [
|
||||
{
|
||||
@@ -94,12 +107,31 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
{
|
||||
toolName: toolNames.Crosshairs,
|
||||
configuration: {
|
||||
viewportIndicators: false,
|
||||
viewportIndicators: true,
|
||||
viewportIndicatorsConfig: {
|
||||
circleRadius: 5,
|
||||
xOffset: 0.95,
|
||||
yOffset: 0.05,
|
||||
},
|
||||
disableOnPassive: true,
|
||||
autoPan: {
|
||||
enabled: false,
|
||||
panSize: 10,
|
||||
},
|
||||
getReferenceLineColor: viewportId => {
|
||||
const viewportInfo = cornerstoneViewportService.getViewportInfo(viewportId);
|
||||
const viewportOptions = viewportInfo?.viewportOptions;
|
||||
if (viewportOptions) {
|
||||
return (
|
||||
colours[viewportOptions.id] ||
|
||||
colorsByOrientation[viewportOptions.orientation] ||
|
||||
'#0c0'
|
||||
);
|
||||
} else {
|
||||
console.warn('missing viewport?', viewportId);
|
||||
return '#0c0';
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -123,8 +155,8 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
toolGroupService.createToolGroupAndAddTools(toolGroupIds.default, tools);
|
||||
}
|
||||
|
||||
function initToolGroups({ toolNames, Enums, toolGroupService, commandsManager }) {
|
||||
_initToolGroups(toolNames, Enums, toolGroupService, commandsManager);
|
||||
function initToolGroups({ toolNames, Enums, toolGroupService, commandsManager, servicesManager }) {
|
||||
_initToolGroups(toolNames, Enums, toolGroupService, commandsManager, servicesManager);
|
||||
}
|
||||
|
||||
export { initToolGroups as default, toolGroupIds };
|
||||
@@ -1,3 +1,15 @@
|
||||
const colours = {
|
||||
'viewport-0': 'rgb(200, 0, 0)',
|
||||
'viewport-1': 'rgb(200, 200, 0)',
|
||||
'viewport-2': 'rgb(0, 200, 0)',
|
||||
};
|
||||
|
||||
const colorsByOrientation = {
|
||||
axial: 'rgb(200, 0, 0)',
|
||||
sagittal: 'rgb(200, 200, 0)',
|
||||
coronal: 'rgb(0, 200, 0)',
|
||||
};
|
||||
|
||||
function createTools(utilityModule) {
|
||||
const { toolNames, Enums } = utilityModule.exports;
|
||||
return {
|
||||
@@ -94,17 +106,38 @@ function initMPRToolGroup(extensionManager, toolGroupService, commandsManager) {
|
||||
const utilityModule = extensionManager.getModuleEntry(
|
||||
'@ohif/extension-cornerstone.utilityModule.tools'
|
||||
);
|
||||
const servicesManager = extensionManager._servicesManager;
|
||||
const { cornerstoneViewportService } = servicesManager.services;
|
||||
const tools = createTools(utilityModule);
|
||||
tools.disabled.push(
|
||||
{
|
||||
toolName: utilityModule.exports.toolNames.Crosshairs,
|
||||
configuration: {
|
||||
viewportIndicators: false,
|
||||
viewportIndicators: true,
|
||||
viewportIndicatorsConfig: {
|
||||
circleRadius: 5,
|
||||
xOffset: 0.95,
|
||||
yOffset: 0.05,
|
||||
},
|
||||
disableOnPassive: true,
|
||||
autoPan: {
|
||||
enabled: false,
|
||||
panSize: 10,
|
||||
},
|
||||
getReferenceLineColor: viewportId => {
|
||||
const viewportInfo = cornerstoneViewportService.getViewportInfo(viewportId);
|
||||
const viewportOptions = viewportInfo?.viewportOptions;
|
||||
if (viewportOptions) {
|
||||
return (
|
||||
colours[viewportOptions.id] ||
|
||||
colorsByOrientation[viewportOptions.orientation] ||
|
||||
'#0c0'
|
||||
);
|
||||
} else {
|
||||
console.warn('missing viewport?', viewportId);
|
||||
return '#0c0';
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
{ toolName: utilityModule.exports.toolNames.ReferenceLines }
|
||||
|
||||
@@ -63,7 +63,7 @@ function modeFactory({ modeConfiguration }) {
|
||||
const { toolNames, Enums } = utilityModule.exports;
|
||||
|
||||
// Init Default and SR ToolGroups
|
||||
initToolGroups(toolNames, Enums, toolGroupService, commandsManager);
|
||||
initToolGroups(toolNames, Enums, toolGroupService, commandsManager, null, servicesManager);
|
||||
|
||||
const { unsubscribe } = toolGroupService.subscribe(
|
||||
toolGroupService.EVENTS.VIEWPORT_ADDED,
|
||||
|
||||
@@ -6,7 +6,14 @@ export const toolGroupIds = {
|
||||
default: 'default',
|
||||
};
|
||||
|
||||
function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, modeLabelConfig) {
|
||||
function _initToolGroups(
|
||||
toolNames,
|
||||
Enums,
|
||||
toolGroupService,
|
||||
commandsManager,
|
||||
modeLabelConfig,
|
||||
servicesManager
|
||||
) {
|
||||
const tools = {
|
||||
active: [
|
||||
{
|
||||
@@ -125,7 +132,12 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, mo
|
||||
{
|
||||
toolName: toolNames.Crosshairs,
|
||||
configuration: {
|
||||
viewportIndicators: false,
|
||||
viewportIndicators: true,
|
||||
viewportIndicatorsConfig: {
|
||||
circleRadius: 5,
|
||||
xOffset: 0.95,
|
||||
yOffset: 0.05,
|
||||
},
|
||||
disableOnPassive: true,
|
||||
autoPan: {
|
||||
enabled: false,
|
||||
@@ -178,8 +190,22 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager, mo
|
||||
toolGroupService.createToolGroupAndAddTools(toolGroupIds.MIP, mipTools);
|
||||
}
|
||||
|
||||
function initToolGroups(toolNames, Enums, toolGroupService, commandsManager, modeLabelConfig) {
|
||||
_initToolGroups(toolNames, Enums, toolGroupService, commandsManager, modeLabelConfig);
|
||||
function initToolGroups(
|
||||
toolNames,
|
||||
Enums,
|
||||
toolGroupService,
|
||||
commandsManager,
|
||||
modeLabelConfig,
|
||||
servicesManager
|
||||
) {
|
||||
_initToolGroups(
|
||||
toolNames,
|
||||
Enums,
|
||||
toolGroupService,
|
||||
commandsManager,
|
||||
modeLabelConfig,
|
||||
servicesManager
|
||||
);
|
||||
}
|
||||
|
||||
export default initToolGroups;
|
||||
Reference in new issue
Block a user