@cornerstonejs/core 1.40.3 → 1.42.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.
Files changed (28) hide show
  1. package/dist/cjs/RenderingEngine/StackViewport.d.ts +4 -4
  2. package/dist/cjs/RenderingEngine/StackViewport.js +20 -20
  3. package/dist/cjs/RenderingEngine/StackViewport.js.map +1 -1
  4. package/dist/cjs/enums/MetadataModules.d.ts +6 -1
  5. package/dist/cjs/enums/MetadataModules.js +5 -0
  6. package/dist/cjs/enums/MetadataModules.js.map +1 -1
  7. package/dist/cjs/types/IImage.d.ts +2 -0
  8. package/dist/cjs/utilities/createSigmoidRGBTransferFunction.js +25 -2
  9. package/dist/cjs/utilities/createSigmoidRGBTransferFunction.js.map +1 -1
  10. package/dist/esm/RenderingEngine/StackViewport.js +20 -20
  11. package/dist/esm/RenderingEngine/StackViewport.js.map +1 -1
  12. package/dist/esm/enums/MetadataModules.js +5 -0
  13. package/dist/esm/enums/MetadataModules.js.map +1 -1
  14. package/dist/esm/utilities/createSigmoidRGBTransferFunction.js +1 -1
  15. package/dist/esm/utilities/createSigmoidRGBTransferFunction.js.map +1 -1
  16. package/dist/types/RenderingEngine/StackViewport.d.ts +4 -4
  17. package/dist/types/RenderingEngine/StackViewport.d.ts.map +1 -1
  18. package/dist/types/enums/MetadataModules.d.ts +6 -1
  19. package/dist/types/enums/MetadataModules.d.ts.map +1 -1
  20. package/dist/types/types/IImage.d.ts +2 -0
  21. package/dist/types/types/IImage.d.ts.map +1 -1
  22. package/dist/umd/index.js +1 -1
  23. package/dist/umd/index.js.map +1 -1
  24. package/package.json +2 -2
  25. package/src/RenderingEngine/StackViewport.ts +58 -62
  26. package/src/enums/MetadataModules.ts +5 -0
  27. package/src/types/IImage.ts +2 -0
  28. package/src/utilities/createSigmoidRGBTransferFunction.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "1.40.3",
3
+ "version": "1.42.0",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "types": "dist/types/index.d.ts",
@@ -47,5 +47,5 @@
47
47
  "type": "individual",
48
48
  "url": "https://ohif.org/donate"
49
49
  },
50
- "gitHead": "5a4bedfe6e8f2b217347109cd0e0c85b7c5bf1d0"
50
+ "gitHead": "75102c80b6bc3714f00590b92ccd8d4d52bf1ca2"
51
51
  }
@@ -1,95 +1,96 @@
1
1
  import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray';
2
- import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
3
2
  import type { vtkImageData as vtkImageDataType } from '@kitware/vtk.js/Common/DataModel/ImageData';
4
- import vtkColorMaps from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction/ColorMaps';
5
- import _cloneDeep from 'lodash.clonedeep';
3
+ import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
6
4
  import vtkCamera from '@kitware/vtk.js/Rendering/Core/Camera';
7
- import { vec2, vec3, mat4 } from 'gl-matrix';
5
+ import vtkColorTransferFunction from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction';
6
+ import vtkColorMaps from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction/ColorMaps';
8
7
  import vtkImageMapper from '@kitware/vtk.js/Rendering/Core/ImageMapper';
9
8
  import vtkImageSlice from '@kitware/vtk.js/Rendering/Core/ImageSlice';
10
- import vtkColorTransferFunction from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction';
11
- import * as metaData from '../metaData';
12
- import Viewport from './Viewport';
9
+ import { mat4, vec2, vec3 } from 'gl-matrix';
10
+ import _cloneDeep from 'lodash.clonedeep';
13
11
  import eventTarget from '../eventTarget';
