@cornerstonejs/core 3.32.12 → 3.33.0

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.
@@ -47,9 +47,10 @@ declare abstract class BaseVolumeViewport extends Viewport {
47
47
  setViewPlane(planeRestriction: PlaneRestriction): void;
48
48
  setViewReference(viewRef: ViewReference): void;
49
49
  private setThreshold;
50
- setProperties({ voiRange, VOILUTFunction, invert, colormap, preset, interpolationType, slabThickness, }?: VolumeViewportProperties, volumeId?: string, suppressEvents?: boolean): void;
50
+ setProperties({ voiRange, VOILUTFunction, invert, colormap, preset, interpolationType, slabThickness, sampleDistanceMultiplier, }?: VolumeViewportProperties, volumeId?: string, suppressEvents?: boolean): void;
51
51
  resetToDefaultProperties(volumeId: string): void;
52
52
  private setPreset;
53
+ setSampleDistanceMultiplier(multiplier: number): void;
53
54
  getDefaultProperties: (volumeId?: string) => VolumeViewportProperties;
54
55
  getProperties: (volumeId?: string) => VolumeViewportProperties;
55
56
  private getColormap;
@@ -31,6 +31,7 @@ import * as metaData from '../metaData';
31
31
  import { getCameraVectors } from './helpers/getCameraVectors';
32
32
  import { isContextPoolRenderingEngine } from './helpers/isContextPoolRenderingEngine';
33
33
  import mprCameraValues from '../constants/mprCameraValues';
34
+ import { setConfiguration, getConfiguration } from '@cornerstonejs/core';
34
35
  class BaseVolumeViewport extends Viewport {
35
36
  constructor(props) {
36
37
  super(props);
@@ -721,7 +722,7 @@ class BaseVolumeViewport extends Viewport {
721
722
  };
722
723
  triggerEvent(this.element, Events.COLORMAP_MODIFIED, eventDetail);
723
724
  }
724
- setProperties({ voiRange, VOILUTFunction, invert, colormap, preset, interpolationType, slabThickness, } = {}, volumeId, suppressEvents = false) {
725
+ setProperties({ voiRange, VOILUTFunction, invert, colormap, preset, interpolationType, slabThickness, sampleDistanceMultiplier, } = {}, volumeId, suppressEvents = false) {
725
726
  if (this.globalDefaultProperties == null) {
726
727
  this.setDefaultProperties({
727
728
  voiRange,
@@ -759,6 +760,9 @@ class BaseVolumeViewport extends Viewport {
759
760
  if (slabThickness !== undefined) {
760
761
  this.setSlabThickness(slabThickness);
761
762
  }
763
+ if (sampleDistanceMultiplier !== undefined) {
764
+ this.setSampleDistanceMultiplier(sampleDistanceMultiplier);
765
+ }
762
766
  }
763
767
  resetToDefaultProperties(volumeId) {
764
768
  const properties = this.globalDefaultProperties;
@@ -781,8 +785,8 @@ class BaseVolumeViewport extends Viewport {
781
785
  this.setSlabThickness(properties.slabThickness);
782
786
  this.viewportProperties.slabThickness = properties.slabThickness;
783
787
  }
784
- if (properties.preset !== undefined) {
785
- this.setPreset(properties.preset, volumeId, false);
788
+ if (properties.sampleDistanceMultiplier !== undefined) {
789
+ this.setSampleDistanceMultiplier(properties.sampleDistanceMultiplier);
786
790
  }
787
791
  if (properties.preset !== undefined) {
788
792
  this.setPreset(properties.preset, volumeId, false);
@@ -816,6 +820,7 @@ class BaseVolumeViewport extends Viewport {
816
820
  });
817
821
  }
818
822
  }
823
+ setSampleDistanceMultiplier(multiplier) { }
819
824
  async setVolumes(volumeInputArray, immediate = false, suppressEvents = false) {
820
825
  const volumeId = volumeInputArray[0].volumeId;
821
826
  const firstImageVolume = cache.getVolume(volumeId);
@@ -3,6 +3,7 @@ import type { ViewportInput } from '../types/IViewport';
3
3
  import BaseVolumeViewport from './BaseVolumeViewport';
4
4
  declare class VolumeViewport3D extends BaseVolumeViewport {
5
5
  constructor(props: ViewportInput);
6
+ setSampleDistanceMultiplier: (multiplier: number) => void;
6
7
  getNumberOfSlices: () => number;
7
8
  isInAcquisitionPlane(): boolean;
8
9
  resetCamera({ resetPan, resetZoom, resetToCenter, }?: {
@@ -3,12 +3,35 @@ import { OrientationAxis, Events } from '../enums';
3
3
  import cache from '../cache/cache';
4
4
  import setDefaultVolumeVOI from './helpers/setDefaultVolumeVOI';
5
5
  import triggerEvent from '../utilities/triggerEvent';
6
- import { isImageActor } from '../utilities/actorCheck';
6
+ import { actorIsA, isImageActor } from '../utilities/actorCheck';
7
7
  import { setTransferFunctionNodes } from '../utilities/transferFunctionUtils';
8
8
  import BaseVolumeViewport from './BaseVolumeViewport';
9
9
  class VolumeViewport3D extends BaseVolumeViewport {
10
10
  constructor(props) {
11
11
  super(props);
12
+ this.setSampleDistanceMultiplier = (multiplier) => {
13
+ const actors = this.getActors();
14
+ actors.forEach((actorEntry) => {
15
+ if (actorIsA(actorEntry, 'vtkVolume')) {
16
+ const actor = actorEntry.actor;
17
+ const mapper = actor.getMapper();
18
+ if (mapper && mapper.getInputData) {
19
+ const imageData = mapper.getInputData();
20
+ if (imageData) {
21
+ const spacing = imageData.getSpacing();
22
+ const defaultSampleDistance = (spacing[0] + spacing[1] + spacing[2]) / 6;
23
+ const sampleDistanceMultiplier = multiplier || 1;
24
+ let sampleDistance = defaultSampleDistance * sampleDistanceMultiplier;
25
+ if (sampleDistance !== undefined && mapper.setSampleDistance) {
26
+ const currentSampleDistance = mapper.getSampleDistance();
27
+ mapper.setSampleDistance(sampleDistance);
28
+ }
29
+ }
30
+ }
31
+ }
32
+ });
33
+ this.render();
34
+ };
12
35
  this.getNumberOfSlices = () => {
13
36
  return 1;
14
37
  };
@@ -9,7 +9,9 @@ export default function createVolumeMapper(imageData, vtkOpenGLTexture) {
9
9
  }
10
10
  volumeMapper.setInputData(imageData);
11
11
  const spacing = imageData.getSpacing();
12
- const sampleDistance = (spacing[0] + spacing[1] + spacing[2]) / 6;
12
+ const sampleDistanceMultiplier = getConfiguration().rendering?.volumeRendering?.sampleDistanceMultiplier ||
13
+ 1;
14
+ const sampleDistance = (sampleDistanceMultiplier * (spacing[0] + spacing[1] + spacing[2])) / 6;
13
15
  volumeMapper.setMaximumSamplesPerRay(4000);
14
16
  volumeMapper.setSampleDistance(sampleDistance);
15
17
  volumeMapper.setScalarTexture(vtkOpenGLTexture);
package/dist/esm/init.js CHANGED
@@ -13,6 +13,9 @@ const defaultConfig = {
13
13
  strictZSpacingForVolumeViewport: true,
14
14
  renderingEngineMode: RenderingEngineModeEnum.ContextPool,
15
15
  webGlContextCount: 7,
16
+ volumeRendering: {
17
+ sampleDistanceMultiplier: 1,
18
+ },
16
19
  },
17
20
  debug: {
18
21
  statsOverlay: false,
@@ -10,6 +10,9 @@ interface Cornerstone3DConfig {
10
10
  strictZSpacingForVolumeViewport?: boolean;
11
11
  renderingEngineMode?: RenderingEngineModeType;
12
12
  webGlContextCount?: number;
13
+ volumeRendering?: {
14
+ sampleDistanceMultiplier?: number;
15
+ };
13
16
  };
14
17
  debug: {
15
18
  statsOverlay?: boolean;
@@ -8,4 +8,5 @@ export interface ViewportProperties {
8
8
  colormap?: ColormapPublic;
9
9
  interpolationType?: InterpolationType;
10
10
  preset?: string;
11
+ sampleDistanceMultiplier?: number;
11
12
  }
@@ -1 +1 @@
1
- export declare const version = "3.32.12";
1
+ export declare const version = "3.33.0";
@@ -1 +1 @@
1
- export const version = '3.32.12';
1
+ export const version = '3.33.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "3.32.12",
3
+ "version": "3.33.0",
4
4
  "description": "Cornerstone3D Core",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -97,5 +97,5 @@
97
97
  "type": "individual",
98
98
  "url": "https://ohif.org/donate"
99
99
  },
100
- "gitHead": "18e77561cbed314d083d89c60d43b8c7f0311108"
100
+ "gitHead": "ddd0cea514cd49ceb614c5417d871894800a9fc5"
101
101
  }