@cornerstonejs/tools 4.9.3 → 4.10.1

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.
@@ -12,7 +12,7 @@ declare class SegmentationStyle {
12
12
  viewportId?: string;
13
13
  segmentationId?: string;
14
14
  segmentIndex?: number;
15
- }, styles: RepresentationStyle): void;
15
+ }, styles: RepresentationStyle, merge?: boolean): void;
16
16
  private copyActiveToInactiveIfNotProvided;
17
17
  getStyle(specifier: {
18
18
  viewportId?: string;
@@ -10,21 +10,16 @@ class SegmentationStyle {
10
10
  viewportsStyle: {},
11
11
  };
12
12
  }
13
- setStyle(specifier, styles) {
13
+ setStyle(specifier, styles, merge = true) {
14
14
  const { viewportId, segmentationId, type, segmentIndex } = specifier;
15
15
  const currentStyles = this.getStyle(specifier);
16
+ const mergedStyles = merge ? { ...currentStyles, ...styles } : styles;
16
17
  let updatedStyles;
17
18
  if (!viewportId && !segmentationId) {
18
- updatedStyles = {
19
- ...currentStyles,
20
- ...styles,
21
- };
19
+ updatedStyles = mergedStyles;
22
20
  }
23
- else {
24
- updatedStyles = this.copyActiveToInactiveIfNotProvided({
25
- ...currentStyles,
26
- ...styles,
27
- }, type);
21
+ else if (merge) {
22
+ updatedStyles = this.copyActiveToInactiveIfNotProvided(mergedStyles, type);
28
23
  }
29
24
  if (!type) {
30
25
  throw new Error('Type is required to set a style');
@@ -12,7 +12,7 @@ type SpecifierWithType<T extends SegmentationRepresentations> = BaseSpecifier &
12
12
  };
13
13
  type StyleForType<T extends SegmentationRepresentations> = T extends SegmentationRepresentations.Labelmap ? LabelmapStyle : T extends SegmentationRepresentations.Contour ? ContourStyle : T extends SegmentationRepresentations.Surface ? SurfaceStyle : never;
14
14
  declare function getStyle<T extends SegmentationRepresentations>(specifier: SpecifierWithType<T>): StyleForType<T>;
15
- declare function setStyle<T extends SegmentationRepresentations>(specifier: SpecifierWithType<T>, style: StyleForType<T>): void;
15
+ declare function setStyle<T extends SegmentationRepresentations>(specifier: SpecifierWithType<T>, style: StyleForType<T>, merge?: boolean): void;
16
16
  declare function setRenderInactiveSegmentations(viewportId: string, renderInactiveSegmentations: boolean): void;
17
17
  declare function getRenderInactiveSegmentations(viewportId: string): boolean;
18
18
  declare function resetToGlobalStyle(): void;
@@ -6,8 +6,8 @@ import { triggerSegmentationRepresentationModified } from '../triggerSegmentatio
6
6
  function getStyle(specifier) {
7
7
  return segmentationStyle.getStyle(specifier);
8
8
  }
9
- function setStyle(specifier, style) {
10
- segmentationStyle.setStyle(specifier, style);
9
+ function setStyle(specifier, style, merge) {
10
+ segmentationStyle.setStyle(specifier, style, merge);
11
11
  if (!specifier.viewportId && !specifier.segmentationId) {
12
12
  const segmentations = getSegmentations();
13
13
  segmentations.forEach((segmentation) => {
@@ -1 +1 @@
1
- export declare const version = "4.9.3";
1
+ export declare const version = "4.10.1";
@@ -1 +1 @@
1
- export const version = '4.9.3';
1
+ export const version = '4.10.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "4.9.3",
3
+ "version": "4.10.1",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -108,7 +108,7 @@
108
108
  "canvas": "3.2.0"
109
109
  },
110
110
  "peerDependencies": {
111
- "@cornerstonejs/core": "4.9.3",
111
+ "@cornerstonejs/core": "4.10.1",
112
112
  "@kitware/vtk.js": "32.12.1",
113
113
  "@types/d3-array": "3.2.1",
114
114
  "@types/d3-interpolate": "3.0.4",
@@ -127,5 +127,5 @@
127
127
  "type": "individual",
128
128
  "url": "https://ohif.org/donate"
129
129
  },
130
- "gitHead": "d299aa6c94de2cc2284d407ab44727b0290fd414"
130
+ "gitHead": "9a5d8930fb15228a16b6cd216a6b840a0f8b6d9a"
131
131
  }