@cornerstonejs/core 1.14.2 → 1.14.4
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.
- package/dist/cjs/utilities/calculateViewportsSpatialRegistration.js +9 -14
- package/dist/cjs/utilities/calculateViewportsSpatialRegistration.js.map +1 -1
- package/dist/esm/utilities/calculateViewportsSpatialRegistration.js +9 -14
- package/dist/esm/utilities/calculateViewportsSpatialRegistration.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
- package/src/utilities/calculateViewportsSpatialRegistration.ts +21 -28
|
@@ -4,28 +4,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const gl_matrix_1 = require("gl-matrix");
|
|
7
|
-
const RenderingEngine_1 = require("../RenderingEngine");
|
|
8
7
|
const spatialRegistrationMetadataProvider_1 = __importDefault(require("./spatialRegistrationMetadataProvider"));
|
|
9
8
|
const __1 = require("..");
|
|
10
|
-
const
|
|
9
|
+
const ALLOWED_DELTA = 0.05;
|
|
11
10
|
function calculateViewportsSpatialRegistration(viewport1, viewport2) {
|
|
12
|
-
if (!(viewport1 instanceof RenderingEngine_1.StackViewport) ||
|
|
13
|
-
!(viewport2 instanceof RenderingEngine_1.StackViewport)) {
|
|
14
|
-
throw new Error('calculateViewportsSpatialRegistration: Both viewports must be StackViewports, volume viewports are not supported yet');
|
|
15
|
-
}
|
|
16
|
-
const isSameFrameOfReference = viewport1.getFrameOfReferenceUID() === viewport2.getFrameOfReferenceUID();
|
|
17
|
-
if (isSameFrameOfReference) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
11
|
const imageId1 = viewport1.getCurrentImageId();
|
|
21
12
|
const imageId2 = viewport2.getCurrentImageId();
|
|
22
13
|
const imagePlaneModule1 = __1.metaData.get('imagePlaneModule', imageId1);
|
|
23
14
|
const imagePlaneModule2 = __1.metaData.get('imagePlaneModule', imageId2);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
if (!imagePlaneModule1 || !imagePlaneModule2) {
|
|
16
|
+
console.log('Viewport spatial registration requires image plane module');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const { imageOrientationPatient: iop2 } = imagePlaneModule2;
|
|
20
|
+
const isSameImagePlane = imagePlaneModule1.imageOrientationPatient.every((v, i) => Math.abs(v - iop2[i]) < ALLOWED_DELTA);
|
|
27
21
|
if (!isSameImagePlane) {
|
|
28
|
-
|
|
22
|
+
console.log('Viewport spatial registration only supported for same orientation (hence translation only) for now', imagePlaneModule1 === null || imagePlaneModule1 === void 0 ? void 0 : imagePlaneModule1.imageOrientationPatient, imagePlaneModule2 === null || imagePlaneModule2 === void 0 ? void 0 : imagePlaneModule2.imageOrientationPatient);
|
|
23
|
+
return;
|
|
29
24
|
}
|
|
30
25
|
const imagePositionPatient1 = imagePlaneModule1.imagePositionPatient;
|
|
31
26
|
const imagePositionPatient2 = imagePlaneModule2.imagePositionPatient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateViewportsSpatialRegistration.js","sourceRoot":"","sources":["../../../src/utilities/calculateViewportsSpatialRegistration.ts"],"names":[],"mappings":";;;;;AAAA,yCAAuC;AAEvC,
|
|
1
|
+
{"version":3,"file":"calculateViewportsSpatialRegistration.js","sourceRoot":"","sources":["../../../src/utilities/calculateViewportsSpatialRegistration.ts"],"names":[],"mappings":";;;;;AAAA,yCAAuC;AAEvC,gHAAwF;AACxF,0BAA8B;AAQ9B,MAAM,aAAa,GAAG,IAAI,CAAC;AAc3B,SAAS,qCAAqC,CAC5C,SAAyB,EACzB,SAAyB;IAEzB,MAAM,QAAQ,GAAG,SAAS,CAAC,iBAAiB,EAAE,CAAC;IAC/C,MAAM,QAAQ,GAAG,SAAS,CAAC,iBAAiB,EAAE,CAAC;IAE/C,MAAM,iBAAiB,GAA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}
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import { vec3, mat4 } from 'gl-matrix';
|
|
2
|
-
import { StackViewport } from '../RenderingEngine';
|
|
3
2
|
import spatialRegistrationMetadataProvider from './spatialRegistrationMetadataProvider';
|
|
4
3
|
import { metaData } from '..';
|
|
5
|
-
|
|
4
|
+
const ALLOWED_DELTA = 0.05;
|
|
6
5
|
function calculateViewportsSpatialRegistration(viewport1, viewport2) {
|
|
7
|
-
if (!(viewport1 instanceof StackViewport) ||
|
|
8
|
-
!(viewport2 instanceof StackViewport)) {
|
|
9
|
-
throw new Error('calculateViewportsSpatialRegistration: Both viewports must be StackViewports, volume viewports are not supported yet');
|
|
10
|
-
}
|
|
11
|
-
const isSameFrameOfReference = viewport1.getFrameOfReferenceUID() === viewport2.getFrameOfReferenceUID();
|
|
12
|
-
if (isSameFrameOfReference) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
6
|
const imageId1 = viewport1.getCurrentImageId();
|
|
16
7
|
const imageId2 = viewport2.getCurrentImageId();
|
|
17
8
|
const imagePlaneModule1 = metaData.get('imagePlaneModule', imageId1);
|
|
18
9
|
const imagePlaneModule2 = metaData.get('imagePlaneModule', imageId2);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
if (!imagePlaneModule1 || !imagePlaneModule2) {
|
|
11
|
+
console.log('Viewport spatial registration requires image plane module');
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const { imageOrientationPatient: iop2 } = imagePlaneModule2;
|
|
15
|
+
const isSameImagePlane = imagePlaneModule1.imageOrientationPatient.every((v, i) => Math.abs(v - iop2[i]) < ALLOWED_DELTA);
|
|
22
16
|
if (!isSameImagePlane) {
|
|
23
|
-
|
|
17
|
+
console.log('Viewport spatial registration only supported for same orientation (hence translation only) for now', imagePlaneModule1?.imageOrientationPatient, imagePlaneModule2?.imageOrientationPatient);
|
|
18
|
+
return;
|
|
24
19
|
}
|
|
25
20
|
const imagePositionPatient1 = imagePlaneModule1.imagePositionPatient;
|
|
26
21
|
const imagePositionPatient2 = imagePlaneModule2.imagePositionPatient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateViewportsSpatialRegistration.js","sourceRoot":"","sources":["../../../src/utilities/calculateViewportsSpatialRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,
|
|
1
|
+
{"version":3,"file":"calculateViewportsSpatialRegistration.js","sourceRoot":"","sources":["../../../src/utilities/calculateViewportsSpatialRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,mCAAmC,MAAM,uCAAuC,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAQ9B,MAAM,aAAa,GAAG,IAAI,CAAC;AAc3B,SAAS,qCAAqC,CAC5C,SAAyB,EACzB,SAAyB;IAEzB,MAAM,QAAQ,GAAG,SAAS,CAAC,iBAAiB,EAAE,CAAC;IAC/C,MAAM,QAAQ,GAAG,SAAS,CAAC,iBAAiB,EAAE,CAAC;IAE/C,MAAM,iBAAiB,GAAG,QAAQ,CAAC,GAAG,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;IACrE,MAAM,iBAAiB,GAAG,QAAQ,CAAC,GAAG,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;IAErE,IAAI,CAAC,iBAAiB,IAAI,CAAC,iBAAiB,EAAE;QAC5C,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;QACzE,OAAO;KACR;IACD,MAAM,EAAE,uBAAuB,EAAE,IAAI,EAAE,GAAG,iBAAiB,CAAC;IAC5D,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,uBAAuB,CAAC,KAAK,CACtE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAA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