Skip to content

Commit

Permalink
feat(measurementService): use the new api for annotation manager in c…
Browse files Browse the repository at this point in the history
…s3d (#3206)

* fix OHIF to use the new api for annotation manager in cs3d

* bump package versions

* fix tests

* remove unnecessary code
  • Loading branch information
sedghi authored Mar 2, 2023
1 parent 35d0787 commit 38d452e
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 43 deletions.
4 changes: 2 additions & 2 deletions extensions/cornerstone-dicom-sr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@babel/runtime": "^7.20.13",
"classnames": "^2.3.2",
"@cornerstonejs/adapters": "^0.3.1",
"@cornerstonejs/core": "^0.31.2",
"@cornerstonejs/tools": "^0.46.2"
"@cornerstonejs/core": "^0.32.0",
"@cornerstonejs/tools": "^0.48.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export default class DICOMSRDisplayTool extends AnnotationTool {
const { element } = viewport;

let annotations = annotation.state.getAnnotations(
element,
this.getToolName()
this.getToolName(),
element
);

// Todo: We don't need this anymore, filtering happens in triggerAnnotationRender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function addMeasurement(
// Use the metadata provider to grab its imagePlaneModule metadata
const imagePlaneModule = metaData.get('imagePlaneModule', imageId);

const annotationManager = annotation.state.getDefaultAnnotationManager();
const annotationManager = annotation.state.getAnnotationManager();

// Create Cornerstone3D Annotation from measurement
const frameNumber =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function getFilteredCornerstoneToolState(
const uidFilter = measurementData.map(md => md.uid);
const uids = uidFilter.slice();

const annotationManager = annotation.state.getDefaultAnnotationManager();
const annotationManager = annotation.state.getAnnotationManager();
const framesOfReference = annotationManager.getFramesOfReference();

for (let i = 0; i < framesOfReference.length; i++) {
Expand Down
6 changes: 3 additions & 3 deletions extensions/cornerstone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^0.3.1",
"@cornerstonejs/core": "^0.31.2",
"@cornerstonejs/streaming-image-volume-loader": "^0.12.2",
"@cornerstonejs/tools": "^0.46.2",
"@cornerstonejs/core": "^0.32.0",
"@cornerstonejs/streaming-image-volume-loader": "^0.13.0",
"@cornerstonejs/tools": "^0.48.0",
"@kitware/vtk.js": "26.5.6",
"html2canvas": "^1.4.1",
"lodash.debounce": "4.0.8",
Expand Down
2 changes: 1 addition & 1 deletion extensions/cornerstone/src/initMeasurementService.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ const connectMeasurementServiceToTools = (
imageId = dataSource.getImageIdsForInstance({ instance });
}

const annotationManager = annotation.state.getDefaultAnnotationManager();
const annotationManager = annotation.state.getAnnotationManager();
annotationManager.addAnnotation({
annotationUID: measurement.uid,
highlighted: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ function getFirstAnnotationSelected(element) {
cs3dToolAnnotationUtils.selection.getAnnotationsSelected() || [];

if (selectedAnnotationUID) {
return cs3dToolAnnotationUtils.state.getAnnotation(
selectedAnnotationUID,
element
);
return cs3dToolAnnotationUtils.state.getAnnotation(selectedAnnotationUID);
}
}

Expand Down
4 changes: 2 additions & 2 deletions extensions/measurement-tracking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"peerDependencies": {
"@ohif/core": "^3.0.0",
"classnames": "^2.3.2",
"@cornerstonejs/core": "^0.31.2",
"@cornerstonejs/tools": "^0.46.2",
"@cornerstonejs/core": "^0.32.0",
"@cornerstonejs/tools": "^0.48.0",
"@ohif/extension-cornerstone-dicom-sr": "^3.0.0",
"dcmjs": "^0.29.4",
"prop-types": "^15.6.2",
Expand Down
2 changes: 1 addition & 1 deletion extensions/tmtv/src/commandsModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ const commandsModule = ({
},
createTMTVRTReport: () => {
// get all Rectangle ROI annotation
const stateManager = csTools.annotation.state.getDefaultAnnotationManager();
const stateManager = csTools.annotation.state.getAnnotationManager();

const annotations = [];

Expand Down
4 changes: 2 additions & 2 deletions platform/viewer/cypress/integration/volume/MPR.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('OHIF MPR', () => {
cy.window()
.its('cornerstoneTools')
.then(cornerstoneTools => {
const state = cornerstoneTools.annotation.state.getDefaultAnnotationManager();
const state = cornerstoneTools.annotation.state.getAnnotationManager();

const fORMap = state.annotations;
// it should not have crosshairs yet
Expand All @@ -117,7 +117,7 @@ describe('OHIF MPR', () => {
cy.window()
.its('cornerstoneTools')
.then(cornerstoneTools => {
const state = cornerstoneTools.annotation.state.getDefaultAnnotationManager();
const state = cornerstoneTools.annotation.state.getAnnotationManager();

const fORMap = state.annotations;
const fOR = Object.keys(fORMap)[0];
Expand Down
2 changes: 1 addition & 1 deletion testdata
Submodule testdata updated 4613 files
46 changes: 23 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1443,28 +1443,28 @@
resolved "https://registry.npmjs.org/@cornerstonejs/codec-openjph/-/codec-openjph-2.4.2.tgz#e96721d56f6ec96f7f95c16321d88cc8467d8d81"
integrity sha512-lgdvBvvNezleY+4pIe2ceUsJzlZe/0PipdeubQ3vZZOz3xxtHHMR1XFCl4fgd8gosR8COHuD7h6q+MwgrwBsng==

"@cornerstonejs/core@^0.31.2":
version "0.31.2"
resolved "https://registry.npmjs.org/@cornerstonejs/core/-/core-0.31.2.tgz#0087cb4445962c82125ae2dddff49aadcfab634d"
integrity sha512-RIxKF/3gGvx8Rca91YlAkUF0DVICedHr6Xis9x8EvOIm+DraP1h3FSQs6bO77FdalAEPGyDjG5U8ZfsAkAXN4g==
"@cornerstonejs/core@^0.32.0":
version "0.32.0"
resolved "https://registry.npmjs.org/@cornerstonejs/core/-/core-0.32.0.tgz#75fb782cc30c82642d6085d7900ec91df51aee36"
integrity sha512-Ep7b+jUO5OtRuEYRlb2Q386ZZfndAdgkDApPoTOYR+BzrwVfMF8/BEmP7UagT/bpAFk5lp5PHt/akN0qM2KR/Q==
dependencies:
detect-gpu "^4.0.45"
lodash.clonedeep "4.5.0"

"@cornerstonejs/streaming-image-volume-loader@^0.12.2":
version "0.12.2"
resolved "https://registry.npmjs.org/@cornerstonejs/streaming-image-volume-loader/-/streaming-image-volume-loader-0.12.2.tgz#5df26356e846743264b624847fe4a1c7f0a304b9"
integrity sha512-0L7+oLAuhv/NIK/zmffHi499QGLcj+KS5Mgcml+7aqecO+ABiOzeC2hdCF9fGRPMN7IWadhDVOE1E78sUoCLRg==
"@cornerstonejs/streaming-image-volume-loader@^0.13.0":
version "0.13.0"
resolved "https://registry.npmjs.org/@cornerstonejs/streaming-image-volume-loader/-/streaming-image-volume-loader-0.13.0.tgz#0b27bde776585274b6f5ab98eb2366711f8fc878"
integrity sha512-js+qaw+I5en0FR/SzJVwGY5WKfldPiVfoJvMuZb7/mNoeoi+N/U47W9WzKlCPqM81xb1mlnjXPyhVdxQ78F36Q==
dependencies:
"@cornerstonejs/core" "^0.31.2"
cornerstone-wado-image-loader "^4.8.0"
"@cornerstonejs/core" "^0.32.0"
cornerstone-wado-image-loader "^4.10.0"

"@cornerstonejs/tools@^0.46.2":
version "0.46.2"
resolved "https://registry.npmjs.org/@cornerstonejs/tools/-/tools-0.46.2.tgz#d2adee12652c3c4ce7782102c82c21af6c4d3198"
integrity sha512-sqyEKU0f3nmBBQHju251C/oLbruBtgn+b5JT7Zvr79VH0qSxQAFVUyzYXWIF6Jmbd6i+A/qI1fiv2Gzv2CZfbg==
"@cornerstonejs/tools@^0.48.0":
version "0.48.0"
resolved "https://registry.npmjs.org/@cornerstonejs/tools/-/tools-0.48.0.tgz#c881866a58dd7fe5338256166630e3de633b14e7"
integrity sha512-uMrfY84m1bzVQ8I6HAkmKjZDuB3cHy9T7SWiOhXqfQGdcftkEJXYzXA6WbXDbsG8LpslnSv79Ovbx1uvH2GrWQ==
dependencies:
"@cornerstonejs/core" "^0.31.2"
"@cornerstonejs/core" "^0.32.0"
lodash.clonedeep "4.5.0"
lodash.get "^4.4.2"

Expand Down Expand Up @@ -8536,10 +8536,10 @@ cornerstone-math@^0.1.9:
resolved "https://registry.npmjs.org/cornerstone-math/-/cornerstone-math-0.1.10.tgz#a3f99db64d73c5adee61ae0d570128eca1682d07"
integrity sha512-23XSAyP7t70ANvhFyqwvva+zFd1bQ2d5GL7tg9qKE932WmImjA2Y9tiy5n0iTtnf51W/78Png8Lia2o4dCdJaQ==

cornerstone-wado-image-loader@^4.2.1:
version "4.9.1"
resolved "https://registry.npmjs.org/cornerstone-wado-image-loader/-/cornerstone-wado-image-loader-4.9.1.tgz#442eeca78ff0bcf9f9cbde04e8c429f35b31c55a"
integrity sha512-l0HRxGAupfufnHjT9uFpwAtafvuGMKKB9SCL8dHUwCK+7jwNeVigy8s6+Oki2nycaJUzy2TRQaauO78mIf3grg==
cornerstone-wado-image-loader@^4.10.0:
version "4.10.0"
resolved "https://registry.npmjs.org/cornerstone-wado-image-loader/-/cornerstone-wado-image-loader-4.10.0.tgz#25c367cfc54a2c92ebbb5c64dba4fe38439112a1"
integrity sha512-XZcgB8DpUxnsTA3vU/zbPtB2uFLL4ght70BPrQHykkX/Jlg/r6Ob7ztX2dEEAAb4ELE/d4icfGuSy10Acg/kyw==
dependencies:
"@babel/eslint-parser" "^7.19.1"
"@cornerstonejs/codec-charls" "^1.2.3"
Expand All @@ -8552,10 +8552,10 @@ cornerstone-wado-image-loader@^4.2.1:
pako "^2.0.4"
uuid "^9.0.0"

cornerstone-wado-image-loader@^4.8.0:
version "4.10.0"
resolved "https://registry.npmjs.org/cornerstone-wado-image-loader/-/cornerstone-wado-image-loader-4.10.0.tgz#25c367cfc54a2c92ebbb5c64dba4fe38439112a1"
integrity sha512-XZcgB8DpUxnsTA3vU/zbPtB2uFLL4ght70BPrQHykkX/Jlg/r6Ob7ztX2dEEAAb4ELE/d4icfGuSy10Acg/kyw==
cornerstone-wado-image-loader@^4.2.1:
version "4.9.1"
resolved "https://registry.npmjs.org/cornerstone-wado-image-loader/-/cornerstone-wado-image-loader-4.9.1.tgz#442eeca78ff0bcf9f9cbde04e8c429f35b31c55a"
integrity sha512-l0HRxGAupfufnHjT9uFpwAtafvuGMKKB9SCL8dHUwCK+7jwNeVigy8s6+Oki2nycaJUzy2TRQaauO78mIf3grg==
dependencies:
"@babel/eslint-parser" "^7.19.1"
"@cornerstonejs/codec-charls" "^1.2.3"
Expand Down

0 comments on commit 38d452e

Please sign in to comment.