14
- import {
15
- triggerEvent,
16
- isEqual,
17
- invertRgbTransferFunction,
18
- createSigmoidRGBTransferFunction,
19
- windowLevel as windowLevelUtil,
20
- imageIdToURI,
21
- isImageActor,
22
- actorIsA,
23
- colormap as colormapUtils,
24
- updateVTKImageDataWithCornerstoneImage,
25
- imageRetrieveMetadataProvider,
26
- } from '../utilities';
12
+ import * as metaData from '../metaData';
27
13
  import type {
28
- Point2,
29
- Point3,
30
- VOIRange,
14
+ ActorEntry,
15
+ CPUFallbackColormapData,
16
+ CPUFallbackEnabledElement,
17
+ CPUIImageData,
18
+ ColormapPublic,
19
+ EventTypes,
20
+ FlipDirection,
31
21
  ICamera,
32
22
  IImage,
23
+ IImageCalibration,
33
24
  IImageData,
34
- CPUIImageData,
25
+ IImagesLoader,
26
+ IStackInput,
27
+ IStackViewport,
28
+ ImageLoadListener,
29
+ Mat3,
35
30
  PTScaling,
31
+ Point2,
32
+ Point3,
36
33
  Scaling,
37
34
  StackViewportProperties,
38
- FlipDirection,
39
- ActorEntry,
40
- CPUFallbackEnabledElement,
41
- CPUFallbackColormapData,
42
- EventTypes,
43
- IStackViewport,
35
+ VOIRange,
44
36
  VolumeActor,
45
- Mat3,
46
- ColormapPublic,
47
- IImageCalibration,
48
- IStackInput,
49
- IImagesLoader,
50
- ImageLoadListener,
51
37
  } from '../types';
52
38
  import { ViewportInput } from '../types/IViewport';
53
- import drawImageSync from './helpers/cpuFallback/drawImageSync';
39
+ import {
40
+ actorIsA,
41
+ colormap as colormapUtils,
42
+ createSigmoidRGBTransferFunction,
43
+ imageIdToURI,
44
+ imageRetrieveMetadataProvider,
45
+ invertRgbTransferFunction,
46
+ isEqual,
47
+ isImageActor,
48
+ triggerEvent,
49
+ updateVTKImageDataWithCornerstoneImage,
50
+ windowLevel as windowLevelUtil,
51
+ } from '../utilities';
52
+ import Viewport from './Viewport';
54
53
  import { getColormap } from './helpers/cpuFallback/colors/index';
54
+ import drawImageSync from './helpers/cpuFallback/drawImageSync';
55
55
 
56
- import { loadAndCacheImage, ImageLoaderOptions } from '../loaders/imageLoader';
57
- import imageLoadPoolManager from '../requestPool/imageLoadPoolManager';
58
56
  import {
57
+ Events,
59
58
  InterpolationType,
59
+ MetadataModules,
60
60
  RequestType,
61
- Events,
62
61
  VOILUTFunctionType,
63
62
  ViewportStatus,
64
63
  } from '../enums';
64
+ import { ImageLoaderOptions, loadAndCacheImage } from '../loaders/imageLoader';
65
+ import imageLoadPoolManager from '../requestPool/imageLoadPoolManager';
66
+ import calculateTransform from './helpers/cpuFallback/rendering/calculateTransform';
65
67
  import canvasToPixel from './helpers/cpuFallback/rendering/canvasToPixel';
66
- import pixelToCanvas from './helpers/cpuFallback/rendering/pixelToCanvas';
67
68
  import getDefaultViewport from './helpers/cpuFallback/rendering/getDefaultViewport';
68
- import calculateTransform from './helpers/cpuFallback/rendering/calculateTransform';
69
+ import pixelToCanvas from './helpers/cpuFallback/rendering/pixelToCanvas';
69
70
  import resize from './helpers/cpuFallback/rendering/resize';
70
71
 
71
- import resetCamera from './helpers/cpuFallback/rendering/resetCamera';
72
- import { Transform } from './helpers/cpuFallback/rendering/transform';
72
+ import cache from '../cache';
73
73
  import { getConfiguration, getShouldUseCPURendering } from '../init';
74
+ import { createProgressive } from '../loaders/ProgressiveRetrieveImages';
75
+ import {
76
+ ImagePixelModule,
77
+ ImagePlaneModule,
78
+ PixelDataTypedArray,
79
+ } from '../types';
74
80
  import {
75
81
  StackViewportNewStackEventDetail,
76
82
  StackViewportScrollEventDetail,
77
83
  VoiModifiedEventDetail,
78
84
  } from '../types/EventTypes';
79
- import cache from '../cache';
80
- import correctShift from './helpers/cpuFallback/rendering/correctShift';
81
85
  import { ImageActor } from '../types/IActor';
82
86
  import createLinearRGBTransferFunction from '../utilities/createLinearRGBTransferFunction';
83
- import {
84
- PixelDataTypedArray,
85
- ImagePixelModule,
86
- ImagePlaneModule,
87
- } from '../types';
88
- import { createProgressive } from '../loaders/ProgressiveRetrieveImages';
89
87
  import {
90
88
  getTransferFunctionNodes,
91
89
  setTransferFunctionNodes,
92
90
  } from '../utilities/transferFunctionUtils';
91
+ import correctShift from './helpers/cpuFallback/rendering/correctShift';
92
+ import resetCamera from './helpers/cpuFallback/rendering/resetCamera';
93
+ import { Transform } from './helpers/cpuFallback/rendering/transform';
93
94
 
94
95
  const EPSILON = 1; // Slice Thickness
95
96
 
