fix(SegmentationPanel): should be able to hide and only show one segment (#3270)
* fix(SegmentationPanel): should be able to hide and only show one segment * fix imports * bump package versions
This commit is contained in:
parent
3b6822e7b6
commit
4e94b588a7
@ -46,7 +46,7 @@
|
|||||||
"@babel/runtime": "^7.20.13",
|
"@babel/runtime": "^7.20.13",
|
||||||
"classnames": "^2.3.2",
|
"classnames": "^2.3.2",
|
||||||
"@cornerstonejs/adapters": "^0.4.1",
|
"@cornerstonejs/adapters": "^0.4.1",
|
||||||
"@cornerstonejs/core": "^0.36.0",
|
"@cornerstonejs/core": "^0.36.2",
|
||||||
"@cornerstonejs/tools": "^0.50.2"
|
"@cornerstonejs/tools": "^0.55.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,9 +44,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.13",
|
"@babel/runtime": "^7.20.13",
|
||||||
"@cornerstonejs/adapters": "^0.4.1",
|
"@cornerstonejs/adapters": "^0.4.1",
|
||||||
"@cornerstonejs/core": "^0.36.0",
|
"@cornerstonejs/core": "^0.36.2",
|
||||||
"@cornerstonejs/streaming-image-volume-loader": "^0.14.1",
|
"@cornerstonejs/streaming-image-volume-loader": "^0.15.1",
|
||||||
"@cornerstonejs/tools": "^0.50.2",
|
"@cornerstonejs/tools": "^0.55.1",
|
||||||
"@kitware/vtk.js": "26.5.6",
|
"@kitware/vtk.js": "26.5.6",
|
||||||
"html2canvas": "^1.4.1",
|
"html2canvas": "^1.4.1",
|
||||||
"lodash.debounce": "4.0.8",
|
"lodash.debounce": "4.0.8",
|
||||||
|
|||||||
@ -151,5 +151,6 @@ const cornerstoneExtension: Types.Extensions.Extension = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type { PublicViewportOptions };
|
||||||
|
export { measurementMappingUtils };
|
||||||
export default cornerstoneExtension;
|
export default cornerstoneExtension;
|
||||||
export { measurementMappingUtils, PublicViewportOptions };
|
|
||||||
|
|||||||
@ -1,22 +1,22 @@
|
|||||||
import cloneDeep from 'lodash.clonedeep';
|
import cloneDeep from 'lodash.clonedeep';
|
||||||
|
|
||||||
import { pubSubServiceInterface } from '@ohif/core';
|
|
||||||
import {
|
import {
|
||||||
utilities as cstUtils,
|
|
||||||
segmentation as cstSegmentation,
|
|
||||||
CONSTANTS as cstConstants,
|
|
||||||
Enums as csToolsEnums,
|
|
||||||
Types as cstTypes,
|
|
||||||
} from '@cornerstonejs/tools';
|
|
||||||
import {
|
|
||||||
eventTarget,
|
|
||||||
cache,
|
cache,
|
||||||
|
eventTarget,
|
||||||
|
getEnabledElementByIds,
|
||||||
|
metaData,
|
||||||
|
Types,
|
||||||
utilities as csUtils,
|
utilities as csUtils,
|
||||||
volumeLoader,
|
volumeLoader,
|
||||||
Types,
|
|
||||||
metaData,
|
|
||||||
getEnabledElementByIds,
|
|
||||||
} from '@cornerstonejs/core';
|
} from '@cornerstonejs/core';
|
||||||
|
import {
|
||||||
|
CONSTANTS as cstConstants,
|
||||||
|
Enums as csToolsEnums,
|
||||||
|
segmentation as cstSegmentation,
|
||||||
|
Types as cstTypes,
|
||||||
|
utilities as cstUtils,
|
||||||
|
} from '@cornerstonejs/tools';
|
||||||
|
import { pubSubServiceInterface } from '@ohif/core';
|
||||||
import isEqual from 'lodash.isequal';
|
import isEqual from 'lodash.isequal';
|
||||||
import { easeInOutBell } from '../../utils/transitions';
|
import { easeInOutBell } from '../../utils/transitions';
|
||||||
import {
|
import {
|
||||||
@ -202,7 +202,7 @@ class SegmentationService {
|
|||||||
this._setActiveSegment(segmentationId, segmentIndex, suppressEvents);
|
this._setActiveSegment(segmentationId, segmentIndex, suppressEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Todo: this includes nonhydrated segmentations which might not be
|
// Todo: this includes non-hydrated segmentations which might not be
|
||||||
// persisted in the store
|
// persisted in the store
|
||||||
this._broadcastEvent(this.EVENTS.SEGMENTATION_UPDATED, {
|
this._broadcastEvent(this.EVENTS.SEGMENTATION_UPDATED, {
|
||||||
segmentation,
|
segmentation,
|
||||||
@ -1598,6 +1598,13 @@ class SegmentationService {
|
|||||||
isVisible
|
isVisible
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// make sure to update the isVisible flag on the segmentation
|
||||||
|
// if a segment becomes invisible then the segmentation should be invisible
|
||||||
|
// in the status as well, and show correct icon
|
||||||
|
segmentation.isVisible = segmentation.segments
|
||||||
|
.filter(Boolean)
|
||||||
|
.every(segment => segment.isVisible);
|
||||||
|
|
||||||
if (suppressEvents === false) {
|
if (suppressEvents === false) {
|
||||||
this._broadcastEvent(this.EVENTS.SEGMENTATION_UPDATED, {
|
this._broadcastEvent(this.EVENTS.SEGMENTATION_UPDATED, {
|
||||||
segmentation,
|
segmentation,
|
||||||
@ -1917,28 +1924,27 @@ class SegmentationService {
|
|||||||
representation => representation.segmentationId === segmentationId
|
representation => representation.segmentationId === segmentationId
|
||||||
);
|
);
|
||||||
|
|
||||||
const visibility = cstSegmentation.config.visibility.getSegmentationVisibility(
|
const { segmentsHidden } = representation;
|
||||||
toolGroupId,
|
|
||||||
representation.segmentationRepresentationUID
|
const currentVisibility = segmentsHidden.size === 0 ? true : false;
|
||||||
);
|
const newVisibility = !currentVisibility;
|
||||||
|
|
||||||
cstSegmentation.config.visibility.setSegmentationVisibility(
|
cstSegmentation.config.visibility.setSegmentationVisibility(
|
||||||
toolGroupId,
|
toolGroupId,
|
||||||
representation.segmentationRepresentationUID,
|
representation.segmentationRepresentationUID,
|
||||||
!visibility
|
newVisibility
|
||||||
);
|
);
|
||||||
|
|
||||||
// set all segments to visible as well
|
// update segments visibility
|
||||||
const segments = this.getSegmentation(segmentationId).segments;
|
const { segmentation } = this._getSegmentationInfo(
|
||||||
Object.keys(segments).forEach(segmentIndex => {
|
segmentationId,
|
||||||
if (segmentIndex !== '0') {
|
toolGroupId
|
||||||
this._setSegmentVisibility(
|
);
|
||||||
segmentationId,
|
|
||||||
Number(segmentIndex),
|
const segments = segmentation.segments.filter(Boolean);
|
||||||
!visibility,
|
|
||||||
toolGroupId
|
segments.forEach(segment => {
|
||||||
);
|
segment.isVisible = newVisibility;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
import { Types, Enums } from '@cornerstonejs/core';
|
import { Types, Enums } from '@cornerstonejs/core';
|
||||||
import { Types as UITypes } from '@ohif/ui';
|
import { Types as UITypes } from '@ohif/ui';
|
||||||
|
import {
|
||||||
|
StackViewportData,
|
||||||
|
VolumeViewportData,
|
||||||
|
} from '../../types/CornerstoneCacheService';
|
||||||
import getCornerstoneBlendMode from '../../utils/getCornerstoneBlendMode';
|
import getCornerstoneBlendMode from '../../utils/getCornerstoneBlendMode';
|
||||||
import getCornerstoneOrientation from '../../utils/getCornerstoneOrientation';
|
import getCornerstoneOrientation from '../../utils/getCornerstoneOrientation';
|
||||||
import getCornerstoneViewportType from '../../utils/getCornerstoneViewportType';
|
import getCornerstoneViewportType from '../../utils/getCornerstoneViewportType';
|
||||||
import JumpPresets from '../../utils/JumpPresets';
|
import JumpPresets from '../../utils/JumpPresets';
|
||||||
import { SyncGroup } from '../SyncGroupService/SyncGroupService';
|
import { SyncGroup } from '../SyncGroupService/SyncGroupService';
|
||||||
import {
|
|
||||||
StackViewportData,
|
|
||||||
VolumeViewportData,
|
|
||||||
} from '../../types/CornerstoneCacheService';
|
|
||||||
|
|
||||||
export type InitialImageOptions = {
|
export type InitialImageOptions = {
|
||||||
index?: number;
|
index?: number;
|
||||||
@ -247,7 +247,7 @@ class ViewportInfo {
|
|||||||
return this.viewportOptions.background || [0, 0, 0];
|
return this.viewportOptions.background || [0, 0, 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public getOrientation(): Types.Orientation {
|
public getOrientation(): Enums.OrientationAxis {
|
||||||
return this.viewportOptions.orientation;
|
return this.viewportOptions.orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { Enums } from '@cornerstonejs/core';
|
import { Enums } from '@cornerstonejs/core';
|
||||||
import { log } from '@ohif/core';
|
|
||||||
|
|
||||||
const AXIAL = 'axial';
|
const AXIAL = 'axial';
|
||||||
const SAGITTAL = 'sagittal';
|
const SAGITTAL = 'sagittal';
|
||||||
|
|||||||
@ -32,8 +32,8 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@ohif/core": "^3.0.0",
|
"@ohif/core": "^3.0.0",
|
||||||
"classnames": "^2.3.2",
|
"classnames": "^2.3.2",
|
||||||
"@cornerstonejs/core": "^0.36.0",
|
"@cornerstonejs/core": "^0.36.2",
|
||||||
"@cornerstonejs/tools": "^0.50.2",
|
"@cornerstonejs/tools": "^0.55.1",
|
||||||
"@ohif/extension-cornerstone-dicom-sr": "^3.0.0",
|
"@ohif/extension-cornerstone-dicom-sr": "^3.0.0",
|
||||||
"dcmjs": "^0.29.4",
|
"dcmjs": "^0.29.4",
|
||||||
"lodash.debounce": "^4.17.21",
|
"lodash.debounce": "^4.17.21",
|
||||||
|
|||||||
@ -171,9 +171,7 @@ const SegmentationGroup = ({
|
|||||||
id={id}
|
id={id}
|
||||||
showAddSegment={showAddSegment}
|
showAddSegment={showAddSegment}
|
||||||
/>
|
/>
|
||||||
<div
|
<div className="flex flex-col min-h-0 ohif-scrollbar overflow-y-hidden">
|
||||||
className="flex flex-col min-h-0 ohif-scrollbar overflow-y-hidden"
|
|
||||||
>
|
|
||||||
{!!segments.length &&
|
{!!segments.length &&
|
||||||
segments.map(segment => {
|
segments.map(segment => {
|
||||||
if (segment === undefined || segment === null) {
|
if (segment === undefined || segment === null) {
|
||||||
|
|||||||
50
yarn.lock
50
yarn.lock
@ -1443,44 +1443,36 @@
|
|||||||
resolved "https://registry.npmjs.org/@cornerstonejs/codec-openjph/-/codec-openjph-2.4.2.tgz#e96721d56f6ec96f7f95c16321d88cc8467d8d81"
|
resolved "https://registry.npmjs.org/@cornerstonejs/codec-openjph/-/codec-openjph-2.4.2.tgz#e96721d56f6ec96f7f95c16321d88cc8467d8d81"
|
||||||
integrity sha512-lgdvBvvNezleY+4pIe2ceUsJzlZe/0PipdeubQ3vZZOz3xxtHHMR1XFCl4fgd8gosR8COHuD7h6q+MwgrwBsng==
|
integrity sha512-lgdvBvvNezleY+4pIe2ceUsJzlZe/0PipdeubQ3vZZOz3xxtHHMR1XFCl4fgd8gosR8COHuD7h6q+MwgrwBsng==
|
||||||
|
|
||||||
"@cornerstonejs/core@^0.33.1":
|
"@cornerstonejs/core@^0.35.1":
|
||||||
version "0.33.1"
|
version "0.35.1"
|
||||||
resolved "https://registry.yarnpkg.com/@cornerstonejs/core/-/core-0.33.1.tgz#dfbcad81239141c2702fd2ab0a3edbe408e7bfad"
|
resolved "https://registry.npmjs.org/@cornerstonejs/core/-/core-0.35.1.tgz#fd5e9f878b51807366d9d0c6659ac91b43efed87"
|
||||||
integrity sha512-QXrnKZBEMharA/FIYqtvkTXD8JeEf742yHybNmehB1cJU1hrsjRJ1JuqXXu6IHWJFx3cAsCaWk4oZyA09OB7OQ==
|
integrity sha512-n6nFo3XVkMKmhNsF20yPznO3jo3MpOl8X+3k/HyHVlZujIsBT/jz0X4dEg/3fzA0aLPdWdZ/kkVw8TBanVKTGA==
|
||||||
dependencies:
|
dependencies:
|
||||||
detect-gpu "^4.0.45"
|
detect-gpu "^4.0.45"
|
||||||
lodash.clonedeep "4.5.0"
|
lodash.clonedeep "4.5.0"
|
||||||
|
|
||||||
"@cornerstonejs/core@^0.33.2":
|
"@cornerstonejs/core@^0.36.2":
|
||||||
version "0.33.2"
|
version "0.36.2"
|
||||||
resolved "https://registry.yarnpkg.com/@cornerstonejs/core/-/core-0.33.2.tgz#63aea3eb9787622be0c75052696119a0e58117e6"
|
resolved "https://registry.npmjs.org/@cornerstonejs/core/-/core-0.36.2.tgz#205573bfd75a273fa6bca587662b4dd1f5e46167"
|
||||||
integrity sha512-iRHq7WIcZOUxOIMV9KEY7iJjTpcpk7vJPAIZM5tqVvTIbcfaACmxpTlpc2NPqT52o0shRQImIkMFiotUKx0Pug==
|
integrity sha512-jJYawOjLGop18O426YxyBepkiaYT/xHMa3mqhToIO5KRxK/UYSGHt0RS8wSHeFR8pNkCAHepcdfhyIVkAln66g==
|
||||||
dependencies:
|
dependencies:
|
||||||
detect-gpu "^4.0.45"
|
detect-gpu "^4.0.45"
|
||||||
lodash.clonedeep "4.5.0"
|
lodash.clonedeep "4.5.0"
|
||||||
|
|
||||||
"@cornerstonejs/core@^0.36.0":
|
"@cornerstonejs/streaming-image-volume-loader@^0.15.1":
|
||||||
version "0.36.0"
|
version "0.15.1"
|
||||||
resolved "https://registry.yarnpkg.com/@cornerstonejs/core/-/core-0.36.0.tgz#b8e798e04cfceb6106ce4700b2aef14532d814f0"
|
resolved "https://registry.npmjs.org/@cornerstonejs/streaming-image-volume-loader/-/streaming-image-volume-loader-0.15.1.tgz#b9fd0efbebbd232119ef0ae7b63bf8b3498bf539"
|
||||||
integrity sha512-vU1wYhezq4x99MT3nuuNS2YVTUn1UkMJ5B9PPSyayQeWxuC0pV0KWBllUAjJA3VR3YDmDUKAfLh9K10u6javYg==
|
integrity sha512-xtBG2RlhjOX/Cd4qGLYGKXjF7oLhRtksmXpPB5nOa1BBBgrGOQHFjNuyh3uhVHg30e5po9oCfomSPHwovhexzw==
|
||||||
dependencies:
|
dependencies:
|
||||||
detect-gpu "^4.0.45"
|
"@cornerstonejs/core" "^0.35.1"
|
||||||
lodash.clonedeep "4.5.0"
|
|
||||||
|
|
||||||
"@cornerstonejs/streaming-image-volume-loader@^0.14.1":
|
|
||||||
version "0.14.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/@cornerstonejs/streaming-image-volume-loader/-/streaming-image-volume-loader-0.14.1.tgz#9830e1cbb65aa0e050336b7f5cb9c81d23e09fc5"
|
|
||||||
integrity sha512-4m2efDbv00pFQfL/ZjnWjo4RJ3yo4ibv4J/8oro7ZrzhXUJl9L4mwdA1HYCAkS+rZQndZba138AO6b+g4nrmXQ==
|
|
||||||
dependencies:
|
|
||||||
"@cornerstonejs/core" "^0.33.1"
|
|
||||||
cornerstone-wado-image-loader "^4.10.0"
|
cornerstone-wado-image-loader "^4.10.0"
|
||||||
|
|
||||||
"@cornerstonejs/tools@^0.50.2":
|
"@cornerstonejs/tools@^0.55.1":
|
||||||
version "0.50.2"
|
version "0.55.1"
|
||||||
resolved "https://registry.yarnpkg.com/@cornerstonejs/tools/-/tools-0.50.2.tgz#0134b21016ec64290b8f9a43ac1a485654ed86eb"
|
resolved "https://registry.npmjs.org/@cornerstonejs/tools/-/tools-0.55.1.tgz#cde00881c35a43f2d10c634350e46f45e8bf9a7b"
|
||||||
integrity sha512-MedGsiisDjd2eOewhojwPpWReKM13x1krKIhPNL3hi8rZjV57T8RTpWfztxSjuUpOvapmlJXutrDPuLSUXs01g==
|
integrity sha512-fYRNqnS9WXWBrkOd++nocKqjlD6p3BvFtPCJeaA8M2bdgEHEHK+KbM999GG5YTmWV88xLW4mjSl+wJvbdWUwEQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@cornerstonejs/core" "^0.33.2"
|
"@cornerstonejs/core" "^0.36.2"
|
||||||
lodash.clonedeep "4.5.0"
|
lodash.clonedeep "4.5.0"
|
||||||
lodash.get "^4.4.2"
|
lodash.get "^4.4.2"
|
||||||
|
|
||||||
@ -8528,9 +8520,9 @@ cornerstone-math@^0.1.9:
|
|||||||
integrity sha512-23XSAyP7t70ANvhFyqwvva+zFd1bQ2d5GL7tg9qKE932WmImjA2Y9tiy5n0iTtnf51W/78Png8Lia2o4dCdJaQ==
|
integrity sha512-23XSAyP7t70ANvhFyqwvva+zFd1bQ2d5GL7tg9qKE932WmImjA2Y9tiy5n0iTtnf51W/78Png8Lia2o4dCdJaQ==
|
||||||
|
|
||||||
cornerstone-wado-image-loader@^4.10.0:
|
cornerstone-wado-image-loader@^4.10.0:
|
||||||
version "4.10.0"
|
version "4.10.2"
|
||||||
resolved "https://registry.npmjs.org/cornerstone-wado-image-loader/-/cornerstone-wado-image-loader-4.10.0.tgz#25c367cfc54a2c92ebbb5c64dba4fe38439112a1"
|
resolved "https://registry.npmjs.org/cornerstone-wado-image-loader/-/cornerstone-wado-image-loader-4.10.2.tgz#139956654324fd2b01fe5b4900d0f4ed8c52633d"
|
||||||
integrity sha512-XZcgB8DpUxnsTA3vU/zbPtB2uFLL4ght70BPrQHykkX/Jlg/r6Ob7ztX2dEEAAb4ELE/d4icfGuSy10Acg/kyw==
|
integrity sha512-qj9dThELqYCm3jAZfg9qnUl8d76gngOl55kYJabY5lh/dFeVIxno/hYxy3ydE7RtG2c/TUGXb+EMUl0CJSqKBQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/eslint-parser" "^7.19.1"
|
"@babel/eslint-parser" "^7.19.1"
|
||||||
"@cornerstonejs/codec-charls" "^1.2.3"
|
"@cornerstonejs/codec-charls" "^1.2.3"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user