fix(SegmentationTools): [Bug] Changes of brush/eraser radius with hotkey do not reflect on segmentation tool (#5535)
This commit is contained in:
1 parent
0c8ab01d34
commit
29bd87c8c0
27 files changed
+472
-267
No files matched your search
@@ -0,0 +1,2 @@
|
||||
export const MIN_SEGMENTATION_DRAWING_RADIUS = 0.5;
|
||||
export const MAX_SEGMENTATION_DRAWING_RADIUS = 99.5;
|
||||
@@ -1,3 +1,5 @@
|
||||
import { MIN_SEGMENTATION_DRAWING_RADIUS, MAX_SEGMENTATION_DRAWING_RADIUS } from './constants';
|
||||
|
||||
const colours = {
|
||||
'viewport-0': 'rgb(200, 0, 0)',
|
||||
'viewport-1': 'rgb(200, 200, 0)',
|
||||
@@ -32,6 +34,8 @@ function createTools({ utilityModule, commandsManager }) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'FILL_INSIDE_CIRCLE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -48,6 +52,8 @@ function createTools({ utilityModule, commandsManager }) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'ERASE_INSIDE_CIRCLE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -55,6 +61,8 @@ function createTools({ utilityModule, commandsManager }) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'FILL_INSIDE_SPHERE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -62,6 +70,8 @@ function createTools({ utilityModule, commandsManager }) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'ERASE_INSIDE_SPHERE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -69,6 +79,8 @@ function createTools({ utilityModule, commandsManager }) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'THRESHOLD_INSIDE_CIRCLE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -76,6 +88,8 @@ function createTools({ utilityModule, commandsManager }) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'THRESHOLD_INSIDE_SPHERE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -83,6 +97,8 @@ function createTools({ utilityModule, commandsManager }) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'THRESHOLD_INSIDE_CIRCLE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
threshold: {
|
||||
isDynamic: true,
|
||||
dynamicRadius: 3,
|
||||
@@ -100,6 +116,8 @@ function createTools({ utilityModule, commandsManager }) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'THRESHOLD_INSIDE_SPHERE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
threshold: {
|
||||
isDynamic: true,
|
||||
dynamicRadius: 3,
|
||||
|
||||
@@ -2,6 +2,8 @@ import type { Button } from '@ohif/core/types';
|
||||
import { ViewportGridService } from '@ohif/core';
|
||||
import i18n from 'i18next';
|
||||
|
||||
import { MIN_SEGMENTATION_DRAWING_RADIUS, MAX_SEGMENTATION_DRAWING_RADIUS } from './constants';
|
||||
|
||||
const setToolActiveToolbar = {
|
||||
commandName: 'setToolActiveToolbar',
|
||||
commandOptions: {
|
||||
@@ -651,6 +653,10 @@ const toolbarButtons: Button[] = [
|
||||
toolNames: ['CircularBrush', 'SphereBrush'],
|
||||
disabledText: i18n.t('Buttons:Create new segmentation to enable this tool.'),
|
||||
},
|
||||
{
|
||||
name: 'evaluate.cornerstone.segmentation.synchronizeDrawingRadius',
|
||||
radiusOptionId: 'brush-radius',
|
||||
},
|
||||
{
|
||||
name: 'evaluate.cornerstone.hasSegmentationOfType',
|
||||
segmentationRepresentationType: 'Labelmap',
|
||||
@@ -667,8 +673,9 @@ const toolbarButtons: Button[] = [
|
||||
name: 'Radius (mm)',
|
||||
id: 'brush-radius',
|
||||
type: 'range',
|
||||
min: 0.5,
|
||||
max: 99.5,
|
||||
explicitRunOnly: true,
|
||||
min: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
max: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
step: 0.5,
|
||||
value: 25,
|
||||
commands: [
|
||||
@@ -894,6 +901,10 @@ const toolbarButtons: Button[] = [
|
||||
name: 'evaluate.cornerstone.segmentation',
|
||||
toolNames: ['CircularEraser', 'SphereEraser'],
|
||||
},
|
||||
{
|
||||
name: 'evaluate.cornerstone.segmentation.synchronizeDrawingRadius',
|
||||
radiusOptionId: 'eraser-radius',
|
||||
},
|
||||
{
|
||||
name: 'evaluate.cornerstone.hasSegmentationOfType',
|
||||
segmentationRepresentationType: 'Labelmap',
|
||||
@@ -904,8 +915,9 @@ const toolbarButtons: Button[] = [
|
||||
name: 'Radius (mm)',
|
||||
id: 'eraser-radius',
|
||||
type: 'range',
|
||||
min: 0.5,
|
||||
max: 99.5,
|
||||
explicitRunOnly: true,
|
||||
min: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
max: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
step: 0.5,
|
||||
value: 25,
|
||||
commands: {
|
||||
@@ -949,6 +961,10 @@ const toolbarButtons: Button[] = [
|
||||
'ThresholdSphereBrushDynamic',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'evaluate.cornerstone.segmentation.synchronizeDrawingRadius',
|
||||
radiusOptionId: 'threshold-radius',
|
||||
},
|
||||
{
|
||||
name: 'evaluate.cornerstone.hasSegmentationOfType',
|
||||
segmentationRepresentationType: 'Labelmap',
|
||||
@@ -960,14 +976,14 @@ const toolbarButtons: Button[] = [
|
||||
segmentationRepresentationType: 'Labelmap',
|
||||
},
|
||||
},
|
||||
|
||||
options: [
|
||||
{
|
||||
name: 'Radius (mm)',
|
||||
id: 'threshold-radius',
|
||||
type: 'range',
|
||||
min: 0.5,
|
||||
max: 99.5,
|
||||
explicitRunOnly: true,
|
||||
min: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
max: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
step: 0.5,
|
||||
value: 25,
|
||||
commands: {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export const MIN_SEGMENTATION_DRAWING_RADIUS = 0.5;
|
||||
export const MAX_SEGMENTATION_DRAWING_RADIUS = 99.5;
|
||||
@@ -1,3 +1,5 @@
|
||||
import { MIN_SEGMENTATION_DRAWING_RADIUS, MAX_SEGMENTATION_DRAWING_RADIUS } from './constants';
|
||||
|
||||
export const toolGroupIds = {
|
||||
CT: 'ctToolGroup',
|
||||
PT: 'ptToolGroup',
|
||||
@@ -61,6 +63,8 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'FILL_INSIDE_CIRCLE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -68,6 +72,8 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'ERASE_INSIDE_CIRCLE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -75,6 +81,8 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'FILL_INSIDE_SPHERE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -82,6 +90,8 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'ERASE_INSIDE_SPHERE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -89,6 +99,8 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'THRESHOLD_INSIDE_CIRCLE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -96,6 +108,8 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
parentTool: 'Brush',
|
||||
configuration: {
|
||||
activeStrategy: 'THRESHOLD_INSIDE_SPHERE',
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -110,6 +124,8 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
|
||||
isDynamic: true,
|
||||
dynamicRadius: 3,
|
||||
},
|
||||
minRadius: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
maxRadius: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { toolGroupIds } from './initToolGroups';
|
||||
import i18n from 'i18next';
|
||||
|
||||
import { MIN_SEGMENTATION_DRAWING_RADIUS, MAX_SEGMENTATION_DRAWING_RADIUS } from './constants';
|
||||
|
||||
const setToolActiveToolbar = {
|
||||
commandName: 'setToolActiveToolbar',
|
||||
commandOptions: {
|
||||
@@ -205,18 +207,25 @@ const toolbarButtons = [
|
||||
props: {
|
||||
icon: 'icon-tool-brush',
|
||||
label: i18n.t('Buttons:Brush'),
|
||||
evaluate: {
|
||||
name: 'evaluate.cornerstone.segmentation',
|
||||
toolNames: ['CircularBrush', 'SphereBrush'],
|
||||
disabledText: i18n.t('Buttons:Create new segmentation to enable this tool.'),
|
||||
},
|
||||
evaluate: [
|
||||
{
|
||||
name: 'evaluate.cornerstone.segmentation',
|
||||
toolNames: ['CircularBrush', 'SphereBrush'],
|
||||
disabledText: i18n.t('Buttons:Create new segmentation to enable this tool.'),
|
||||
},
|
||||
{
|
||||
name: 'evaluate.cornerstone.segmentation.synchronizeDrawingRadius',
|
||||
radiusOptionId: 'brush-radius',
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: 'Radius (mm)',
|
||||
id: 'brush-radius',
|
||||
type: 'range',
|
||||
min: 0.5,
|
||||
max: 99.5,
|
||||
explicitRunOnly: true,
|
||||
min: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
max: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
step: 0.5,
|
||||
value: 25,
|
||||
commands: {
|
||||
@@ -244,17 +253,24 @@ const toolbarButtons = [
|
||||
props: {
|
||||
icon: 'icon-tool-eraser',
|
||||
label: i18n.t('Buttons:Eraser'),
|
||||
evaluate: {
|
||||
name: 'evaluate.cornerstone.segmentation',
|
||||
toolNames: ['CircularEraser', 'SphereEraser'],
|
||||
},
|
||||
evaluate: [
|
||||
{
|
||||
name: 'evaluate.cornerstone.segmentation',
|
||||
toolNames: ['CircularEraser', 'SphereEraser'],
|
||||
},
|
||||
{
|
||||
name: 'evaluate.cornerstone.segmentation.synchronizeDrawingRadius',
|
||||
radiusOptionId: 'eraser-radius',
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: 'Radius (mm)',
|
||||
id: 'eraser-radius',
|
||||
type: 'range',
|
||||
min: 0.5,
|
||||
max: 99.5,
|
||||
explicitRunOnly: true,
|
||||
min: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
max: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
step: 0.5,
|
||||
value: 25,
|
||||
commands: {
|
||||
@@ -282,17 +298,24 @@ const toolbarButtons = [
|
||||
props: {
|
||||
icon: 'icon-tool-threshold',
|
||||
label: i18n.t('Buttons:Threshold Tool'),
|
||||
evaluate: {
|
||||
name: 'evaluate.cornerstone.segmentation',
|
||||
toolNames: ['ThresholdCircularBrush', 'ThresholdSphereBrush'],
|
||||
},
|
||||
evaluate: [
|
||||
{
|
||||
name: 'evaluate.cornerstone.segmentation',
|
||||
toolNames: ['ThresholdCircularBrush', 'ThresholdSphereBrush'],
|
||||
},
|
||||
{
|
||||
name: 'evaluate.cornerstone.segmentation.synchronizeDrawingRadius',
|
||||
radiusOptionId: 'threshold-radius',
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: 'Radius (mm)',
|
||||
id: 'threshold-radius',
|
||||
type: 'range',
|
||||
min: 0.5,
|
||||
max: 99.5,
|
||||
explicitRunOnly: true,
|
||||
min: MIN_SEGMENTATION_DRAWING_RADIUS,
|
||||
max: MAX_SEGMENTATION_DRAWING_RADIUS,
|
||||
step: 0.5,
|
||||
value: 25,
|
||||
commands: {
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "7.28.2",
|
||||
"@cornerstonejs/core": "4.5.20",
|
||||
"@cornerstonejs/tools": "4.5.20",
|
||||
"@cornerstonejs/core": "4.9.0",
|
||||
"@cornerstonejs/tools": "4.9.0",
|
||||
"@ohif/core": "3.12.0-beta.80",
|
||||
"@ohif/extension-cornerstone-dicom-sr": "3.12.0-beta.80",
|
||||
"@ohif/extension-ultrasound-pleura-bline": "3.12.0-beta.80",
|
||||
|
||||
Reference in new issue
Block a user