@@ -442,7 +443,7 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
442
443
  metadata: { Modality: this.modality },
443
444
  scaling: this.scaling,
444
445
  hasPixelSpacing: this.hasPixelSpacing,
445
- calibration: this.calibration,
446
+ calibration: { ...this.csImage.calibration, ...this.calibration },
446
447
  preScale: {
447
448
  ...this.csImage.preScale,
448
449
  },
@@ -484,7 +485,7 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
484
485
  },
485
486
  scalarData: this.cpuImagePixelData,
486
487
  hasPixelSpacing: this.hasPixelSpacing,
487
- calibration: this.calibration,
488
+ calibration: { ...this.csImage.calibration, ...this.calibration },
488
489
  preScale: {
489
490
  ...this.csImage.preScale,
490
491
  },
@@ -587,6 +588,7 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
587
588
 
588
589
  const { modality } = metaData.get('generalSeriesModule', imageId);
589
590
  const imageIdScalingFactor = metaData.get('scalingModule', imageId);
591
+ const calibration = metaData.get(MetadataModules.CALIBRATION, imageId);
590
592
 
591
593
  if (modality === 'PT' && imageIdScalingFactor) {
592
594
  this._addScalingToViewport(imageIdScalingFactor);
@@ -596,7 +598,7 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
596
598
  const voiLUTFunctionEnum = this._getValidVOILUTFunction(voiLUTFunction);
597
599
  this.VOILUTFunction = voiLUTFunctionEnum;
598
600
 
599
- this.calibration = null;
601
+ this.calibration = calibration;
600
602
  let imagePlaneModule = this._getImagePlaneModule(imageId);
601
603
 
602
604
  if (!this.useCPURendering) {
@@ -2963,15 +2965,9 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
2963
2965
 
2964
2966
  // create default values for imagePlaneModule if values are undefined
2965
2967
  private _getImagePlaneModule(imageId: string): ImagePlaneModule {
2966
- const imagePlaneModule = metaData.get('imagePlaneModule', imageId);
2967
-
2968
- const calibratedPixelSpacing = metaData.get(
2969
- 'calibratedPixelSpacing',
2970
- imageId
2971
- );
2968
+ const imagePlaneModule = metaData.get(MetadataModules.IMAGE_PLANE, imageId);
2972
2969
 
2973
2970
  this.calibration ||= imagePlaneModule.calibration;
2974
-
2975
2971
  const newImagePlaneModule: ImagePlaneModule = {
2976
2972
  ...imagePlaneModule,
2977
2973
  };
@@ -9,12 +9,17 @@
9
9
  enum MetadataModules {
10
10
  CINE = 'cineModule',
11
11
  IMAGE_URL = 'imageUrlModule',
12
+ SOP_COMMON = 'sopCommonModule',
13
+ VOI_LUT = 'voiLutModule',
14
+ MODALITY_LUT = 'modalityLutModule',
12
15
  GENERAL_SERIES = 'generalSeriesModule',
13
16
  PATIENT_STUDY = 'patientStudyModule',
14
17
  NM_MULTIFRAME_GEOMETRY = 'nmMultiframeGeometryModule',
15
18
  IMAGE_PLANE = 'imagePlaneModule',
16
19
  IMAGE_PIXEL = 'imagePixelModule',
17
20
  MULTIFRAME = 'multiframeModule',
21
+ ULTRASOUND_ENHANCED_REGION = 'ultrasoundEnhancedRegionModule',
22
+ CALIBRATION = 'calibrationModule',
18
23
  }
19
24
 
20
25
  export default MetadataModules;
@@ -3,6 +3,7 @@ import type CPUFallbackColormap from './CPUFallbackColormap';
3
3
  import type CPUFallbackEnabledElement from './CPUFallbackEnabledElement';
4
4
  import type { PixelDataTypedArray } from './PixelDataTypedArray';
5
5
  import { ImageQualityStatus } from '../enums';
6
+ import IImageCalibration from './IImageCalibration';
6
7
 
7
8
  /**
8
9
  * Cornerstone Image interface, it is used for both CPU and GPU rendering
@@ -118,6 +119,7 @@ interface IImage {
118
119
  };
119
120
 
120
121
  imageQualityStatus?: ImageQualityStatus;
122
+ calibration?: IImageCalibration;
121
123
  }
122
124
 
123
125
  export default IImage;
@@ -1,7 +1,7 @@
1
1
  import vtkColorTransferFunction from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction';
2
2
  import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray';
3
3
  import { VOIRange } from '../types';
4
- import { windowLevel as windowLevelUtil } from '.';
4
+ import * as windowLevelUtil from './windowLevel';
5
5
 
6
6
  /**
7
7
  * A utility that can be used to generate an Sigmoid RgbTransferFunction.