diff --git a/.circleci/config.yml b/.circleci/config.yml index 2a0b4224a4..b0f601bb5c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,7 +40,8 @@ jobs: - run: bun install - persist_to_workspace: root: ~/repo - paths: . + paths: + - "." BUILD: <<: *defaults @@ -64,22 +65,6 @@ jobs: - commit.txt - version.json - API_CHECK: - <<: *defaults - steps: - - attach_workspace: - at: ~/repo - - install_bun - - run: bun install -d ajv - - run: bun run api-check - FORMAT_CHECK: - <<: *defaults - steps: - - attach_workspace: - at: ~/repo - - install_bun - - run: bun run format-check - # https://circleci.com/docs/2.0/collect-test-data/#karma TEST: <<: *defaults @@ -117,7 +102,8 @@ jobs: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config - add_ssh_keys: - fingerprints: 7e:0f:5b:bb:e3:7a:2e:2f:b4:85:bd:66:09:69:cb:f2 + fingerprints: + - "7e:0f:5b:bb:e3:7a:2e:2f:b4:85:bd:66:09:69:cb:f2" - run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc - run: git config --global user.email "contact@ohif.org" - run: git config --global user.name "ohif-bot" @@ -150,12 +136,6 @@ workflows: - BUILD: requires: - CHECKOUT - - FORMAT_CHECK: - requires: - - BUILD - - API_CHECK: - requires: - - BUILD - TEST: requires: - CHECKOUT # TODO: Also require build? @@ -168,13 +148,17 @@ workflows: branches: only: - main - # - beta + - beta - BUILD: requires: - CHECKOUT - TEST: requires: - CHECKOUT + # - HOLD_FOR_APPROVAL: + # type: approval + # requires: + # - BUILD - NPM_PUBLISH: requires: - BUILD diff --git a/.eslintrc.json b/.eslintrc.json index d17eb9bf44..a52bf493f6 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -55,7 +55,15 @@ "tsconfigRootDir": "./", "warnOnUnsupportedTypeScriptVersion": false }, - "ignorePatterns": ["packages/docs", "dist", "**/*_test.js", "**/*_jest.js", "**/*babel*", "**/*.d.ts", "**/*_types.ts"], + "ignorePatterns": [ + "packages/docs", + "dist", + "**/*_test.js", + "**/*_jest.js", + "**/*babel*", + "**/*.d.ts", + "**/*_types.ts" + ], "rules": { "import/no-cycle": ["error", { "maxDepth": 15 }], // Enforce consistent brace style for all control statements for readability diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 77f84eb84b..df00a4bbb2 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -72,8 +72,6 @@ after the commits are squashed. - [] My code has been well-documented (function documentation, inline comments, etc.) -- [] I have run the `yarn build:update-api` to update the API documentation, and have - committed the changes to this PR. (Read more here https://www.cornerstonejs.org/docs/contribute/update-api) #### Public Documentation Updates diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml new file mode 100644 index 0000000000..8337b29e2e --- /dev/null +++ b/.github/workflows/format-check.yml @@ -0,0 +1,38 @@ +name: Format Check + +on: + pull_request: + branches: [ '*' ] + push: + branches: [ main, beta ] + +jobs: + format-check: + timeout-minutes: 30 + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.18.1' + cache: 'npm' + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install dependencies + run: bun install + + - name: Build dependencies + run: bun run build:esm + + - name: Run format check + run: bun run format-check + env: + NODE_OPTIONS: --max_old_space_size=32896 diff --git a/CHANGELOG.md b/CHANGELOG.md index 985fdf2d53..7e3585cf30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,110 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.0.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.4...v3.0.5) (2025-03-06) + +### Bug Fixes + +- **segmentation:** Add segmentation ID requirement for threshold operations ([#1879](https://github.com/cornerstonejs/cornerstone3D/issues/1879)) ([eae9577](https://github.com/cornerstonejs/cornerstone3D/commit/eae957729848d44971050ca40d684dae8f919170)) + +## [3.0.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.3...v3.0.4) (2025-03-05) + +### Bug Fixes + +- **worker:** should not change type of input ([#1877](https://github.com/cornerstonejs/cornerstone3D/issues/1877)) ([a97effd](https://github.com/cornerstonejs/cornerstone3D/commit/a97effd52abe35eaf532a5634a69b76f932099e7)) + +## [3.0.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.2...v3.0.3) (2025-03-04) + +### Bug Fixes + +- try to pass the fake version number ([#1873](https://github.com/cornerstonejs/cornerstone3D/issues/1873)) ([06c82fb](https://github.com/cornerstonejs/cornerstone3D/commit/06c82fba65c1cf578eb322642dfe080d39ce0719)) + +## [3.0.2](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.1...v3.0.2) (2025-03-04) + +### Bug Fixes + +- **CrosshairsTool:** support HPDI screens in CrosshairsTool ([#1824](https://github.com/cornerstonejs/cornerstone3D/issues/1824)) ([cd299e4](https://github.com/cornerstonejs/cornerstone3D/commit/cd299e40723fb94a6f2568a8008935d8e01ff4f4)), closes [#1822](https://github.com/cornerstonejs/cornerstone3D/issues/1822) +- **segmentation:** resolve variable declaration and null check issues ([#1872](https://github.com/cornerstonejs/cornerstone3D/issues/1872)) ([029966d](https://github.com/cornerstonejs/cornerstone3D/commit/029966d0a3ffc86fa38d3e089d9b0d7d5c105f32)) + +### Features + +- **surface-segmentation:** add visibilty configuration for surface segmentation ([#1846](https://github.com/cornerstonejs/cornerstone3D/issues/1846)) ([e1b5bc6](https://github.com/cornerstonejs/cornerstone3D/commit/e1b5bc646f3997be88ec237f86406c310420379a)) + +## [3.0.1](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0...v3.0.1) (2025-02-27) + +**Note:** Version bump only for package root + +# [3.0.0](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.16...v3.0.0) (2025-02-27) + +### Features + +- Cornerstone3D 3.0 ([#1865](https://github.com/cornerstonejs/cornerstone3D/issues/1865)) ([fe65459](https://github.com/cornerstonejs/cornerstone3D/commit/fe654590d16414e76361e1b2826fd64c3734ae87)) + +# [3.0.0-beta.6](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2025-02-27) + +### Features + +- Add key image adapters for key image point mark ([#1754](https://github.com/cornerstonejs/cornerstone3D/issues/1754)) ([a1fd3f9](https://github.com/cornerstonejs/cornerstone3D/commit/a1fd3f9d0ea40d53cafd792d59bc1dbfc90663a5)) + +# [3.0.0-beta.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2025-02-25) + +**Note:** Version bump only for package root + +# [3.0.0-beta.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2025-02-25) + +**Note:** Version bump only for package root + +# [3.0.0-beta.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2025-02-25) + +**Note:** Version bump only for package root + +# [3.0.0-beta.2](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.14...v3.0.0-beta.2) (2025-02-24) + +### Bug Fixes + +- publish beta for 3.0 ([6000ed8](https://github.com/cornerstonejs/cornerstone3D/commit/6000ed8cb2bee031a93fe57eeda81d926ee31240)) +- publish beta for 3.0 ([8bf65df](https://github.com/cornerstonejs/cornerstone3D/commit/8bf65df9bec5f52459de1c49c4834b316f680f1b)) + +## [2.19.14](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.13...v2.19.14) (2025-02-24) + +### Bug Fixes + +- **seg:** revert change ([#1843](https://github.com/cornerstonejs/cornerstone3D/issues/1843)) ([c483e81](https://github.com/cornerstonejs/cornerstone3D/commit/c483e811e12e494b3d764810f182b2be71b43645)) + +## [2.19.13](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.12...v2.19.13) (2025-02-21) + +**Note:** Version bump only for package root + +## [2.19.12](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.11...v2.19.12) (2025-02-20) + +### Bug Fixes + +- planar freehand roi undefined unit ([#1839](https://github.com/cornerstonejs/cornerstone3D/issues/1839)) ([ace8933](https://github.com/cornerstonejs/cornerstone3D/commit/ace893349ed4d066adf035ca776511ac9c394a86)) + +## [2.19.11](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.10...v2.19.11) (2025-02-18) + +### Bug Fixes + +- changing opacity based on segment index ([#1833](https://github.com/cornerstonejs/cornerstone3D/issues/1833)) ([6bf44cf](https://github.com/cornerstonejs/cornerstone3D/commit/6bf44cf0e151f239dbc41ca4277f0360e2c873f7)) + +## [2.19.10](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.9...v2.19.10) (2025-02-18) + +### Bug Fixes + +- Prevent overwriting existing inactive styles ([#1831](https://github.com/cornerstonejs/cornerstone3D/issues/1831)) ([8e8c29e](https://github.com/cornerstonejs/cornerstone3D/commit/8e8c29e6d6276936b1be5e4fb116a4ec2585dfd8)) + +## [2.19.9](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.8...v2.19.9) (2025-02-18) + +### Bug Fixes + +- incorrect check for validating pixel data array type ([#1830](https://github.com/cornerstonejs/cornerstone3D/issues/1830)) ([f9d5b79](https://github.com/cornerstonejs/cornerstone3D/commit/f9d5b79c75a4125bbf4e646752ad2071ddc76c41)) + +## [2.19.8](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.7...v2.19.8) (2025-02-18) + +### Bug Fixes + +- **rendering:** fix image overflow issues by restoring data type check ([#1829](https://github.com/cornerstonejs/cornerstone3D/issues/1829)) ([f5ff886](https://github.com/cornerstonejs/cornerstone3D/commit/f5ff886cbc7fce190f943880c180533f3af97065)) + ## [2.19.7](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.6...v2.19.7) (2025-02-06) ### Bug Fixes diff --git a/addOns/externals/polyseg-wasm/CHANGELOG.md b/addOns/externals/polyseg-wasm/CHANGELOG.md deleted file mode 100644 index c39250d36e..0000000000 --- a/addOns/externals/polyseg-wasm/CHANGELOG.md +++ /dev/null @@ -1,114 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.1.10](https://github.com/cornerstonejs/cornerstone3D/compare/v2.1.9...v2.1.10) (2024-11-05) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.1.9](https://github.com/cornerstonejs/cornerstone3D/compare/v2.1.8...v2.1.9) (2024-11-05) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.1.8](https://github.com/cornerstonejs/cornerstone3D/compare/v2.1.7...v2.1.8) (2024-11-05) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.1.7](https://github.com/cornerstonejs/cornerstone3D/compare/v2.1.6...v2.1.7) (2024-11-04) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.1.6](https://github.com/cornerstonejs/cornerstone3D/compare/v2.1.5...v2.1.6) (2024-11-04) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.1.5](https://github.com/cornerstonejs/cornerstone3D/compare/v2.1.4...v2.1.5) (2024-10-31) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.1.4](https://github.com/cornerstonejs/cornerstone3D/compare/v2.1.3...v2.1.4) (2024-10-31) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.1.3](https://github.com/cornerstonejs/cornerstone3D/compare/v2.1.2...v2.1.3) (2024-10-31) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.1.2](https://github.com/cornerstonejs/cornerstone3D/compare/v2.1.1...v2.1.2) (2024-10-31) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.1.1](https://github.com/cornerstonejs/cornerstone3D/compare/v2.1.0...v2.1.1) (2024-10-30) - -**Note:** Version bump only for package @externals/polyseg-wasm - -# [2.1.0](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.5...v2.1.0) (2024-10-29) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.0.5](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.4...v2.0.5) (2024-10-29) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.0.4](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.3...v2.0.4) (2024-10-29) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.0.3](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.2...v2.0.3) (2024-10-29) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.0.2](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.1...v2.0.2) (2024-10-29) - -**Note:** Version bump only for package @externals/polyseg-wasm - -## [2.0.1](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.0...v2.0.1) (2024-10-29) - -**Note:** Version bump only for package @externals/polyseg-wasm - -# [2.0.0](https://github.com/cornerstonejs/cornerstone3D/compare/v1.86.0...v2.0.0) (2024-10-29) - -### Features - -- Cornerstone3D 2.0 ([#1400](https://github.com/cornerstonejs/cornerstone3D/issues/1400)) ([692d9af](https://github.com/cornerstonejs/cornerstone3D/commit/692d9afc6a8bcfa801c4aff0eec7706812bbfed8)) - -# [2.0.0-beta.30](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.0-beta.29...v2.0.0-beta.30) (2024-10-04) - -**Note:** Version bump only for package @externals/polyseg-wasm - -# [2.0.0-beta.29](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.0-beta.28...v2.0.0-beta.29) (2024-10-01) - -**Note:** Version bump only for package @externals/polyseg-wasm - -# [2.0.0-beta.28](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.0-beta.27...v2.0.0-beta.28) (2024-09-12) - -**Note:** Version bump only for package @externals/polyseg-wasm - -# [2.0.0-beta.27](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.0-beta.26...v2.0.0-beta.27) (2024-08-26) - -**Note:** Version bump only for package @externals/polyseg-wasm - -# [2.0.0-beta.26](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.0-beta.25...v2.0.0-beta.26) (2024-08-23) - -**Note:** Version bump only for package @externals/polyseg-wasm - -# [2.0.0-beta.25](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.0-beta.24...v2.0.0-beta.25) (2024-08-23) - -**Note:** Version bump only for package @externals/polyseg-wasm - -# [2.0.0-beta.24](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.0-beta.23...v2.0.0-beta.24) (2024-08-22) - -**Note:** Version bump only for package @externals/polyseg-wasm - -# [2.0.0-beta.23](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.0-beta.22...v2.0.0-beta.23) (2024-08-22) - -**Note:** Version bump only for package @externals/polyseg-wasm - -# [2.0.0-beta.22](https://github.com/cornerstonejs/cornerstone3D/compare/v2.0.0-beta.21...v2.0.0-beta.22) (2024-08-22) - -**Note:** Version bump only for package @externals/polyseg-wasm - -# [2.0.0-beta.21](https://github.com/cornerstonejs/cornerstone3D/compare/v1.82.5...v2.0.0-beta.21) (2024-08-21) - -**Note:** Version bump only for package @externals/polyseg-wasm diff --git a/addOns/externals/polyseg-wasm/package.json b/addOns/externals/polyseg-wasm/package.json deleted file mode 100644 index c662a6cb2e..0000000000 --- a/addOns/externals/polyseg-wasm/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "@externals/polyseg-wasm", - "description": "External reference to @icr/polyseg-wasm", - "private": true, - "version": "2.1.10", - "license": "MIT", - "engines": { - "node": ">=18", - "yarn": ">=1.19.1" - }, - "dependencies": { - "@icr/polyseg-wasm": "^0.4.0", - "@itk-wasm/morphological-contour-interpolation": "1.0.1" - } -} diff --git a/api-extractor.json b/api-extractor.json deleted file mode 100644 index 2fff114344..0000000000 --- a/api-extractor.json +++ /dev/null @@ -1,332 +0,0 @@ -{ - "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - - /** - * Determines the "" token that can be used with other config file settings. The project folder - * typically contains the tsconfig.json and package.json config files, but the path is user-defined. - * - * The path is resolved relative to the folder of the config file that contains the setting. - * - * The default value for "projectFolder" is the token "", which means the folder is determined by traversing - * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder - * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error - * will be reported. - * - * SUPPORTED TOKENS: - * DEFAULT VALUE: "" - */ - // "projectFolder": "..", - - /** - * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor - * analyzes the symbols exported by this module. - * - * The file extension must be ".d.ts" and not ".ts". - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - */ - "mainEntryPointFilePath": "/dist/esm/index.d.ts", - - /** - * A list of NPM package names whose exports should be treated as part of this package. - * - * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1", - * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part - * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly - * imports library2. To avoid this, we can specify: - * - * "bundledPackages": [ "library2" ], - * - * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been - * local files for library1. - */ - "bundledPackages": [ - "@cornerstonejs/core", - "@cornerstonejs/tools", - ], - - /** - * Determines how the TypeScript compiler engine will be invoked by API Extractor. - */ - "compiler": { - /** - * this is very important since We are overriding a TypeScript file since for development we use path - * to cross-reference the monorepor libraries. Here we should override it to not use for the API creation. - */ - "overrideTsconfig": { - "paths": {} - } - }, - - /** - * Configures how the API report file (*.api.md) will be generated. - */ - "apiReport": { - /** - * (REQUIRED) Whether to generate an API report. - */ - "enabled": true - - /** - * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce - * a full file path. - * - * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/". - * - * SUPPORTED TOKENS: , - * DEFAULT VALUE: ".api.md" - */ - // "reportFileName": ".api.md", - - /** - * Specifies the folder where the API report file is written. The file name portion is determined by - * the "reportFileName" setting. - * - * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy, - * e.g. for an API review. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/etc/" - */ - // "reportFolder": "/etc/", - - /** - * Specifies the folder where the temporary report file is written. The file name portion is determined by - * the "reportFileName" setting. - * - * After the temporary file is written to disk, it is compared with the file in the "reportFolder". - * If they are different, a production build will fail. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/temp/" - */ - // "reportTempFolder": "/temp/" - }, - - /** - * Configures how the doc model file (*.api.json) will be generated. - */ - "docModel": { - /** - * (REQUIRED) Whether to generate a doc model file. - */ - "enabled": false - - /** - * The output path for the doc model file. The file extension should be ".api.json". - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/temp/.api.json" - */ - // "apiJsonFilePath": "/temp/.api.json" - }, - - /** - * Configures how the .d.ts rollup file will be generated. - */ - "dtsRollup": { - /** - * (REQUIRED) Whether to generate the .d.ts rollup file. - */ - "enabled": true - - /** - * Specifies the output path for a .d.ts rollup file to be generated without any trimming. - * This file will include all declarations that are exported by the main entry point. - * - * If the path is an empty string, then this file will not be written. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/dist/.d.ts" - */ - // "untrimmedFilePath": "/dist/.d.ts", - - /** - * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. - * This file will include only declarations that are marked as "@public" or "@beta". - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "" - */ - // "betaTrimmedFilePath": "/dist/-beta.d.ts", - - /** - * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. - * This file will include only declarations that are marked as "@public". - * - * If the path is an empty string, then this file will not be written. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "" - */ - // "publicTrimmedFilePath": "/dist/-public.d.ts", - - /** - * When a declaration is trimmed, by default it will be replaced by a code comment such as - * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the - * declaration completely. - * - * DEFAULT VALUE: false - */ - // "omitTrimmingComments": true - }, - - /** - * Configures how the tsdoc-metadata.json file will be generated. - */ - "tsdocMetadata": { - /** - * Whether to generate the tsdoc-metadata.json file. - * - * DEFAULT VALUE: true - */ - "enabled": true - /** - * Specifies where the TSDoc metadata file should be written. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * The default value is "", which causes the path to be automatically inferred from the "tsdocMetadata", - * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup - * falls back to "tsdoc-metadata.json" in the package folder. - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "" - */ - // "tsdocMetadataFilePath": "/dist/tsdoc-metadata.json" - }, - - /** - * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files - * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead. - * To use the OS's default newline kind, specify "os". - * - * DEFAULT VALUE: "crlf" - */ - // "newlineKind": "crlf", - - /** - * Configures how API Extractor reports error and warning messages produced during analysis. - * - * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages. - */ - "messages": { - /** - * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing - * the input .d.ts files. - * - * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551" - * - * DEFAULT VALUE: A single "default" entry with logLevel=warning. - */ - "compilerMessageReporting": { - /** - * Configures the default routing for messages that don't match an explicit rule in this table. - */ - "default": { - /** - * Specifies whether the message should be written to the the tool's output log. Note that - * the "addToApiReportFile" property may supersede this option. - * - * Possible values: "error", "warning", "none" - * - * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail - * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes - * the "--local" option), the warning is displayed but the build will not fail. - * - * DEFAULT VALUE: "warning" - */ - "logLevel": "none" - - /** - * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), - * then the message will be written inside that file; otherwise, the message is instead logged according to - * the "logLevel" option. - * - * DEFAULT VALUE: false - */ - // "addToApiReportFile": false - } - - // "TS2551": { - // "logLevel": "warning", - // "addToApiReportFile": true - // }, - // - // . . . - }, - - /** - * Configures handling of messages reported by API Extractor during its analysis. - * - * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag" - * - * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings - */ - "extractorMessageReporting": { - "default": { - "logLevel": "none" - // "addToApiReportFile": false - }, - - "ae-forgotten-export": { - "logLevel": "none", - "addToApiReportFile": false - }, - - "ae-missing-release-tag": { - "logLevel": "none", - "addToApiReportFile": false - } - // "ae-extra-release-tag": { - // "logLevel": "warning", - // "addToApiReportFile": true - // }, - // - // . . . - }, - - /** - * Configures handling of messages reported by the TSDoc parser when analyzing code comments. - * - * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text" - * - * DEFAULT VALUE: A single "default" entry with logLevel=warning. - */ - "tsdocMessageReporting": { - "default": { - "logLevel": "warning" - // "addToApiReportFile": false - } - - // "tsdoc-link-tag-unescaped-text": { - // "logLevel": "warning", - // "addToApiReportFile": true - // }, - // - // . . . - } - } -} diff --git a/bun.lock b/bun.lock index e1fddb74bd..0c0ff55ab7 100644 --- a/bun.lock +++ b/bun.lock @@ -1,5 +1,5 @@ { - "lockfileVersion": 0, + "lockfileVersion": 1, "workspaces": { "": { "name": "root", @@ -43,6 +43,7 @@ "autoprefixer": "^10.4.14", "babel-loader": "9.1.2", "babel-plugin-istanbul": "^6.1.1", + "babel-plugin-transform-import-meta": "2.3.2", "chai": "^5.1.2", "clean-webpack-plugin": "^4.0.0", "commander": "^10.0.1", @@ -128,17 +129,9 @@ "dicom-microscopy-viewer": "^0.46.1", }, }, - "addOns/externals/polyseg-wasm": { - "name": "@externals/polyseg-wasm", - "version": "2.1.10", - "dependencies": { - "@icr/polyseg-wasm": "^0.4.0", - "@itk-wasm/morphological-contour-interpolation": "1.0.1", - }, - }, "packages/adapters": { "name": "@cornerstonejs/adapters", - "version": "2.19.6", + "version": "3.0.4", "dependencies": { "@babel/runtime-corejs2": "^7.17.8", "buffer": "^6.0.3", @@ -147,13 +140,13 @@ "ndarray": "^1.0.19", }, "peerDependencies": { - "@cornerstonejs/core": "packages/core", - "@cornerstonejs/tools": "packages/tools", + "@cornerstonejs/core": "^3.0.4", + "@cornerstonejs/tools": "^3.0.4", }, }, "packages/ai": { "name": "@cornerstonejs/ai", - "version": "2.19.6", + "version": "3.0.4", "dependencies": { "@babel/runtime-corejs2": "^7.17.8", "buffer": "^6.0.3", @@ -165,13 +158,13 @@ "onnxruntime-web": "1.17.1", }, "peerDependencies": { - "@cornerstonejs/core": "packages/core", - "@cornerstonejs/tools": "packages/tools", + "@cornerstonejs/core": "^3.0.0-beta.5", + "@cornerstonejs/tools": "^3.0.0-beta.5", }, }, "packages/core": { "name": "@cornerstonejs/core", - "version": "2.19.6", + "version": "3.0.4", "dependencies": { "@kitware/vtk.js": "32.9.0", "comlink": "^4.4.1", @@ -180,7 +173,7 @@ }, "packages/dicomImageLoader": { "name": "@cornerstonejs/dicom-image-loader", - "version": "2.19.6", + "version": "3.0.4", "dependencies": { "@cornerstonejs/codec-charls": "^1.2.3", "@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2", @@ -192,19 +185,19 @@ "uuid": "^9.0.0", }, "peerDependencies": { - "@cornerstonejs/core": "packages/core", + "@cornerstonejs/core": "^3.0.4", "dicom-parser": "^1.8.9", }, }, "packages/docs": { "name": "docs", - "version": "2.1.10", + "version": "3.0.0", "dependencies": { - "@cornerstonejs/adapters": "packages/adapters", - "@cornerstonejs/core": "packages/core", - "@cornerstonejs/dicom-image-loader": "packages/dicomImageLoader", - "@cornerstonejs/nifti-volume-loader": "packages/nifti-volume-loader", - "@cornerstonejs/tools": "packages/tools", + "@cornerstonejs/adapters": "^3.0.4", + "@cornerstonejs/core": "^3.0.4", + "@cornerstonejs/dicom-image-loader": "^3.0.4", + "@cornerstonejs/nifti-volume-loader": "^3.0.4", + "@cornerstonejs/tools": "^3.0.4", "@docusaurus/core": "3.6.3", "@docusaurus/faster": "3.6.3", "@docusaurus/module-type-aliases": "3.6.3", @@ -240,19 +233,44 @@ "typedoc": "0.26.10", }, }, + "packages/labelmap-interpolation": { + "name": "@cornerstonejs/labelmap-interpolation", + "version": "3.0.4", + "dependencies": { + "@itk-wasm/morphological-contour-interpolation": "1.1.0", + "itk-wasm": "1.0.0-b.165", + }, + "peerDependencies": { + "@cornerstonejs/core": "^2.19.11", + "@cornerstonejs/tools": "^2.19.11", + "@kitware/vtk.js": "^32.9.0", + }, + }, "packages/nifti-volume-loader": { "name": "@cornerstonejs/nifti-volume-loader", - "version": "2.19.6", + "version": "3.0.4", "dependencies": { "nifti-reader-js": "^0.6.8", }, "peerDependencies": { - "@cornerstonejs/core": "packages/core", + "@cornerstonejs/core": "^3.0.4", + }, + }, + "packages/polymorphic-segmentation": { + "name": "@cornerstonejs/polymorphic-segmentation", + "version": "3.0.4", + "dependencies": { + "@icr/polyseg-wasm": "0.4.0", + }, + "peerDependencies": { + "@cornerstonejs/core": "^2.19.11", + "@cornerstonejs/tools": "^2.19.11", + "@kitware/vtk.js": "^32.9.0", }, }, "packages/tools": { "name": "@cornerstonejs/tools", - "version": "2.19.6", + "version": "3.0.4", "dependencies": { "@types/offscreencanvas": "2019.7.3", "comlink": "^4.4.1", @@ -262,7 +280,7 @@ "canvas": "^2.11.2", }, "peerDependencies": { - "@cornerstonejs/core": "packages/core", + "@cornerstonejs/core": "^3.0.4", "@kitware/vtk.js": "32.9.0", "@types/d3-array": "^3.0.4", "@types/d3-interpolate": "^3.0.1", @@ -525,7 +543,7 @@ "@babel/plugin-transform-reserved-words": ["@babel/plugin-transform-reserved-words@7.25.9", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.25.9" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-7DL7DKYjn5Su++4RXu8puKZm2XBPHyjWLUidaPEkCUBbE7IPcsrkRHggAOOKydH1dASWdcUBxrkOGNxUv5P3Jg=="], - "@babel/plugin-transform-runtime": ["@babel/plugin-transform-runtime@7.25.9", "", { "dependencies": { "@babel/helper-module-imports": "^7.25.9", "@babel/helper-plugin-utils": "^7.25.9", "babel-plugin-polyfill-corejs2": "^0.4.10", "babel-plugin-polyfill-corejs3": "^0.10.6", "babel-plugin-polyfill-regenerator": "^0.6.1", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-nZp7GlEl+yULJrClz0SwHPqir3lc0zsPrDHQUcxGspSL7AKrexNSEfTbfqnDNJUO13bgKyfuOLMF8Xqtu8j3YQ=="], + "@babel/plugin-transform-runtime": ["@babel/plugin-transform-runtime@7.26.9", "", { "dependencies": { "@babel/helper-module-imports": "^7.25.9", "@babel/helper-plugin-utils": "^7.26.5", "babel-plugin-polyfill-corejs2": "^0.4.10", "babel-plugin-polyfill-corejs3": "^0.10.6", "babel-plugin-polyfill-regenerator": "^0.6.1", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Jf+8y9wXQbbxvVYTM8gO5oEF2POdNji0NMltEkG7FtmzD9PVz7/lxpqSdTvwsjTMU5HIHuDVNf2SOxLkWi+wPQ=="], "@babel/plugin-transform-shorthand-properties": ["@babel/plugin-transform-shorthand-properties@7.25.9", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.25.9" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-MUv6t0FhO5qHnS/W8XCbHmiRWOphNufpE1IVxhK5kuN3Td9FT1x4rx4K42s3RYdMXCXpfWkGSbCSd0Z64xA7Ng=="], @@ -557,9 +575,9 @@ "@babel/runtime": ["@babel/runtime@7.21.5", "", { "dependencies": { "regenerator-runtime": "^0.13.11" } }, "sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q=="], - "@babel/runtime-corejs2": ["@babel/runtime-corejs2@7.26.7", "", { "dependencies": { "core-js": "^2.6.12", "regenerator-runtime": "^0.14.0" } }, "sha512-C7fo97gUfsUP54j6GcQ+rJXyW6vgRRqF7J1ZxXesWcQtSRyzH1+eYrqFGzmU2JSUGFV0hQA2zLY/Z8AMrEx0qg=="], + "@babel/runtime-corejs2": ["@babel/runtime-corejs2@7.26.9", "", { "dependencies": { "core-js": "^2.6.12", "regenerator-runtime": "^0.14.0" } }, "sha512-DHEUkm9RD4RfIThlLTemmHNFVTj9Z/augVFMuyheFjwoFv1jFjauncHrcSW6Kv1TpzTupB01zFk2iRFAh2iE9A=="], - "@babel/runtime-corejs3": ["@babel/runtime-corejs3@7.26.7", "", { "dependencies": { "core-js-pure": "^3.30.2", "regenerator-runtime": "^0.14.0" } }, "sha512-55gRV8vGrCIYZnaQHQrD92Lo/hYE3Sj5tmbuf0hhHR7sj2CWhEhHU89hbq+UVDXvFG1zUVXJhUkEq1eAfqXtFw=="], + "@babel/runtime-corejs3": ["@babel/runtime-corejs3@7.26.9", "", { "dependencies": { "core-js-pure": "^3.30.2", "regenerator-runtime": "^0.14.0" } }, "sha512-5EVjbTegqN7RSJle6hMWYxO4voo4rI+9krITk+DWR+diJgGrjZjrIBnJhjrHYYQsFgI7j1w1QnrvV7YSKBfYGg=="], "@babel/template": ["@babel/template@7.25.9", "", { "dependencies": { "@babel/code-frame": "^7.25.9", "@babel/parser": "^7.25.9", "@babel/types": "^7.25.9" } }, "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg=="], @@ -583,9 +601,9 @@ "@colors/colors": ["@colors/colors@1.5.0", "", {}, "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ=="], - "@cornerstonejs/adapters": ["@cornerstonejs/adapters@workspace:packages/adapters", { "dependencies": { "@babel/runtime-corejs2": "^7.17.8", "buffer": "^6.0.3", "dcmjs": "^0.29.8", "gl-matrix": "^3.4.3", "ndarray": "^1.0.19" }, "peerDependencies": { "@cornerstonejs/core": "packages/core", "@cornerstonejs/tools": "packages/tools" } }], + "@cornerstonejs/adapters": ["@cornerstonejs/adapters@workspace:packages/adapters"], - "@cornerstonejs/ai": ["@cornerstonejs/ai@workspace:packages/ai", { "dependencies": { "@babel/runtime-corejs2": "^7.17.8", "buffer": "^6.0.3", "dcmjs": "^0.29.8", "gl-matrix": "^3.4.3", "lodash.clonedeep": "^4.5.0", "ndarray": "^1.0.19", "onnxruntime-common": "1.17.1", "onnxruntime-web": "1.17.1" }, "peerDependencies": { "@cornerstonejs/core": "packages/core", "@cornerstonejs/tools": "packages/tools" } }], + "@cornerstonejs/ai": ["@cornerstonejs/ai@workspace:packages/ai"], "@cornerstonejs/calculate-suv": ["@cornerstonejs/calculate-suv@1.0.3", "", {}, "sha512-2SwVJKzC1DzyxdxJtCht9dhTND2GFjLwhhkDyyC7vJq5tIgbhxgPk1CSwovO1pxmoybAXzjOxnaubllxLgoT+w=="], @@ -597,13 +615,17 @@ "@cornerstonejs/codec-openjph": ["@cornerstonejs/codec-openjph@2.4.7", "", {}, "sha512-qvP4q4JDib7mi9r7LqKOwqz7YZ8gjtDX4ZCezeYf8+eb7MBXCz5uXAMeVF3yz9Axw4XiIMdB/pqXkm8tqCl13w=="], - "@cornerstonejs/core": ["@cornerstonejs/core@workspace:packages/core", { "dependencies": { "@kitware/vtk.js": "32.9.0", "comlink": "^4.4.1", "gl-matrix": "^3.4.3" } }], + "@cornerstonejs/core": ["@cornerstonejs/core@workspace:packages/core"], - "@cornerstonejs/dicom-image-loader": ["@cornerstonejs/dicom-image-loader@workspace:packages/dicomImageLoader", { "dependencies": { "@cornerstonejs/codec-charls": "^1.2.3", "@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2", "@cornerstonejs/codec-openjpeg": "^1.2.2", "@cornerstonejs/codec-openjph": "^2.4.5", "comlink": "^4.4.1", "jpeg-lossless-decoder-js": "^2.1.0", "pako": "^2.0.4", "uuid": "^9.0.0" }, "peerDependencies": { "@cornerstonejs/core": "packages/core", "dicom-parser": "^1.8.9" } }], + "@cornerstonejs/dicom-image-loader": ["@cornerstonejs/dicom-image-loader@workspace:packages/dicomImageLoader"], - "@cornerstonejs/nifti-volume-loader": ["@cornerstonejs/nifti-volume-loader@workspace:packages/nifti-volume-loader", { "dependencies": { "nifti-reader-js": "^0.6.8" }, "peerDependencies": { "@cornerstonejs/core": "packages/core" } }], + "@cornerstonejs/labelmap-interpolation": ["@cornerstonejs/labelmap-interpolation@workspace:packages/labelmap-interpolation"], - "@cornerstonejs/tools": ["@cornerstonejs/tools@workspace:packages/tools", { "dependencies": { "@types/offscreencanvas": "2019.7.3", "comlink": "^4.4.1", "lodash.get": "^4.4.2" }, "devDependencies": { "canvas": "^2.11.2" }, "peerDependencies": { "@cornerstonejs/core": "packages/core", "@kitware/vtk.js": "32.9.0", "@types/d3-array": "^3.0.4", "@types/d3-interpolate": "^3.0.1", "d3-array": "^3.2.3", "d3-interpolate": "^3.0.1", "gl-matrix": "^3.4.3" } }], + "@cornerstonejs/nifti-volume-loader": ["@cornerstonejs/nifti-volume-loader@workspace:packages/nifti-volume-loader"], + + "@cornerstonejs/polymorphic-segmentation": ["@cornerstonejs/polymorphic-segmentation@workspace:packages/polymorphic-segmentation"], + + "@cornerstonejs/tools": ["@cornerstonejs/tools@workspace:packages/tools"], "@cspotcode/source-map-support": ["@cspotcode/source-map-support@0.8.1", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.9" } }, "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw=="], @@ -811,9 +833,7 @@ "@eslint/js": ["@eslint/js@8.57.1", "", {}, "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q=="], - "@externals/dicom-microscopy-viewer": ["@externals/dicom-microscopy-viewer@workspace:addOns/externals/dicom-microscopy-viewer", { "dependencies": { "dicom-microscopy-viewer": "^0.46.1" } }], - - "@externals/polyseg-wasm": ["@externals/polyseg-wasm@workspace:addOns/externals/polyseg-wasm", { "dependencies": { "@icr/polyseg-wasm": "^0.4.0", "@itk-wasm/morphological-contour-interpolation": "1.0.1" } }], + "@externals/dicom-microscopy-viewer": ["@externals/dicom-microscopy-viewer@workspace:addOns/externals/dicom-microscopy-viewer"], "@fastify/accept-negotiator": ["@fastify/accept-negotiator@1.1.0", "", {}, "sha512-OIHZrb2ImZ7XG85HXOONLcJWGosv7sIvM2ifAPQVhg9Lv7qdmMBNVaai4QTdyuaqbKM5eO6sLSQOYI7wEQeCJQ=="], @@ -869,7 +889,7 @@ "@itk-wasm/dam": ["@itk-wasm/dam@1.1.1", "", { "dependencies": { "axios": "^1.4.0", "commander": "^10.0.1", "decompress": "^4.2.1", "files-from-path": "^1.0.0", "ipfs-car": "^1.0.0", "tar": "^6.1.13" }, "bin": { "dam": "cli.js" } }, "sha512-7+9L3lrLMKF4y6B6qjs8GqfbpxT0waOJUM14NdMNEA6M+BoBS8fdHREhQHo2s7QMA5O7I+Jv7m+dyqlisGnbdQ=="], - "@itk-wasm/morphological-contour-interpolation": ["@itk-wasm/morphological-contour-interpolation@1.0.1", "", { "dependencies": { "itk-wasm": "1.0.0-b.165" } }, "sha512-wxLB4nX6CiWpNQyTWC7oeFXogiZbtmSuLhyAtY66sM0SEnMoOcAuSX2+osPcOo13rfYnHLA02uQiICp8hvUGwA=="], + "@itk-wasm/morphological-contour-interpolation": ["@itk-wasm/morphological-contour-interpolation@1.1.0", "", { "dependencies": { "itk-wasm": "1.0.0-b.173" } }, "sha512-n6JIyDcSCCjlpfCW8mnTTzwPTE8U1QT87hNmyAknxdpGR4dfAzIutuKNrwgvr9UiKEBcit0X3HNx9dkzDwcIcw=="], "@jest/console": ["@jest/console@29.7.0", "", { "dependencies": { "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "jest-message-util": "^29.7.0", "jest-util": "^29.7.0", "slash": "^3.0.0" } }, "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg=="], @@ -1821,6 +1841,8 @@ "babel-plugin-polyfill-regenerator": ["babel-plugin-polyfill-regenerator@0.6.3", "", { "dependencies": { "@babel/helper-define-polyfill-provider": "^0.6.3" }, "peerDependencies": { "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, "sha512-LiWSbl4CRSIa5x/JAU6jZiG9eit9w6mz+yVMFwDE83LAWvt0AfGBoZ7HS/mkhrKuh2ZlzfVZYKoLjXdqw6Yt7Q=="], + "babel-plugin-transform-import-meta": ["babel-plugin-transform-import-meta@2.3.2", "", { "dependencies": { "@babel/template": "^7.25.9", "tslib": "^2.8.1" }, "peerDependencies": { "@babel/core": "^7.10.0" } }, "sha512-902o4GiQqI1GqAXfD5rEoz0PJamUfJ3VllpdWaNsFTwdaNjFSFHawvBO+cp5K2j+g2h3bZ4lnM1Xb6yFYGihtA=="], + "babel-preset-current-node-syntax": ["babel-preset-current-node-syntax@1.1.0", "", { "dependencies": { "@babel/plugin-syntax-async-generators": "^7.8.4", "@babel/plugin-syntax-bigint": "^7.8.3", "@babel/plugin-syntax-class-properties": "^7.12.13", "@babel/plugin-syntax-class-static-block": "^7.14.5", "@babel/plugin-syntax-import-attributes": "^7.24.7", "@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/plugin-syntax-json-strings": "^7.8.3", "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", "@babel/plugin-syntax-numeric-separator": "^7.10.4", "@babel/plugin-syntax-object-rest-spread": "^7.8.3", "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", "@babel/plugin-syntax-optional-chaining": "^7.8.3", "@babel/plugin-syntax-private-property-in-object": "^7.14.5", "@babel/plugin-syntax-top-level-await": "^7.14.5" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw=="], "babel-preset-jest": ["babel-preset-jest@29.6.3", "", { "dependencies": { "babel-plugin-jest-hoist": "^29.6.3", "babel-preset-current-node-syntax": "^1.0.0" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA=="], @@ -2397,7 +2419,7 @@ "docdash": ["docdash@1.2.0", "", {}, "sha512-IYZbgYthPTspgqYeciRJNPhSwL51yer7HAwDXhF5p+H7mTDbPvY3PCk/QDjNxdPCpWkaJVFC4t7iCNB/t9E5Kw=="], - "docs": ["docs@workspace:packages/docs", { "dependencies": { "@cornerstonejs/adapters": "packages/adapters", "@cornerstonejs/core": "packages/core", "@cornerstonejs/dicom-image-loader": "packages/dicomImageLoader", "@cornerstonejs/nifti-volume-loader": "packages/nifti-volume-loader", "@cornerstonejs/tools": "packages/tools", "@docusaurus/core": "3.6.3", "@docusaurus/faster": "3.6.3", "@docusaurus/module-type-aliases": "3.6.3", "@docusaurus/plugin-google-gtag": "3.6.3", "@docusaurus/preset-classic": "3.6.3", "@kitware/vtk.js": "32.9.0", "@mdx-js/react": "^3.0.1", "@svgr/webpack": "^8.1.0", "clsx": "^1.1.1", "dcmjs": "^0.33.0", "dicom-parser": "^1.8.21", "dicomweb-client": "0.10.4", "docusaurus-plugin-copy": "0.1.1", "docusaurus-plugin-typedoc": "1.0.5", "file-loader": "^6.2.0", "gl-matrix": "^3.4.3", "hammerjs": "^2.0.8", "prism-react-renderer": "2.4.0", "react": "18.3.1", "react-dom": "18.3.1", "react-resize-detector": "11.0.1", "react-router-dom": "6.23.1", "typedoc-plugin-markdown": "4.2.9", "url-loader": "^4.1.1" }, "devDependencies": { "copyfiles": "2.4.1", "esbuild-loader": "^2.18.0", "karma-chrome-launcher": "^3.1.0", "netlify-plugin-cache": "^1.0.3", "puppeteer": "^13.1.3", "shader-loader": "^1.3.1", "typedoc": "0.26.10" } }], + "docs": ["docs@workspace:packages/docs"], "doctrine": ["doctrine@3.0.0", "", { "dependencies": { "esutils": "^2.0.2" } }, "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w=="], @@ -4843,7 +4865,7 @@ "strip-bom-string": ["strip-bom-string@1.0.0", "", {}, "sha512-uCC2VHvQRYu+lMh4My/sFNmF2klFymLX1wHJeXnbEJERpV/ZsVuonzerjfrGpIGF7LBVa1O7i9kjiWvJiFck8g=="], - "strip-dirs": ["strip-dirs@3.0.0", "", { "dependencies": { "inspect-with-kind": "^1.0.5", "is-plain-obj": "^1.1.0" } }, "sha512-I0sdgcFTfKQlUPZyAqPJmSG3HLO9rWDFnxonnIbskYNM3DwFOeTNB5KzVq3dA1GdRAc/25b5Y7UO2TQfKWw4aQ=="], + "strip-dirs": ["strip-dirs@2.1.0", "", { "dependencies": { "is-natural-number": "^4.0.1" } }, "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g=="], "strip-final-newline": ["strip-final-newline@3.0.0", "", {}, "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw=="], @@ -5429,8 +5451,12 @@ "@docsearch/react/algoliasearch": ["algoliasearch@5.20.0", "", { "dependencies": { "@algolia/client-abtesting": "5.20.0", "@algolia/client-analytics": "5.20.0", "@algolia/client-common": "5.20.0", "@algolia/client-insights": "5.20.0", "@algolia/client-personalization": "5.20.0", "@algolia/client-query-suggestions": "5.20.0", "@algolia/client-search": "5.20.0", "@algolia/ingestion": "1.20.0", "@algolia/monitoring": "1.20.0", "@algolia/recommend": "5.20.0", "@algolia/requester-browser-xhr": "5.20.0", "@algolia/requester-fetch": "5.20.0", "@algolia/requester-node-http": "5.20.0" } }, "sha512-groO71Fvi5SWpxjI9Ia+chy0QBwT61mg6yxJV27f5YFf+Mw+STT75K6SHySpP8Co5LsCrtsbCH5dJZSRtkSKaQ=="], + "@docusaurus/babel/@babel/plugin-transform-runtime": ["@babel/plugin-transform-runtime@7.25.9", "", { "dependencies": { "@babel/helper-module-imports": "^7.25.9", "@babel/helper-plugin-utils": "^7.25.9", "babel-plugin-polyfill-corejs2": "^0.4.10", "babel-plugin-polyfill-corejs3": "^0.10.6", "babel-plugin-polyfill-regenerator": "^0.6.1", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-nZp7GlEl+yULJrClz0SwHPqir3lc0zsPrDHQUcxGspSL7AKrexNSEfTbfqnDNJUO13bgKyfuOLMF8Xqtu8j3YQ=="], + "@docusaurus/babel/@babel/runtime": ["@babel/runtime@7.26.7", "", { "dependencies": { "regenerator-runtime": "^0.14.0" } }, "sha512-AOPI3D+a8dXnja+iwsUqGRjr1BbZIe771sXdapOtYI531gSqpi92vXivKcq2asu/DFpdl1ceFAKZyRzK2PCVcQ=="], + "@docusaurus/babel/@babel/runtime-corejs3": ["@babel/runtime-corejs3@7.26.7", "", { "dependencies": { "core-js-pure": "^3.30.2", "regenerator-runtime": "^0.14.0" } }, "sha512-55gRV8vGrCIYZnaQHQrD92Lo/hYE3Sj5tmbuf0hhHR7sj2CWhEhHU89hbq+UVDXvFG1zUVXJhUkEq1eAfqXtFw=="], + "@docusaurus/babel/fs-extra": ["fs-extra@11.3.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew=="], "@docusaurus/bundler/babel-loader": ["babel-loader@9.2.1", "", { "dependencies": { "find-cache-dir": "^4.0.0", "schema-utils": "^4.0.0" }, "peerDependencies": { "@babel/core": "^7.12.0", "webpack": ">=5" } }, "sha512-fqe8naHt46e0yIdkjUZYqddSXfej3AHajX+CSO5X7oy0EmPc6o5Xh+RClNoHjnieWz9AW4kZxW9yyFMhVB1QLA=="], @@ -5463,8 +5489,6 @@ "@docusaurus/mdx-loader/webpack": ["webpack@5.97.1", "", { "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.6", "@webassemblyjs/ast": "^1.14.1", "@webassemblyjs/wasm-edit": "^1.14.1", "@webassemblyjs/wasm-parser": "^1.14.1", "acorn": "^8.14.0", "browserslist": "^4.24.0", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.17.1", "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.2.11", "json-parse-even-better-errors": "^2.3.1", "loader-runner": "^4.2.0", "mime-types": "^2.1.27", "neo-async": "^2.6.2", "schema-utils": "^3.2.0", "tapable": "^2.1.1", "terser-webpack-plugin": "^5.3.10", "watchpack": "^2.4.1", "webpack-sources": "^3.2.3" }, "bin": { "webpack": "bin/webpack.js" } }, "sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg=="], - "@docusaurus/module-type-aliases/react-helmet-async": ["react-helmet-async@2.0.5", "", { "dependencies": { "invariant": "^2.2.4", "react-fast-compare": "^3.2.2", "shallowequal": "^1.1.0" }, "peerDependencies": { "react": "^16.6.0 || ^17.0.0 || ^18.0.0" } }, "sha512-rYUYHeus+i27MvFE+Jaa4WsyBKGkL6qVgbJvSBoX8mbsWoABJXdEO0bZyi0F6i+4f0NuIb8AvqPMj3iXFHkMwg=="], - "@docusaurus/plugin-content-blog/fs-extra": ["fs-extra@11.3.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew=="], "@docusaurus/plugin-content-blog/webpack": ["webpack@5.97.1", "", { "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.6", "@webassemblyjs/ast": "^1.14.1", "@webassemblyjs/wasm-edit": "^1.14.1", "@webassemblyjs/wasm-parser": "^1.14.1", "acorn": "^8.14.0", "browserslist": "^4.24.0", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.17.1", "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.2.11", "json-parse-even-better-errors": "^2.3.1", "loader-runner": "^4.2.0", "mime-types": "^2.1.27", "neo-async": "^2.6.2", "schema-utils": "^3.2.0", "tapable": "^2.1.1", "terser-webpack-plugin": "^5.3.10", "watchpack": "^2.4.1", "webpack-sources": "^3.2.3" }, "bin": { "webpack": "bin/webpack.js" } }, "sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg=="], @@ -5539,6 +5563,8 @@ "@istanbuljs/load-nyc-config/find-up": ["find-up@4.1.0", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="], + "@itk-wasm/morphological-contour-interpolation/itk-wasm": ["itk-wasm@1.0.0-b.173", "", { "dependencies": { "@itk-wasm/dam": "^1.1.1", "@thewtex/zstddec": "^0.2.0", "@types/emscripten": "^1.39.10", "axios": "^1.6.2", "chalk": "^5.3.0", "comlink": "^4.4.1", "commander": "^11.1.0", "fs-extra": "^11.2.0", "glob": "^8.1.0", "markdown-table": "^3.0.3", "mime-types": "^2.1.35", "wasm-feature-detect": "^1.6.1" }, "bin": { "itk-wasm": "src/itk-wasm-cli.js" } }, "sha512-SV2lfZ1mClWuSK/noaZgGj9jhroY4MZu19ci9pIucuyhoGdXrVSmWlPH/JYMDi9RP3BogmQwe9wfFc3X1dcEPg=="], + "@jest/core/ansi-escapes": ["ansi-escapes@4.3.2", "", { "dependencies": { "type-fest": "^0.21.3" } }, "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ=="], "@jest/core/ci-info": ["ci-info@3.9.0", "", {}, "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ=="], @@ -5825,6 +5851,8 @@ "@web3-storage/car-block-validator/multiformats": ["multiformats@9.9.0", "", {}, "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg=="], + "@xhmikosr/decompress/strip-dirs": ["strip-dirs@3.0.0", "", { "dependencies": { "inspect-with-kind": "^1.0.5", "is-plain-obj": "^1.1.0" } }, "sha512-I0sdgcFTfKQlUPZyAqPJmSG3HLO9rWDFnxonnIbskYNM3DwFOeTNB5KzVq3dA1GdRAc/25b5Y7UO2TQfKWw4aQ=="], + "@xhmikosr/decompress-tar/tar-stream": ["tar-stream@3.1.7", "", { "dependencies": { "b4a": "^1.6.4", "fast-fifo": "^1.2.0", "streamx": "^2.15.0" } }, "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ=="], "@zkochan/js-yaml/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], @@ -5997,6 +6025,8 @@ "cssstyle/cssom": ["cssom@0.3.8", "", {}, "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg=="], + "dcmjs/@babel/runtime-corejs3": ["@babel/runtime-corejs3@7.26.7", "", { "dependencies": { "core-js-pure": "^3.30.2", "regenerator-runtime": "^0.14.0" } }, "sha512-55gRV8vGrCIYZnaQHQrD92Lo/hYE3Sj5tmbuf0hhHR7sj2CWhEhHU89hbq+UVDXvFG1zUVXJhUkEq1eAfqXtFw=="], + "decamelize-keys/decamelize": ["decamelize@1.2.0", "", {}, "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA=="], "decamelize-keys/map-obj": ["map-obj@1.0.1", "", {}, "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg=="], @@ -6005,8 +6035,6 @@ "decompress/pify": ["pify@2.3.0", "", {}, "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog=="], - "decompress/strip-dirs": ["strip-dirs@2.1.0", "", { "dependencies": { "is-natural-number": "^4.0.1" } }, "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g=="], - "decompress-tar/file-type": ["file-type@5.2.0", "", {}, "sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ=="], "decompress-tar/is-stream": ["is-stream@1.1.0", "", {}, "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ=="], @@ -6851,8 +6879,6 @@ "stringify-object/is-obj": ["is-obj@1.0.1", "", {}, "sha512-l4RyHgRqGN4Y3+9JHVrNqO+tN0rV5My76uW5/nuO4K1b6vw5G8d/cmFjP9tRfEsdhZNt0IFdZuK/c2Vr4Nb+Qg=="], - "strip-dirs/is-plain-obj": ["is-plain-obj@1.1.0", "", {}, "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg=="], - "stylelint/cosmiconfig": ["cosmiconfig@8.3.6", "", { "dependencies": { "import-fresh": "^3.3.0", "js-yaml": "^4.1.0", "parse-json": "^5.2.0", "path-type": "^4.0.0" }, "peerDependencies": { "typescript": ">=4.9.5" }, "optionalPeers": ["typescript"] }, "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA=="], "stylelint/file-entry-cache": ["file-entry-cache@7.0.2", "", { "dependencies": { "flat-cache": "^3.2.0" } }, "sha512-TfW7/1iI4Cy7Y8L6iqNdZQVvdXn0f8B4QcIXmkIbtTIe/Okm/nSlHb4IwGzRVOd3WfSieCgvf5cMzEfySAIl0g=="], @@ -7039,8 +7065,12 @@ "@docsearch/react/algoliasearch/@algolia/requester-node-http": ["@algolia/requester-node-http@5.20.0", "", { "dependencies": { "@algolia/client-common": "5.20.0" } }, "sha512-kmtQClq/w3vtPteDSPvaW9SPZL/xrIgMrxZyAgsFwrJk0vJxqyC5/hwHmrCraDnStnGSADnLpBf4SpZnwnkwWw=="], + "@docusaurus/babel/@babel/plugin-transform-runtime/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], + "@docusaurus/babel/@babel/runtime/regenerator-runtime": ["regenerator-runtime@0.14.1", "", {}, "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="], + "@docusaurus/babel/@babel/runtime-corejs3/regenerator-runtime": ["regenerator-runtime@0.14.1", "", {}, "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="], + "@docusaurus/bundler/babel-loader/find-cache-dir": ["find-cache-dir@4.0.0", "", { "dependencies": { "common-path-prefix": "^3.0.0", "pkg-dir": "^7.0.0" } }, "sha512-9ZonPT4ZAK4a+1pUPVPZJapbi7O5qbbJPdYw/NOQWZZbVLdDTYM3A4R9z/DpAM08IDaFGsvPgiGZ82WEwUDWjg=="], "@docusaurus/bundler/html-minifier-terser/entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="], @@ -7211,6 +7241,14 @@ "@istanbuljs/load-nyc-config/find-up/locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="], + "@itk-wasm/morphological-contour-interpolation/itk-wasm/chalk": ["chalk@5.3.0", "", {}, "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w=="], + + "@itk-wasm/morphological-contour-interpolation/itk-wasm/commander": ["commander@11.1.0", "", {}, "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ=="], + + "@itk-wasm/morphological-contour-interpolation/itk-wasm/fs-extra": ["fs-extra@11.3.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew=="], + + "@itk-wasm/morphological-contour-interpolation/itk-wasm/glob": ["glob@8.1.0", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^5.0.1", "once": "^1.3.0" } }, "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ=="], + "@jest/core/ansi-escapes/type-fest": ["type-fest@0.21.3", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="], "@jest/reporters/glob/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], @@ -7469,6 +7507,8 @@ "@vercel/nft/micromatch/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + "@xhmikosr/decompress/strip-dirs/is-plain-obj": ["is-plain-obj@1.1.0", "", {}, "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg=="], + "archiver-utils/readable-stream/string_decoder": ["string_decoder@1.3.0", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="], "archiver/readable-stream/string_decoder": ["string_decoder@1.3.0", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="], @@ -7587,6 +7627,8 @@ "csso/css-tree/mdn-data": ["mdn-data@2.0.28", "", {}, "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g=="], + "dcmjs/@babel/runtime-corejs3/regenerator-runtime": ["regenerator-runtime@0.14.1", "", {}, "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="], + "decompress-tar/tar-stream/bl": ["bl@1.2.3", "", { "dependencies": { "readable-stream": "^2.3.5", "safe-buffer": "^5.1.1" } }, "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww=="], "decompress/make-dir/pify": ["pify@3.0.0", "", {}, "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg=="], @@ -7617,6 +7659,8 @@ "detective-typescript/@typescript-eslint/typescript-estree/globby": ["globby@11.1.0", "", { "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", "fast-glob": "^3.2.9", "ignore": "^5.2.0", "merge2": "^1.4.1", "slash": "^3.0.0" } }, "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g=="], + "docs/dcmjs/@babel/runtime-corejs3": ["@babel/runtime-corejs3@7.26.7", "", { "dependencies": { "core-js-pure": "^3.30.2", "regenerator-runtime": "^0.14.0" } }, "sha512-55gRV8vGrCIYZnaQHQrD92Lo/hYE3Sj5tmbuf0hhHR7sj2CWhEhHU89hbq+UVDXvFG1zUVXJhUkEq1eAfqXtFw=="], + "docs/typedoc/markdown-it": ["markdown-it@14.1.0", "", { "dependencies": { "argparse": "^2.0.1", "entities": "^4.4.0", "linkify-it": "^5.0.0", "mdurl": "^2.0.0", "punycode.js": "^2.3.1", "uc.micro": "^2.1.0" }, "bin": { "markdown-it": "bin/markdown-it.mjs" } }, "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg=="], "docs/typedoc/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="], @@ -8385,6 +8429,8 @@ "@istanbuljs/load-nyc-config/find-up/locate-path/p-locate": ["p-locate@4.1.0", "", { "dependencies": { "p-limit": "^2.2.0" } }, "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="], + "@itk-wasm/morphological-contour-interpolation/itk-wasm/glob/minimatch": ["minimatch@5.1.6", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g=="], + "@jsdevtools/coverage-istanbul-loader/schema-utils/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], "@lerna/create/execa/npm-run-path/path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="], @@ -8569,6 +8615,8 @@ "detective-typescript/@typescript-eslint/typescript-estree/@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], + "docs/dcmjs/@babel/runtime-corejs3/regenerator-runtime": ["regenerator-runtime@0.14.1", "", {}, "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="], + "docs/typedoc/markdown-it/argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], "docs/typedoc/markdown-it/entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="], @@ -8909,6 +8957,8 @@ "@docusaurus/utils/webpack/schema-utils/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], + "@itk-wasm/morphological-contour-interpolation/itk-wasm/glob/minimatch/brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="], + "@lerna/create/rimraf/glob/minimatch/brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="], "@netlify/build-info/read-pkg/normalize-package-data/hosted-git-info/lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="], @@ -9045,6 +9095,8 @@ "@docusaurus/core/update-notifier/boxen/wrap-ansi/strip-ansi/ansi-regex": ["ansi-regex@6.1.0", "", {}, "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA=="], + "@itk-wasm/morphological-contour-interpolation/itk-wasm/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], + "@lerna/create/rimraf/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], "@netlify/functions-utils/@netlify/zip-it-and-ship-it/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], diff --git a/commit.txt b/commit.txt index 1c9cdfa4cd..e00a3af5e0 100644 --- a/commit.txt +++ b/commit.txt @@ -1 +1 @@ -f43a1766ba16aec1fc6bd638543f406735281220 \ No newline at end of file +eae957729848d44971050ca40d684dae8f919170 \ No newline at end of file diff --git a/common/reviews/api/ai.api.md b/common/reviews/api/ai.api.md deleted file mode 100644 index bbb180026b..0000000000 --- a/common/reviews/api/ai.api.md +++ /dev/null @@ -1,196 +0,0 @@ -## API Report File for "@cornerstonejs/ai" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import type ColorTransferFunction from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction'; -import { Corners } from '@kitware/vtk.js/Interaction/Widgets/OrientationMarkerWidget/Constants'; -import type { IColorMapPreset } from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction/ColorMaps'; -import type { mat3 } from 'gl-matrix'; -import { mat4 } from 'gl-matrix'; -import type { Range as Range_2 } from '@kitware/vtk.js/types'; -import { vec3 } from 'gl-matrix'; -import type vtkActor from '@kitware/vtk.js/Rendering/Core/Actor'; -import vtkAnnotatedCubeActor from '@kitware/vtk.js/Rendering/Core/AnnotatedCubeActor'; -import type { vtkCamera } from '@kitware/vtk.js/Rendering/Core/Camera'; -import { vtkColorTransferFunction } from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction'; -import { vtkImageData } from '@kitware/vtk.js/Common/DataModel/ImageData'; -import type vtkImageSlice from '@kitware/vtk.js/Rendering/Core/ImageSlice'; -import type { vtkObject } from '@kitware/vtk.js/interfaces'; -import type vtkOpenGLTexture from '@kitware/vtk.js/Rendering/OpenGL/Texture'; -import type vtkPiecewiseFunction from '@kitware/vtk.js/Common/DataModel/PiecewiseFunction'; -import vtkPlane from '@kitware/vtk.js/Common/DataModel/Plane'; -import type vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData'; -import type vtkRenderer from '@kitware/vtk.js/Rendering/Core/Renderer'; -import type vtkVolume from '@kitware/vtk.js/Rendering/Core/Volume'; - -// @public (undocumented) -export class ONNXSegmentationController { - constructor(options?: { - listeners: any; - getPromptAnnotations: any; - promptAnnotationTypes: any; - models: any; - modelName: any; - islandFillOptions: any; - }); - // (undocumented) - acceptPreview(element: any): void; - // (undocumented) - protected annotationModifiedListener: (_event?: any) => void; - // (undocumented) - protected annotationsNeedUpdating: boolean; - // (undocumented) - static BoxPrompt: string; - // (undocumented) - protected boxRadius: number; - // (undocumented) - cacheImageEncodings(current?: any, offset?: number, length?: number): any; - // (undocumented) - canvas: HTMLCanvasElement; - // (undocumented) - canvasMask: HTMLCanvasElement; - // (undocumented) - clear(viewport: any): void; - // (undocumented) - createLabelmap(mask: any, canvasPosition: any, _points: any, _labels: any): void; - // (undocumented) - protected currentImage: any; - // (undocumented) - decode(points: any, labels: any, useSession?: any): Promise; - // (undocumented) - protected desiredImage: { - imageId: any; - sampleImageId: any; - imageIndex: number; - decoder: any; - encoder: any; - }; - // (undocumented) - disconnectViewport(viewport: any): void; - // (undocumented) - protected excludeTool: string; - // (undocumented) - fetchAndCacheModel(url: any, name: any): Promise; - // (undocumented) - getConfig(modelName?: string): any; - // (undocumented) - getDirectoryForImageId(session: any, imageId: any): Promise; - // (undocumented) - getFileNameForImageId(imageId: any, extension: any): any; - // (undocumented) - protected getPromptAnnotations: (viewport?: any) => cornerstoneTools.Types.Annotations; - // (undocumented) - protected handleImage({ imageId, sampleImageId }: { - imageId: any; - sampleImageId: any; - }, imageSession: any): Promise; - // (undocumented) - protected imageEncodings: Map; - // (undocumented) - protected imageImageData: any; - // (undocumented) - initModel(): Promise; - // (undocumented) - initViewport(viewport: any): void; - // (undocumented) - interpolateScroll(viewport?: any, dir?: number): Promise; - // (undocumented) - protected isGpuInUse: boolean; - // (undocumented) - protected islandFillOptions: { - maxInternalRemove: number; - fillInternalEdge: boolean; - }; - // (undocumented) - protected load(): Promise; - // (undocumented) - loadModels(models: any, imageSession?: any): Promise; - // (undocumented) - loadStorageImageEncoding(session: any, imageId: any, index?: any): Promise; - // (undocumented) - protected log(logger: Loggers, ...args: any[]): void; - // (undocumented) - mapAnnotationPoint(worldPoint: any): number[]; - // (undocumented) - static MarkerExclude: string; - // (undocumented) - static MarkerInclude: string; - // (undocumented) - protected maskImageData: any; - // (undocumented) - maxHeight: number; - // (undocumented) - maxWidth: number; - // (undocumented) - modelHeight: number; - // (undocumented) - static MODELS: { - sam_l: ({ - name: string; - url: string; - size: number; - key: string; - feedType: string; - } | { - name: string; - url: string; - size: number; - key: string; - feedType?: undefined; - })[]; - sam_h: ({ - name: string; - url: string; - size: number; - key: string; - feedType: string; - } | { - name: string; - url: string; - size: number; - key: string; - feedType?: undefined; - })[]; - }; - // (undocumented) - modelWidth: number; - // (undocumented) - protected pCutoff: number; - // (undocumented) - protected promptAnnotationTypes: string[]; - // (undocumented) - rejectPreview(element: any): void; - // (undocumented) - restoreImageEncoding(session: any, imageId: any): Promise; - // (undocumented) - protected runDecode(): Promise; - // (undocumented) - setPCutoff(cutoff: number): void; - // (undocumented) - protected sharedImageEncoding: any; - // (undocumented) - storeImageEncoding(session: any, imageId: any, data: any): Promise; - // (undocumented) - tool: any; - // (undocumented) - tryLoad(options?: { - resetImage: boolean; - }): void; - // (undocumented) - updateAnnotations(): void; - // (undocumented) - protected viewport: any; - // (undocumented) - static viewportOptions: { - displayArea: Types.DisplayArea; - background: Types.Point3; - }; - // (undocumented) - protected viewportRenderedListener: (_event: any) => void; -} - -// (No @packageDocumentation comment for this package) - -``` diff --git a/common/reviews/api/core.api.md b/common/reviews/api/core.api.md deleted file mode 100644 index 7a579bc5b1..0000000000 --- a/common/reviews/api/core.api.md +++ /dev/null @@ -1,5236 +0,0 @@ -## API Report File for "@cornerstonejs/core" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import type ColorTransferFunction from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction'; -import type { mat3 } from 'gl-matrix'; -import { mat4 } from 'gl-matrix'; -import type { Range as Range_2 } from '@kitware/vtk.js/types'; -import { vec3 } from 'gl-matrix'; -import type vtkActor from '@kitware/vtk.js/Rendering/Core/Actor'; -import type { vtkCamera } from '@kitware/vtk.js/Rendering/Core/Camera'; -import { vtkColorTransferFunction } from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction'; -import { vtkImageData } from '@kitware/vtk.js/Common/DataModel/ImageData'; -import type vtkImageSlice from '@kitware/vtk.js/Rendering/Core/ImageSlice'; -import type { vtkObject } from '@kitware/vtk.js/interfaces'; -import type vtkOpenGLTexture from '@kitware/vtk.js/Rendering/OpenGL/Texture'; -import vtkPlane from '@kitware/vtk.js/Common/DataModel/Plane'; -import type vtkRenderer from '@kitware/vtk.js/Rendering/Core/Renderer'; -import type vtkVolume from '@kitware/vtk.js/Rendering/Core/Volume'; -import vtkVolumeMapper from '@kitware/vtk.js/Rendering/Core/VolumeMapper'; - -// @public (undocumented) -interface AABB2 { - // (undocumented) - maxX: number; - // (undocumented) - maxY: number; - // (undocumented) - minX: number; - // (undocumented) - minY: number; -} - -// @public (undocumented) -interface AABB3 { - // (undocumented) - maxX: number; - // (undocumented) - maxY: number; - // (undocumented) - maxZ: number; - // (undocumented) - minX: number; - // (undocumented) - minY: number; - // (undocumented) - minZ: number; -} - -// @public (undocumented) -type Actor = vtkActor; - -// @public (undocumented) -interface ActorEntry { - // (undocumented) - [key: string]: unknown; - // (undocumented) - actor: Actor | VolumeActor | ImageActor | ICanvasActor; - // (undocumented) - blendMode?: BlendModes; - // (undocumented) - callbacks?: ({ volumeActor, volumeId, }: { - volumeActor: VolumeActor; - volumeId: string; - }) => void; - // (undocumented) - clippingFilter?: any; - // (undocumented) - referencedId?: string; - // (undocumented) - slabThickness?: number; - // (undocumented) - uid: string; -} - -// @public (undocumented) -function actorIsA(actorEntry: Types.ActorEntry | Types.Actor, actorType: actorTypes): boolean; - -// @public (undocumented) -interface ActorSliceRange { - // (undocumented) - actor: VolumeActor; - // (undocumented) - current: number; - // (undocumented) - focalPoint: Point3; - // (undocumented) - max: number; - // (undocumented) - min: number; - // (undocumented) - viewPlaneNormal: Point3; -} - -// @public (undocumented) -export function addImageSlicesToViewports(renderingEngine: IRenderingEngine, stackInputs: IStackInput[], viewportIds: string[]): Promise; - -// @public (undocumented) -function addProvider(provider: (type: string, ...query: string[]) => unknown, priority?: number): void; - -// @public (undocumented) -export function addVolumesToViewports(renderingEngine: IRenderingEngine, volumeInputs: IVolumeInput[], viewportIds: string[], immediateRender?: boolean, suppressEvents?: boolean): Promise; - -// @public (undocumented) -type AffineMatrix = [ -[ -number, -number, -number, -number -], -[ -number, -number, -number, -number -], -[ -number, -number, -number, -number -], -[ -number, -number, -number, -number -] -]; - -// @public (undocumented) -function applyPreset(actor: VolumeActor, preset: ViewportPreset): void; - -// @public (undocumented) -const autoLoad: (volumeId: string) => void; - -// @public (undocumented) -const backgroundColors: { - slicer3D: number[]; -}; - -// @public (undocumented) -export abstract class BaseVolumeViewport extends Viewport { - constructor(props: ViewportInput); - // (undocumented) - addVolumes(volumeInputArray: IVolumeInput[], immediate?: boolean, suppressEvents?: boolean): Promise; - // (undocumented) - protected applyViewOrientation(orientation: OrientationAxis | OrientationVectors, resetCamera?: boolean): void; - // (undocumented) - canvasToWorld: (canvasPos: Point2) => Point3; - // (undocumented) - clearDefaultProperties(volumeId?: string): void; - // (undocumented) - flip(flipDirection: FlipDirection): void; - // (undocumented) - getAllVolumeIds(): string[]; - // (undocumented) - getBounds(): number[]; - // (undocumented) - abstract getCurrentImageId(): string | undefined; - // (undocumented) - getDefaultProperties: (volumeId?: string) => VolumeViewportProperties; - // (undocumented) - getFrameOfReferenceUID: () => string; - // (undocumented) - getImageData(volumeId?: string): IImageData | undefined; - // (undocumented) - getImageIds: (volumeId?: string) => string[]; - // (undocumented) - getIntensityFromWorld(point: Point3): number; - // (undocumented) - protected _getOrientationVectors(orientation: OrientationAxis | OrientationVectors): OrientationVectors; - // (undocumented) - getProperties: (volumeId?: string) => VolumeViewportProperties; - // (undocumented) - getRotation: () => number; - // (undocumented) - getSlabThickness(): number; - // (undocumented) - getSliceIndex(): number; - // (undocumented) - getSliceViewInfo(): { - width: number; - height: number; - sliceIndex: number; - slicePlane: number; - sliceToIndexMatrix: mat4; - indexToSliceMatrix: mat4; - }; - // (undocumented) - getViewReference(viewRefSpecifier?: ViewReferenceSpecifier): ViewReference; - // (undocumented) - getViewReferenceId(specifier?: ViewReferenceSpecifier): string; - // (undocumented) - protected getVOIModifiedEventDetail(volumeId: string): VoiModifiedEventDetail; - // (undocumented) - getVolumeId(specifier?: ViewReferenceSpecifier): string; - // (undocumented) - hasImageURI: (imageURI: string) => boolean; - // (undocumented) - hasVolumeId(volumeId: string): boolean; - // (undocumented) - hasVolumeURI(volumeURI: string): boolean; - // (undocumented) - protected initialTransferFunctionNodes: TransferFunctionNodes; - // (undocumented) - protected initialViewUp: Point3; - // (undocumented) - isReferenceViewable(viewRef: ViewReference, options?: ReferenceCompatibleOptions): boolean; - // (undocumented) - removeVolumeActors(actorUIDs: string[], immediate?: boolean): void; - // (undocumented) - abstract resetProperties(volumeId?: string): void; - // (undocumented) - abstract resetSlabThickness(): void; - // (undocumented) - resetToDefaultProperties(volumeId: string): void; - // (undocumented) - scroll(delta?: number): void; - // (undocumented) - abstract setBlendMode(blendMode: BlendModes, filterActorUIDs?: string[], immediate?: boolean): void; - // (undocumented) - setCamera(cameraInterface: ICamera, storeAsInitialCamera?: boolean): void; - // (undocumented) - protected setCameraClippingRange(): void; - // (undocumented) - setDefaultProperties(ViewportProperties: VolumeViewportProperties, volumeId?: string): void; - // (undocumented) - protected setInterpolationType(interpolationType: InterpolationType, volumeId?: string): void; - // (undocumented) - setOrientation(_orientation: OrientationAxis | OrientationVectors, _immediate?: boolean): void; - // (undocumented) - setProperties({ voiRange, VOILUTFunction, invert, colormap, preset, interpolationType, slabThickness, }?: VolumeViewportProperties, volumeId?: string, suppressEvents?: boolean): void; - // (undocumented) - protected setRotation: (rotation: number) => void; - // (undocumented) - abstract setSlabThickness(slabThickness: number, filterActorUIDs?: string[]): void; - // (undocumented) - setViewReference(viewRef: ViewReference): void; - // (undocumented) - setVolumes(volumeInputArray: IVolumeInput[], immediate?: boolean, suppressEvents?: boolean): Promise; - // (undocumented) - useCPURendering: boolean; - // (undocumented) - static get useCustomRenderingPipeline(): boolean; - // (undocumented) - protected viewportProperties: VolumeViewportProperties; - // (undocumented) - worldToCanvas: (worldPos: Point3) => Point2; -} - -// @public (undocumented) -enum BlendModes { - // (undocumented) - AVERAGE_INTENSITY_BLEND, - // (undocumented) - COMPOSITE, - // (undocumented) - LABELMAP_EDGE_PROJECTION_BLEND, - // (undocumented) - MAXIMUM_INTENSITY_BLEND, - // (undocumented) - MINIMUM_INTENSITY_BLEND -} - -// @public (undocumented) -type BoundsIJK = [Point2, Point2, Point2]; - -// @public (undocumented) -type BoundsLPS = [Point3, Point3, Point3]; - -// @public (undocumented) -export const cache: Cache_2; - -// @public (undocumented) -function calculateViewportsSpatialRegistration(viewport1: StackViewport | IVolumeViewport, viewport2: StackViewport | IVolumeViewport): void; - -// @public (undocumented) -enum CalibrationTypes { - // (undocumented) - ERMF = "ERMF", - // (undocumented) - ERROR = "Error", - // (undocumented) - NOT_APPLICABLE = "", - // (undocumented) - PROJECTION = "Proj", - // (undocumented) - REGION = "Region", - // (undocumented) - UNCALIBRATED = "Uncalibrated", - // (undocumented) - USER = "User" -} - -// @public (undocumented) -type CameraModifiedEvent = CustomEvent_2; - -// @public (undocumented) -interface CameraModifiedEventDetail { - // (undocumented) - camera: ICamera; - // (undocumented) - element: HTMLDivElement; - // (undocumented) - previousCamera: ICamera; - // (undocumented) - renderingEngineId: string; - // (undocumented) - viewportId: string; -} - -// @public (undocumented) -type CameraResetEvent = CustomEvent_2; - -// @public (undocumented) -interface CameraResetEventDetail { - // (undocumented) - camera: ICamera; - // (undocumented) - element: HTMLDivElement; - // (undocumented) - renderingEngineId: string; - // (undocumented) - viewportId: string; -} - -// @public (undocumented) -function cancelLoadAll(): void; - -// @public (undocumented) -function cancelLoadImage(imageId: string): void; - -// @public (undocumented) -function cancelLoadImages(imageIds: string[]): void; - -// @public (undocumented) -export function canRenderFloatTextures(): boolean; - -// @public (undocumented) -function clamp(value: number, min: number, max: number): number; - -// @public (undocumented) -function clip(val: number, low: number, high: number): number; - -// @public (undocumented) -type Color = [number, number, number, number]; - -declare namespace color { - export { - hexToRgb, - rgbToHex - } -} - -// @public (undocumented) -type ColorLUT = Color[]; - -declare namespace colormap { - export { - getColormap, - getColormapNames, - registerColormap, - findMatchingColormap - } -} - -// @public (undocumented) -type ColormapModifiedEvent = CustomEvent_2; - -// @public (undocumented) -interface ColormapModifiedEventDetail { - // (undocumented) - colormap: ColormapPublic; - // (undocumented) - viewportId: string; - // (undocumented) - volumeId?: string; -} - -// @public (undocumented) -interface ColormapPublic { - // (undocumented) - name?: string; - // (undocumented) - opacity?: OpacityMapping[] | number; -} - -// @public (undocumented) -interface ColormapRegistration { - // (undocumented) - ColorSpace: string; - // (undocumented) - Name: string; - // (undocumented) - RGBPoints: RGB[] | number[]; -} - -// @public (undocumented) -const colormapsData: CPUFallbackColormapsData; - -declare namespace CONSTANTS { - export { - colormapsData as CPU_COLORMAPS, - RENDERING_DEFAULTS, - mprCameraValues as MPR_CAMERA_VALUES, - EPSILON, - presets as VIEWPORT_PRESETS, - backgroundColors as BACKGROUND_COLORS - } -} -export { CONSTANTS } - -// @public (undocumented) -interface ContourData { - // (undocumented) - color: Point3; - // (undocumented) - points: Point3[]; - // (undocumented) - segmentIndex: number; - // (undocumented) - type: ContourType; -} - -// @public (undocumented) -interface ContourSetData { - // (undocumented) - color?: Point3; - // (undocumented) - data: ContourData[]; - // (undocumented) - frameOfReferenceUID: string; - // (undocumented) - id: string; - // (undocumented) - segmentIndex?: number; -} - -// @public (undocumented) -enum ContourType { - // (undocumented) - CLOSED_PLANAR = "CLOSED_PLANAR", - // (undocumented) - OPEN_PLANAR = "OPEN_PLANAR" -} - -// @public (undocumented) -export function convertMapperToNotSharedMapper(sharedMapper: vtkVolumeMapper): vtkVolumeMapper; - -// @public (undocumented) -function convertStackToVolumeViewport({ viewport, options, }: { - viewport: StackViewport; - options?: { - volumeId?: string; - viewportId?: string; - background?: Point3; - orientation?: OrientationAxis; - }; -}): Promise; - -// @public (undocumented) -function convertToGrayscale(scalarData: any, width: number, height: number): any; - -// @public (undocumented) -function convertVolumeToStackViewport({ viewport, options, }: { - viewport: Types.IVolumeViewport; - options: { - viewportId?: string; - background?: Types.Point3; - }; -}): Promise; - -// @public (undocumented) -interface Cornerstone3DConfig { - // (undocumented) - gpuTier: { - tier: number; - }; - // (undocumented) - isMobile: boolean; - // (undocumented) - peerImport?: (moduleId: string) => Promise; - // (undocumented) - rendering: { - preferSizeOverAccuracy: boolean; - useCPURendering: boolean; - strictZSpacingForVolumeViewport: boolean; - }; -} - -// @public (undocumented) -export function cornerstoneStreamingDynamicImageVolumeLoader(volumeId: string, options: { - imageIds: string[]; -}): IVolumeLoader_2; - -// @public (undocumented) -export function cornerstoneStreamingImageVolumeLoader(volumeId: string, options: { - imageIds: string[]; - progressiveRendering?: boolean | IRetrieveConfiguration; -}): IVolumeLoader; - -// @public (undocumented) -interface CPUFallbackColormap { - // (undocumented) - addColor: (rgba: Point4) => void; - // (undocumented) - buildLookupTable: (lut: CPUFallbackLookupTable) => void; - // (undocumented) - clearColors: () => void; - // (undocumented) - createLookupTable: () => CPUFallbackLookupTable; - // (undocumented) - getColor: (index: number) => Point4; - // (undocumented) - getColorRepeating: (index: number) => Point4; - // (undocumented) - getColorSchemeName: () => string; - // (undocumented) - getId: () => string; - // (undocumented) - getNumberOfColors: () => number; - // (undocumented) - insertColor: (index: number, rgba: Point4) => void; - // (undocumented) - isValidIndex: (index: number) => boolean; - // (undocumented) - removeColor: (index: number) => void; - // (undocumented) - setColor: (index: number, rgba: Point4) => void; - // (undocumented) - setColorSchemeName: (name: string) => void; - // (undocumented) - setNumberOfColors: (numColors: number) => void; -} - -// @public (undocumented) -interface CPUFallbackColormapData { - // (undocumented) - colors?: Point4[]; - // (undocumented) - gamma?: number; - // (undocumented) - name: string; - // (undocumented) - numColors?: number; - // (undocumented) - numOfColors?: number; - // (undocumented) - segmentedData?: unknown; -} - -// @public (undocumented) -type CPUFallbackColormapsData = Record; - -// @public (undocumented) -interface CPUFallbackEnabledElement { - // (undocumented) - canvas?: HTMLCanvasElement; - // (undocumented) - colormap?: CPUFallbackColormap; - // (undocumented) - image?: IImage; - // (undocumented) - invalid?: boolean; - // (undocumented) - metadata?: { - direction?: Mat3; - dimensions?: Point3; - spacing?: Point3; - origin?: Point3; - imagePlaneModule?: ImagePlaneModule; - imagePixelModule?: ImagePixelModule; - }; - // (undocumented) - needsRedraw?: boolean; - // (undocumented) - options?: { - [key: string]: unknown; - colormap?: CPUFallbackColormap; - }; - // (undocumented) - pan?: Point2; - // (undocumented) - renderingTools?: CPUFallbackRenderingTools; - // (undocumented) - rotation?: number; - // (undocumented) - scale?: number; - // (undocumented) - transform?: CPUFallbackTransform; - // (undocumented) - viewport?: CPUFallbackViewport; - // (undocumented) - voxelManager?: IVoxelManager | IVoxelManager; - // (undocumented) - zoom?: number; -} - -// @public (undocumented) -interface CPUFallbackLookupTable { - // (undocumented) - build: (force: boolean) => void; - // (undocumented) - getColor: (scalar: number) => Point4; - // (undocumented) - setAlphaRange: (start: number, end: number) => void; - // (undocumented) - setHueRange: (start: number, end: number) => void; - // (undocumented) - setNumberOfTableValues: (number: number) => void; - // (undocumented) - setRamp: (ramp: string) => void; - // (undocumented) - setRange: (start: number, end: number) => void; - // (undocumented) - setSaturationRange: (start: number, end: number) => void; - // (undocumented) - setTableRange: (start: number, end: number) => void; - // (undocumented) - setTableValue(index: number, rgba: Point4): any; - // (undocumented) - setValueRange: (start: number, end: number) => void; -} - -// @public (undocumented) -interface CPUFallbackLUT { - // (undocumented) - id?: string; - // (undocumented) - lut: number[]; -} - -// @public (undocumented) -interface CPUFallbackRenderingTools { - // (undocumented) - colorLUT?: CPUFallbackLookupTable; - // (undocumented) - colormapId?: string; - // (undocumented) - lastRenderedImageId?: string; - // (undocumented) - lastRenderedIsColor?: boolean; - // (undocumented) - lastRenderedViewport?: { - windowWidth: number | number[]; - windowCenter: number | number[]; - invert: boolean; - rotation: number; - hflip: boolean; - vflip: boolean; - modalityLUT: CPUFallbackLUT; - voiLUT: CPUFallbackLUT; - colormap: unknown; - }; - // (undocumented) - renderCanvas?: HTMLCanvasElement; - // (undocumented) - renderCanvasContext?: CanvasRenderingContext2D; - // (undocumented) - renderCanvasData?: ImageData; -} - -// @public (undocumented) -interface CPUFallbackTransform { - // (undocumented) - clone: () => CPUFallbackTransform; - // (undocumented) - getMatrix: () => TransformMatrix2D; - // (undocumented) - invert: () => void; - // (undocumented) - multiply: (matrix: TransformMatrix2D) => void; - // (undocumented) - reset: () => void; - // (undocumented) - rotate: (rad: number) => void; - // (undocumented) - scale: (sx: number, sy: number) => void; - // (undocumented) - transformPoint: (point: Point2) => Point2; - // (undocumented) - translate: (x: number, y: number) => void; -} - -// @public (undocumented) -interface CPUFallbackViewport { - // (undocumented) - colormap?: CPUFallbackColormap; - // (undocumented) - displayedArea?: CPUFallbackViewportDisplayedArea; - // (undocumented) - focalPoint?: number[]; - // (undocumented) - hflip?: boolean; - // (undocumented) - invert?: boolean; - // (undocumented) - modality?: string; - // (undocumented) - modalityLUT?: CPUFallbackLUT; - // (undocumented) - parallelScale?: number; - // (undocumented) - pixelReplication?: boolean; - // (undocumented) - rotation?: number; - // (undocumented) - scale?: number; - // (undocumented) - translation?: { - x: number; - y: number; - }; - // (undocumented) - vflip?: boolean; - // (undocumented) - voi?: { - windowWidth: number; - windowCenter: number; - voiLUTFunction: VOILUTFunctionType; - }; - // (undocumented) - voiLUT?: CPUFallbackLUT; -} - -// @public (undocumented) -interface CPUFallbackViewportDisplayedArea { - // (undocumented) - brhc: { - x: number; - y: number; - }; - // (undocumented) - columnPixelSpacing: number; - // (undocumented) - presentationSizeMode: string; - // (undocumented) - rowPixelSpacing: number; - // (undocumented) - tlhc: { - x: number; - y: number; - }; -} - -// @public (undocumented) -interface CPUIImageData { - // (undocumented) - calibration?: IImageCalibration; - // (undocumented) - dimensions: Point3; - // (undocumented) - direction: Mat3; - // (undocumented) - hasPixelSpacing?: boolean; - // (undocumented) - imageData: CPUImageData; - // (undocumented) - metadata: { - Modality: string; - FrameOfReferenceUID: string; - }; - // (undocumented) - numberOfComponents?: number; - // (undocumented) - origin: Point3; - // (undocumented) - preScale?: { - scaled?: boolean; - scalingParameters?: { - modality?: string; - rescaleSlope?: number; - rescaleIntercept?: number; - suvbw?: number; - }; - }; - // (undocumented) - scalarData: PixelDataTypedArray; - // (undocumented) - scaling?: Scaling; - // (undocumented) - spacing: Point3; - // (undocumented) - voxelManager?: IVoxelManager | IVoxelManager; -} - -// @public (undocumented) -interface CPUImageData { - // (undocumented) - getDimensions?: () => Point3; - // (undocumented) - getDirection?: () => Mat3; - // (undocumented) - getIndexToWorld?: () => Point3; - // (undocumented) - getRange?: () => [number, number]; - // (undocumented) - getScalarData?: () => PixelDataTypedArray; - // (undocumented) - getSpacing?: () => Point3; - // (undocumented) - getWorldToIndex?: () => Point3; - // (undocumented) - indexToWorld?: (point: Point3) => Point3; - // (undocumented) - worldToIndex?: (point: Point3) => Point3; -} - -// @public (undocumented) -function createAndCacheDerivedImage(referencedImageId: string, options?: DerivedImageOptions): IImage; - -// @public (undocumented) -function createAndCacheDerivedImages(referencedImageIds: string[], options?: DerivedImageOptions & { - getDerivedImageId?: (referencedImageId: string) => string; - targetBuffer?: { - type: PixelDataTypedArrayString; - }; - voxelRepresentation?: VoxelManagerEnum; -}): IImage[]; - -// @public (undocumented) -function createAndCacheDerivedLabelmapImage(referencedImageId: string, options?: DerivedImageOptions): IImage; - -// @public (undocumented) -function createAndCacheDerivedLabelmapImages(referencedImageIds: string[], options?: DerivedImageOptions): IImage[]; - -// @public (undocumented) -function createAndCacheDerivedLabelmapVolume(referencedVolumeId: string, options?: DerivedVolumeOptions): IImageVolume; - -// @public (undocumented) -function createAndCacheDerivedVolume(referencedVolumeId: string, options: DerivedVolumeOptions): IImageVolume; - -// @public (undocumented) -function createAndCacheGeometry(geometryId: string, options: GeometryOptions): IGeometry; - -// @public (undocumented) -function createAndCacheLocalImage(imageId: string, options: LocalImageOptions): IImage; - -// @public (undocumented) -function createAndCacheVolume(volumeId: string, options?: VolumeLoaderOptions): Promise; - -// @public (undocumented) -function createAndCacheVolumeFromImages(volumeId: string, imageIds: string[]): Promise; - -// @public (undocumented) -function createAndCacheVolumeFromImagesSync(volumeId: string, imageIds: string[]): IImageVolume; - -// @public (undocumented) -function createLinearRGBTransferFunction(voiRange: VOIRange): vtkColorTransferFunction; - -// @public (undocumented) -function createLocalLabelmapVolume(options: LocalVolumeOptions, volumeId: string, preventCache?: boolean): IImageVolume; - -// @public (undocumented) -function createLocalVolume(volumeId: string, options?: LocalVolumeOptions): IImageVolume; - -// @public (undocumented) -function createSigmoidRGBTransferFunction(voiRange: VOIRange, approximationNodes?: number): vtkColorTransferFunction; - -// @public (undocumented) -function createSubVolume(referencedVolumeId: string, boundsIJK: AABB3, options?: { - targetBuffer?: { - type: PixelDataTypedArrayString; - }; -}): ImageVolume; - -// @public (undocumented) -export function createVolumeActor(props: createVolumeActorInterface, element: HTMLDivElement, viewportId: string, suppressEvents?: boolean): Promise; - -// @public (undocumented) -export function createVolumeMapper(imageData: vtkImageData, vtkOpenGLTexture: vtkOpenGLTexture): vtkVolumeMapper; - -// @public (undocumented) -interface CustomEvent_2 extends Event { - // (undocumented) - readonly detail: T; - // (undocumented) - initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: T): void; -} - -// @public (undocumented) -type DataSetOptions = { - groupId?: string; - viewSelector?: ViewPresentationSelector; - viewReference?: ViewReferenceSpecifier; -}; - -// @public (undocumented) -function decimate(list: unknown[], interleave: number, offset?: number): number[]; - -// @public (undocumented) -function deepClone(obj: unknown): unknown; - -// @public (undocumented) -function deepEqual(obj1: unknown, obj2: unknown): boolean; - -// @public (undocumented) -const deepMerge: (target?: {}, source?: {}, optionsArgument?: any) => any; - -// @public (undocumented) -const DefaultHistoryMemo: HistoryMemo; - -// @public (undocumented) -interface DicomDateObject { - // (undocumented) - day: number; - // (undocumented) - month: number; - // (undocumented) - year: number; -} - -// @public (undocumented) -interface DicomTimeObject { - // (undocumented) - fractionalSeconds?: number; - // (undocumented) - hours: number; - // (undocumented) - minutes?: number; - // (undocumented) - seconds?: number; -} - -// @public (undocumented) -interface DisplayArea { - // (undocumented) - imageArea?: [number, number]; - // (undocumented) - imageCanvasPoint?: { - imagePoint: [number, number]; - canvasPoint?: [number, number]; - }; - // (undocumented) - interpolationType?: InterpolationType; - // (undocumented) - scale?: number; - // (undocumented) - storeAsInitialCamera?: boolean; - // (undocumented) - type?: 'SCALE' | 'FIT'; -} - -// @public (undocumented) -type DisplayAreaModifiedEvent = CustomEvent_2; - -// @public (undocumented) -interface DisplayAreaModifiedEventDetail { - // (undocumented) - displayArea: DisplayArea; - // (undocumented) - storeAsInitialCamera?: boolean; - // (undocumented) - viewportId: string; - // (undocumented) - volumeId?: string; -} - -// @public (undocumented) -enum DynamicOperatorType { - // (undocumented) - AVERAGE = "AVERAGE", - // (undocumented) - SUBTRACT = "SUBTRACT", - // (undocumented) - SUM = "SUM" -} - -// @public (undocumented) -type ElementDisabledEvent = CustomEvent_2; - -// @public (undocumented) -interface ElementDisabledEventDetail { - // (undocumented) - element: HTMLDivElement; - // (undocumented) - renderingEngineId: string; - // (undocumented) - viewportId: string; -} - -// @public (undocumented) -type ElementEnabledEvent = CustomEvent_2; - -// @public (undocumented) -interface ElementEnabledEventDetail { - // (undocumented) - element: HTMLDivElement; - // (undocumented) - renderingEngineId: string; - // (undocumented) - viewportId: string; -} - -declare namespace Enums { - export { - EVENTS as Events, - BlendModes, - CalibrationTypes, - InterpolationType, - RequestType, - ViewportType, - OrientationAxis, - GeometryType, - ContourType, - VOILUTFunctionType, - DynamicOperatorType, - ViewportStatus, - VideoEnums, - MetadataModules, - ImageQualityStatus, - VoxelManagerEnum, - GenerateImageType - } -} -export { Enums } - -// @public (undocumented) -const EPSILON = 0.001; - -declare namespace eventListener { - export { - TargetEventListeners, - MultiTargetEventListenerManager - } -} - -// @public (undocumented) -export enum EVENTS { - // (undocumented) - CACHE_SIZE_EXCEEDED = "CACHE_SIZE_EXCEEDED", - // (undocumented) - CAMERA_MODIFIED = "CORNERSTONE_CAMERA_MODIFIED", - // (undocumented) - CAMERA_RESET = "CORNERSTONE_CAMERA_RESET", - // (undocumented) - CLIPPING_PLANES_UPDATED = "CORNERSTONE_CLIPPING_PLANES_UPDATED", - // (undocumented) - COLORMAP_MODIFIED = "CORNERSTONE_COLORMAP_MODIFIED", - // (undocumented) - DISPLAY_AREA_MODIFIED = "CORNERSTONE_DISPLAY_AREA_MODIFIED", - // (undocumented) - DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED = "DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED", - // (undocumented) - DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED = "DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED", - // (undocumented) - DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED = "DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED", - // (undocumented) - DYNAMIC_VOLUME_TIME_POINT_LOADED = "DYNAMIC_VOLUME_TIME_POINT_LOADED", - // (undocumented) - ELEMENT_DISABLED = "CORNERSTONE_ELEMENT_DISABLED", - // (undocumented) - ELEMENT_ENABLED = "CORNERSTONE_ELEMENT_ENABLED", - // (undocumented) - ERROR_EVENT = "CORNERSTONE_ERROR", - // (undocumented) - GEOMETRY_CACHE_GEOMETRY_ADDED = "CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_ADDED", - // (undocumented) - GEOMETRY_CACHE_GEOMETRY_REMOVED = "CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_REMOVED", - // (undocumented) - GEOMETRY_LOADED = "GEOMETRY_LOADED", - // (undocumented) - GEOMETRY_LOADED_FAILED = "GEOMETRY_LOADED_FAILED", - // (undocumented) - IMAGE_CACHE_IMAGE_ADDED = "CORNERSTONE_IMAGE_CACHE_IMAGE_ADDED", - // (undocumented) - IMAGE_CACHE_IMAGE_REMOVED = "CORNERSTONE_IMAGE_CACHE_IMAGE_REMOVED", - // (undocumented) - IMAGE_LOAD_ERROR = "IMAGE_LOAD_ERROR", - // (undocumented) - IMAGE_LOAD_FAILED = "CORNERSTONE_IMAGE_LOAD_FAILED", - // (undocumented) - IMAGE_LOADED = "CORNERSTONE_IMAGE_LOADED", - // (undocumented) - IMAGE_RENDERED = "CORNERSTONE_IMAGE_RENDERED", - // (undocumented) - IMAGE_RETRIEVAL_STAGE = "CORNERSTONE_IMAGE_RETRIEVAL_STAGE", - // (undocumented) - IMAGE_SPACING_CALIBRATED = "CORNERSTONE_IMAGE_SPACING_CALIBRATED", - // (undocumented) - IMAGE_VOLUME_LOADING_COMPLETED = "CORNERSTONE_IMAGE_VOLUME_LOADING_COMPLETED", - // (undocumented) - IMAGE_VOLUME_MODIFIED = "CORNERSTONE_IMAGE_VOLUME_MODIFIED", - // (undocumented) - PRE_STACK_NEW_IMAGE = "CORNERSTONE_PRE_STACK_NEW_IMAGE", - // (undocumented) - PRESET_MODIFIED = "CORNERSTONE_VIEWPORT_RENDERING_PRESET_MODIFIED", - // (undocumented) - STACK_NEW_IMAGE = "CORNERSTONE_STACK_NEW_IMAGE", - // (undocumented) - STACK_SCROLL_OUT_OF_BOUNDS = "STACK_SCROLL_OUT_OF_BOUNDS", - // (undocumented) - STACK_VIEWPORT_SCROLL = "CORNERSTONE_STACK_VIEWPORT_SCROLL", - // (undocumented) - VIEWPORT_NEW_IMAGE_SET = "CORNERSTONE_VIEWPORT_NEW_IMAGE_SET", - // (undocumented) - VOI_MODIFIED = "CORNERSTONE_VOI_MODIFIED", - // (undocumented) - VOLUME_CACHE_VOLUME_ADDED = "CORNERSTONE_VOLUME_CACHE_VOLUME_ADDED", - // (undocumented) - VOLUME_CACHE_VOLUME_REMOVED = "CORNERSTONE_VOLUME_CACHE_VOLUME_REMOVED", - // (undocumented) - VOLUME_LOADED = "CORNERSTONE_VOLUME_LOADED", - // (undocumented) - VOLUME_LOADED_FAILED = "CORNERSTONE_VOLUME_LOADED_FAILED", - // (undocumented) - VOLUME_NEW_IMAGE = "CORNERSTONE_VOLUME_NEW_IMAGE", - // (undocumented) - VOLUME_VIEWPORT_NEW_VOLUME = "CORNERSTONE_VOLUME_VIEWPORT_NEW_VOLUME", - // (undocumented) - VOLUME_VIEWPORT_SCROLL = "VOLUME_VIEWPORT_SCROLL", - // (undocumented) - VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS = "VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS", - // (undocumented) - WEB_WORKER_PROGRESS = "CORNERSTONE_WEB_WORKER_PROGRESS" -} - -// @public (undocumented) -export const eventTarget: CornerstoneEventTarget; - -declare namespace EventTypes { - export { - ImageLoadStageEventDetail, - VolumeScrollOutOfBoundsEventDetail, - VolumeScrollOutOfBoundsEvent, - CameraModifiedEventDetail, - CameraModifiedEvent, - VoiModifiedEvent, - VoiModifiedEventDetail, - ColormapModifiedEvent, - ColormapModifiedEventDetail, - DisplayAreaModifiedEvent, - DisplayAreaModifiedEventDetail, - ElementDisabledEvent, - ElementDisabledEventDetail, - ElementEnabledEvent, - ElementEnabledEventDetail, - ImageRenderedEventDetail, - ImageRenderedEvent, - ImageVolumeModifiedEvent, - ImageVolumeModifiedEventDetail, - ImageVolumeLoadingCompletedEvent, - ImageVolumeLoadingCompletedEventDetail, - ImageLoadedEvent, - ImageLoadedEventDetail, - ImageLoadedFailedEventDetail, - ImageLoadedFailedEvent, - VolumeLoadedEvent, - VolumeLoadedEventDetail, - VolumeLoadedFailedEvent, - VolumeLoadedFailedEventDetail, - ImageCacheImageAddedEvent, - ImageCacheImageAddedEventDetail, - ImageCacheImageRemovedEvent, - ImageCacheImageRemovedEventDetail, - VolumeCacheVolumeAddedEvent, - VolumeCacheVolumeAddedEventDetail, - VolumeCacheVolumeRemovedEvent, - VolumeCacheVolumeRemovedEventDetail, - StackNewImageEvent, - StackNewImageEventDetail, - PreStackNewImageEvent, - PreStackNewImageEventDetail, - ImageSpacingCalibratedEvent, - ImageSpacingCalibratedEventDetail, - VolumeNewImageEvent, - VolumeNewImageEventDetail, - StackViewportNewStackEvent, - StackViewportNewStackEventDetail, - StackViewportScrollEvent, - StackViewportScrollEventDetail, - StackScrollOutOfBoundsEvent, - StackScrollOutOfBoundsEventDetail, - CameraResetEvent, - CameraResetEventDetail - } -} - -// @public (undocumented) -function findMatchingColormap(rgbPoints: any, actor: any): ColormapPublic | null; - -// @public (undocumented) -interface FlipDirection { - // (undocumented) - flipHorizontal?: boolean; - // (undocumented) - flipVertical?: boolean; -} - -// @public (undocumented) -class FrameRange { - // (undocumented) - protected static frameRangeExtractor: RegExp; - // (undocumented) - protected static framesToImageId(imageId: string, range: FramesRange | string): string; - // (undocumented) - static framesToString(range: any): string; - // (undocumented) - static imageIdToFrameEnd(imageId: string): number; - // (undocumented) - protected static imageIdToFrames(imageId: string): FramesRange; - // (undocumented) - static imageIdToFrameStart(imageId: string): number; -} - -// @public (undocumented) -interface GeneralSeriesModuleMetadata { - // (undocumented) - modality: string; - // (undocumented) - seriesDate: DicomDateObject; - // (undocumented) - seriesInstanceUID: string; - // (undocumented) - seriesNumber: number; - // (undocumented) - seriesTime: DicomTimeObject; - // (undocumented) - studyInstanceUID: string; -} - -// @public (undocumented) -enum GenerateImageType { - // (undocumented) - AVERAGE = "AVERAGE", - // (undocumented) - SUBTRACT = "SUBTRACT", - // (undocumented) - SUM = "SUM" -} - -// @public (undocumented) -function generateVolumePropsFromImageIds(imageIds: string[], volumeId: string): ImageVolumeProps; - -declare namespace geometryLoader { - export { - loadGeometry, - loadAndCacheGeometry, - createAndCacheGeometry, - registerGeometryLoader, - registerUnknownGeometryLoader - } -} -export { geometryLoader } - -// @public (undocumented) -type GeometryLoaderFn = (geometryId: string, options?: Record) => { - promise: Promise; - cancelFn?: () => void | undefined; - decache?: () => void | undefined; -}; - -// @public (undocumented) -enum GeometryType { - // (undocumented) - CONTOUR = "CONTOUR", - // (undocumented) - SURFACE = "SURFACE" -} - -// @public (undocumented) -function getBufferConfiguration(targetBufferType: PixelDataTypedArrayString, length: number, options?: { - isVolumeBuffer?: boolean; -}): { - numBytes: number; - TypedArrayConstructor: new (length: number) => PixelDataTypedArray; -}; - -// @public (undocumented) -function getClosestImageId(imageVolume: IImageVolume | { - direction: mat3; - spacing: Point3; - imageIds: string[]; -}, worldPos: Point3, viewPlaneNormal: Point3): string; - -// @public (undocumented) -function getClosestStackImageIndexForPoint(point: Point3, viewport: StackViewport): number | null; - -// @public (undocumented) -function getColormap(name: any): any; - -// @public (undocumented) -function getColormapNames(): any[]; - -// @public (undocumented) -export function getConfiguration(): Cornerstone3DConfig; - -// @public (undocumented) -function getCurrentVolumeViewportSlice(viewport: IVolumeViewport): { - width: number; - height: number; - scalarData: PixelDataTypedArray; - sliceToIndexMatrix: mat4; - indexToSliceMatrix: mat4; -}; - -// @public (undocumented) -function getDynamicVolumeInfo(imageIds: any): { - isDynamicVolume: boolean; - timePoints: string[][]; - splittingTag: string; -}; - -// @public (undocumented) -export function getEnabledElement(element: HTMLDivElement | undefined): IEnabledElement | undefined; - -// @public (undocumented) -export function getEnabledElementByIds(viewportId: string, renderingEngineId: string): IEnabledElement; - -// @public (undocumented) -export function getEnabledElementByViewportId(viewportId: string): IEnabledElement; - -// @public (undocumented) -export function getEnabledElements(): IEnabledElement[]; - -// @public (undocumented) -function getImageLegacy(element: HTMLDivElement): Types.IImage | undefined; - -// @public (undocumented) -function getImageSliceDataForVolumeViewport(viewport: IVolumeViewport): ImageSliceData; - -// @public (undocumented) -function getMetaData(type: string, ...queries: any[]): any; - -// @public (undocumented) -function getMinMax(storedPixelData: PixelDataTypedArray): { - min: number; - max: number; -}; - -// @public (undocumented) -export function getOrCreateCanvas(element: HTMLDivElement): HTMLCanvasElement; - -// @public (undocumented) -function getRandomSampleFromArray(array: T[], size: number): T[]; - -// @public (undocumented) -export function getRenderingEngine(id: string): IRenderingEngine | undefined; - -// @public (undocumented) -export function getRenderingEngines(): IRenderingEngine[] | undefined; - -// @public (undocumented) -function getRuntimeId(context?: unknown, separator?: string, max?: number): string; - -// @public (undocumented) -function getScalingParameters(imageId: string): ScalingParameters; - -// @public (undocumented) -export function getShouldUseCPURendering(): boolean; - -// @public (undocumented) -function getSliceRange(volumeActor: VolumeActor, viewPlaneNormal: Point3, focalPoint: Point3): ActorSliceRange; - -// @public (undocumented) -function getSpacingInNormalDirection(imageVolume: IImageVolume | { - direction: mat3; - spacing: Point3; -}, viewPlaneNormal: Point3): number; - -// @public (undocumented) -function getTargetVolumeAndSpacingInNormalDir(viewport: IVolumeViewport, camera: ICamera, targetId?: string, useSlabThickness?: boolean): { - imageVolume: IImageVolume; - spacingInNormalDirection: number; - actorUID: string; -}; - -// @public (undocumented) -function getTransferFunctionNodes(transferFunction: any): any[]; - -// @public (undocumented) -function getUnknownVolumeLoaderSchema(): string; - -// @public (undocumented) -function getViewportImageCornersInWorld(viewport: StackViewport | IVolumeViewport): Point3[]; - -// @public (undocumented) -function getViewportImageIds(viewport: IViewport): string[]; - -// @public (undocumented) -const getViewportModality: (viewport: IViewport, volumeId?: string) => string; - -// @public (undocumented) -function getViewportsWithImageURI(imageURI: string): Viewport_2[]; - -// @public (undocumented) -function getViewportsWithVolumeId(volumeId: string): IVolumeViewport[]; - -// @public (undocumented) -function getVoiFromSigmoidRGBTransferFunction(cfun: vtkColorTransferFunction): [number, number]; - -// @public (undocumented) -function getVolumeActorCorners(volumeActor: any): Point3[]; - -// @public (undocumented) -function getVolumeDirectionVectors(imageData: any, camera: any): { - worldVecRowDir: vec3; - worldVecColDir: vec3; - worldVecSliceDir: vec3; - ijkVecRowDir: vec3; - ijkVecColDir: vec3; - ijkVecSliceDir: vec3; -}; - -// @public (undocumented) -const getVolumeId: (targetId: string) => string; - -// @public (undocumented) -function getVolumeLoaderSchemes(): string[]; - -// @public (undocumented) -function getVolumeSliceRangeInfo(viewport: IVolumeViewport, volumeId: string, useSlabThickness?: boolean): { - sliceRange: ActorSliceRange; - spacingInNormalDirection: number; - camera: ICamera; -}; - -// @public (undocumented) -function getVolumeViewportsContainingSameVolumes(targetViewport: IVolumeViewport, renderingEngineId?: string): IVolumeViewport[]; - -// @public (undocumented) -function getVolumeViewportScrollInfo(viewport: IVolumeViewport, volumeId: string, useSlabThickness?: boolean): { - numScrollSteps: number; - currentStepIndex: number; - sliceRangeInfo: { - sliceRange: ActorSliceRange; - spacingInNormalDirection: number; - camera: ICamera; - }; -}; - -// @public (undocumented) -export function getWebWorkerManager(): any; - -// @public (undocumented) -const hasFloatScalingParameters: (scalingParameters: ScalingParameters) => boolean; - -// @public (undocumented) -function hasNaNValues(input: number[] | number): boolean; - -// @public (undocumented) -function hexToRgb(hex: any): { - r: number; - g: number; - b: number; -}; - -// @public (undocumented) -class HistoryMemo { - constructor(label?: string, size?: number); - // (undocumented) - readonly label: any; - // (undocumented) - push(item: Memo | Memoable): Memo; - // (undocumented) - redo(items?: number): void; - // (undocumented) - get size(): number; - set size(newSize: number); - // (undocumented) - undo(items?: number): void; -} - -declare namespace HistoryMemo_2 { - export { - Memo, - Memoable, - HistoryMemo, - DefaultHistoryMemo - } -} - -// @public (undocumented) -type IBaseVolumeViewport = BaseVolumeViewport; - -// @public (undocumented) -interface ICache { - // (undocumented) - getCacheSize: () => number; - // (undocumented) - getImageLoadObject: (imageId: string) => IImageLoadObject | void; - // (undocumented) - getMaxCacheSize: () => number; - // (undocumented) - getVolumeLoadObject: (volumeId: string) => IVolumeLoadObject | void; - // (undocumented) - purgeCache: () => void; - // (undocumented) - putImageLoadObject: (imageId: string, imageLoadObject: IImageLoadObject, updateCache?: boolean) => Promise; - // (undocumented) - putVolumeLoadObject: (volumeId: string, volumeLoadObject: IVolumeLoadObject) => Promise; - // (undocumented) - setMaxCacheSize: (maxCacheSize: number) => void; -} - -// @public (undocumented) -interface ICachedGeometry { - // (undocumented) - geometry?: IGeometry; - // (undocumented) - geometryId: string; - // (undocumented) - geometryLoadObject: IGeometryLoadObject; - // (undocumented) - loaded: boolean; - // (undocumented) - sizeInBytes: number; - // (undocumented) - timeStamp: number; -} - -// @public (undocumented) -interface ICachedImage { - // (undocumented) - image?: IImage; - // (undocumented) - imageId: string; - // (undocumented) - imageLoadObject?: IImageLoadObject; - // (undocumented) - loaded: boolean; - // (undocumented) - sharedCacheKey?: string; - // (undocumented) - sizeInBytes: number; - // (undocumented) - timeStamp: number; -} - -// @public (undocumented) -interface ICachedVolume { - // (undocumented) - loaded: boolean; - // (undocumented) - sizeInBytes: number; - // (undocumented) - timeStamp: number; - // (undocumented) - volume?: IImageVolume; - // (undocumented) - volumeId: string; - // (undocumented) - volumeLoadObject: IVolumeLoadObject; -} - -// @public (undocumented) -interface ICamera { - // (undocumented) - clippingRange?: Point2; - // (undocumented) - flipHorizontal?: boolean; - // (undocumented) - flipVertical?: boolean; - // (undocumented) - focalPoint?: Point3; - // (undocumented) - parallelProjection?: boolean; - // (undocumented) - parallelScale?: number; - // (undocumented) - position?: Point3; - // (undocumented) - rotation?: number; - // (undocumented) - scale?: number; - // (undocumented) - viewAngle?: number; - // (undocumented) - viewPlaneNormal?: Point3; - // (undocumented) - viewUp?: Point3; -} - -// @public (undocumented) -type ICanvasActor = CanvasActor; - -// @public (undocumented) -type IContour = Contour; - -// @public (undocumented) -type IContourSet = ContourSet; - -// @public (undocumented) -interface IDynamicImageVolume extends IImageVolume { - // (undocumented) - get dimensionGroupNumber(): number; - set dimensionGroupNumber(dimensionGroupNumber: number); - // (undocumented) - get numDimensionGroups(): number; - // (undocumented) - get numTimePoints(): number; - // (undocumented) - scroll(delta: number): void; - // (undocumented) - get timePointIndex(): number; - set timePointIndex(timePointIndex: number); -} - -// @public (undocumented) -interface IEnabledElement { - // (undocumented) - FrameOfReferenceUID: string; - // (undocumented) - renderingEngine: IRenderingEngine; - // (undocumented) - renderingEngineId: string; - // (undocumented) - viewport: StackViewport | IVolumeViewport; - // (undocumented) - viewportId: string; -} - -// @public (undocumented) -interface IGeometry { - // (undocumented) - data: IContourSet | ISurface; - // (undocumented) - id: string; - // (undocumented) - sizeInBytes: number; - // (undocumented) - type: GeometryType; -} - -// @public (undocumented) -interface IGeometryLoadObject { - // (undocumented) - cancelFn?: () => void; - // (undocumented) - decache?: () => void; - // (undocumented) - promise: Promise; -} - -// @public (undocumented) -interface IImage { - // (undocumented) - bufferView?: { - buffer: ArrayBuffer; - offset: number; - }; - // (undocumented) - cachedLut?: { - windowWidth?: number | number[]; - windowCenter?: number | number[]; - invert?: boolean; - lutArray?: Uint8ClampedArray; - modalityLUT?: CPUFallbackLUT; - voiLUT?: CPUFallbackLUT; - }; - // (undocumented) - calibration?: IImageCalibration; - // (undocumented) - color: boolean; - // (undocumented) - colormap?: CPUFallbackColormap; - // (undocumented) - columnPixelSpacing: number; - // (undocumented) - columns: number; - // (undocumented) - dataType: PixelDataTypedArrayString; - // (undocumented) - decodeTimeInMS?: number; - // (undocumented) - FrameOfReferenceUID?: string; - // (undocumented) - getCanvas: () => HTMLCanvasElement; - // (undocumented) - getPixelData: () => PixelDataTypedArray; - // (undocumented) - height: number; - // (undocumented) - imageFrame?: ImageFrame; - // (undocumented) - imageId: string; - // (undocumented) - imageQualityStatus?: ImageQualityStatus; - // (undocumented) - intercept: number; - // (undocumented) - invert: boolean; - // (undocumented) - isPreScaled?: boolean; - // (undocumented) - loadTimeInMS?: number; - // (undocumented) - maxPixelValue: number; - // (undocumented) - minPixelValue: number; - // (undocumented) - modalityLUT?: CPUFallbackLUT; - // (undocumented) - numberOfComponents: number; - // (undocumented) - photometricInterpretation?: string; - // (undocumented) - preScale?: { - enabled: boolean; - scaled?: boolean; - scalingParameters?: { - modality?: string; - rescaleSlope?: number; - rescaleIntercept?: number; - suvbw?: number; - }; - }; - // (undocumented) - referencedImageId?: string; - // (undocumented) - render?: (enabledElement: CPUFallbackEnabledElement, invalidated: boolean) => unknown; - // (undocumented) - rgba: boolean; - // (undocumented) - rowPixelSpacing: number; - // (undocumented) - rows: number; - // (undocumented) - scaling?: { - PT?: { - SUVlbmFactor?: number; - SUVbsaFactor?: number; - suvbwToSuvlbm?: number; - suvbwToSuvbsa?: number; - }; - }; - // (undocumented) - sharedCacheKey?: string; - // (undocumented) - sizeInBytes: number; - // (undocumented) - sliceThickness?: number; - // (undocumented) - slope: number; - // (undocumented) - stats?: { - lastStoredPixelDataToCanvasImageDataTime?: number; - lastGetPixelDataTime?: number; - lastPutImageDataTime?: number; - lastLutGenerateTime?: number; - lastRenderedViewport?: unknown; - lastRenderTime?: number; - }; - // (undocumented) - voiLUT?: CPUFallbackLUT; - // (undocumented) - voiLUTFunction: VOILUTFunctionType; - // (undocumented) - voxelManager?: IVoxelManager | IVoxelManager; - // (undocumented) - width: number; - // (undocumented) - windowCenter: number[] | number; - // (undocumented) - windowWidth: number[] | number; -} - -// @public (undocumented) -interface IImageCalibration { - // (undocumented) - aspect?: number; - // (undocumented) - columnPixelSpacing?: number; - // (undocumented) - rowPixelSpacing?: number; - // (undocumented) - scale?: number; - // (undocumented) - sequenceOfUltrasoundRegions?: Record[]; - // (undocumented) - tooltip?: string; - // (undocumented) - type: CalibrationTypes; -} - -// @public (undocumented) -interface IImageData { - // (undocumented) - calibration?: IImageCalibration; - // (undocumented) - dimensions: Point3; - // (undocumented) - direction: Mat3; - // (undocumented) - hasPixelSpacing?: boolean; - // (undocumented) - imageData: vtkImageData; - // (undocumented) - metadata: { - Modality: string; - FrameOfReferenceUID: string; - }; - // (undocumented) - numberOfComponents?: number; - // (undocumented) - origin: Point3; - // (undocumented) - preScale?: { - scaled?: boolean; - scalingParameters?: { - modality?: string; - rescaleSlope?: number; - rescaleIntercept?: number; - suvbw?: number; - }; - }; - // (undocumented) - scalarData: PixelDataTypedArray; - // (undocumented) - scaling?: Scaling; - // (undocumented) - spacing: Point3; - // (undocumented) - voxelManager?: IVoxelManager | IVoxelManager; -} - -// @public (undocumented) -interface IImageLoadObject { - // (undocumented) - cancelFn?: () => void; - // (undocumented) - decache?: () => void; - // (undocumented) - promise: Promise; -} - -// @public (undocumented) -export interface IImagesLoader { - // (undocumented) - loadImages: (imageIds: string[], listener: ImageLoadListener) => Promise; -} - -// @public (undocumented) -type IImageVolume = ImageVolume; - -// @public (undocumented) -type ImageActor = vtkImageSlice; - -// @public (undocumented) -type ImageCacheImageAddedEvent = CustomEvent_2; - -// @public (undocumented) -interface ImageCacheImageAddedEventDetail { - // (undocumented) - image: ICachedImage; -} - -// @public (undocumented) -type ImageCacheImageRemovedEvent = CustomEvent_2; - -// @public (undocumented) -interface ImageCacheImageRemovedEventDetail { - // (undocumented) - imageId: string; -} - -// @public (undocumented) -interface ImageFrame { - // (undocumented) - bitsAllocated: number; - // (undocumented) - bitsStored: number; - // (undocumented) - bluePaletteColorLookupTableData: number[]; - // (undocumented) - bluePaletteColorLookupTableDescriptor: number[]; - // (undocumented) - columns: number; - // (undocumented) - decodeLevel?: unknown; - // (undocumented) - decodeTimeInMS?: number; - // (undocumented) - greenPaletteColorLookupTableData: number[]; - // (undocumented) - greenPaletteColorLookupTableDescriptor: number[]; - // (undocumented) - imageData?: ImageData; - // (undocumented) - imageId: string; - // (undocumented) - imageQualityStatus?: ImageQualityStatus; - // (undocumented) - largestPixelValue: number; - // (undocumented) - loadTimeInMS?: number; - // (undocumented) - photometricInterpretation: string; - // (undocumented) - pixelData: PixelDataTypedArray; - // (undocumented) - pixelDataLength?: number; - // (undocumented) - pixelRepresentation: number; - // (undocumented) - planarConfiguration: number; - // (undocumented) - preScale?: { - enabled: boolean; - scaled: boolean; - scalingParameters?: { - intercept?: number; - slope?: number; - rescaleSlope?: number; - rescaleIntercept?: number; - modality?: string; - suvbw?: number; - }; - }; - // (undocumented) - redPaletteColorLookupTableData: number[]; - // (undocumented) - redPaletteColorLookupTableDescriptor: number[]; - // (undocumented) - rows: number; - // (undocumented) - samplesPerPixel: number; - // (undocumented) - smallestPixelValue: number; - // (undocumented) - transferSyntax?: string; -} - -// @public (undocumented) -function imageIdToURI(imageId: string): string; - -// @public (undocumented) -type ImageLoadedEvent = CustomEvent_2; - -// @public (undocumented) -interface ImageLoadedEventDetail { - // (undocumented) - image: IImage; -} - -// @public (undocumented) -type ImageLoadedFailedEvent = CustomEvent_2; - -// @public (undocumented) -interface ImageLoadedFailedEventDetail { - // (undocumented) - error: unknown; - // (undocumented) - imageId: string; -} - -declare namespace imageLoader { - export { - loadImage, - loadAndCacheImage, - loadAndCacheImages, - createAndCacheDerivedImage, - createAndCacheDerivedImages, - createAndCacheLocalImage, - cancelLoadImage, - cancelLoadImages, - cancelLoadAll, - registerImageLoader, - registerUnknownImageLoader, - unregisterAllImageLoaders, - createAndCacheDerivedLabelmapImages, - createAndCacheDerivedLabelmapImage, - ImageLoaderOptions - } -} -export { imageLoader } - -// @public (undocumented) -type ImageLoaderFn = (imageId: string, options?: Record) => { - promise: Promise>; - cancelFn?: () => void | undefined; - decache?: () => void | undefined; -}; - -// @public (undocumented) -interface ImageLoaderOptions { - // (undocumented) - additionalDetails?: Record; - // (undocumented) - ignoreCache?: boolean; - // (undocumented) - priority: number; - // (undocumented) - requestType: string; -} - -// @public (undocumented) -export interface ImageLoadListener { - // (undocumented) - errorCallback: (imageId: any, permanent: any, reason: any) => void; - // (undocumented) - getLoaderImageOptions?: (imageId: any) => Record; - // (undocumented) - successCallback: (imageId: any, image: any) => void; -} - -// @public (undocumented) -const imageLoadPoolManager: RequestPoolManager; -export { imageLoadPoolManager } -export { imageLoadPoolManager as requestPoolManager } - -// @public (undocumented) -interface ImageLoadRequests { - // (undocumented) - additionalDetails: { - volumeId: string; - }; - // (undocumented) - callLoadImage: (imageId: string, imageIdIndex: number, options: unknown) => Promise; - // (undocumented) - imageId: string; - // (undocumented) - imageIdIndex: number; - // (undocumented) - options: { - targetBuffer: { - type: string; - rows: number; - columns: number; - }; - preScale: { - enabled: boolean; - scalingParameters: ScalingParameters; - }; - transferPixelData: boolean; - }; - // (undocumented) - priority: number; - // (undocumented) - requestType: RequestType; -} - -// @public (undocumented) -interface ImageLoadStageEventDetail { - // (undocumented) - numberOfFailures: number; - // (undocumented) - numberOfImages: number; - // (undocumented) - stageDurationInMS: number; - // (undocumented) - stageId: string; - // (undocumented) - startDurationInMS: number; -} - -// @public (undocumented) -interface ImagePixelModule { - // (undocumented) - bitsAllocated: number; - // (undocumented) - bitsStored: number; - // (undocumented) - highBit: number; - // (undocumented) - modality: string; - // (undocumented) - photometricInterpretation: string; - // (undocumented) - pixelRepresentation: string; - // (undocumented) - samplesPerPixel: number; - // (undocumented) - voiLUTFunction: VOILUTFunctionType; - // (undocumented) - windowCenter: number | number[]; - // (undocumented) - windowWidth: number | number[]; -} - -// @public (undocumented) -interface ImagePixelModuleMetadata { - // (undocumented) - bitsAllocated: number; - // (undocumented) - bitsStored: number; - // (undocumented) - bluePaletteColorLookupTableData: number[]; - // (undocumented) - bluePaletteColorLookupTableDescriptor: number[]; - // (undocumented) - columns: number; - // (undocumented) - greenPaletteColorLookupTableData: number[]; - // (undocumented) - greenPaletteColorLookupTableDescriptor: number[]; - // (undocumented) - highBit: number; - // (undocumented) - largestPixelValue?: number; - // (undocumented) - photometricInterpretation: string; - // (undocumented) - pixelAspectRatio: string; - // (undocumented) - pixelRepresentation: number; - // (undocumented) - planarConfiguration: number; - // (undocumented) - redPaletteColorLookupTableData: number[]; - // (undocumented) - redPaletteColorLookupTableDescriptor: number[]; - // (undocumented) - rows: number; - // (undocumented) - samplesPerPixel: number; - // (undocumented) - smallestPixelValue?: number; -} - -// @public (undocumented) -interface ImagePlaneModule { - // (undocumented) - columnCosines?: Point3; - // (undocumented) - columnPixelSpacing?: number; - // (undocumented) - columns: number; - // (undocumented) - frameOfReferenceUID: string; - // (undocumented) - imageOrientationPatient?: Float32Array; - // (undocumented) - imagePositionPatient?: Point3; - // (undocumented) - pixelSpacing?: Point2; - // (undocumented) - rowCosines?: Point3; - // (undocumented) - rowPixelSpacing?: number; - // (undocumented) - rows: number; - // (undocumented) - sliceLocation?: number; - // (undocumented) - sliceThickness?: number; -} - -// @public (undocumented) -interface ImagePlaneModuleMetadata { - // (undocumented) - columnCosines: number[]; - // (undocumented) - columnPixelSpacing: number | null; - // (undocumented) - columns: number; - // (undocumented) - frameOfReferenceUID: string; - // (undocumented) - imageOrientationPatient: number[]; - // (undocumented) - imagePositionPatient: number[]; - // (undocumented) - pixelSpacing: number[]; - // (undocumented) - rowCosines: number[]; - // (undocumented) - rowPixelSpacing: number | null; - // (undocumented) - rows: number; - // (undocumented) - sliceLocation: number; - // (undocumented) - sliceThickness: number; - // (undocumented) - usingDefaultValues: boolean; -} - -// @public (undocumented) -enum ImageQualityStatus { - // (undocumented) - ADJACENT_REPLICATE = 3, - // (undocumented) - FAR_REPLICATE = 1, - // (undocumented) - FULL_RESOLUTION = 8, - // (undocumented) - LOSSY = 7, - // (undocumented) - SUBRESOLUTION = 6 -} - -// @public (undocumented) -type ImageRenderedEvent = CustomEvent_2; - -// @public (undocumented) -interface ImageRenderedEventDetail { - // (undocumented) - element: HTMLDivElement; - // (undocumented) - renderingEngineId: string; - // (undocumented) - suppressEvents?: boolean; - // (undocumented) - viewportId: string; - // (undocumented) - viewportStatus: ViewportStatus; -} - -// @public (undocumented) -export const imageRetrievalPoolManager: RequestPoolManager; - -// @public (undocumented) -const imageRetrieveMetadataProvider: { - IMAGE_RETRIEVE_CONFIGURATION: string; - clear: () => void; - add: (key: string, payload: any) => void; - clone: () => Map; - restore: (state: Map) => void; - get: (type: string, ...queries: string[]) => unknown; -}; - -// @public (undocumented) -interface ImageSliceData { - // (undocumented) - imageIndex: number; - // (undocumented) - numberOfSlices: number; -} - -// @public (undocumented) -type ImageSpacingCalibratedEvent = CustomEvent_2; - -// @public (undocumented) -interface ImageSpacingCalibratedEventDetail { - // (undocumented) - calibration: IImageCalibration; - // (undocumented) - element: HTMLDivElement; - // (undocumented) - imageData: vtkImageData; - // (undocumented) - imageId: string; - // (undocumented) - renderingEngineId: string; - // (undocumented) - viewportId: string; - // (undocumented) - worldToIndex: mat4; -} - -// @public (undocumented) -function imageToWorldCoords(imageId: string, imageCoords: Point2): Point3 | undefined; - -// @public (undocumented) -export class ImageVolume { - constructor(props: ImageVolumeProps); - // (undocumented) - additionalDetails?: Record; - // (undocumented) - cancelLoading: () => void; - // (undocumented) - protected cornerstoneImageMetaData: any; - // (undocumented) - dataType?: PixelDataTypedArrayString; - // (undocumented) - destroy(): void; - // (undocumented) - dimensions: Point3; - // (undocumented) - direction: Mat3; - // (undocumented) - getCornerstoneImages(): IImage[]; - // (undocumented) - getImageIdByIndex(imageIdIndex: number): string; - // (undocumented) - getImageIdIndex(imageId: string): number; - // (undocumented) - getImageURIIndex(imageURI: string): number; - // (undocumented) - getScalarDataLength(): number; - // (undocumented) - hasPixelSpacing: boolean; - // (undocumented) - imageData?: vtkImageData; - // (undocumented) - protected imageIdIndexToFrameIndex(imageIdIndex: number): number; - // (undocumented) - get imageIds(): string[]; - set imageIds(newImageIds: string[]); - // (undocumented) - invalidate(): void; - // (undocumented) - isDynamicVolume(): boolean; - // (undocumented) - isPreScaled: boolean; - // (undocumented) - load(callback?: (...args: unknown[]) => void): void; - // (undocumented) - loadStatus?: Record; - // (undocumented) - metadata: Metadata; - // (undocumented) - modified(): void; - // (undocumented) - numFrames: number; - // (undocumented) - numTimePoints?: number; - // (undocumented) - numVoxels: number; - // (undocumented) - origin: Point3; - // (undocumented) - referencedImageIds?: string[]; - // (undocumented) - referencedVolumeId?: string; - // (undocumented) - removeFromCache(): void; - // (undocumented) - scaling?: { - PT?: { - SUVlbmFactor?: number; - SUVbsaFactor?: number; - suvbwToSuvlbm?: number; - suvbwToSuvbsa?: number; - }; - }; - // (undocumented) - get sizeInBytes(): number; - // (undocumented) - spacing: Point3; - // (undocumented) - protected totalNumFrames: number; - // (undocumented) - readonly volumeId: string; - // (undocumented) - voxelManager?: IVoxelManager | IVoxelManager; - // (undocumented) - vtkOpenGLTexture: vtkStreamingOpenGLTexture; -} - -// @public (undocumented) -type ImageVolumeLoadingCompletedEvent = CustomEvent_2; - -// @public (undocumented) -interface ImageVolumeLoadingCompletedEventDetail { - // (undocumented) - FrameOfReferenceUID: string; - // (undocumented) - volumeId: string; -} - -// @public (undocumented) -type ImageVolumeModifiedEvent = CustomEvent_2; - -// @public (undocumented) -interface ImageVolumeModifiedEventDetail { - // (undocumented) - FrameOfReferenceUID: string; - // (undocumented) - framesProcessed: number; - // (undocumented) - numberOfFrames: number; - // (undocumented) - volumeId: string; -} - -// @public (undocumented) -interface ImageVolumeProps extends VolumeProps { - // (undocumented) - imageIds: string[]; - // (undocumented) - referencedImageIds?: string[]; -} - -// @public (undocumented) -function indexWithinDimensions(index: Point3, dimensions: Point3): boolean; - -// @public (undocumented) -export function init(configuration?: Cornerstone3DConfig): boolean; - -// @public (undocumented) -interface InternalVideoCamera { - // (undocumented) - panWorld?: Point2; - // (undocumented) - parallelScale?: number; -} - -// @public (undocumented) -enum InterpolationType { - // (undocumented) - FAST_LINEAR = 2, - // (undocumented) - LINEAR = 1, - // (undocumented) - NEAREST = 0 -} - -// @public (undocumented) -function invertRgbTransferFunction(rgbTransferFunction: vtkColorTransferFunction): void; - -// @public (undocumented) -type IPointsManager = PointsManager; - -// @public (undocumented) -interface IRegisterImageLoader { - // (undocumented) - registerImageLoader: (scheme: string, imageLoader: ImageLoaderFn) => void; -} - -// @public (undocumented) -type IRenderingEngine = RenderingEngine; - -// @public (undocumented) -export interface IRetrieveConfiguration { - // (undocumented) - create?: (IRetrieveConfiguration: any) => IImagesLoader; - // (undocumented) - retrieveOptions?: Record; - // (undocumented) - stages?: RetrieveStage[]; -} - -// @public (undocumented) -type IRLEVoxelMap = RLEVoxelMap; - -// @public (undocumented) -export function isCornerstoneInitialized(): boolean; - -// @public (undocumented) -function isEqual(v1: ValueType, v2: ValueType, tolerance?: number): boolean; - -// @public (undocumented) -const isEqualAbs: (v1: ValueType, v2: ValueType, tolerance?: any) => boolean; - -// @public (undocumented) -const isEqualNegative: (v1: ValueType, v2: ValueType, tolerance?: any) => boolean; - -// @public (undocumented) -function isImageActor(actorEntry: Types.ActorEntry): boolean; - -// @public (undocumented) -function isOpposite(v1: Point3, v2: Point3, tolerance?: number): boolean; - -// @public (undocumented) -const isPTPrescaledWithSUV: (image: IImage) => number; - -// @public (undocumented) -interface IStackInput { - // (undocumented) - [key: string]: unknown; - // (undocumented) - actorUID?: string; - // (undocumented) - callback?: StackInputCallback; - // (undocumented) - imageId: string; - // (undocumented) - visibility?: boolean; -} - -// @public (undocumented) -interface IStreamingImageVolume extends IImageVolume { - // (undocumented) - clearLoadCallbacks(): void; - // (undocumented) - decache(completelyRemove?: boolean): void; - // (undocumented) - load(): void; -} - -// @public (undocumented) -interface IStreamingVolumeProperties { - // (undocumented) - imageIds: string[]; - // (undocumented) - loadStatus: { - loaded: boolean; - loading: boolean; - cancelled: boolean; - cachedFrames: ImageQualityStatus[]; - callbacks: (() => void)[]; - }; -} - -// @public (undocumented) -type ISurface = Surface; - -// @public (undocumented) -function isValidVolume(imageIds: string[]): boolean; - -// @public (undocumented) -function isVideoTransferSyntax(uidOrUids: string | string[]): string | false; - -// @public (undocumented) -type IVideoViewport = VideoViewport; - -// @public (undocumented) -type IViewport = Viewport; - -// @public (undocumented) -interface IViewportId { - // (undocumented) - renderingEngineId: string; - // (undocumented) - viewportId: string; -} - -// @public (undocumented) -type IVolume = ImageVolumeProps; - -// @public (undocumented) -type IVolumeInput = { - volumeId: string; - actorUID?: string; - visibility?: boolean; - callback?: VolumeInputCallback; - blendMode?: BlendModes; - slabThickness?: number; - [key: string]: unknown; -}; - -// @public (undocumented) -interface IVolumeLoadObject { - // (undocumented) - cancelFn?: () => void; - // (undocumented) - decache?: () => void; - // (undocumented) - promise: Promise; -} - -// @public (undocumented) -type IVolumeViewport = VolumeViewport; - -// @public (undocumented) -type IVoxelManager = VoxelManager; - -// @public (undocumented) -type IWSIViewport = WSIViewport; - -// @public (undocumented) -function jumpToSlice(element: HTMLDivElement, options?: JumpToSliceOptions): Promise; - -// @public (undocumented) -type JumpToSliceOptions = { - imageIndex: number; - debounceLoading?: boolean; - volumeId?: string; -}; - -// @public (undocumented) -function linePlaneIntersection(p0: Point3, p1: Point3, plane: Plane): Point3; - -// @public (undocumented) -function loadAndCacheGeometry(geometryId: string, options?: GeometryOptions): Promise; - -// @public (undocumented) -function loadAndCacheImage(imageId: string, options?: ImageLoaderOptions): Promise; - -// @public (undocumented) -function loadAndCacheImages(imageIds: string[], options?: ImageLoaderOptions): Promise[]; - -// @public (undocumented) -function loadGeometry(geometryId: string, options?: GeometryOptions): Promise; - -// @public (undocumented) -function loadImage(imageId: string, options?: ImageLoaderOptions): Promise; - -// @public (undocumented) -function loadImageToCanvas(options: LoadImageOptions): Promise; - -// @public (undocumented) -function loadVolume(volumeId: string, options?: VolumeLoaderOptions): Promise; - -// @public (undocumented) -interface LocalVolumeOptions { - // (undocumented) - dimensions: Point3; - // (undocumented) - direction: Mat3; - // (undocumented) - imageIds?: string[]; - // (undocumented) - metadata: Metadata; - // (undocumented) - origin: Point3; - // (undocumented) - preventCache?: boolean; - // (undocumented) - referencedImageIds?: string[]; - // (undocumented) - referencedVolumeId?: string; - // (undocumented) - scalarData?: PixelDataTypedArray; - // (undocumented) - spacing: Point3; - // (undocumented) - targetBuffer?: { - type: PixelDataTypedArrayString; - }; -} - -// @public (undocumented) -function makeVolumeMetadata(imageIds: string[]): Metadata; - -// @public (undocumented) -type Mat3 = [number, number, number, number, number, number, number, number, number] | Float32Array; - -// @public (undocumented) -type Memo = { - restoreMemo: (undo?: boolean) => void; - commitMemo?: () => boolean; -}; - -// @public (undocumented) -type Memoable = { - createMemo: () => Memo; -}; - -// @public (undocumented) -interface Metadata { - // (undocumented) - BitsAllocated: number; - // (undocumented) - BitsStored: number; - // (undocumented) - Columns: number; - // (undocumented) - FrameOfReferenceUID: string; - // (undocumented) - HighBit: number; - // (undocumented) - ImageOrientationPatient: number[]; - // (undocumented) - Modality: string; - // (undocumented) - PhotometricInterpretation: string; - // (undocumented) - PixelRepresentation: number; - // (undocumented) - PixelSpacing: number[]; - // (undocumented) - Rows: number; - // (undocumented) - SamplesPerPixel: number; - // (undocumented) - SeriesInstanceUID?: string; - // (undocumented) - voiLut: VOI[]; - // (undocumented) - VOILUTFunction: string; -} - -declare namespace metaData { - export { - addProvider, - removeProvider, - removeAllProviders, - getMetaData as get - } -} -export { metaData } - -// @public (undocumented) -enum MetadataModules { - // (undocumented) - CALIBRATION = "calibrationModule", - // (undocumented) - CINE = "cineModule", - // (undocumented) - GENERAL_IMAGE = "generalImageModule", - // (undocumented) - GENERAL_SERIES = "generalSeriesModule", - // (undocumented) - GENERAL_STUDY = "generalStudyModule", - // (undocumented) - IMAGE_PIXEL = "imagePixelModule", - // (undocumented) - IMAGE_PLANE = "imagePlaneModule", - // (undocumented) - IMAGE_URL = "imageUrlModule", - // (undocumented) - MODALITY_LUT = "modalityLutModule", - // (undocumented) - MULTIFRAME = "multiframeModule", - // (undocumented) - NM_MULTIFRAME_GEOMETRY = "nmMultiframeGeometryModule", - // (undocumented) - OVERLAY_PLANE = "overlayPlaneModule", - // (undocumented) - PATIENT = "patientModule", - // (undocumented) - PATIENT_STUDY = "patientStudyModule", - // (undocumented) - PET_IMAGE = "petImageModule", - // (undocumented) - PET_ISOTOPE = "petIsotopeModule", - // (undocumented) - PET_SERIES = "petSeriesModule", - // (undocumented) - SOP_COMMON = "sopCommonModule", - // (undocumented) - ULTRASOUND_ENHANCED_REGION = "ultrasoundEnhancedRegionModule", - // (undocumented) - VOI_LUT = "voiLutModule", - // (undocumented) - WADO_WEB_CLIENT = "wadoWebClient" -} - -// @public (undocumented) -const metadataProvider: { - add: (imageId: string, payload: IImageCalibration) => void; - get: (type: string, imageId: string) => IImageCalibration; -}; - -// @public (undocumented) -const metadataProvider_2: { - add: (imageId: string, payload: { - metadata: unknown; - type: string; - }) => void; - addRaw: (imageId: string, payload: { - metadata: unknown; - type: string; - }) => void; - get: (type: string, imageId: string) => unknown; - clear: () => void; -}; - -// @public (undocumented) -const mprCameraValues: any; - -// @public (undocumented) -class MultiTargetEventListenerManager { - // (undocumented) - addEventListener(target: EventTarget, type: string, callback: EventListener, options?: AddEventListenerOptions): void; - // (undocumented) - removeEventListener(target: EventTarget, type: string, callback?: EventListener, options?: EventListenerOptions): void; - // (undocumented) - reset(): void; -} - -// @public (undocumented) -interface NearbyFrames { - // (undocumented) - imageQualityStatus?: ImageQualityStatus; - // (undocumented) - offset: number; -} - -// @public (undocumented) -enum OrientationAxis { - // (undocumented) - ACQUISITION = "acquisition", - // (undocumented) - AXIAL = "axial", - // (undocumented) - CORONAL = "coronal", - // (undocumented) - SAGITTAL = "sagittal" -} - -// @public (undocumented) -interface OrientationVectors { - // (undocumented) - viewPlaneNormal: Point3; - // (undocumented) - viewUp: Point3; -} - -// @public (undocumented) -interface PatientStudyModuleMetadata { - // (undocumented) - patientAge: number; - // (undocumented) - patientSize: number; - // (undocumented) - patientWeight: number; -} - -// @public (undocumented) -export function peerImport(moduleId: string): Promise; - -// @public (undocumented) -type PixelDataTypedArray = Float32Array | Int16Array | Uint16Array | Uint8Array | Int8Array | Uint8ClampedArray; - -// @public (undocumented) -type PixelDataTypedArrayString = 'Float32Array' | 'Int16Array' | 'Uint16Array' | 'Uint8Array' | 'Int8Array' | 'Uint8ClampedArray' | 'none'; - -declare namespace planar { - export { - linePlaneIntersection, - planeEquation, - threePlaneIntersection, - planeDistanceToPoint - } -} - -// @public (undocumented) -type Plane = [number, number, number, number]; - -// @public (undocumented) -function planeDistanceToPoint(plane: Plane, point: Point3, signed?: boolean): number; - -// @public (undocumented) -function planeEquation(normal: Point3, point: Point3 | vec3, normalized?: boolean): Plane; - -// @public (undocumented) -type Point2 = [number, number]; - -// @public (undocumented) -type Point3 = [number, number, number]; - -// @public (undocumented) -type Point4 = [number, number, number, number]; - -// @public (undocumented) -function pointInShapeCallback(imageData: vtkImageData | CPUImageData, options: PointInShapeOptions): Array | undefined; - -// @public (undocumented) -class PointsManager { - constructor(configuration?: PolyDataPointConfiguration); - // (undocumented) - array: ArrayBuffer; - // (undocumented) - _byteSize: number; - // (undocumented) - static create2(initialSize?: number): PointsManager; - // (undocumented) - static create3(initialSize?: number, points?: Point3[]): PointsManager; - // (undocumented) - data: Float32Array; - // (undocumented) - get dimensionLength(): number; - // (undocumented) - get dimensions(): number; - // (undocumented) - _dimensions: number; - // (undocumented) - forEach(func: (value: T, index: number) => void): void; - // (undocumented) - static fromXYZ({ x, y, z }: PointsXYZ): IPointsManager; - // (undocumented) - getPoint(index: number): T; - // (undocumented) - getPointArray(index: number): T; - // (undocumented) - getTypedArray(): Float32Array; - // (undocumented) - protected grow(additionalSize?: number, growSize?: number): void; - // (undocumented) - growSize: number; - // (undocumented) - kIndex: number; - // (undocumented) - get length(): number; - // (undocumented) - _length: number; - // (undocumented) - map(f: (value: any, index: number) => R): R[]; - // (undocumented) - get points(): T[]; - // (undocumented) - push(point: T): void; - // (undocumented) - reverse(): void; - // (undocumented) - sources: IPointsManager[]; - // (undocumented) - subselect(count?: number, offset?: number): IPointsManager; - // (undocumented) - toXYZ(): PointsXYZ; -} - -// @public (undocumented) -interface PointsXYZ { - // (undocumented) - x: number[]; - // (undocumented) - y: number[]; - // (undocumented) - z: number[]; -} - -// @public (undocumented) -interface PolyDataPointConfiguration { - // (undocumented) - dimensions?: number; - // (undocumented) - growSize?: number; - // (undocumented) - initialSize?: number; -} - -// @public (undocumented) -const presets: ViewportPreset[]; - -// @public (undocumented) -type PreStackNewImageEvent = CustomEvent_2; - -// @public (undocumented) -interface PreStackNewImageEventDetail { - // (undocumented) - imageId: string; - // (undocumented) - imageIdIndex: number; - // (undocumented) - renderingEngineId: string; - // (undocumented) - viewportId: string; -} - -// @public (undocumented) -class ProgressiveIterator { - // (undocumented) - [Symbol.asyncIterator](): AsyncGenerator; - constructor(name?: any); - // (undocumented) - add(x: T, done?: boolean): void; - // (undocumented) - static as(promise: any): any; - // (undocumented) - done: any; - // (undocumented) - donePromise(): Promise; - // (undocumented) - forEach(callback: any, errorCallback: any): Promise; - // (undocumented) - generate(processFunction: any, errorCallback?: ErrorCallback_2): Promise; - // (undocumented) - getDonePromise(): PromiseIterator; - // (undocumented) - getNextPromise(): PromiseIterator; - // (undocumented) - getRecent(): T; - // (undocumented) - name?: string; - // (undocumented) - nextPromise(): Promise; - // (undocumented) - reject(reason: Error): void; - // (undocumented) - resolve(): void; -} - -// @public (undocumented) -export class ProgressiveRetrieveImages implements IImagesLoader, IRetrieveConfiguration { - constructor(imageRetrieveConfiguration: IRetrieveConfiguration); - // (undocumented) - static createProgressive: typeof createProgressive; - // (undocumented) - static interleavedRetrieveStages: { - stages: RetrieveStage[]; - }; - // (undocumented) - loadImages(imageIds: string[], listener: ImageLoadListener): Promise; - // (undocumented) - retrieveOptions: Record; - // (undocumented) - static sequentialRetrieveStages: { - stages: RetrieveStage[]; - }; - // (undocumented) - static singleRetrieveStages: { - stages: RetrieveStage[]; - }; - // (undocumented) - stages: RetrieveStage[]; -} - -// @public (undocumented) -interface PTScaling { - // (undocumented) - suvbsa?: number; - // (undocumented) - suvbw?: number; - // (undocumented) - suvbwToSuvbsa?: number; - // (undocumented) - suvbwToSuvlbm?: number; - // (undocumented) - suvlbm?: number; -} - -// @public (undocumented) -type PublicContourSetData = ContourSetData; - -// @public (undocumented) -type PublicSurfaceData = SurfaceData; - -// @public (undocumented) -interface PublicViewportInput { - // (undocumented) - defaultOptions?: ViewportInputOptions; - // (undocumented) - element: HTMLDivElement; - // (undocumented) - type: ViewportType; - // (undocumented) - viewportId: string; -} - -// @public (undocumented) -type RangeRetrieveOptions = BaseRetrieveOptions & { - rangeIndex: number; - chunkSize?: number | ((metadata: any) => number); -}; - -// @public (undocumented) -interface ReferenceCompatibleOptions { - // (undocumented) - asNearbyProjection?: boolean; - // (undocumented) - asOverlay?: boolean; - // (undocumented) - asVolume?: boolean; - // (undocumented) - imageURI?: string; - // (undocumented) - withNavigation?: boolean; - // (undocumented) - withOrientation?: boolean; -} - -// @public (undocumented) -function registerColormap(colormap: ColormapRegistration): void; - -// @public (undocumented) -function registerGeometryLoader(scheme: string, geometryLoader: GeometryLoaderFn): void; - -// @public (undocumented) -export function registerImageLoader(scheme: string, imageLoader: ImageLoaderFn): void; - -// @public (undocumented) -function registerUnknownGeometryLoader(geometryLoader: GeometryLoaderFn): GeometryLoaderFn | undefined; - -// @public (undocumented) -function registerUnknownImageLoader(imageLoader: ImageLoaderFn): ImageLoaderFn; - -// @public (undocumented) -function registerUnknownVolumeLoader(volumeLoader: VolumeLoaderFn): VolumeLoaderFn | undefined; - -// @public (undocumented) -function registerVolumeLoader(scheme: string, volumeLoader: VolumeLoaderFn): void; - -// @public (undocumented) -function removeAllProviders(): void; - -// @public (undocumented) -function removeProvider(provider: (type: string, query: unknown) => unknown): void; - -// @public (undocumented) -const RENDERING_DEFAULTS: { - MINIMUM_SLAB_THICKNESS: number; - MAXIMUM_RAY_DISTANCE: number; -}; - -// @public (undocumented) -export class RenderingEngine { - constructor(id?: string); - // (undocumented) - _debugRender(): void; - // (undocumented) - destroy(): void; - // (undocumented) - disableElement(viewportId: string): void; - // (undocumented) - _downloadOffScreenCanvas(): void; - // (undocumented) - enableElement(viewportInputEntry: PublicViewportInput): void; - // (undocumented) - fillCanvasWithBackgroundColor(canvas: HTMLCanvasElement, backgroundColor: [number, number, number]): void; - // (undocumented) - getStackViewport(viewportId: string): StackViewport; - // (undocumented) - getStackViewports(): StackViewport[]; - // (undocumented) - getViewport(viewportId: string): IViewport; - // (undocumented) - getViewports(): IViewport[]; - // (undocumented) - getVolumeViewports(): IVolumeViewport[]; - // (undocumented) - hasBeenDestroyed: boolean; - // (undocumented) - readonly id: string; - // (undocumented) - readonly offScreenCanvasContainer: HTMLDivElement; - // (undocumented) - offscreenMultiRenderWindow: any; - // (undocumented) - render(): void; - // (undocumented) - renderFrameOfReference: (FrameOfReferenceUID: string) => void; - // (undocumented) - renderViewport(viewportId: string): void; - // (undocumented) - renderViewports(viewportIds: string[]): void; - // (undocumented) - resize(immediate?: boolean, keepCamera?: boolean): void; - // (undocumented) - setViewports(publicViewportInputEntries: PublicViewportInput[]): void; -} - -// @public (undocumented) -function renderToCanvasCPU(canvas: HTMLCanvasElement, imageOrVolume: IImage | IVolume, modality?: string, _renderingEngineId?: string, _viewportOptions?: ViewportInputOptions): Promise; - -// @public (undocumented) -function renderToCanvasGPU(canvas: HTMLCanvasElement, imageOrVolume: IImage | IVolume, modality?: any, renderingEngineId?: string, viewportOptions?: ViewportInputOptions & { - viewReference?: ViewReference; -}): Promise; - -// @public (undocumented) -enum RequestType { - // (undocumented) - Compute = "compute", - // (undocumented) - Interaction = "interaction", - // (undocumented) - Prefetch = "prefetch", - // (undocumented) - Thumbnail = "thumbnail" -} - -// @public (undocumented) -export function resetInitialization(): void; - -// @public (undocumented) -export function resetUseCPURendering(): void; - -// @public (undocumented) -export type RetrieveOptions = BaseRetrieveOptions | StreamingRetrieveOptions | RangeRetrieveOptions; - -// @public (undocumented) -export interface RetrieveStage { - // (undocumented) - decimate?: number; - // (undocumented) - id: string; - // (undocumented) - nearbyFrames?: NearbyFrames[]; - // (undocumented) - offset?: number; - // (undocumented) - positions?: number[]; - // (undocumented) - priority?: number; - // (undocumented) - requestType?: RequestType; - // (undocumented) - retrieveType?: string; -} - -// @public (undocumented) -type RGB = [number, number, number]; - -// @public (undocumented) -function rgbToHex(r: any, g: any, b: any): string; - -// @public (undocumented) -interface RLERun_2 { - // (undocumented) - end: number; - // (undocumented) - start: number; - // (undocumented) - value: T; -} - -// @public (undocumented) -class RLEVoxelMap { - constructor(width: number, height: number, depth?: number); - // (undocumented) - clear(): void; - // (undocumented) - static copyMap(destination: RLEVoxelMap, source: RLEVoxelMap): void; - // (undocumented) - defaultValue: T; - // (undocumented) - delete(index: number): void; - // (undocumented) - depth: number; - // (undocumented) - fillFrom(getter: (i: number, j: number, k: number) => T, boundsIJK: BoundsIJK): void; - // (undocumented) - findAdjacents(item: [RLERun, number, number, Point3[]?], { diagonals, planar, singlePlane }: { - diagonals?: boolean; - planar?: boolean; - singlePlane?: boolean; - }): any[]; - // (undocumented) - protected findIndex(row: RLERun[], i: number): number; - // (undocumented) - floodFill(i: number, j: number, k: number, value: T, options?: { - planar?: boolean; - diagonals?: boolean; - singlePlane?: boolean; - }): number; - // (undocumented) - forEach(callback: any, options?: { - rowModified?: boolean; - }): void; - // (undocumented) - forEachRow(callback: any): void; - // (undocumented) - get: (index: number) => T; - // (undocumented) - getPixelData(k?: number, pixelData?: PixelDataTypedArray): PixelDataTypedArray; - // (undocumented) - protected getRLE(i: number, j: number, k?: number): RLERun; - // (undocumented) - getRun: (j: number, k: number) => RLERun[]; - // (undocumented) - static getScalarData: (ArrayType?: Uint8ClampedArrayConstructor) => Uint8ClampedArray; - // (undocumented) - has(index: number): boolean; - // (undocumented) - height: number; - // (undocumented) - protected jMultiple: number; - // (undocumented) - keys(): number[]; - // (undocumented) - protected kMultiple: number; - // (undocumented) - normalizer: PlaneNormalizer; - // (undocumented) - protected numComps: number; - // (undocumented) - pixelDataConstructor: Uint8ArrayConstructor; - // (undocumented) - protected rows: Map[]>; - // (undocumented) - set: (index: number, value: T) => void; - // (undocumented) - toIJK(index: number): Point3; - // (undocumented) - toIndex([i, j, k]: Point3): number; - // (undocumented) - updateScalarData: (scalarData: PixelDataTypedArray) => void; - // (undocumented) - width: number; -} - -// @public (undocumented) -function roundNumber(value: string | number | (string | number)[], precision?: number): string; - -// @public (undocumented) -function roundToPrecision(value: any): number; - -// @public (undocumented) -function scaleArray(array: Float32Array | Uint8Array | Uint16Array | Int16Array, scalingParameters: ScalingParameters): Float32Array | Uint8Array | Uint16Array | Int16Array; - -// @public (undocumented) -function scaleRGBTransferFunction(rgbTransferFunction: ColorTransferFunction, scalingFactor: number): void; - -// @public (undocumented) -interface Scaling { - // (undocumented) - PT?: PTScaling; -} - -// @public (undocumented) -interface ScalingParameters { - // (undocumented) - modality: string; - // (undocumented) - rescaleIntercept: number; - // (undocumented) - rescaleSlope: number; - // (undocumented) - suvbsa?: number; - // (undocumented) - suvbw?: number; - // (undocumented) - suvlbm?: number; -} - -// @public (undocumented) -function scroll_2(viewport: IViewport | IVideoViewport, options: ScrollOptions_2): void; - -// @public (undocumented) -type ScrollOptions_2 = { - delta: number; - volumeId?: string; - debounceLoading?: boolean; - loop?: boolean; - scrollSlabs?: boolean; -}; - -// @public (undocumented) -export function setConfiguration(c: Cornerstone3DConfig): void; - -// @public (undocumented) -export function setPreferSizeOverAccuracy(status: boolean): void; - -// @public (undocumented) -export class Settings { - constructor(base?: Settings); - // (undocumented) - static assert(subject: Settings): Settings; - // (undocumented) - dump(): Record; - // (undocumented) - extend(): Settings; - // (undocumented) - static extendRuntimeSettings(): Settings; - // (undocumented) - forEach(callback: (key: string, value: unknown) => void): void; - // (undocumented) - get(key: string): unknown; - // (undocumented) - static getDefaultSettings(subfield?: any): Settings | unknown; - // (undocumented) - static getObjectSettings(subject: unknown, from?: unknown): Settings; - // (undocumented) - static getRuntimeSettings(): Settings; - // (undocumented) - import(root: Record): void; - // (undocumented) - set(key: string, value: unknown): boolean; - // (undocumented) - unset(key: string): boolean; -} - -// @public (undocumented) -function setTransferFunctionNodes(transferFunction: any, nodes: any): void; - -// @public (undocumented) -export function setUseCPURendering(status: boolean, updateViewports?: boolean): void; - -// @public (undocumented) -export function setVolumesForViewports(renderingEngine: IRenderingEngine, volumeInputs: IVolumeInput[], viewportIds: string[], immediateRender?: boolean, suppressEvents?: boolean): Promise; - -// @public (undocumented) -function snapFocalPointToSlice(focalPoint: Point3, position: Point3, sliceRange: ActorSliceRange, viewPlaneNormal: Point3, spacingInNormalDirection: number, deltaFrames: number): { - newFocalPoint: Point3; - newPosition: Point3; -}; - -// @public (undocumented) -interface SopCommonModuleMetadata { - // (undocumented) - sopClassUID: string; - // (undocumented) - sopInstanceUID: string; -} - -// @public (undocumented) -function sortImageIdsAndGetSpacing(imageIds: string[], scanAxisNormal?: vec3): SortedImageIdsItem; - -// @public (undocumented) -const spatialRegistrationMetadataProvider: { - add: (query: string[], payload: mat4) => void; - get: (type: string, viewportId1: string, viewportId2: string) => mat4; -}; - -// @public (undocumented) -enum SpeedUnit { - // (undocumented) - FRAME = "f", - // (undocumented) - SECOND = "s" -} - -// @public (undocumented) -function splitImageIdsBy4DTags(imageIds: string[]): { - imageIdGroups: string[][]; - splittingTag: string | null; -}; - -// @public (undocumented) -type StackInputCallback = (params: { - imageActor: ImageActor; - imageId: string; -}) => unknown; - -// @public (undocumented) -type StackNewImageEvent = CustomEvent_2; - -// @public (undocumented) -interface StackNewImageEventDetail { - // (undocumented) - image: IImage; - // (undocumented) - imageId: string; - // (undocumented) - imageIdIndex: number; - // (undocumented) - renderingEngineId: string; - // (undocumented) - viewportId: string; -} - -// @public (undocumented) -type StackScrollOutOfBoundsEvent = CustomEvent_2; - -// @public (undocumented) -type StackScrollOutOfBoundsEventDetail = { - imageIdIndex: number; - direction: number; -}; - -// @public (undocumented) -export class StackViewport extends Viewport { - constructor(props: ViewportInput); - // (undocumented) - addActor: (actorEntry: ActorEntry) => void; - // (undocumented) - addActors: (actors: ActorEntry[]) => void; - // (undocumented) - addImages(stackInputs: IStackInput[]): void; - // (undocumented) - calibrateSpacing(imageId: string): void; - // (undocumented) - canvasToWorld: (canvasPos: Point2) => Point3; - // (undocumented) - clearDefaultProperties(imageId?: string): void; - // (undocumented) - createVTKImageData({ origin, direction, dimensions, spacing, numberOfComponents, pixelArray, }: { - origin: any; - direction: any; - dimensions: any; - spacing: any; - numberOfComponents: any; - pixelArray: any; - }): vtkImageData; - // (undocumented) - customRenderViewportToCanvas: () => { - canvas: HTMLCanvasElement; - element: HTMLDivElement; - viewportId: string; - renderingEngineId: string; - viewportStatus: ViewportStatus; - }; - // (undocumented) - errorCallback(imageId: any, permanent: any, error: any): void; - // (undocumented) - getActor: (actorUID: string) => ActorEntry; - // (undocumented) - getActors: () => ActorEntry[]; - // (undocumented) - getCamera: () => ICamera; - // (undocumented) - getCornerstoneImage: () => IImage; - // (undocumented) - getCurrentImageId: (index?: number) => string; - // (undocumented) - getCurrentImageIdIndex: () => number; - // (undocumented) - getDefaultActor: () => ActorEntry; - // (undocumented) - getDefaultProperties: (imageId?: string) => StackViewportProperties; - // (undocumented) - getFrameOfReferenceUID: (sliceIndex?: number) => string; - // (undocumented) - getImageData: () => IImageData | CPUIImageData; - // (undocumented) - getImageDataMetadata(image: IImage): ImageDataMetaData; - // (undocumented) - getImageIds: () => string[]; - // (undocumented) - getImagePlaneReferenceData(sliceIndex?: number): ViewReference; - // (undocumented) - getLoaderImageOptions(imageId: string): { - useRGBA: boolean; - transferSyntaxUID: any; - priority: number; - requestType: RequestType; - additionalDetails: { - imageId: string; - imageIdIndex: number; - }; - }; - // (undocumented) - getNumberOfSlices: () => number; - // (undocumented) - getProperties: () => StackViewportProperties; - // (undocumented) - getRenderer: () => vtkRenderer; - // (undocumented) - getRotation: () => number; - // (undocumented) - getSliceIndex: () => number; - // (undocumented) - getSliceIndexForImage(reference: string | ViewReference): number; - // (undocumented) - getSliceInfo(): { - sliceIndex: number; - slicePlane: number; - width: number; - height: number; - }; - // (undocumented) - getSliceViewInfo(): { - width: number; - height: number; - sliceIndex: number; - slicePlane: number; - sliceToIndexMatrix: mat4; - indexToSliceMatrix: mat4; - }; - // (undocumented) - getTargetImageIdIndex: () => number; - // (undocumented) - getViewReference(viewRefSpecifier?: ViewReferenceSpecifier): ViewReference; - // (undocumented) - getViewReferenceId(specifier?: ViewReferenceSpecifier): string; - // (undocumented) - hasImageId: (imageId: string) => boolean; - // (undocumented) - hasImageURI: (imageURI: string) => boolean; - // (undocumented) - protected imagesLoader: IImagesLoader; - // (undocumented) - isReferenceViewable(viewRef: ViewReference, options?: ReferenceCompatibleOptions): boolean; - // (undocumented) - jumpToWorld(worldPos: Point3): boolean; - // (undocumented) - loadImages(imageIds: string[], listener: ImageLoadListener): Promise; - // (undocumented) - modality: string; - // (undocumented) - removeAllActors: () => void; - // (undocumented) - renderImageObject: (image: any) => void; - // (undocumented) - resetCamera: (options?: { - resetPan?: boolean; - resetZoom?: boolean; - resetToCenter?: boolean; - suppressEvents?: boolean; - }) => boolean; - // (undocumented) - resetCameraForResize: () => boolean; - // (undocumented) - resetProperties(): void; - // (undocumented) - resetToDefaultProperties(): void; - // (undocumented) - resize: () => void; - // (undocumented) - scaling: Scaling; - // (undocumented) - scroll(delta: number, debounce?: boolean, loop?: boolean): void; - // (undocumented) - setActors: (actors: ActorEntry[]) => void; - // (undocumented) - setCamera: (cameraInterface: ICamera, storeAsInitialCamera?: boolean) => void; - // (undocumented) - setDefaultProperties(ViewportProperties: StackViewportProperties, imageId?: string): void; - // (undocumented) - setImageIdIndex(imageIdIndex: number): Promise; - // (undocumented) - protected setInterpolationType: (interpolationType: InterpolationType) => void; - // (undocumented) - setProperties({ colormap, voiRange, VOILUTFunction, invert, interpolationType, }?: StackViewportProperties, suppressEvents?: boolean): void; - // (undocumented) - protected setRotation: (rotation: number) => void; - // (undocumented) - setStack(imageIds: string[], currentImageIdIndex?: number): Promise; - // (undocumented) - setUseCPURendering(value: boolean): void; - // (undocumented) - setViewReference(viewRef: ViewReference): void; - // (undocumented) - stackActorReInitialized: boolean; - // (undocumented) - successCallback(imageId: any, image: any): void; - // (undocumented) - unsetColormap: () => void; - // (undocumented) - updateRenderingPipeline: () => void; - // (undocumented) - static get useCustomRenderingPipeline(): boolean; - // (undocumented) - worldToCanvas: (worldPos: Point3) => Point2; -} - -// @public (undocumented) -type StackViewportNewStackEvent = CustomEvent_2; - -// @public (undocumented) -interface StackViewportNewStackEventDetail { - // (undocumented) - currentImageIdIndex: number; - // (undocumented) - element: HTMLDivElement; - // (undocumented) - imageIds: string[]; - // (undocumented) - viewportId: string; -} - -// @public (undocumented) -type StackViewportProperties = ViewportProperties & { - interpolationType?: InterpolationType; - suppressEvents?: boolean; - isComputedVOI?: boolean; -}; - -// @public (undocumented) -type StackViewportScrollEvent = CustomEvent_2; - -// @public (undocumented) -interface StackViewportScrollEventDetail { - // (undocumented) - direction: number; - // (undocumented) - imageId: string; - // (undocumented) - newImageIdIndex: number; -} - -// @public (undocumented) -export class StreamingDynamicImageVolume extends BaseStreamingImageVolume implements IDynamicImageVolume { - constructor(imageVolumeProperties: ImageVolumeProps & { - splittingTag: string; - imageIdGroups: string[][]; - }, streamingProperties: IStreamingVolumeProperties); - // (undocumented) - protected checkDimensionGroupCompletion(imageIdIndex: number): void; - // (undocumented) - protected checkTimePointCompletion(imageIdIndex: number): void; - // (undocumented) - get dimensionGroupNumber(): number; - set dimensionGroupNumber(dimensionGroupNumber: number); - // (undocumented) - flatImageIdIndexToDimensionGroupNumber(flatImageIdIndex: number): number; - // (undocumented) - flatImageIdIndexToImageIdIndex(flatImageIdIndex: number): number; - // (undocumented) - flatImageIdIndexToTimePointIndex(flatImageIdIndex: number): number; - // (undocumented) - getCurrentDimensionGroupImageIds(): string[]; - // (undocumented) - getCurrentTimePointImageIds(): string[]; - // (undocumented) - getImageIdsToLoad(): string[]; - // (undocumented) - getImageLoadRequests: (priority: number) => { - callLoadImage: (imageId: any, imageIdIndex: any, options: any) => any; - imageId: string; - imageIdIndex: number; - options: { - targetBuffer: { - type: PixelDataTypedArrayString; - rows: any; - columns: any; - }; - allowFloatRendering: boolean; - preScale: { - enabled: boolean; - scalingParameters: ScalingParameters; - }; - transferPixelData: boolean; - requestType: RequestType; - transferSyntaxUID: any; - additionalDetails: { - imageId: string; - imageIdIndex: number; - volumeId: string; - }; - }; - priority: number; - requestType: RequestType; - additionalDetails: { - volumeId: string; - }; - }[]; - // (undocumented) - isDimensionGroupLoaded(dimensionGroupNumber: number): boolean; - // (undocumented) - isTimePointLoaded(timePointIndex: number): boolean; - // (undocumented) - numDimensionGroups: number; - // (undocumented) - numTimePoints: number; - // (undocumented) - scroll(delta: number): void; - // (undocumented) - get splittingTag(): string; - set timePointIndex(index: number); - // (undocumented) - get timePointIndex(): number; -} - -// @public (undocumented) -export class StreamingImageVolume extends BaseStreamingImageVolume { - constructor(imageVolumeProperties: ImageVolumeProps, streamingProperties: IStreamingVolumeProperties); - // (undocumented) - getImageIdsToLoad: () => string[]; - // (undocumented) - getImageLoadRequests(priority: number): ImageLoadRequests[]; - // (undocumented) - getScalarData(): PixelDataTypedArray; -} - -// @public (undocumented) -type StreamingRetrieveOptions = BaseRetrieveOptions & { - streaming: boolean; -}; - -// @public (undocumented) -export class Surface { - constructor(props: SurfaceProps); - // (undocumented) - get centroid(): Point3; - // (undocumented) - get color(): RGB; - set color(color: RGB); - // (undocumented) - get flatPointsArray(): number[]; - // (undocumented) - readonly frameOfReferenceUID: string; - // (undocumented) - readonly id: string; - // (undocumented) - get points(): number[]; - set points(points: number[]); - // (undocumented) - get polys(): number[]; - set polys(polys: number[]); - // (undocumented) - get segmentIndex(): number; - // (undocumented) - readonly sizeInBytes: number; - // (undocumented) - get totalNumberOfPoints(): number; -} - -// @public (undocumented) -interface SurfaceData { - // (undocumented) - color?: Point3; - // (undocumented) - frameOfReferenceUID: string; - // (undocumented) - id: string; - // (undocumented) - points: number[]; - // (undocumented) - polys: number[]; - // (undocumented) - segmentIndex?: number; -} - -// @public (undocumented) -class TargetEventListeners { - constructor(target: EventTarget); - // (undocumented) - addEventListener(type: string, callback: EventListener, options?: AddEventListenerOptions): void; - // (undocumented) - get isEmpty(): boolean; - // (undocumented) - removeEventListener(type: string, callback?: EventListener, options?: EventListenerOptions): void; - // (undocumented) - reset(): void; -} - -// @public (undocumented) -function threePlaneIntersection(firstPlane: Plane, secondPlane: Plane, thirdPlane: Plane): Point3; - -// @public (undocumented) -function toLowHighRange(windowWidth: number, windowCenter: number, voiLUTFunction?: VOILUTFunctionType): { - lower: number; - upper: number; -}; - -// @public (undocumented) -function toWindowLevel(low: number, high: number): { - windowWidth: number; - windowCenter: number; -}; - -declare namespace transferFunctionUtils { - export { - getTransferFunctionNodes, - setTransferFunctionNodes - } -} - -// @public (undocumented) -interface TransferSyntaxMetadata { - // (undocumented) - transferSyntaxUID: string; -} - -// @public (undocumented) -function transformIndexToWorld(imageData: any, voxelPos: Point3): any; - -// @public (undocumented) -type TransformMatrix2D = [number, number, number, number, number, number]; - -// @public (undocumented) -function transformWorldToIndex(imageData: any, worldPos: Point3): any; - -// @public (undocumented) -function transformWorldToIndexContinuous(imageData: any, worldPos: Point3): any; - -// @public (undocumented) -export function triggerEvent(el: EventTarget, type: string, detail?: unknown): boolean; - -declare namespace Types { - export { - RetrieveStage, - RetrieveOptions, - RangeRetrieveOptions, - StreamingRetrieveOptions, - NearbyFrames, - IRetrieveConfiguration, - IImagesLoader, - Cornerstone3DConfig, - ICamera, - StackViewport as IStackViewport, - IVideoViewport, - IWSIViewport, - IVolumeViewport, - IEnabledElement, - ICache, - IVolume, - IViewportId, - IImageVolume, - ImageVolumeProps, - IDynamicImageVolume, - IRenderingEngine, - ScalingParameters, - PTScaling, - IPointsManager, - PolyDataPointConfiguration, - Scaling, - IStreamingImageVolume, - IImage, - IImageData, - IImageCalibration, - CPUIImageData, - CPUImageData, - EventTypes, - ImageLoaderFn, - VolumeLoaderFn, - IRegisterImageLoader, - IStreamingVolumeProperties, - IViewport, - ViewReference, - DataSetOptions as ImageSetOptions, - ViewPresentation, - ViewPresentationSelector, - ReferenceCompatibleOptions, - ViewReferenceSpecifier, - StackViewportProperties, - VolumeViewportProperties, - ViewportProperties, - PublicViewportInput, - VolumeActor, - Actor, - ActorEntry, - ImageActor, - ICanvasActor, - IImageLoadObject, - IVolumeLoadObject, - IVolumeInput, - VolumeInputCallback, - IStackInput, - StackInputCallback, - ViewportPreset, - Metadata, - OrientationVectors, - AABB2, - AABB3, - Point2, - Point3, - PointsXYZ, - Point4, - Mat3, - Plane, - ViewportInputOptions, - VideoViewportProperties, - WSIViewportProperties, - VOIRange, - VOI, - DisplayArea, - FlipDirection, - ICachedImage, - ICachedVolume, - CPUFallbackEnabledElement, - CPUFallbackViewport, - CPUFallbackTransform, - CPUFallbackColormapData, - CPUFallbackViewportDisplayedArea, - CPUFallbackColormapsData, - CPUFallbackColormap, - TransformMatrix2D, - CPUFallbackLookupTable, - CPUFallbackLUT, - CPUFallbackRenderingTools, - CustomEvent_2 as CustomEventType, - ActorSliceRange, - ImageSliceData, - IGeometry, - IGeometryLoadObject, - ICachedGeometry, - PublicContourSetData, - ContourSetData, - ContourData, - IContourSet, - IContour, - PublicSurfaceData, - SurfaceData, - ISurface, - RGB, - ColormapPublic, - ColormapRegistration, - PixelDataTypedArray, - PixelDataTypedArrayString, - ImagePixelModule, - ImagePlaneModule, - AffineMatrix, - ImageLoadListener, - InternalVideoCamera, - VideoViewportInput, - BoundsIJK, - BoundsLPS, - Color, - ColorLUT, - VolumeProps, - ImageFrame as IImageFrame, - DicomDateObject, - DicomTimeObject, - GeneralSeriesModuleMetadata, - ImagePlaneModuleMetadata, - SopCommonModuleMetadata, - ImagePixelModuleMetadata, - PatientStudyModuleMetadata, - TransferSyntaxMetadata, - LocalVolumeOptions, - IVoxelManager, - IRLEVoxelMap, - RLERun_2 as RLERun, - ViewportInput, - ImageLoadRequests, - IBaseVolumeViewport, - GeometryLoaderFn, - ScrollOptions_2 as ScrollOptions, - JumpToSliceOptions, - Memo, - HistoryMemo, - VoxelManager, - RLEVoxelMap - } -} -export { Types } - -// @public (undocumented) -function unregisterAllImageLoaders(): void; - -// @public (undocumented) -function updateVTKImageDataWithCornerstoneImage(sourceImageData: vtkImageData, image: IImage): void; - -declare namespace utilities { - export { - FrameRange, - eventListener, - invertRgbTransferFunction, - createSigmoidRGBTransferFunction, - getVoiFromSigmoidRGBTransferFunction, - createLinearRGBTransferFunction, - scaleRGBTransferFunction as scaleRgbTransferFunction, - triggerEvent, - imageIdToURI, - metadataProvider as calibratedPixelSpacingMetadataProvider, - clamp, - uuidv4, - planar, - getMinMax, - getRuntimeId, - isEqual, - isEqualAbs, - isEqualNegative, - isOpposite, - getViewportModality, - windowLevel, - convertToGrayscale, - getClosestImageId, - getSpacingInNormalDirection, - getTargetVolumeAndSpacingInNormalDir, - getVolumeActorCorners, - indexWithinDimensions, - getVolumeViewportsContainingSameVolumes, - getViewportsWithVolumeId, - transformWorldToIndex, - transformIndexToWorld, - loadImageToCanvas, - renderToCanvasCPU, - renderToCanvasGPU, - worldToImageCoords, - imageToWorldCoords, - getVolumeSliceRangeInfo, - getVolumeViewportScrollInfo, - getSliceRange, - snapFocalPointToSlice, - getImageSliceDataForVolumeViewport, - isImageActor, - isPTPrescaledWithSUV, - actorIsA, - getViewportsWithImageURI, - getClosestStackImageIndexForPoint, - getCurrentVolumeViewportSlice, - calculateViewportsSpatialRegistration, - spatialRegistrationMetadataProvider, - getViewportImageCornersInWorld, - hasNaNValues, - applyPreset, - deepMerge, - PointsManager, - getScalingParameters, - colormap, - getImageLegacy, - ProgressiveIterator, - decimate, - imageRetrieveMetadataProvider, - transferFunctionUtils, - updateVTKImageDataWithCornerstoneImage, - sortImageIdsAndGetSpacing, - makeVolumeMetadata, - isValidVolume, - metadataProvider_2 as genericMetadataProvider, - isVideoTransferSyntax, - HistoryMemo_2 as HistoryMemo, - generateVolumePropsFromImageIds, - getBufferConfiguration, - VoxelManager, - RLEVoxelMap, - convertStackToVolumeViewport, - convertVolumeToStackViewport, - roundNumber, - roundToPrecision, - getViewportImageIds, - getRandomSampleFromArray, - getVolumeId, - color, - hasFloatScalingParameters, - getDynamicVolumeInfo, - autoLoad, - scaleArray, - deepClone, - splitImageIdsBy4DTags, - pointInShapeCallback, - deepEqual, - jumpToSlice, - scroll_2 as scroll, - clip, - transformWorldToIndexContinuous, - createSubVolume, - getVolumeDirectionVectors - } -} -export { utilities } - -// @public (undocumented) -function uuidv4(): string; - -declare namespace VideoEnums { - export { - SpeedUnit - } -} - -// @public (undocumented) -export class VideoViewport extends Viewport { - constructor(props: VideoViewportInput); - // (undocumented) - addImages(stackInputs: IStackInput[]): void; - // (undocumented) - readonly canvasContext: CanvasRenderingContext2D; - // (undocumented) - protected canvasToIndex: (canvasPos: Point2) => Point2; - // (undocumented) - canvasToWorld: (canvasPos: Point2, destPos?: Point3) => Point3; - // (undocumented) - protected createActorMapper(image: any): CanvasActor; - // (undocumented) - customRenderViewportToCanvas: () => void; - // (undocumented) - end(): Promise; - // (undocumented) - static frameRangeExtractor: RegExp; - // (undocumented) - getCamera(): ICamera; - // (undocumented) - getCurrentImageId(index?: number): string; - // (undocumented) - getCurrentImageIdIndex(): number; - // (undocumented) - getFrameNumber(): number; - // (undocumented) - getFrameOfReferenceUID: () => string; - // (undocumented) - getFrameRange(): [number, number]; - // (undocumented) - getFrameRate(): number; - // (undocumented) - getImageData(): IImageData | CPUIImageData; - // (undocumented) - getImageDataMetadata(image: IImage | string): { - bitsAllocated: number; - numberOfComponents: number; - origin: any; - rows: any; - columns: any; - direction: number[]; - dimensions: any[]; - spacing: any[]; - hasPixelSpacing: boolean; - numVoxels: number; - imagePlaneModule: any; - }; - // (undocumented) - getImageIds(): string[]; - // (undocumented) - getMiddleSliceData: () => never; - // (undocumented) - getNumberOfSlices: () => number; - // (undocumented) - getPan(): Point2; - // (undocumented) - getProperties: () => VideoViewportProperties; - // (undocumented) - getRotation: () => number; - // (undocumented) - protected getScalarData(): CanvasScalarData; - // (undocumented) - getSliceIndex(): number; - // (undocumented) - getSliceIndexForImage(reference: string | ViewReference): number; - // (undocumented) - getSliceViewInfo(): { - width: number; - height: number; - sliceIndex: number; - slicePlane: number; - sliceToIndexMatrix: mat4; - indexToSliceMatrix: mat4; - }; - // (undocumented) - protected getTransform(): Transform; - // (undocumented) - getViewReference(viewRefSpecifier?: ViewReferenceSpecifier): ViewReference; - // (undocumented) - getViewReferenceId(specifier?: ViewReferenceSpecifier): string; - // (undocumented) - hasImageURI(imageURI: string): boolean; - // (undocumented) - protected imageId: string; - // (undocumented) - protected indexToCanvas: (indexPos: Point2) => Point2; - // (undocumented) - isReferenceViewable(viewRef: ViewReference, options?: ReferenceCompatibleOptions): boolean; - // (undocumented) - protected metadata: any; - // (undocumented) - modality: any; - // (undocumented) - pause(): void; - // (undocumented) - play(): Promise; - // (undocumented) - readonly renderingEngineId: string; - // (undocumented) - resetCamera: () => boolean; - // (undocumented) - resetProperties(): void; - // (undocumented) - resize: () => void; - // (undocumented) - scroll(delta?: number): Promise; - // (undocumented) - setAverageWhite(averageWhite: [number, number, number]): void; - // (undocumented) - setCamera(camera: ICamera): void; - // (undocumented) - protected setColorTransform(): void; - // (undocumented) - setDataIds(imageIds: string[], options?: DataSetOptions): void; - // (undocumented) - setFrameNumber(frame: number): Promise; - // (undocumented) - setFrameRange(frameRange: number[]): void; - // (undocumented) - setPlaybackRate(rate?: number): void; - // (undocumented) - setProperties(props: VideoViewportProperties): void; - // (undocumented) - setScrollSpeed(scrollSpeed?: number, unit?: VideoEnums.SpeedUnit): void; - // (undocumented) - setTime(timeInSeconds: number): Promise; - // (undocumented) - setVideo(imageId: string, frameNumber?: number): Promise; - // (undocumented) - setViewReference(viewRef: ViewReference): void; - // (undocumented) - setVOI(voiRange: VOIRange): void; - // (undocumented) - setWindowLevel(windowWidth?: number, windowCenter?: number): void; - // (undocumented) - start(): Promise; - // (undocumented) - togglePlayPause(): boolean; - // (undocumented) - readonly uid: any; - // (undocumented) - updateCameraClippingPlanesAndRange(): void; - // (undocumented) - static get useCustomRenderingPipeline(): boolean; - // (undocumented) - useCustomRenderingPipeline: boolean; - // (undocumented) - worldToCanvas: (worldPos: Point3) => Point2; -} - -// @public (undocumented) -interface VideoViewportInput { - // (undocumented) - canvas: HTMLCanvasElement; - // (undocumented) - defaultOptions: unknown; - // (undocumented) - element: HTMLDivElement; - // (undocumented) - id: string; - // (undocumented) - renderingEngineId: string; - // (undocumented) - sHeight: number; - // (undocumented) - sWidth: number; - // (undocumented) - sx: number; - // (undocumented) - sy: number; - // (undocumented) - type: ViewportType; -} - -// @public (undocumented) -type VideoViewportProperties = ViewportProperties & { - loop?: boolean; - muted?: boolean; - pan?: Point2; - playbackRate?: number; - scrollSpeed?: number; -}; - -// @public (undocumented) -export class Viewport { - constructor(props: ViewportInput); - // (undocumented) - _actors: Map; - // (undocumented) - addActor(actorEntry: ActorEntry): void; - // (undocumented) - addActors(actors: ActorEntry[], options?: { - resetCamera?: boolean; - }): void; - // (undocumented) - addWidget: (widgetId: any, widget: any) => void; - // (undocumented) - static boundsRadius(bounds: number[]): number; - // (undocumented) - protected calibration: IImageCalibration; - // (undocumented) - static readonly CameraViewPresentation: ViewPresentationSelector; - // (undocumented) - readonly canvas: HTMLCanvasElement; - // (undocumented) - canvasToWorld: (canvasPos: Point2) => Point3; - // (undocumented) - customRenderViewportToCanvas: () => unknown; - // (undocumented) - readonly defaultOptions: ViewportInputOptions; - // (undocumented) - readonly element: HTMLDivElement; - // (undocumented) - protected fitToCanvasCamera: ICamera; - // (undocumented) - protected flip({ flipHorizontal, flipVertical }: FlipDirection): void; - // (undocumented) - protected flipHorizontal: boolean; - // (undocumented) - protected flipVertical: boolean; - // (undocumented) - getActor(actorUID: string): ActorEntry; - // (undocumented) - getActorByIndex(index: number): ActorEntry; - // (undocumented) - getActors(): ActorEntry[]; - // (undocumented) - getActorUIDByIndex(index: number): string; - // (undocumented) - getActorUIDs(): string[]; - // (undocumented) - getCamera(): ICamera; - // (undocumented) - protected getCameraNoRotation(): ICamera; - // (undocumented) - getCanvas(): HTMLCanvasElement; - // (undocumented) - getClippingPlanesForActor(actorEntry?: ActorEntry): vtkPlane[]; - // (undocumented) - _getCorners(bounds: number[]): number[][]; - // (undocumented) - getCurrentImageIdIndex(): number; - // (undocumented) - getDefaultActor(): ActorEntry; - // (undocumented) - getDisplayArea(): DisplayArea | undefined; - // (undocumented) - _getEdges(bounds: number[]): [number[], number[]][]; - // (undocumented) - _getFocalPointForResetCamera(centeredFocalPoint: Point3, previousCamera: ICamera, { resetPan, resetToCenter }: { - resetPan?: boolean; - resetToCenter?: boolean; - }): Point3; - // (undocumented) - getFrameOfReferenceUID: () => string; - // (undocumented) - getImageActor(volumeId?: string): ImageActor | null; - // (undocumented) - getImageData(): any; - // (undocumented) - getNumberOfSlices: () => number; - // (undocumented) - getPan(initialCamera?: ICamera): Point2; - // (undocumented) - getProperties: () => ViewportProperties; - // (undocumented) - getRenderer(): vtkRenderer; - // (undocumented) - getRenderingEngine(): IRenderingEngine; - // (undocumented) - getRotation: () => number; - // (undocumented) - getSliceIndex(): number; - // (undocumented) - getSliceViewInfo(): { - width: number; - height: number; - sliceIndex: number; - slicePlane: number; - sliceToIndexMatrix: mat4; - indexToSliceMatrix: mat4; - }; - // (undocumented) - getViewPresentation(viewPresSel?: ViewPresentationSelector): ViewPresentation; - // (undocumented) - getViewReference(viewRefSpecifier?: ViewReferenceSpecifier): ViewReference; - // (undocumented) - getViewReferenceId(_specifier?: ViewReferenceSpecifier): string; - // (undocumented) - protected getVtkActiveCamera(): vtkCamera | vtkSlabCamera; - // (undocumented) - getWidget: (id: any) => any; - // (undocumented) - getWidgets: () => any[]; - // (undocumented) - getZoom(compareCamera?: ICamera): number; - // (undocumented) - protected hasPixelSpacing: boolean; - // (undocumented) - readonly id: string; - // (undocumented) - protected initialCamera: ICamera; - // (undocumented) - protected insetImageMultiplier: number; - // (undocumented) - isDisabled: boolean; - // (undocumented) - _isInBounds(point: Point3, bounds: number[]): boolean; - // (undocumented) - isReferenceViewable(viewRef: ViewReference, options?: ReferenceCompatibleOptions): boolean; - // (undocumented) - options: ViewportInputOptions; - // (undocumented) - _removeActor(actorUID: string): void; - // (undocumented) - removeActors(actorUIDs: string[]): void; - // (undocumented) - removeAllActors(): void; - // (undocumented) - removeWidgets: () => void; - // (undocumented) - render(): void; - // (undocumented) - readonly renderingEngineId: string; - // (undocumented) - reset(immediate?: boolean): void; - // (undocumented) - resetCamera(options?: { - resetPan?: boolean; - resetZoom?: boolean; - resetToCenter?: boolean; - storeAsInitialCamera?: boolean; - }): boolean; - // (undocumented) - protected resetCameraNoEvent(): void; - // (undocumented) - resize: () => void; - // (undocumented) - setActors(actors: ActorEntry[]): void; - // (undocumented) - setCamera(cameraInterface: ICamera, storeAsInitialCamera?: boolean): void; - // (undocumented) - protected setCameraNoEvent(camera: ICamera): void; - // (undocumented) - setDataIds(_imageIds: string[], _options?: DataSetOptions): void; - // (undocumented) - setDisplayArea(displayArea: DisplayArea, suppressEvents?: boolean): void; - // (undocumented) - protected setDisplayAreaFit(displayArea: DisplayArea): void; - // (undocumented) - protected setDisplayAreaScale(displayArea: DisplayArea): void; - // (undocumented) - protected setFitToCanvasCamera(camera: ICamera): void; - // (undocumented) - protected setInitialCamera(camera: ICamera): void; - // (undocumented) - protected setInterpolationType(_interpolationType: InterpolationType, _arg?: any): void; - // (undocumented) - setOptions(options: ViewportInputOptions, immediate?: boolean): void; - // (undocumented) - setOrientationOfClippingPlanes(vtkPlanes: vtkPlane[], slabThickness: number, viewPlaneNormal: Point3, focalPoint: Point3): void; - // (undocumented) - setPan(pan: Point2, storeAsInitialCamera?: boolean): void; - // (undocumented) - setRendered(): void; - // (undocumented) - protected setRotation: (_rotation: number) => void; - // (undocumented) - setViewPresentation(viewPres: ViewPresentation): void; - // (undocumented) - setViewReference(viewRef: ViewReference): void; - // (undocumented) - setZoom(value: number, storeAsInitialCamera?: boolean): void; - // (undocumented) - sHeight: number; - // (undocumented) - _suppressCameraModifiedEvents: boolean; - // (undocumented) - readonly suppressEvents: boolean; - // (undocumented) - sWidth: number; - // (undocumented) - sx: number; - // (undocumented) - sy: number; - // (undocumented) - static readonly TransferViewPresentation: ViewPresentationSelector; - // (undocumented) - triggerCameraModifiedEventIfNecessary(previousCamera: ICamera, updatedCamera: ICamera): void; - // (undocumented) - readonly type: ViewportType; - // (undocumented) - updateCameraClippingPlanesAndRange(): void; - // (undocumented) - protected updateClippingPlanesForActors(updatedCamera: ICamera): Promise; - // (undocumented) - updateRenderingPipeline: () => void; - // (undocumented) - static get useCustomRenderingPipeline(): boolean; - // (undocumented) - viewportStatus: ViewportStatus; - // (undocumented) - worldToCanvas: (worldPos: Point3) => Point2; -} - -// @public (undocumented) -interface ViewportInput { - // (undocumented) - canvas: HTMLCanvasElement; - // (undocumented) - defaultOptions: ViewportInputOptions; - // (undocumented) - element: HTMLDivElement; - // (undocumented) - id: string; - // (undocumented) - renderingEngineId: string; - // (undocumented) - sHeight: number; - // (undocumented) - sWidth: number; - // (undocumented) - sx: number; - // (undocumented) - sy: number; - // (undocumented) - type: ViewportType; -} - -// @public (undocumented) -interface ViewportInputOptions { - // (undocumented) - background?: RGB; - // (undocumented) - displayArea?: DisplayArea; - // (undocumented) - orientation?: OrientationAxis | OrientationVectors; - // (undocumented) - parallelProjection?: boolean; - // (undocumented) - suppressEvents?: boolean; -} - -// @public (undocumented) -interface ViewportPreset { - // (undocumented) - ambient: string; - // (undocumented) - colorTransfer: string; - // (undocumented) - diffuse: string; - // (undocumented) - gradientOpacity: string; - // (undocumented) - interpolation: string; - // (undocumented) - name: string; - // (undocumented) - scalarOpacity: string; - // (undocumented) - shade: string; - // (undocumented) - specular: string; - // (undocumented) - specularPower: string; -} - -// @public (undocumented) -interface ViewportProperties { - // (undocumented) - colormap?: ColormapPublic; - // (undocumented) - interpolationType?: InterpolationType; - // (undocumented) - invert?: boolean; - // (undocumented) - preset?: string; - // (undocumented) - VOILUTFunction?: VOILUTFunctionType; - // (undocumented) - voiRange?: VOIRange; -} - -// @public (undocumented) -enum ViewportStatus { - // (undocumented) - LOADING = "loading", - // (undocumented) - NO_DATA = "noData", - // (undocumented) - PRE_RENDER = "preRender", - // (undocumented) - RENDERED = "rendered", - // (undocumented) - RESIZE = "resize" -} - -// @public (undocumented) -enum ViewportType { - // (undocumented) - ORTHOGRAPHIC = "orthographic", - // (undocumented) - PERSPECTIVE = "perspective", - // (undocumented) - STACK = "stack", - // (undocumented) - VIDEO = "video", - // (undocumented) - VOLUME_3D = "volume3d", - // (undocumented) - WHOLE_SLIDE = "wholeSlide" -} - -// @public (undocumented) -interface ViewPresentation { - // (undocumented) - displayArea?: DisplayArea; - // (undocumented) - flipHorizontal?: boolean; - // (undocumented) - flipVertical?: boolean; - // (undocumented) - pan?: Point2; - // (undocumented) - rotation?: number; - // (undocumented) - slabThickness?: number; - // (undocumented) - zoom?: number; -} - -// @public (undocumented) -interface ViewPresentationSelector { - // (undocumented) - displayArea?: boolean; - // (undocumented) - flipHorizontal?: boolean; - // (undocumented) - flipVertical?: boolean; - // (undocumented) - paletteLut?: boolean; - // (undocumented) - pan?: boolean; - // (undocumented) - rotation?: boolean; - // (undocumented) - slabThickness?: number; - // (undocumented) - windowLevel?: boolean; - // (undocumented) - zoom?: boolean; -} - -// @public (undocumented) -type ViewReference = { - FrameOfReferenceUID?: string; - referencedImageId?: string; - referencedImageURI?: string; - multiSliceReference?: ReferencedImageRange; - cameraFocalPoint?: Point3; - viewPlaneNormal?: Point3; - viewUp?: Point3; - sliceIndex?: number; - volumeId?: string; - bounds?: BoundsLPS; -}; - -// @public (undocumented) -type ViewReferenceSpecifier = { - sliceIndex?: number; - rangeEndSliceIndex?: number; - frameNumber?: number; - forFrameOfReference?: boolean; - points?: Point3[]; - volumeId?: string; -}; - -// @public (undocumented) -interface VOI { - // (undocumented) - windowCenter: number; - // (undocumented) - windowWidth: number; -} - -// @public (undocumented) -enum VOILUTFunctionType { - // (undocumented) - LINEAR = "LINEAR", - // (undocumented) - LINEAR_EXACT = "LINEAR_EXACT", - // (undocumented) - SAMPLED_SIGMOID = "SIGMOID" -} - -// @public (undocumented) -type VoiModifiedEvent = CustomEvent_2; - -// @public (undocumented) -interface VoiModifiedEventDetail { - // (undocumented) - colormap?: ColormapPublic; - // (undocumented) - invert?: boolean; - // (undocumented) - invertStateChanged?: boolean; - // (undocumented) - range: VOIRange; - // (undocumented) - viewportId: string; - // (undocumented) - VOILUTFunction?: VOILUTFunctionType; - // (undocumented) - volumeId?: string; -} - -// @public (undocumented) -interface VOIRange { - // (undocumented) - lower: number; - // (undocumented) - upper: number; -} - -// @public (undocumented) -type VolumeActor = vtkVolume; - -// @public (undocumented) -type VolumeCacheVolumeAddedEvent = CustomEvent_2; - -// @public (undocumented) -interface VolumeCacheVolumeAddedEventDetail { - // (undocumented) - volume: ICachedVolume; -} - -// @public (undocumented) -type VolumeCacheVolumeRemovedEvent = CustomEvent_2; - -// @public (undocumented) -interface VolumeCacheVolumeRemovedEventDetail { - // (undocumented) - volumeId: string; -} - -// @public (undocumented) -type VolumeInputCallback = (params: { - volumeActor: VolumeActor; - volumeId: string; -}) => unknown; - -// @public (undocumented) -type VolumeLoadedEvent = CustomEvent_2; - -// @public (undocumented) -interface VolumeLoadedEventDetail { - // (undocumented) - volume: IImageVolume; -} - -// @public (undocumented) -type VolumeLoadedFailedEvent = CustomEvent_2; - -// @public (undocumented) -interface VolumeLoadedFailedEventDetail { - // (undocumented) - error: unknown; - // (undocumented) - volumeId: string; -} - -declare namespace volumeLoader { - export { - loadVolume, - createAndCacheVolume, - createAndCacheDerivedVolume, - createAndCacheVolumeFromImages, - createAndCacheVolumeFromImagesSync, - createLocalVolume, - registerVolumeLoader, - getVolumeLoaderSchemes, - registerUnknownVolumeLoader, - getUnknownVolumeLoaderSchema, - createAndCacheDerivedLabelmapVolume, - createLocalLabelmapVolume, - LocalVolumeOptions - } -} -export { volumeLoader } - -// @public (undocumented) -type VolumeLoaderFn = (volumeId: string, options?: Record) => { - promise: Promise; - cancelFn?: () => void | undefined; - decache?: () => void | undefined; -}; - -// @public (undocumented) -type VolumeNewImageEvent = CustomEvent_2; - -// @public (undocumented) -interface VolumeNewImageEventDetail { - // (undocumented) - imageIndex: number; - // (undocumented) - numberOfSlices: number; - // (undocumented) - renderingEngineId: string; - // (undocumented) - viewportId: string; -} - -// @public (undocumented) -interface VolumeProps { - // (undocumented) - additionalDetails?: Record; - // (undocumented) - dataType: PixelDataTypedArrayString; - // (undocumented) - dimensions: Point3; - // (undocumented) - direction: Mat3; - // (undocumented) - imageData?: vtkImageData; - // (undocumented) - metadata: Metadata; - // (undocumented) - numberOfComponents?: number; - // (undocumented) - origin: Point3; - // (undocumented) - referencedVolumeId?: string; - // (undocumented) - scalarData?: PixelDataTypedArray | PixelDataTypedArray[]; - // (undocumented) - scaling?: { - PT?: { - SUVlbmFactor?: number; - SUVbsaFactor?: number; - suvbwToSuvlbm?: number; - suvbwToSuvbsa?: number; - }; - }; - // (undocumented) - sizeInBytes?: number; - // (undocumented) - spacing: Point3; - // (undocumented) - volumeId: string; - // (undocumented) - voxelManager?: IVoxelManager | IVoxelManager; -} - -// @public (undocumented) -type VolumeScrollOutOfBoundsEvent = CustomEvent_2; - -// @public (undocumented) -type VolumeScrollOutOfBoundsEventDetail = { - volumeId: string; - viewport: IVolumeViewport; - desiredStepIndex: number; - currentStepIndex: number; - delta: number; - numScrollSteps: number; - currentImageId: string; -}; - -// @public (undocumented) -export class VolumeViewport extends BaseVolumeViewport { - constructor(props: ViewportInput); - // (undocumented) - addVolumes(volumeInputArray: IVolumeInput[], immediate?: boolean, suppressEvents?: boolean): Promise; - // (undocumented) - getBlendMode(filterActorUIDs?: string[]): BlendModes; - // (undocumented) - getCurrentImageId: () => string | undefined; - // (undocumented) - getCurrentImageIdIndex: (volumeId?: string, useSlabThickness?: boolean) => number; - // (undocumented) - getCurrentSlicePixelData(): PixelDataTypedArray; - // (undocumented) - getNumberOfSlices: () => number; - // (undocumented) - getSliceIndex: () => number; - // (undocumented) - getSlicePlaneCoordinates: () => { - sliceIndex: number; - point: Point3; - }[]; - // (undocumented) - getSlicesClippingPlanes(): { - sliceIndex: number; - planes: { - normal: Point3; - origin: Point3; - }[]; - }[]; - // (undocumented) - getSliceViewInfo(): { - sliceIndex: number; - slicePlane: number; - width: number; - height: number; - sliceToIndexMatrix: mat4; - indexToSliceMatrix: mat4; - }; - // (undocumented) - getViewReference(viewRefSpecifier?: ViewReferenceSpecifier): ViewReference; - // (undocumented) - jumpToWorld(worldPos: Point3): boolean; - // (undocumented) - resetCamera(options?: any): boolean; - // (undocumented) - resetCameraForResize: () => boolean; - // (undocumented) - resetProperties(volumeId?: string): void; - // (undocumented) - resetSlabThickness(): void; - // (undocumented) - setBlendMode(blendMode: BlendModes, filterActorUIDs?: any[], immediate?: boolean): void; - // (undocumented) - protected setCameraClippingRange(): void; - // (undocumented) - setOrientation(orientation: OrientationAxis | OrientationVectors, immediate?: boolean): void; - // (undocumented) - setSlabThickness(slabThickness: number, filterActorUIDs?: any[]): void; - // (undocumented) - setVolumes(volumeInputArray: IVolumeInput[], immediate?: boolean, suppressEvents?: boolean): Promise; -} - -// @public (undocumented) -export class VolumeViewport3D extends BaseVolumeViewport { - constructor(props: ViewportInput); - // (undocumented) - getCurrentImageId: () => string; - // (undocumented) - getCurrentImageIdIndex: () => number; - // (undocumented) - getNumberOfSlices: () => number; - // (undocumented) - getRotation: () => number; - // (undocumented) - getSliceIndex(): number; - // (undocumented) - resetCamera({ resetPan, resetZoom, resetToCenter, }?: { - resetPan?: boolean; - resetZoom?: boolean; - resetToCenter?: boolean; - }): boolean; - // (undocumented) - resetCameraForResize: () => boolean; - // (undocumented) - resetProperties(volumeId?: string): void; - // (undocumented) - resetSlabThickness(): void; - // (undocumented) - setBlendMode(blendMode: BlendModes, filterActorUIDs?: string[], immediate?: boolean): void; - // (undocumented) - setCamera(props: any): void; - // (undocumented) - protected setCameraClippingRange(): void; - // (undocumented) - setSlabThickness(slabThickness: number, filterActorUIDs?: string[]): void; -} - -// @public (undocumented) -type VolumeViewportProperties = ViewportProperties & { - preset?: string; - slabThickness?: number; - orientation?: OrientationAxis; -}; - -// @public (undocumented) -class VoxelManager { - constructor(dimensions: any, options: { - _get: (index: number) => T; - _set?: (index: number, v: T) => boolean; - _getScalarData?: () => ArrayLike; - _id?: string; - _updateScalarData?: (scalarData: ArrayLike) => PixelDataTypedArray; - numberOfComponents?: number; - scalarData?: ArrayLike; - _getConstructor?: () => new (length: number) => PixelDataTypedArray; - }); - // (undocumented) - static addBounds(bounds: BoundsIJK, point: Point3): void; - // (undocumented) - static addInstanceToImage(image: IImage): void; - // (undocumented) - addPoint(point: Point3 | number): void; - // (undocumented) - get bytePerVoxel(): number; - // (undocumented) - clear(): void; - // (undocumented) - static createHistoryVoxelManager({ sourceVoxelManager, }: { - sourceVoxelManager: VoxelManager; - }): VoxelManager; - // (undocumented) - static createImageVolumeVoxelManager({ dimensions, imageIds, numberOfComponents, }: { - dimensions: Point3; - imageIds: string[]; - numberOfComponents: number; - }): IVoxelManager | IVoxelManager; - // (undocumented) - static createImageVoxelManager({ width, height, scalarData, numberOfComponents, }: { - width: number; - height: number; - scalarData: PixelDataTypedArray; - numberOfComponents?: number; - }): IVoxelManager | IVoxelManager; - // (undocumented) - static createLazyVoxelManager({ dimensions, planeFactory, }: { - dimensions: Point3; - planeFactory: (width: number, height: number) => T; - }): VoxelManager; - // (undocumented) - static createMapVoxelManager({ dimension, }: { - dimension: Point3; - }): IVoxelManager; - // (undocumented) - static createRLEHistoryVoxelManager(sourceVoxelManager: VoxelManager): VoxelManager; - // (undocumented) - static createRLEImageVoxelManager({ dimensions, }: { - dimensions: Point2; - }): VoxelManager; - // (undocumented) - static createRLEVolumeVoxelManager({ dimensions, }: { - dimensions: Point3; - }): VoxelManager; - // (undocumented) - static createScalarDynamicVolumeVoxelManager({ imageIdGroups, dimensions, dimensionGroupNumber, timePoint, numberOfComponents, }: { - imageIdGroups: string[][]; - dimensions: Point3; - dimensionGroupNumber?: number; - timePoint?: number; - numberOfComponents?: number; - }): IVoxelManager | IVoxelManager; - // (undocumented) - static createScalarVolumeVoxelManager({ dimensions, scalarData, numberOfComponents, }: { - dimensions: Point3; - scalarData: any; - numberOfComponents?: number; - }): IVoxelManager | IVoxelManager; - // (undocumented) - readonly dimensions: Point3; - // (undocumented) - forEach: (callback: (args: { - value: unknown; - index: number; - pointIJK: Point3; - pointLPS: Point3; - }) => void, options?: { - boundsIJK?: BoundsIJK; - isInObject?: (pointLPS: any, pointIJK: any) => boolean; - returnPoints?: boolean; - imageData?: vtkImageData | CPUImageData; - }) => void | any[]; - // (undocumented) - frameSize: number; - // (undocumented) - readonly _get: (index: number) => T; - // (undocumented) - getArrayOfModifiedSlices(): number[]; - // (undocumented) - getAtIJK: (i: any, j: any, k: any) => T; - // (undocumented) - getAtIJKPoint: ([i, j, k]: [any, any, any]) => T; - // (undocumented) - getAtIndex: (index: any) => T; - // (undocumented) - getBoundsIJK(): BoundsIJK; - // (undocumented) - getCompleteScalarDataArray?: () => ArrayLike; - // (undocumented) - getConstructor(): new (length: number) => PixelDataTypedArray; - // (undocumented) - readonly _getConstructor?: () => new (length: number) => PixelDataTypedArray; - // (undocumented) - getDefaultBounds(): BoundsIJK; - // (undocumented) - getMiddleSliceData: () => PixelDataTypedArray; - // (undocumented) - getMinMax(): { - min: any; - max: any; - }; - // (undocumented) - getPoints(): Point3[]; - // (undocumented) - getRange: () => [number, number]; - // (undocumented) - getScalarData(storeScalarData?: boolean): PixelDataTypedArray; - // (undocumented) - _getScalarData?: () => ArrayLike; - // (undocumented) - getScalarDataLength(): number; - // (undocumented) - _getScalarDataLength?: () => number; - // (undocumented) - getSliceData: ({ sliceIndex, slicePlane, }: { - sliceIndex: number; - slicePlane: number; - }) => PixelDataTypedArray; - // (undocumented) - _getSliceData: (args: { - sliceIndex: number; - slicePlane: number; - }) => PixelDataTypedArray; - // (undocumented) - readonly _id: string; - // (undocumented) - isInObject: (pointLPS: any, pointIJK: any) => boolean; - // (undocumented) - map: Map | IRLEVoxelMap; - // (undocumented) - modifiedSlices: Set; - // (undocumented) - readonly numberOfComponents: any; - // (undocumented) - points: Set; - // (undocumented) - resetModifiedSlices(): void; - // (undocumented) - rleForEach(callback: any, options?: any): void; - // (undocumented) - readonly _set: (index: number, v: T) => boolean; - // (undocumented) - setAtIJK: (i: number, j: number, k: number, v: any) => boolean; - // (undocumented) - setAtIJKPoint: ([i, j, k]: Point3, v: any) => void; - // (undocumented) - setAtIndex: (index: any, v: any) => boolean; - // (undocumented) - setCompleteScalarDataArray?: (scalarData: ArrayLike) => void; - // (undocumented) - setScalarData(newScalarData: PixelDataTypedArray): void; - // (undocumented) - get sizeInBytes(): number; - // (undocumented) - sourceVoxelManager: IVoxelManager; - // (undocumented) - static: any; - // (undocumented) - toIJK(index: number): Point3; - // (undocumented) - toIndex(ijk: Point3): number; - // (undocumented) - _updateScalarData?: (scalarData: ArrayLike) => PixelDataTypedArray; - // (undocumented) - width: number; -} - -// @public (undocumented) -enum VoxelManagerEnum { - // (undocumented) - RLE = "RLE", - // (undocumented) - Volume = "Volume" -} - -declare namespace windowLevel { - export { - toWindowLevel, - toLowHighRange - } -} - -// @public (undocumented) -function worldToImageCoords(imageId: string, worldCoords: Point3): Point2 | undefined; - -// @public (undocumented) -export class WSIViewport extends Viewport { - constructor(props: ViewportInput); - // (undocumented) - static addMiniNavigationOverlayCss(): void; - // (undocumented) - protected canvasToIndex: (canvasPos: Point2) => Point2; - // (undocumented) - canvasToWorld: (canvasPos: Point2) => Point3; - // (undocumented) - customRenderViewportToCanvas: () => void; - // (undocumented) - getCamera(): ICamera; - // (undocumented) - getCurrentImageId(): string; - // (undocumented) - getCurrentImageIdIndex(): number; - // (undocumented) - static getDicomMicroscopyViewer: () => Promise; - // (undocumented) - getFrameNumber(): number; - // (undocumented) - getFrameOfReferenceUID: () => string; - // (undocumented) - getImageData(): CPUIImageData; - // (undocumented) - getImageIds: () => Array; - // (undocumented) - getNumberOfSlices: () => number; - // (undocumented) - getProperties: () => WSIViewportProperties; - // (undocumented) - getRotation: () => number; - // (undocumented) - protected getScalarData(): any; - // (undocumented) - getSliceIndex(): number; - // (undocumented) - protected getTransform(): Transform; - // (undocumented) - getView(): any; - // (undocumented) - getViewReferenceId(): string; - // (undocumented) - getZoom(): any; - // (undocumented) - hasImageURI(imageURI: string): boolean; - // (undocumented) - protected imageIds: string[]; - // (undocumented) - protected indexToCanvas: (indexPos: Point2) => Point2; - // (undocumented) - protected map: any; - // (undocumented) - protected metadata: any; - // (undocumented) - protected metadataDicomweb: any; - // (undocumented) - modality: any; - // (undocumented) - postrender: () => void; - // (undocumented) - readonly renderingEngineId: string; - // (undocumented) - resetCamera: () => boolean; - // (undocumented) - resetProperties(): void; - // (undocumented) - resize: () => void; - // (undocumented) - scroll(delta: number): void; - // (undocumented) - setCamera(camera: ICamera): void; - // (undocumented) - setDataIds(imageIds: string[], options?: DataSetOptions & { - miniNavigationOverlay?: boolean; - webClient: unknown; - }): Promise; - // (undocumented) - setFrameNumber(frame: number): Promise; - // (undocumented) - setProperties(props: WSIViewportProperties): void; - // (undocumented) - setWSI(imageIds: string[], client: any): Promise; - // (undocumented) - setZoom(zoom: number): void; - // (undocumented) - readonly uid: any; - // (undocumented) - static get useCustomRenderingPipeline(): boolean; - // (undocumented) - worldToCanvas: (worldPos: Point3) => Point2; -} - -// @public (undocumented) -type WSIViewportProperties = ViewportProperties; - -// (No @packageDocumentation comment for this package) - -``` diff --git a/common/reviews/api/dicom-image-loader.api.md b/common/reviews/api/dicom-image-loader.api.md deleted file mode 100644 index 23c601c79b..0000000000 --- a/common/reviews/api/dicom-image-loader.api.md +++ /dev/null @@ -1,638 +0,0 @@ -## API Report File for "@cornerstonejs/dicom-image-loader" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import type { ByteArray } from 'dicom-parser'; -import { DataSet } from 'dicom-parser'; -import * as dicomParser from 'dicom-parser'; -import type { Element as Element_2 } from 'dicom-parser'; -import { ImageQualityStatus as ImageQualityStatus_2 } from 'packages/core/dist/esm/enums'; -import { mat4 } from 'gl-matrix'; -import { PromiseIterator } from 'packages/core/dist/esm/utilities/ProgressiveIterator'; -import type { Range as Range_2 } from '@kitware/vtk.js/types'; -import type vtkActor from '@kitware/vtk.js/Rendering/Core/Actor'; -import type { vtkCamera } from '@kitware/vtk.js/Rendering/Core/Camera'; -import { vtkImageData } from '@kitware/vtk.js/Common/DataModel/ImageData'; -import type vtkImageSlice from '@kitware/vtk.js/Rendering/Core/ImageSlice'; -import type { vtkObject } from '@kitware/vtk.js/interfaces'; -import type vtkOpenGLTexture from '@kitware/vtk.js/Rendering/OpenGL/Texture'; -import vtkPlane from '@kitware/vtk.js/Common/DataModel/Plane'; -import type vtkRenderer from '@kitware/vtk.js/Rendering/Core/Renderer'; -import type vtkVolume from '@kitware/vtk.js/Rendering/Core/Volume'; - -declare namespace constants { - export { - transferSyntaxes - } -} -export { constants } - -// @public (undocumented) -export function convertColorSpace(imageFrame: any, colorBuffer: any, useRGBA: any): void; - -// @public (undocumented) -export function (imageFrame: Types_2.IImageFrame, colorBuffer: ByteArray, useRGBA: boolean): void; - -// @public (undocumented) -export function (imageFrame: ByteArray, colorBuffer: ByteArray, useRGBA: boolean): void; - -// @public (undocumented) -export function (imageFrame: ByteArray, colorBuffer: ByteArray, useRGBA: boolean): void; - -// @public (undocumented) -export function (imageFrame: ByteArray, colorBuffer: ByteArray, useRGBA: boolean): void; - -// @public (undocumented) -export function (imageFrame: ByteArray, colorBuffer: ByteArray, useRGBA: boolean): void; - -// @public (undocumented) -const cornerstoneDICOMImageLoader: { - constants: typeof constants; - convertRGBColorByPixel: typeof convertRGBColorByPixel; - convertRGBColorByPlane: typeof convertRGBColorByPlane; - convertYBRFullByPixel: typeof convertYBRFullByPixel; - convertYBRFullByPlane: typeof convertYBRFullByPlane; - convertPALETTECOLOR: typeof convertPALETTECOLOR; - wadouri: { - metaData: { - getImagePixelModule: getImagePixelModule; - getLUTs: getLUTs; - getModalityLUTOutputPixelRepresentation: getModalityLUTOutputPixelRepresentation; - getNumberValues: getNumberValues; - metaDataProvider: metaDataProvider; - metadataForDataset: metadataForDataset; - }; - dataSetCacheManager: { - isLoaded: (uri: string) => boolean; - load: (uri: string, loadRequest: Types.LoadRequestFunction, imageId: string) => CornerstoneWadoLoaderCachedPromise; - unload: (uri: string) => void; - getInfo: getInfo; - purge: () => void; - get: (uri: string) => DataSet; - update: (uri: string, dataSet: DataSet) => void; - }; - fileManager: { - add: (file: Blob) => string; - get: (index: number) => Blob; - remove: (index: number) => void; - purge: () => void; - }; - getEncapsulatedImageFrame: getEncapsulatedImageFrame; - getUncompressedImageFrame: getUncompressedImageFrame; - loadFileRequest: loadFileRequest; - loadImageFromPromise: loadImageFromPromise; - getLoaderForScheme: getLoaderForScheme; - getPixelData: getPixelData_2; - loadImage: loadImage; - parseImageId: parseImageId; - unpackBinaryFrame: unpackBinaryFrame; - register: default_2; - }; - wadors: { - metaData: { - getNumberString: getNumberString; - getNumberValue: getNumberValue; - getNumberValues: getNumberValues_2; - getValue: getValue_2; - metaDataProvider: metaDataProvider_2; - }; - findIndexOfString: findIndexOfString; - getPixelData: typeof getPixelData; - loadImage: loadImage_2; - metaDataManager: { - add: (imageId: string, metadata: Types.WADORSMetaData) => void; - get: (imageId: string) => Types.WADORSMetaData; - remove: (imageId: any) => void; - purge: () => void; - }; - register: default_3; - }; - init: typeof init; - convertColorSpace: typeof convertColorSpace; - createImage: typeof createImage; - decodeJPEGBaseline8BitColor: typeof decodeJPEGBaseline8BitColor; - getImageFrame: typeof getImageFrame; - getPixelData: typeof getPixelData; - getMinMax: typeof getMinMax; - isColorImage: typeof isColorImage; - isJPEGBaseline8BitColor: typeof isJPEGBaseline8BitColor; - internal: { - xhrRequest: xhrRequest; - streamRequest: streamRequest; - setOptions: setOptions; - getOptions: getOptions; - }; - decodeImageFrame: typeof decodeImageFrame; -}; -export default cornerstoneDICOMImageLoader; - -// @public (undocumented) -export function createImage(imageId: string, pixelData: ByteArray, transferSyntax: string, options?: DICOMLoaderImageOptions): Promise; - -// @public (undocumented) -export function decodeImageFrame(imageFrame: any, transferSyntax: any, pixelData: any, decodeConfig: any, options: any, callbackFn: any): Promise; - -// @public (undocumented) -export function decodeJPEGBaseline8BitColor(imageFrame: Types_2.IImageFrame, pixelData: ByteArray, canvas: HTMLCanvasElement): Promise; - -// @public (undocumented) -interface DICOMLoaderDataSetWithFetchMore extends DataSet { - // (undocumented) - fetchMore?: (fetchOptions: { - uri: string; - imageId: string; - fetchedLength: number; - lengthToFetch: number; - }) => Promise; -} - -// @public (undocumented) -interface DICOMLoaderIImage extends Types_2.IImage { - // (undocumented) - data?: DataSet; - // (undocumented) - decodeTimeInMS: number; - // (undocumented) - floatPixelData?: ByteArray | Float32Array; - // (undocumented) - imageFrame?: Types_2.IImageFrame; - // (undocumented) - loadTimeInMS?: number; - // (undocumented) - totalTimeInMS?: number; - // (undocumented) - transferSyntaxUID?: string; -} - -// @public (undocumented) -interface DICOMLoaderImageOptions { - // (undocumented) - allowFloatRendering?: boolean; - // (undocumented) - decodeLevel?: number; - // (undocumented) - loader?: LoadRequestFunction; - // (undocumented) - preScale?: { - enabled: boolean; - scalingParameters?: Types_2.ScalingParameters; - }; - // (undocumented) - retrieveOptions?: Types_2.RetrieveOptions; - // (undocumented) - streamingData?: StreamingData; - // (undocumented) - targetBuffer?: { - type: Types_2.PixelDataTypedArrayString; - arrayBuffer: ArrayBufferLike; - length: number; - offset: number; - rows?: number; - columns?: number; - }; - // (undocumented) - useRGBA?: boolean; -} - -// @public (undocumented) -export function getImageFrame(imageId: string): Types_2.IImageFrame; - -// @public (undocumented) -export function getMinMax(storedPixelData: Types_2.PixelDataTypedArray): { - min: number; - max: number; -}; - -// @public (undocumented) -export function getPixelData(uri: string, imageId: string, mediaType?: string, options?: CornerstoneWadoRsLoaderOptions): PromiseIterator | LoaderXhrRequestPromise< { -contentType: string; -pixelData: Uint8Array; -imageQualityStatus: ImageQualityStatus_2; -percentComplete: number; -}> | Promise<{ - contentType: string; - imageQualityStatus: ImageQualityStatus_2; - pixelData: Uint8Array; - extractDone?: undefined; - tokenIndex?: undefined; - responseHeaders?: undefined; - boundary?: undefined; - multipartContentType?: undefined; -} | { - contentType: any; - extractDone: boolean; - tokenIndex: any; - responseHeaders: any; - boundary: any; - multipartContentType: any; - pixelData: any; - imageQualityStatus?: undefined; -}>; - -// @public (undocumented) -export function init(options?: LoaderOptions): void; - -// @public (undocumented) -export const internal: { - xhrRequest: typeof xhrRequest; - streamRequest: typeof streamRequest; - setOptions: typeof setOptions; - getOptions: typeof getOptions; -}; - -// @public (undocumented) -export function (photoMetricInterpretation: string): boolean; - -// @public (undocumented) -export function isJPEGBaseline8BitColor(imageFrame: Types_2.IImageFrame, transferSyntax: string): boolean; - -// @public (undocumented) -interface LoaderDecodeOptions { -} - -// @public (undocumented) -interface LoaderOptions { - // (undocumented) - beforeProcessing?: (xhr: XMLHttpRequest) => Promise; - // (undocumented) - beforeSend?: (xhr: XMLHttpRequest, imageId: string, defaultHeaders: Record, params: LoaderXhrRequestParams) => Record | void; - // (undocumented) - decodeConfig?: LoaderDecodeOptions; - // (undocumented) - errorInterceptor?: (error: LoaderXhrRequestError) => void; - // (undocumented) - imageCreated?: (imageObject: unknown) => void; - // (undocumented) - maxWebWorkers?: number; - // (undocumented) - onloadend?: (event: ProgressEvent, params: unknown) => void; - // (undocumented) - onloadstart?: (event: ProgressEvent, params: unknown) => void; - // (undocumented) - onprogress?: (event: ProgressEvent, params: unknown) => void; - // (undocumented) - onreadystatechange?: (event: Event, params: unknown) => void; - // (undocumented) - open?: (xhr: XMLHttpRequest, url: string, defaultHeaders: Record, params: LoaderXhrRequestParams) => void; - // (undocumented) - strict?: boolean; -} - -// @public (undocumented) -interface LoaderXhrRequestError extends Error { - // (undocumented) - request: XMLHttpRequest; - // (undocumented) - response: unknown; - // (undocumented) - status: number; -} - -// @public (undocumented) -interface LoaderXhrRequestParams { - // (undocumented) - deferred?: { - resolve: (value: ArrayBuffer | PromiseLike) => void; - reject: (reason: any) => void; - }; - // (undocumented) - imageId?: string; - // (undocumented) - url?: string; -} - -// @public (undocumented) -interface LoaderXhrRequestPromise extends Promise { - // (undocumented) - xhr?: XMLHttpRequest; -} - -// @public (undocumented) -type LoadRequestFunction = (url: string, imageId: string, ...args: unknown[]) => Promise; - -// @public (undocumented) -interface LutType { - // (undocumented) - firstValueMapped: number; - // (undocumented) - id: string; - // (undocumented) - lut: number[]; - // (undocumented) - numBitsPerEntry: number; -} - -// @public (undocumented) -namespace transferSyntaxes { - let // (undocumented) - IMPLICIT_VR_LITTLE_ENDIAN: string; - let // (undocumented) - EXPLICIT_VR_LITTLE_ENDIAN: string; - let // (undocumented) - DEFLATED_EXPLICIT_VR_LITTLE_ENDIAN: string; - let // (undocumented) - EXPLICIT_VR_BIG_ENDIAN: string; - let // (undocumented) - JPEG_BASELINE_PROCESS_1: string; - let // (undocumented) - JPEG_EXTENDED_PROCESS_2_4: string; - let // (undocumented) - JPEG_EXTENDED_PROCESSES_3_5: string; - let // (undocumented) - JPEG_SPECTRAL_SELECTION_NONHIERARCHICAL_PROCESSES_6_8: string; - let // (undocumented) - JPEG_SPECTRAL_SELECTION_NONHIERARCHICAL_PROCESSES_7_9: string; - let // (undocumented) - JPEG_FULL_PROGRESSION_NONHIERARCHICAL_PROCESSES_10_12: string; - let // (undocumented) - JPEG_FULL_PROGRESSION_NONHIERARCHICAL_PROCESSES_11_13: string; - let // (undocumented) - JPEG_LOSSLESS_NONHIERARCHICAL_PROCESS_14: string; - let // (undocumented) - JPEG_LOSSLESS_NONHIERARCHICAL_PROCESS_15: string; - let // (undocumented) - JPEG_EXTENDED_HIERARCHICAL_PROCESSES_16_18: string; - let // (undocumented) - JPEG_EXTENDED_HIERARCHICAL_PROCESSES_17_19: string; - let // (undocumented) - JPEG_SPECTRAL_SELECTION_HIERARCHICAL_PROCESSES_20_22: string; - let // (undocumented) - JPEG_SPECTRAL_SELECTION_HIERARCHICAL_PROCESSES_21_23: string; - let // (undocumented) - JPEG_FULL_PROGRESSION_HIERARCHICAL_PROCESSES_24_26: string; - let // (undocumented) - JPEG_FULL_PROGRESSION_HIERARCHICAL_PROCESSES_25_27: string; - let // (undocumented) - JPEG_LOSSLESS_NONHIERARCHICAL_PROCESS_28: string; - let // (undocumented) - JPEG_LOSSLESS_NONHIERARCHICAL_PROCESS_29: string; - let // (undocumented) - JPEG_LOSSLESS_NONHIERARCHICAL_FIRST_ORDER_PREDICTION_PROCESS_14: string; - let // (undocumented) - JPEG_LS_LOSSLESS_IMAGE_COMPRESSION: string; - let // (undocumented) - JPEG_LS_LOSSY_NEAR_LOSSLESS_IMAGE_COMPRESSION: string; - let // (undocumented) - JPEG_2000_IMAGE_COMPRESSION_LOSSLESS_ONLY: string; - let // (undocumented) - JPEG_2000_IMAGE_COMPRESSION: string; - let // (undocumented) - JPEG_2000_PART_2_MULTICOMPONENT_IMAGE_COMPRESSION_LOSSLESS_ONLY: string; - let // (undocumented) - JPEG_2000_PART_2_MULTICOMPONENT_IMAGE_COMPRESSION: string; - let // (undocumented) - JPIP_REFERENCED: string; - let // (undocumented) - JPIP_REFERENCED_DEFLATE: string; - let // (undocumented) - MPEG2_MAIN_PROFILE_MAIN_LEVEL: string; - let // (undocumented) - MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_1: string; - let // (undocumented) - MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE_LEVEL_4_1: string; - let // (undocumented) - MPEG4_AVC_H264_HIGH_PROFILE_FOR_2D_VIDEO: string; - let // (undocumented) - MPEG4_AVC_H264_HIGH_PROFILE_FOR_3D_VIDEO: string; - let // (undocumented) - JPIP_LOSSLESS: string; - let // (undocumented) - JPIP_PART2_MULTICOMPONENT_IMAGE_COMPRESSION: string; - let // (undocumented) - RFC_2557_MIME_ENCAPSULATION: string; - let // (undocumented) - JPEG_XR_IMAGE_COMPRESSION: string; - let // (undocumented) - JPEG_2000_IMAGE_COMPRESSION_LOSSLESS_ONLY_RETIRED: string; - let // (undocumented) - JPEG_2000_IMAGE_COMPRESSION_RETIRED: string; - let // (undocumented) - JPEG_2000_PART_2_MULTICOMPONENT_IMAGE_COMPRESSION_LOSSLESS_ONLY_RETIRED: string; - let // (undocumented) - JPEG_2000_PART_2_MULTICOMPONENT_IMAGE_COMPRESSION_RETIRED: string; -} - -declare namespace Types { - export { - LoaderDecodeOptions, - LoaderOptions, - WADORSMetaData, - WADORSMetaDataElement, - LoaderXhrRequestError, - LoaderXhrRequestParams, - LoaderXhrRequestPromise, - DICOMLoaderIImage, - DICOMLoaderImageOptions, - LutType, - WebWorkerOptions, - WebWorkerDecodeConfig, - WebWorkerTaskOptions, - WorkerTaskTypes, - WorkerTask, - WebWorkerDecodeTaskData, - WebWorkerDecodeData, - WebWorkerLoadData, - WebWorkerInitializeData, - WebWorkerData, - WebWorkerResponse, - WebWorkerDeferredObject, - LoadRequestFunction, - DICOMLoaderDataSetWithFetchMore - } -} -export { Types } - -// @public (undocumented) -export const wadors: { - metaData: { - getNumberString: typeof getNumberString; - getNumberValue: typeof getNumberValue; - getNumberValues: typeof getNumberValues_2; - getValue: typeof getValue_2; - metaDataProvider: typeof metaDataProvider_2; - }; - findIndexOfString: typeof findIndexOfString; - getPixelData: typeof getPixelData; - loadImage: typeof loadImage_2; - metaDataManager: { - add: (imageId: string, metadata: WADORSMetaData) => void; - get: (imageId: string) => WADORSMetaData; - remove: (imageId: any) => void; - purge: () => void; - }; - register: typeof default_3; -}; - -// @public (undocumented) -type WADORSMetaData = Record; - -// @public (undocumented) -interface WADORSMetaDataElement { - // (undocumented) - Value: ValueType; -} - -// @public (undocumented) -export const wadouri: { - metaData: { - getImagePixelModule: typeof getImagePixelModule; - getLUTs: typeof getLUTs; - getModalityLUTOutputPixelRepresentation: typeof getModalityLUTOutputPixelRepresentation; - getNumberValues: typeof getNumberValues; - metaDataProvider: typeof metaDataProvider; - metadataForDataset: typeof metadataForDataset; - }; - dataSetCacheManager: { - isLoaded: (uri: string) => boolean; - load: (uri: string, loadRequest: LoadRequestFunction, imageId: string) => CornerstoneWadoLoaderCachedPromise; - unload: (uri: string) => void; - getInfo: getInfo; - purge: () => void; - get: (uri: string) => DataSet; - update: (uri: string, dataSet: DataSet) => void; - }; - fileManager: { - add: (file: Blob) => string; - get: (index: number) => Blob; - remove: (index: number) => void; - purge: () => void; - }; - getEncapsulatedImageFrame: typeof getEncapsulatedImageFrame; - getUncompressedImageFrame: typeof getUncompressedImageFrame; - loadFileRequest: typeof loadFileRequest; - loadImageFromPromise: typeof loadImageFromPromise; - getLoaderForScheme: typeof getLoaderForScheme; - getPixelData: typeof getPixelData_2; - loadImage: typeof loadImage; - parseImageId: typeof parseImageId; - unpackBinaryFrame: typeof unpackBinaryFrame; - register: typeof default_2; -}; - -// @public (undocumented) -type WebWorkerData = WebWorkerDecodeData | WebWorkerLoadData | WebWorkerInitializeData; - -// @public (undocumented) -interface WebWorkerDecodeConfig { - // (undocumented) - initializeCodecsOnStartup: boolean; - // (undocumented) - strict?: boolean; -} - -// @public (undocumented) -interface WebWorkerDecodeData { - // (undocumented) - data: WebWorkerDecodeTaskData; - // (undocumented) - taskType: 'decodeTask'; - // (undocumented) - workerIndex: number; -} - -// @public (undocumented) -interface WebWorkerDecodeTaskData { - // (undocumented) - decodeConfig: LoaderDecodeOptions; - // (undocumented) - imageFrame: Types_2.IImageFrame; - // (undocumented) - options: LoaderOptions; - // (undocumented) - pixelData: ByteArray; - // (undocumented) - transferSyntax: string; -} - -// @public (undocumented) -interface WebWorkerDeferredObject { - // (undocumented) - reject: (err: any) => void; - // (undocumented) - resolve: (arg: T | PromiseLike) => void; -} - -// @public (undocumented) -interface WebWorkerInitializeData { - // (undocumented) - config: WebWorkerOptions; - // (undocumented) - taskType: 'initialize'; - // (undocumented) - workerIndex: number; -} - -// @public (undocumented) -interface WebWorkerLoadData { - // (undocumented) - config: WebWorkerOptions; - // (undocumented) - sourcePath: string; - // (undocumented) - taskType: 'loadWebWorkerTask'; - // (undocumented) - workerIndex: number; -} - -// @public (undocumented) -interface WebWorkerOptions { - // (undocumented) - maxWebWorkers?: number; - // (undocumented) - startWebWorkersOnDemand?: boolean; - // (undocumented) - taskConfiguration?: WebWorkerTaskOptions; - // (undocumented) - webWorkerTaskPaths?: string[]; -} - -// @public (undocumented) -interface WebWorkerResponse { - // (undocumented) - data?: Types_2.IImageFrame; - // (undocumented) - result: string | Types_2.IImageFrame; - // (undocumented) - status: 'failed' | 'success'; - // (undocumented) - taskType: WorkerTaskTypes; - // (undocumented) - workerIndex: number; -} - -// @public (undocumented) -interface WebWorkerTaskOptions { - // (undocumented) - decodeTask: WebWorkerDecodeConfig; -} - -// @public (undocumented) -interface WorkerTask { - // (undocumented) - added: number; - // (undocumented) - data: WebWorkerDecodeTaskData; - // (undocumented) - deferred: WebWorkerDeferredObject; - // (undocumented) - priority: number; - // (undocumented) - start?: number; - // (undocumented) - status: 'ready' | 'success' | 'failed'; - // (undocumented) - taskId: number; - // (undocumented) - taskType: WorkerTaskTypes; - // (undocumented) - transferList: Transferable[]; -} - -// @public (undocumented) -type WorkerTaskTypes = 'decodeTask' | 'loadWebWorkerTask' | 'initialize'; - -// (No @packageDocumentation comment for this package) - -``` diff --git a/common/reviews/api/nifti-volume-loader.api.md b/common/reviews/api/nifti-volume-loader.api.md deleted file mode 100644 index a705125f62..0000000000 --- a/common/reviews/api/nifti-volume-loader.api.md +++ /dev/null @@ -1,68 +0,0 @@ -## API Report File for "@cornerstonejs/nifti-volume-loader" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { mat4 } from 'gl-matrix'; -import type { Range as Range_2 } from '@kitware/vtk.js/types'; -import type vtkActor from '@kitware/vtk.js/Rendering/Core/Actor'; -import type { vtkCamera } from '@kitware/vtk.js/Rendering/Core/Camera'; -import { vtkImageData } from '@kitware/vtk.js/Common/DataModel/ImageData'; -import type vtkImageSlice from '@kitware/vtk.js/Rendering/Core/ImageSlice'; -import type { vtkObject } from '@kitware/vtk.js/interfaces'; -import type vtkOpenGLTexture from '@kitware/vtk.js/Rendering/OpenGL/Texture'; -import vtkPlane from '@kitware/vtk.js/Common/DataModel/Plane'; -import type vtkRenderer from '@kitware/vtk.js/Rendering/Core/Renderer'; -import type vtkVolume from '@kitware/vtk.js/Rendering/Core/Volume'; - -// @public (undocumented) -export function cornerstoneNiftiImageLoader(imageId: string): Types.IImageLoadObject; - -// @public (undocumented) -export function createNiftiImageIdsAndCacheMetadata({ url }: { - url: any; -}): Promise; - -declare namespace Enums { - export { - Events - } -} -export { Enums } - -// @public (undocumented) -enum Events { - // (undocumented) - NIFTI_VOLUME_LOADED = "CORNERSTONE_NIFTI_VOLUME_LOADED", - // (undocumented) - NIFTI_VOLUME_PROGRESS = "CORNERSTONE_NIFTI_VOLUME_PROGRESS" -} - -declare namespace helpers { - export { - modalityScaleNifti, - makeVolumeMetadata - } -} -export { helpers } - -// @public (undocumented) -export function init(options?: LoaderOptions): void; - -// @public (undocumented) -function makeVolumeMetadata(niftiHeader: any, orientation: any, pixelRepresentation: any): { - volumeMetadata: Types.Metadata; - dimensions: Types.Point3; - direction: Types.Mat3; -}; - -// @public (undocumented) -function modalityScaleNifti(niftiHeader: any, niftiImageBuffer: any): { - scalarData: Types.PixelDataTypedArray; - pixelRepresentation: number; -}; - -// (No @packageDocumentation comment for this package) - -``` diff --git a/common/reviews/api/tools.api.md b/common/reviews/api/tools.api.md deleted file mode 100644 index 39ab0f21a1..0000000000 --- a/common/reviews/api/tools.api.md +++ /dev/null @@ -1,7070 +0,0 @@ -## API Report File for "@cornerstonejs/tools" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import type ColorTransferFunction from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction'; -import { Corners } from '@kitware/vtk.js/Interaction/Widgets/OrientationMarkerWidget/Constants'; -import type { IColorMapPreset } from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction/ColorMaps'; -import type { mat3 } from 'gl-matrix'; -import { mat4 } from 'gl-matrix'; -import type { Range as Range_2 } from '@kitware/vtk.js/types'; -import { vec3 } from 'gl-matrix'; -import type vtkActor from '@kitware/vtk.js/Rendering/Core/Actor'; -import vtkAnnotatedCubeActor from '@kitware/vtk.js/Rendering/Core/AnnotatedCubeActor'; -import type { vtkCamera } from '@kitware/vtk.js/Rendering/Core/Camera'; -import { vtkColorTransferFunction } from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction'; -import { vtkImageData } from '@kitware/vtk.js/Common/DataModel/ImageData'; -import type vtkImageSlice from '@kitware/vtk.js/Rendering/Core/ImageSlice'; -import type { vtkObject } from '@kitware/vtk.js/interfaces'; -import type vtkOpenGLTexture from '@kitware/vtk.js/Rendering/OpenGL/Texture'; -import type vtkPiecewiseFunction from '@kitware/vtk.js/Common/DataModel/PiecewiseFunction'; -import vtkPlane from '@kitware/vtk.js/Common/DataModel/Plane'; -import type vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData'; -import type vtkRenderer from '@kitware/vtk.js/Rendering/Core/Renderer'; -import type vtkVolume from '@kitware/vtk.js/Rendering/Core/Volume'; - -declare namespace aabb { - export { - intersectAABB, - distanceToPoint, - distanceToPointSquared - } -} - -// @public (undocumented) -function acceptAutogeneratedInterpolations(annotationGroupSelector: AnnotationGroupSelector, selector: AcceptInterpolationSelector): void; - -declare namespace activeSegmentation { - export { - getActiveSegmentation, - setActiveSegmentation - } -} - -// @public (undocumented) -const addCanvasPointsToArray: (element: HTMLDivElement, canvasPoints: Types_2.Point2[], newCanvasPoint: Types_2.Point2, commonData: PlanarFreehandROICommonData) => number; - -// @public (undocumented) -function addColorLUT(colorLUT: Types_2.ColorLUT, index?: number): number; - -// @public (undocumented) -function addColorLUT_2(colorLUT: Types_2.ColorLUT, colorLUTIndex?: number): number; - -// @public (undocumented) -function addContourRepresentationToViewport(viewportId: string, contourInputArray: RepresentationPublicInput[]): void; - -// @public (undocumented) -function addContourRepresentationToViewportMap(viewportInputMap: { - [viewportId: string]: RepresentationPublicInput[]; -}): {}; - -// @public (undocumented) -function addContourSegmentationAnnotation(annotation: ContourSegmentationAnnotation): void; - -// @public (undocumented) -function addEnabledElement(evt: Types_2.EventTypes.ElementEnabledEvent): void; - -// @public (undocumented) -function addLabelmapRepresentationToViewport(viewportId: string, labelmapInputArray: RepresentationPublicInput[]): void; - -// @public (undocumented) -function addLabelmapRepresentationToViewportMap(viewportInputMap: { - [viewportId: string]: RepresentationPublicInput[]; -}): void; - -// @public (undocumented) -function addSegmentationRepresentations(viewportId: string, segmentationInputArray: RepresentationPublicInput[]): void; - -// @public (undocumented) -function addSegmentations(segmentationInputArray: SegmentationPublicInput[], suppressEvents?: boolean): void; - -// @public (undocumented) -function addSurfaceRepresentationToViewport(viewportId: string, surfaceInputArray: RepresentationPublicInput[]): void; - -// @public (undocumented) -function addSurfaceRepresentationToViewportMap(viewportInputMap: { - [viewportId: string]: RepresentationPublicInput[]; -}): {}; - -// @public (undocumented) -export function addTool(ToolClass: any): void; - -// @public (undocumented) -function addToolState(element: HTMLDivElement, data: CINETypes.ToolData): void; - -// @public (undocumented) -interface AdvancedMagnifyAnnotation extends Annotation { - // (undocumented) - data: { - zoomFactor: number; - sourceViewportId: string; - magnifyViewportId: string; - isCanvasAnnotation: boolean; - handles: { - points: [Types_2.Point3, Types_2.Point3, Types_2.Point3, Types_2.Point3]; - activeHandleIndex: number | null; - }; - }; -} - -// @public (undocumented) -export class AdvancedMagnifyTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - static Actions: typeof AdvancedMagnifyToolActions; - // (undocumented) - _activateModify: (element: any) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => AdvancedMagnifyAnnotation; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateModify: (element: any) => void; - // (undocumented) - _dragDrawCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _dragHandle: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _dragModifyCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: Array; - handleIndex?: number; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - handleSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: AdvancedMagnifyAnnotation, handle: ToolHandle) => void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: AdvancedMagnifyAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - magnifyViewportManager: MagnifyViewportManager; - // (undocumented) - onSetToolDisabled: () => void; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - showZoomFactorsList(evt: EventTypes_2.InteractionEventType, annotation: AdvancedMagnifyAnnotation): void; - // (undocumented) - static toolName: any; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: AdvancedMagnifyAnnotation) => void; -} - -declare namespace angle { - export { - angleBetweenLines - } -} - -// @public (undocumented) -interface AngleAnnotation extends Annotation { - // (undocumented) - data: { - handles: { - points: Types_2.Point3[]; - activeHandleIndex: number | null; - textBox: { - hasMoved: boolean; - worldPosition: Types_2.Point3; - worldBoundingBox: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - }; - label: string; - cachedStats: { - [targetId: string]: { - angle: number; - }; - }; - }; -} - -// @public (undocumented) -function angleBetweenLines(line1: Line, line2: Line): number; - -// @public (undocumented) -export class AngleTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _activateModify: (element: HTMLDivElement) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => AngleAnnotation; - // (undocumented) - angleStartedNotYetCompleted: boolean; - // (undocumented) - _calculateCachedStats(annotation: any, renderingEngine: any, enabledElement: any): any; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _deactivateModify: (element: HTMLDivElement) => void; - // (undocumented) - _dragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - handleIndex?: number; - movingTextBox?: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: AngleAnnotation, handle: ToolHandle): void; - // (undocumented) - static hydrate: (viewportId: string, points: Types_2.Point3[], options?: { - annotationUID?: string; - }) => AngleAnnotation; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: AngleAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: AngleAnnotation) => void; -} - -// @public (undocumented) -type Annotation = { - annotationUID?: string; - parentAnnotationUID?: string; - interpolationUID?: string; - childAnnotationUIDs?: string[]; - highlighted?: boolean; - isLocked?: boolean; - isVisible?: boolean; - invalidated?: boolean; - isSelected?: boolean; - autoGenerated?: boolean; - metadata: Types_2.ViewReference & { - toolName: string; - cameraPosition?: Types_2.Point3; - viewUp?: Types_2.Point3; - }; - data: { - handles?: { - points?: Types_2.Point3[]; - activeHandleIndex?: number | null; - textBox?: { - hasMoved?: boolean; - worldPosition?: Types_2.Point3; - worldBoundingBox?: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - [key: string]: unknown; - }; - [key: string]: unknown; - cachedStats?: Record; - }; -}; - -declare namespace annotation { - export { - config, - locking, - selection, - state_2 as state, - visibility, - FrameOfReferenceSpecificAnnotationManager, - AnnotationGroup - } -} -export { annotation } - -// @public (undocumented) -type AnnotationAddedEventDetail = { - viewportId?: string; - renderingEngineId?: string; - annotation: Annotation; -}; - -// @public (undocumented) -type AnnotationAddedEventType = Types_2.CustomEventType; - -// @public (undocumented) -type AnnotationCompletedEventDetail = { - annotation: Annotation; - changeType?: ChangeTypes.Completed; -}; - -// @public (undocumented) -type AnnotationCompletedEventType = Types_2.CustomEventType; - -// @public (undocumented) -export abstract class AnnotationDisplayTool extends BaseTool { - // (undocumented) - protected createAnnotation(evt: EventTypes_2.InteractionEventType): Annotation; - // (undocumented) - filterInteractableAnnotationsForElement(element: HTMLDivElement, annotations: Annotations): Annotations; - // (undocumented) - protected getReferencedImageId(viewport: Types_2.IViewport, worldPos: Types_2.Point3, viewPlaneNormal: Types_2.Point3, viewUp?: Types_2.Point3): string; - // (undocumented) - getStyle(property: string, specifications: StyleSpecifier, annotation?: Annotation): unknown; - // (undocumented) - onImageSpacingCalibrated: (evt: Types_2.EventTypes.ImageSpacingCalibratedEvent) => void; - // (undocumented) - abstract renderAnnotation(enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper): any; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -class AnnotationGroup { - constructor(); - // (undocumented) - add(...annotationUIDs: string[]): void; - // (undocumented) - clear(): void; - // (undocumented) - findNearby(uid: string, direction: 1): string; - // (undocumented) - has(uid: string): boolean; - // (undocumented) - get isVisible(): boolean; - // (undocumented) - remove(...annotationUIDs: string[]): void; - // (undocumented) - setVisible(isVisible: boolean, baseEvent: BaseEventDetail, filter?: (annotationUID: string) => boolean): void; - // (undocumented) - protected unboundVisibleFilter(uid: string): boolean; - // (undocumented) - visibleFilter: (uid: string) => boolean; -} - -// @public (undocumented) -type AnnotationGroupSelector = HTMLDivElement | string; - -// @public (undocumented) -type AnnotationHandle = Types_2.Point3; - -// @public (undocumented) -function annotationHydration(viewport: Types_2.IViewport, toolName: string, worldPoints: Types_2.Point3[], options?: { - FrameOfReferenceUID?: string; - annotationUID?: string; -}): Annotation; - -// @public (undocumented) -type AnnotationInterpolationCompletedEventDetail = { - annotation: InterpolationROIAnnotation; - element: HTMLDivElement; - viewportId: string; - renderingEngineId: string; -}; - -// @public (undocumented) -type AnnotationInterpolationCompletedEventType = Types_2.CustomEventType; - -// @public (undocumented) -type AnnotationInterpolationRemovedEventDetail = { - annotations: Array; - element: HTMLDivElement; - viewportId: string; - renderingEngineId: string; -}; - -// @public (undocumented) -type AnnotationInterpolationRemovedEventType = Types_2.CustomEventType; - -// @public (undocumented) -type AnnotationLockChangeEventDetail = { - added: Array; - removed: Array; - locked: Array; -}; - -// @public (undocumented) -type AnnotationLockChangeEventType = Types_2.CustomEventType; - -// @public (undocumented) -type AnnotationModifiedEventDetail = { - viewportId: string; - renderingEngineId: string; - annotation: Annotation; - changeType?: ChangeTypes; -}; - -// @public (undocumented) -type AnnotationModifiedEventType = Types_2.CustomEventType; - -// @public (undocumented) -class AnnotationMultiSlice { - // (undocumented) - static getFrameRange(annotation: Annotation): number | [number, number]; - // (undocumented) - static getFrameRangeStr(annotation: Annotation): string; - // (undocumented) - static setEndRange(viewport: any, annotation: any, endRange?: any): void; - // (undocumented) - static setRange(viewport: any, annotation: any, startRange?: number, endRange?: number): void; - // (undocumented) - static setSingle(viewport: any, annotation: any, current?: any): void; - // (undocumented) - static setStartRange(viewport: any, annotation: any, startRange?: any): void; - // (undocumented) - static setViewportFrameRange(viewport: any, specifier: any): void; -} - -// @public (undocumented) -type AnnotationRemovedEventDetail = { - annotation: Annotation; - annotationManagerUID: string; -}; - -// @public (undocumented) -type AnnotationRemovedEventType = Types_2.CustomEventType; - -// @public (undocumented) -type AnnotationRenderContext = { - enabledElement: Types_2.IEnabledElement; - targetId: string; - annotation: Annotation; - annotationStyle: AnnotationStyle; - svgDrawingHelper: SVGDrawingHelper; -}; - -// @public (undocumented) -type AnnotationRenderedEventDetail = { - element: HTMLDivElement; - viewportId: string; - renderingEngineId: string; -}; - -// @public (undocumented) -type AnnotationRenderedEventType = Types_2.CustomEventType; - -// @public (undocumented) -type Annotations = Array; - -// @public (undocumented) -type AnnotationSelectionChangeEventDetail = { - added: Array; - removed: Array; - selection: Array; -}; - -// @public (undocumented) -type AnnotationSelectionChangeEventType = Types_2.CustomEventType; - -// @public (undocumented) -type AnnotationState = { - [key: string]: GroupSpecificAnnotations; -}; - -// @public (undocumented) -type AnnotationStyle = { - [key in `${Properties}${States}${Modes}`]?: string | number | boolean | Record; -}; - -declare namespace AnnotationStyle_2 { - export { - AnnotationStyle, - ToolStyleConfig, - StyleConfig, - StyleSpecifier - } -} - -// @public (undocumented) -enum AnnotationStyleStates { - // (undocumented) - AutoGenerated = "AutoGenerated", - // (undocumented) - Default = "", - // (undocumented) - Highlighted = "Highlighted", - // (undocumented) - Locked = "Locked", - // (undocumented) - Selected = "Selected" -} - -// @public (undocumented) -export abstract class AnnotationTool extends AnnotationDisplayTool { - constructor(toolProps: PublicToolProps, defaultToolProps: ToolProps); - // (undocumented) - abstract addNewAnnotation(evt: EventTypes_2.InteractionEventType, interactionType: InteractionTypes): Annotation; - // (undocumented) - abstract cancel(element: HTMLDivElement): any; - // (undocumented) - static createAndAddAnnotation(viewport: any, ...annotationBaseData: any[]): void; - // (undocumented) - static createAnnotation(...annotationBaseData: any[]): Annotation; - // (undocumented) - static createAnnotationForViewport(viewport: any, ...annotationBaseData: any[]): T; - // (undocumented) - static createAnnotationMemo(element: any, annotation: Annotation, options?: { - newAnnotation?: boolean; - deleting?: boolean; - }): { - restoreMemo: () => void; - }; - // (undocumented) - protected static createAnnotationState(annotation: Annotation, deleting?: boolean): { - annotationUID: string; - data: { - [key: string]: unknown; - handles?: { - points?: Types_2.Point3[]; - activeHandleIndex?: number | null; - textBox?: { - hasMoved?: boolean; - worldPosition?: Types_2.Point3; - worldBoundingBox?: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - [key: string]: unknown; - }; - cachedStats?: Record; - }; - deleting: boolean; - }; - // (undocumented) - protected createMemo(element: any, annotation: any, options?: any): void; - // (undocumented) - protected getAnnotationStyle(context: { - annotation: Annotation; - styleSpecifier: StyleSpecifier; - }): AnnotationStyle; - // (undocumented) - getHandleNearImagePoint(element: HTMLDivElement, annotation: Annotation, canvasCoords: Types_2.Point2, proximity: number): ToolHandle | undefined; - // (undocumented) - getLinkedTextBoxStyle(specifications: StyleSpecifier, annotation?: Annotation): Record; - // (undocumented) - abstract handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: Annotation, handle: ToolHandle, interactionType: InteractionTypes): void; - // (undocumented) - abstract isPointNearTool(element: HTMLDivElement, annotation: Annotation, canvasCoords: Types_2.Point2, proximity: number, interactionType: string): boolean; - // (undocumented) - static isSuvScaled(viewport: Types_2.IStackViewport | Types_2.IVolumeViewport, targetId: string, imageId?: string): boolean; - // (undocumented) - isSuvScaled: typeof AnnotationTool.isSuvScaled; - // (undocumented) - mouseMoveCallback: (evt: EventTypes_2.MouseMoveEventType, filteredAnnotations?: Annotations) => boolean; - // (undocumented) - static toolName: any; - // (undocumented) - abstract toolSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: Annotation, interactionType: InteractionTypes, canvasCoords?: Types_2.Point2): void; -} - -// @public (undocumented) -class AnnotationToPointData { - constructor(); - // (undocumented) - static convert(annotation: any, index: any, metadataProvider: any): { - ReferencedROINumber: any; - ROIDisplayColor: number[]; - ContourSequence: any; - }; - // (undocumented) - static register(toolClass: any): void; - // (undocumented) - static TOOL_NAMES: Record; -} - -// @public (undocumented) -type AnnotationVisibilityChangeEventDetail = { - lastHidden: Array; - lastVisible: Array; - hidden: Array; -}; - -// @public (undocumented) -type AnnotationVisibilityChangeEventType = Types_2.CustomEventType; - -// @public (undocumented) -function areCoplanarContours(firstAnnotation: ContourAnnotation, secondAnnotation: ContourAnnotation): boolean; - -// @public (undocumented) -function areSameSegment(firstAnnotation: ContourSegmentationAnnotation, secondAnnotation: ContourSegmentationAnnotation): boolean; - -// @public (undocumented) -export class ArrowAnnotateTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _activateModify: (element: HTMLDivElement) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => ArrowAnnotation; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _deactivateModify: (element: HTMLDivElement) => void; - // (undocumented) - _doneChangingTextCallback(element: any, annotation: any, updatedText: any): void; - // (undocumented) - doubleClickCallback: (evt: EventTypes_2.TouchTapEventType) => void; - // (undocumented) - _dragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - handleIndex?: number; - movingTextBox?: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: ArrowAnnotation, handle: ToolHandle): void; - // (undocumented) - static hydrate: (viewportId: string, points: Types_2.Point3[], text?: string, options?: { - annotationUID?: string; - }) => ArrowAnnotation; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - _isInsideVolume(index1: any, index2: any, dimensions: any): boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: ArrowAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: ArrowAnnotation) => void; - // (undocumented) - touchTapCallback: (evt: EventTypes_2.TouchTapEventType) => void; -} - -// @public (undocumented) -interface ArrowAnnotation extends Annotation { - // (undocumented) - data: { - text: string; - handles: { - points: Types_2.Point3[]; - arrowFirst: boolean; - activeHandleIndex: number | null; - textBox: { - hasMoved: boolean; - worldPosition: Types_2.Point3; - worldBoundingBox: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - }; - }; -} - -// @public (undocumented) -export abstract class BaseTool { - constructor(toolProps: PublicToolProps, defaultToolProps: ToolProps); - // (undocumented) - applyActiveStrategy(enabledElement: Types_2.IEnabledElement, operationData: unknown): any; - // (undocumented) - applyActiveStrategyCallback(enabledElement: Types_2.IEnabledElement, operationData: unknown, callbackType: StrategyCallbacks | string, ...extraArgs: any[]): any; - // (undocumented) - configuration: Record; - // (undocumented) - static createZoomPanMemo(viewport: any): { - restoreMemo: () => void; - }; - // (undocumented) - static defaults: { - configuration: { - strategies: {}; - defaultStrategy: any; - activeStrategy: any; - strategyOptions: {}; - }; - }; - // (undocumented) - doneEditMemo(): void; - // (undocumented) - protected getTargetId(viewport: Types_2.IViewport): string | undefined; - // (undocumented) - protected getTargetImageData(targetId: string): Types_2.IImageData | Types_2.CPUIImageData; - // (undocumented) - getToolName(): string; - // (undocumented) - protected memo: utilities_2.HistoryMemo.Memo; - // (undocumented) - static mergeDefaultProps(defaultProps?: {}, additionalProps?: any): any; - // (undocumented) - mode: ToolModes; - // (undocumented) - redo(): void; - // (undocumented) - setActiveStrategy(strategyName: string): void; - // (undocumented) - setConfiguration(newConfiguration: Record): void; - // (undocumented) - supportedInteractionTypes: InteractionTypes[]; - // (undocumented) - toolGroupId: string; - // (undocumented) - static toolName: any; - // (undocumented) - get toolName(): string; - // (undocumented) - undo(): void; -} - -declare namespace BasicStatsCalculator { - export { - BasicStatsCalculator_2 as BasicStatsCalculator, - Calculator - } -} - -// @public (undocumented) -class BasicStatsCalculator_2 extends Calculator { - // (undocumented) - static getStatistics: (options?: { - unit: string; - }) => NamedStatistics; - // (undocumented) - static statsCallback: ({ value: newValue, pointLPS }: { - value: any; - pointLPS?: any; - }) => void; - // (undocumented) - static statsInit(options: { - storePointData: boolean; - }): void; -} - -// @public (undocumented) -interface BidirectionalAnnotation extends Annotation { - // (undocumented) - data: { - handles: { - points: Types_2.Point3[]; - activeHandleIndex: number | null; - textBox: { - hasMoved: boolean; - worldPosition: Types_2.Point3; - worldBoundingBox: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - }; - label: string; - cachedStats: { - [targetId: string]: { - length: number; - width: number; - unit: string; - }; - }; - }; -} - -// @public (undocumented) -type BidirectionalData = { - majorAxis: [Types_2.Point3, Types_2.Point3]; - minorAxis: [Types_2.Point3, Types_2.Point3]; - maxMajor: number; - maxMinor: number; - segmentIndex: number; - label?: string; - color?: string | number[]; - referencedImageId: string; - sliceIndex: number; -}; - -// @public (undocumented) -export class BidirectionalTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: any) => void; - // (undocumented) - _activateModify: (element: any) => void; - // (undocumented) - addNewAnnotation(evt: EventTypes_2.InteractionEventType): BidirectionalAnnotation; - // (undocumented) - _calculateCachedStats: (annotation: any, renderingEngine: any, enabledElement: any) => any; - // (undocumented) - _calculateLength(pos1: any, pos2: any): number; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateDraw: (element: any) => void; - // (undocumented) - _deactivateModify: (element: any) => void; - // (undocumented) - _dragDrawCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _dragModifyCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _dragModifyHandle: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - handleIndex?: number; - movingTextBox: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _getSignedAngle: (vector1: any, vector2: any) => number; - // (undocumented) - handleSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: BidirectionalAnnotation, handle: ToolHandle) => void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - _isInsideVolume: (index1: any, index2: any, index3: any, index4: any, dimensions: any) => boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: BidirectionalAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - _movingLongAxisWouldPutItThroughShortAxis: (firstLineSegment: any, secondLineSegment: any) => boolean; - // (undocumented) - preventHandleOutsideImage: boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: BidirectionalAnnotation) => void; -} - -declare namespace boundingBox { - export { - extend2DBoundingBoxInViewAxis, - getBoundingBoxAroundShapeIJK, - getBoundingBoxAroundShapeWorld, - getBoundingBoxAroundShapeIJK as getBoundingBoxAroundShape - } -} - -// @public (undocumented) -type BoundsIJK_2 = Types_2.BoundsIJK; - -// @public (undocumented) -export class BrushTool extends LabelmapBaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - acceptPreview(element?: HTMLDivElement): void; - // (undocumented) - getStatistics(element: any, segmentIndices?: any): any; - // (undocumented) - interpolate(element: any, config: any): void; - // (undocumented) - invalidateBrushCursor(): void; - // (undocumented) - mouseMoveCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - onSetToolDisabled: (evt: any) => void; - // (undocumented) - onSetToolEnabled: () => void; - // (undocumented) - onSetToolPassive: (evt: any) => void; - // (undocumented) - preMouseDownCallback: (evt: EventTypes_2.MouseDownActivateEventType) => boolean; - // (undocumented) - previewCallback: () => void; - // (undocumented) - rejectPreview(element?: HTMLDivElement): void; - // (undocumented) - renderAnnotation(enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper): void; - // (undocumented) - static toolName: any; - // (undocumented) - protected updateCursor(evt: EventTypes_2.InteractionEventType): void; -} - -// @public (undocumented) -class BSpline extends CubicSpline { - // (undocumented) - protected getTransformMatrix(): number[]; -} - -// @public (undocumented) -function calculateMinMaxMean(pixelLuminance: any, globalMin: any, globalMax: any): { - min: any; - max: any; - mean: number; -}; - -// @public (undocumented) -function calculatePerimeter(polyline: number[][], closed: boolean): number; - -// @public (undocumented) -abstract class Calculator { - // (undocumented) - static getStatistics: () => NamedStatistics; - // (undocumented) - static run: ({ value }: { - value: any; - }) => void; -} - -// @public (undocumented) -function calibrateImageSpacing(imageId: string, renderingEngine: Types_2.IRenderingEngine, calibrationOrScale: Types_2.IImageCalibration | number): void; - -// @public (undocumented) -export function cancelActiveManipulations(element: HTMLDivElement): string | undefined; - -// @public (undocumented) -function canComputeRequestedRepresentation(segmentationId: string, type: SegmentationRepresentations): boolean; - -// @public (undocumented) -type CanvasCoordinates = [ -Types_2.Point2, -Types_2.Point2, -Types_2.Point2, -Types_2.Point2 -]; - -// @public (undocumented) -class CardinalSpline extends CubicSpline { - constructor(props?: CardinalSplineProps); - // (undocumented) - get fixedScale(): boolean; - // (undocumented) - protected getTransformMatrix(): number[]; - // (undocumented) - get scale(): number; - set scale(scale: number); -} - -// @public (undocumented) -type CardinalSplineProps = SplineProps & { - scale?: number; - fixedScale?: boolean; -}; - -// @public (undocumented) -class CatmullRomSpline extends CardinalSpline { - constructor(); -} - -// @public (undocumented) -enum ChangeTypes { - // (undocumented) - Completed = "Completed", - // (undocumented) - HandlesUpdated = "HandlesUpdated", - // (undocumented) - History = "History", - // (undocumented) - InitialSetup = "InitialSetup", - // (undocumented) - Interaction = "Interaction", - // (undocumented) - InterpolationUpdated = "InterpolationUpdated", - // (undocumented) - MetadataReferenceModified = "MetadataReferenceModified", - // (undocumented) - StatsUpdated = "StatsUpdated" -} - -// @public (undocumented) -enum ChangeTypes_2 { - // (undocumented) - POLYSEG_CONTOUR_TO_LABELMAP = "Converting Contour to Labelmap", - // (undocumented) - POLYSEG_CONTOUR_TO_SURFACE = "Converting Contour to Surface", - // (undocumented) - POLYSEG_LABELMAP_TO_SURFACE = "Converting Labelmap to Surface", - // (undocumented) - POLYSEG_SURFACE_TO_LABELMAP = "Converting Surfaces to Labelmap", - // (undocumented) - SURFACE_CLIPPING = "Clipping Surfaces" -} - -// @public (undocumented) -function checkAndSetAnnotationLocked(annotationUID: string): boolean; - -// @public (undocumented) -function checkAndSetAnnotationVisibility(annotationUID: string): boolean; - -declare namespace cine { - export { - playClip, - stopClip, - Events_3 as Events, - getToolState, - addToolState - } -} - -// @public (undocumented) -type CinePlayContext = { - get numScrollSteps(): number; - get currentStepIndex(): number; - get frameTimeVectorEnabled(): boolean; - waitForRenderedCount?: number; - scroll(delta: number): void; - play?(fps?: number): number; -}; - -declare namespace CINETypes { - export { - PlayClipOptions, - ToolData, - CinePlayContext - } -} - -declare namespace circle { - export { - getCanvasCircleRadius, - getCanvasCircleCorners - } -} - -// @public (undocumented) -interface CircleROIAnnotation extends Annotation { - // (undocumented) - data: { - handles: { - points: [Types_2.Point3, Types_2.Point3]; - activeHandleIndex: number | null; - textBox?: { - hasMoved: boolean; - worldPosition: Types_2.Point3; - worldBoundingBox: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - }; - label: string; - cachedStats?: (ROICachedStats & { - [targetId: string]: { - radius: number; - radiusUnit: string; - perimeter: number; - }; - }) | { - pointsInVolume: Types_2.Point3[]; - projectionPoints: Types_2.Point3[][]; - }; - }; -} - -// @public (undocumented) -interface CircleROIStartEndThresholdAnnotation extends Annotation { - // (undocumented) - data: { - label: string; - startCoordinate: number; - endCoordinate: number; - cachedStats?: { - pointsInVolume: Types_2.Point3[]; - projectionPoints: Types_2.Point3[][]; - statistics?: ROICachedStats; - }; - handles: { - points: [Types_2.Point3, Types_2.Point3]; - activeHandleIndex: number | null; - textBox?: { - hasMoved: boolean; - worldPosition: Types_2.Point3; - worldBoundingBox: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - }; - }; - // (undocumented) - metadata: { - cameraPosition?: Types_2.Point3; - cameraFocalPoint?: Types_2.Point3; - viewPlaneNormal?: Types_2.Point3; - viewUp?: Types_2.Point3; - annotationUID?: string; - FrameOfReferenceUID: string; - referencedImageId?: string; - toolName: string; - enabledElement: Types_2.IEnabledElement; - volumeId: string; - spacingInNormal: number; - }; -} - -// @public (undocumented) -export class CircleROIStartEndThresholdTool extends CircleROITool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => { - highlighted: boolean; - invalidated: boolean; - metadata: { - toolName: string; - viewPlaneNormal: Types_2.Point3; - viewUp: Types_2.Point3; - FrameOfReferenceUID: string; - referencedImageId: any; - volumeId: any; - spacingInNormal: number; - enabledElement: Types_2.IEnabledElement; - }; - data: { - label: string; - startCoordinate: number; - endCoordinate: number; - handles: { - textBox: { - hasMoved: boolean; - worldPosition: Types_2.Point3; - worldBoundingBox: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - points: [Types_2.Point3, Types_2.Point3]; - activeHandleIndex: any; - }; - cachedStats: { - pointsInVolume: any[]; - projectionPoints: any[]; - statistics: ROICachedStats; - }; - labelmapUID: any; - }; - }; - // (undocumented) - _calculateCachedStatsTool(annotation: any, enabledElement: any): any; - // (undocumented) - _computePointsInsideVolume(annotation: any, imageVolume: any, targetId: any, enabledElement: any): void; - // (undocumented) - _computeProjectionPoints(annotation: CircleROIStartEndThresholdAnnotation, imageVolume: Types_2.IImageVolume): void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: Array; - handleIndex?: number; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _getCoordinateForViewplaneNormal(pos: vec3 | number, viewPlaneNormal: Types_2.Point3): number | undefined; - // (undocumented) - _getEndCoordinate(worldPos: Types_2.Point3, spacingInNormal: number, viewPlaneNormal: Types_2.Point3): number | undefined; - // (undocumented) - _getIndexOfCoordinatesForViewplaneNormal(viewPlaneNormal: Types_2.Point3): number; - // (undocumented) - _getStartCoordinate(worldPos: Types_2.Point3, spacingInNormal: number, viewPlaneNormal: Types_2.Point3): number | undefined; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -export class CircleROITool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: any) => void; - // (undocumented) - _activateModify: (element: any) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => CircleROIAnnotation; - // (undocumented) - _calculateCachedStats: (annotation: any, viewport: any, renderingEngine: any, enabledElement: any) => any; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateDraw: (element: any) => void; - // (undocumented) - _deactivateModify: (element: any) => void; - // (undocumented) - _dragDrawCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _dragHandle: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _dragModifyCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: Array; - handleIndex?: number; - movingTextBox?: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - handleSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: CircleROIAnnotation, handle: ToolHandle) => void; - // (undocumented) - static hydrate: (viewportId: string, points: Types_2.Point3[], options?: { - annotationUID?: string; - }) => CircleROIAnnotation; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - _isInsideVolume: (index1: any, index2: any, dimensions: any) => boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: CircleROIAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: CircleROIAnnotation) => void; -} - -// @public (undocumented) -export class CircleScissorsTool extends LabelmapBaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: any) => void; - // (undocumented) - _deactivateDraw: (element: any) => void; - // (undocumented) - _dragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - segmentIndex: number; - segmentationId: string; - volumeId: string; - referencedVolumeId: string; - segmentsLocked: number[]; - segmentColor: [number, number, number, number]; - viewportIdsToRender: string[]; - handleIndex?: number; - movingTextBox: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - imageId: string; - centerCanvas?: Array; - memo?: LabelmapMemo_2; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - preMouseDownCallback: (evt: EventTypes_2.InteractionEventType) => boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -function clip_2(a: any, b: any, box: any, da?: any, db?: any): 0 | 1; - -// @public (undocumented) -type ClosestControlPoint = ClosestPoint & { - index: number; -}; - -// @public (undocumented) -type ClosestPoint = { - point: Types_2.Point2; - distance: number; -}; - -// @public (undocumented) -type ClosestSplinePoint = ClosestPoint & { - uValue: number; -}; - -// @public (undocumented) -interface CobbAngleAnnotation extends Annotation { - // (undocumented) - data: { - handles: { - points: Types_2.Point3[]; - activeHandleIndex: number | null; - textBox: { - hasMoved: boolean; - worldPosition: Types_2.Point3; - worldBoundingBox: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - }; - label: string; - cachedStats: { - [targetId: string]: { - angle: number; - arc1Angle: number; - arc2Angle: number; - points: { - world: { - arc1Start: Types_2.Point3; - arc1End: Types_2.Point3; - arc2Start: Types_2.Point3; - arc2End: Types_2.Point3; - arc1Angle: number; - arc2Angle: number; - }; - canvas: { - arc1Start: Types_2.Point2; - arc1End: Types_2.Point2; - arc2Start: Types_2.Point2; - arc2End: Types_2.Point2; - arc1Angle: number; - arc2Angle: number; - }; - }; - }; - }; - }; -} - -// @public (undocumented) -export class CobbAngleTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _activateModify: (element: HTMLDivElement) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.MouseDownActivateEventType) => CobbAngleAnnotation; - // (undocumented) - angleStartedNotYetCompleted: boolean; - // (undocumented) - _calculateCachedStats(annotation: any, renderingEngine: any, enabledElement: any): any; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _deactivateModify: (element: HTMLDivElement) => void; - // (undocumented) - distanceToLines: ({ viewport, points, canvasCoords, proximity }: { - viewport: any; - points: any; - canvasCoords: any; - proximity: any; - }) => { - distanceToPoint: number; - distanceToPoint2: number; - isNearFirstLine: boolean; - isNearSecondLine: boolean; - }; - // (undocumented) - _dragCallback: (evt: EventTypes_2.MouseDragEventType | EventTypes_2.MouseMoveEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - handleIndex?: number; - movingTextBox?: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - isNearFirstLine?: boolean; - isNearSecondLine?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.MouseUpEventType | EventTypes_2.MouseClickEventType) => void; - // (undocumented) - getArcsStartEndPoints: ({ firstLine, secondLine, mid1, mid2, }: { - firstLine: any; - secondLine: any; - mid1: any; - mid2: any; - }) => { - arc1Start: Types_2.Point2; - arc1End: Types_2.Point2; - arc2Start: Types_2.Point2; - arc2End: Types_2.Point2; - arc1Angle: number; - arc2Angle: number; - }; - // (undocumented) - handleSelectedCallback(evt: EventTypes_2.MouseDownEventType, annotation: CobbAngleAnnotation, handle: ToolHandle, interactionType?: string): void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: CobbAngleAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - _mouseDownCallback: (evt: EventTypes_2.MouseUpEventType | EventTypes_2.MouseClickEventType) => void; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.MouseDownEventType, annotation: CobbAngleAnnotation, interactionType: InteractionTypes, canvasCoords: Types_2.Point2, proximity?: number) => void; -} - -declare namespace color_2 { - export { - getSegmentIndexColor, - addColorLUT_2 as addColorLUT, - setColorLUT, - setSegmentIndexColor - } -} - -// @public (undocumented) -class Colorbar extends Widget { - constructor(props: ColorbarProps); - // (undocumented) - get activeColormapName(): string; - set activeColormapName(colormapName: string); - // (undocumented) - protected createRootElement(): HTMLElement; - // (undocumented) - _createTicksBar(props: ColorbarProps): ColorbarTicks; - // (undocumented) - destroy(): void; - // (undocumented) - protected getVOIMultipliers(): [number, number]; - // (undocumented) - protected hideTicks(): void; - // (undocumented) - get imageRange(): ColorbarVOIRange; - set imageRange(imageRange: ColorbarVOIRange); - // (undocumented) - protected onContainerResize(): void; - // (undocumented) - protected onVoiChange(voiRange: ColorbarVOIRange): void; - // (undocumented) - get showFullImageRange(): boolean; - set showFullImageRange(value: boolean); - // (undocumented) - protected showTicks(): void; - // (undocumented) - get voiRange(): ColorbarVOIRange; - set voiRange(voiRange: ColorbarVOIRange); -} - -declare namespace colorbar { - export { - Types_3 as Types, - Enums_3 as Enums, - Colorbar, - ViewportColorbar - } -} - -// @public (undocumented) -type ColorbarCommonProps = { - imageRange?: ColorbarImageRange; - voiRange?: ColorbarVOIRange; - ticks?: { - position?: ColorbarRangeTextPosition; - style?: ColorbarTicksStyle; - }; - showFullPixelValueRange?: boolean; -}; - -// @public (undocumented) -type ColorbarImageRange = { - lower: number; - upper: number; -}; - -// @public (undocumented) -type ColorbarProps = (WidgetProps & ColorbarCommonProps) & { - colormaps: IColorMapPreset[]; - activeColormapName?: string; -}; - -// @public (undocumented) -enum ColorbarRangeTextPosition { - // (undocumented) - Bottom = "bottom", - // (undocumented) - Left = "left", - // (undocumented) - Right = "right", - // (undocumented) - Top = "top" -} - -// @public (undocumented) -type ColorbarSize = { - width: number; - height: number; -}; - -// @public (undocumented) -type ColorbarTicksProps = ColorbarCommonProps & { - top?: number; - left?: number; - size?: ColorbarSize; - container?: HTMLElement; -}; - -// @public (undocumented) -type ColorbarTicksStyle = { - font?: string; - color?: string; - tickSize?: number; - tickWidth?: number; - labelMargin?: number; - maxNumTicks?: number; -}; - -// @public (undocumented) -type ColorbarVOIRange = ColorbarImageRange; - -// @public (undocumented) -function computeAndAddContourRepresentation(segmentationId: string, options?: PolySegConversionOptions): Promise<{ - annotationUIDsMap: Map>; -}>; - -// @public (undocumented) -function computeAndAddLabelmapRepresentation(segmentationId: string, options?: PolySegConversionOptions): Promise; - -// @public (undocumented) -function computeAndAddSurfaceRepresentation(segmentationId: string, options?: PolySegConversionOptions): Promise<{ - geometryIds: Map; -}>; - -declare namespace config { - export { - getState, - getFont, - toolStyle as style - } -} - -declare namespace config_2 { - export { - color_2 as color, - visibility_2 as visibility, - style - } -} - -declare namespace CONSTANTS { - export { - CORNERSTONE_COLOR_LUT as COLOR_LUT - } -} -export { CONSTANTS } - -// @public (undocumented) -function containsPoint(polyline: Types_2.Point2[], point: Types_2.Point2, options?: { - closed?: boolean; - holes?: Types_2.Point2[][]; -}): boolean; - -// @public (undocumented) -function containsPoints(polyline: Types_2.Point2[], points: Types_2.Point2[]): boolean; - -// @public (undocumented) -function contourAndFindLargestBidirectional(segmentation: any): any; - -// @public (undocumented) -type ContourAnnotation = Annotation & ContourAnnotationData; - -// @public (undocumented) -type ContourAnnotationCompletedEventDetail = AnnotationCompletedEventDetail & { - contourHoleProcessingEnabled: boolean; -}; - -// @public (undocumented) -type ContourAnnotationData = { - data: { - cachedStats?: Record; - contour: { - polyline: Types_2.Point3[]; - closed: boolean; - windingDirection?: ContourWindingDirection; - pointsManager?: Types_2.IPointsManager; - }; - }; - onInterpolationComplete?: () => void; -}; - -declare namespace contours { - export { - areCoplanarContours, - _default_2 as contourFinder, - getDeduplicatedVTKPolyDataPoints, - _default_3 as detectContourHoles, - generateContourSetsFromLabelmap, - AnnotationToPointData, - getContourHolesDataWorld, - getContourHolesDataCanvas, - updateContourPolyline, - acceptAutogeneratedInterpolations, - findHandlePolylineIndex, - calculatePerimeter - } -} - -declare namespace contourSegmentation { - export { - areSameSegment, - isContourSegmentationAnnotation, - addContourSegmentationAnnotation, - removeContourSegmentationAnnotation - } -} - -// @public (undocumented) -type ContourSegmentationAnnotation = ContourAnnotation & ContourSegmentationAnnotationData; - -// @public (undocumented) -type ContourSegmentationAnnotationData = { - autoGenerated?: boolean; - interpolationUID?: string; - interpolationCompleted?: boolean; - data: { - segmentation: { - segmentationId: string; - segmentIndex: number; - }; - contour: { - originalPolyline?: Types_2.Point3[]; - }; - }; - metadata?: { - originalToolName?: string; - }; - handles?: { - interpolationSources?: Types_2.IPointsManager[]; - }; - onInterpolationComplete?: (annotation: ContourSegmentationAnnotation) => unknown; -}; - -// @public (undocumented) -type ContourSegmentationData = { - geometryIds?: string[]; - annotationUIDsMap?: Map>; -}; - -// @public (undocumented) -type ContourStyle = BaseContourStyle & InactiveContourStyle & AutoGeneratedContourStyle; - -// @public (undocumented) -type ControlPointInfo = { - index: number; - point: Types_2.Point2; -}; - -// @public (undocumented) -function copyPoints(points: ITouchPoints): ITouchPoints; - -// @public (undocumented) -function copyPointsList(points: ITouchPoints[]): ITouchPoints[]; - -// @public (undocumented) -const CORNERSTONE_COLOR_LUT: Types_2.Color[]; - -// @public (undocumented) -function createBidirectionalToolData(bidirectionalData: BidirectionalData, viewport: any): Annotation; - -// @public (undocumented) -function createCameraPositionSynchronizer(synchronizerName: string): Synchronizer; - -// @public (undocumented) -function createImageSliceSynchronizer(synchronizerName: string): Synchronizer; - -// @public (undocumented) -function createLabelmapMemo(segmentationId: string, segmentationVoxelManager: Types_2.IVoxelManager, preview?: InitializedOperationData): { - segmentationId: string; - restoreMemo: typeof restoreMemo; - commitMemo: typeof commitMemo; - segmentationVoxelManager: Types_2.IVoxelManager; - voxelManager: Types_2.IVoxelManager; - memo: LabelmapMemo_2; - preview: InitializedOperationData; -} | { - segmentationId: string; - restoreMemo: typeof restoreMemo; - commitMemo: typeof commitMemo; - segmentationVoxelManager: Types_2.IVoxelManager; - voxelManager: utilities_2.VoxelManager; -}; - -// @public (undocumented) -function createLabelmapVolumeForViewport(input: { - viewportId: string; - renderingEngineId: string; - segmentationId?: string; - options?: Types_2.LocalVolumeOptions & { - volumeId?: string; - }; -}): Promise; - -// @public (undocumented) -function createMergedLabelmapForIndex(labelmaps: Array, segmentIndex?: number, volumeId?: string): Types_2.IImageVolume; - -// @public (undocumented) -function createPresentationViewSynchronizer(synchronizerName: string, options?: Types_2.ViewPresentation): Synchronizer; - -// @public (undocumented) -function createPresentationViewSynchronizer_2(synchronizerName: string): Synchronizer; - -// @public (undocumented) -function createPreviewMemo(segmentationId: string, preview: InitializedOperationData): { - segmentationId: string; - restoreMemo: typeof restoreMemo; - commitMemo: typeof commitMemo; - segmentationVoxelManager: Types_2.IVoxelManager; - voxelManager: Types_2.IVoxelManager; - memo: LabelmapMemo_2; - preview: InitializedOperationData; -}; - -// @public (undocumented) -function createRleMemo(segmentationId: string, segmentationVoxelManager: Types_2.IVoxelManager): { - segmentationId: string; - restoreMemo: typeof restoreMemo; - commitMemo: typeof commitMemo; - segmentationVoxelManager: Types_2.IVoxelManager; - voxelManager: utilities_2.VoxelManager; -}; - -// @public (undocumented) -const createStackImageSynchronizer: typeof createImageSliceSynchronizer; - -// @public (undocumented) -function createSynchronizer(synchronizerId: string, eventName: string, eventHandler: ISynchronizerEventHandler, options?: SynchronizerOptions): Synchronizer; - -// @public (undocumented) -function createToolGroup(toolGroupId: string): ToolGroup | undefined; - -// @public (undocumented) -function createVOISynchronizer(synchronizerName: string, options: VOISynchronizerOptions): Synchronizer; - -// @public (undocumented) -function createZoomPanSynchronizer(synchronizerName: string): Synchronizer; - -// @public (undocumented) -export class CrosshairsTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateModify: (element: any) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => CrosshairsAnnotation; - // (undocumented) - _applyDeltaShiftToSelectedViewportCameras(renderingEngine: any, viewportsAnnotationsToUpdate: any, delta: any): void; - // (undocumented) - _applyDeltaShiftToViewportCamera(renderingEngine: Types_2.IRenderingEngine, annotation: any, delta: any): void; - // (undocumented) - _areViewportIdArraysEqual: (viewportIdArrayOne: any, viewportIdArrayTwo: any) => boolean; - // (undocumented) - _autoPanViewportIfNecessary(viewportId: string, renderingEngine: Types_2.IRenderingEngine): void; - // (undocumented) - cancel: () => void; - // (undocumented) - _checkIfViewportsRenderingSameScene: (viewport: any, otherViewport: any) => any; - // (undocumented) - computeToolCenter: () => void; - // (undocumented) - _computeToolCenter: (viewportsInfo: any) => void; - // (undocumented) - _deactivateModify: (element: any) => void; - // (undocumented) - _dragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _filterAnnotationsByUniqueViewportOrientations: (enabledElement: any, annotations: any) => any[]; - // (undocumented) - filterInteractableAnnotationsForElement: (element: any, annotations: any) => any; - // (undocumented) - _filterViewportWithSameOrientation: (enabledElement: any, referenceAnnotation: any, annotations: any) => any; - // (undocumented) - _getAnnotations: (enabledElement: Types_2.IEnabledElement) => Annotation[]; - // (undocumented) - _getAnnotationsForViewportsWithDifferentCameras: (enabledElement: any, annotations: any) => any; - // (undocumented) - getHandleNearImagePoint(element: HTMLDivElement, annotation: Annotation, canvasCoords: Types_2.Point2, proximity: number): ToolHandle | undefined; - // (undocumented) - _getReferenceLineColor?: (viewportId: string) => string; - // (undocumented) - _getReferenceLineControllable?: (viewportId: string) => boolean; - // (undocumented) - _getReferenceLineDraggableRotatable?: (viewportId: string) => boolean; - // (undocumented) - _getReferenceLineSlabThicknessControlsOn?: (viewportId: string) => boolean; - // (undocumented) - _getRotationHandleNearImagePoint(viewport: any, annotation: any, canvasCoords: any, proximity: any): any; - // (undocumented) - _getSlabThicknessHandleNearImagePoint(viewport: any, annotation: any, canvasCoords: any, proximity: any): any; - // (undocumented) - _getViewportsInfo: () => any[]; - // (undocumented) - handleSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: Annotation) => void; - // (undocumented) - initializeViewport: ({ renderingEngineId, viewportId, }: Types_2.IViewportId) => { - normal: Types_2.Point3; - point: Types_2.Point3; - }; - // (undocumented) - _isClockWise(a: any, b: any, c: any): boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: CrosshairsAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - _jump: (enabledElement: any, jumpWorld: any) => boolean; - // (undocumented) - mouseMoveCallback: (evt: EventTypes_2.MouseMoveEventType, filteredToolAnnotations: Annotations) => boolean; - // (undocumented) - onCameraModified: (evt: any) => void; - // (undocumented) - _onNewVolume: () => void; - // (undocumented) - onResetCamera: (evt: any) => void; - // (undocumented) - onSetToolActive(): void; - // (undocumented) - onSetToolDisabled(): void; - // (undocumented) - onSetToolEnabled(): void; - // (undocumented) - onSetToolPassive(): void; - // (undocumented) - _pointNearReferenceLine: (annotation: any, canvasCoords: any, proximity: any, lineViewport: any) => boolean; - // (undocumented) - _pointNearTool(element: any, annotation: any, canvasCoords: any, proximity: any): boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - resetCrosshairs: () => void; - // (undocumented) - setSlabThickness(viewport: any, slabThickness: any): void; - // (undocumented) - _subscribeToViewportNewVolumeSet(viewports: any): void; - // (undocumented) - toolCenter: Types_2.Point3; - // (undocumented) - static toolName: any; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: Annotation, interactionType: InteractionTypes) => void; - // (undocumented) - _unsubscribeToViewportNewVolumeSet(viewportsInfo: any): void; -} - -// @public (undocumented) -abstract class CubicSpline extends Spline { - // (undocumented) - protected getPreviewCurveSegments(controlPointPreview: Types_2.Point2, closeSpline: boolean): SplineCurveSegment[]; - // (undocumented) - protected getSplineCurves(): SplineCurveSegment[]; -} - -// @public (undocumented) -const CursorNames: string[]; - -declare namespace cursors { - export { - MouseCursor, - ImageMouseCursor, - SVGMouseCursor, - elementCursor, - registerCursor, - CursorNames, - CursorSVG, - setCursorForElement - } -} -export { cursors } - -// @public (undocumented) -const CursorSVG: Record; - -// @public (undocumented) -function debounce(func: Function, wait?: number, options?: { - leading?: boolean; - maxWait?: number; - trailing?: boolean; -}): Function; - -// @public (undocumented) -function decimate_2(polyline: Types_2.Point2[], epsilon?: number): Types_2.Point2[]; - -// @public (undocumented) -const _default: { - filterAnnotationsWithinSlice: typeof filterAnnotationsWithinSlice; - getWorldWidthAndHeightFromCorners: typeof getWorldWidthAndHeightFromCorners; - getWorldWidthAndHeightFromTwoPoints: typeof getWorldWidthAndHeightFromTwoPoints; - filterAnnotationsForDisplay: typeof filterAnnotationsForDisplay; - getPointInLineOfSightWithCriteria: typeof getPointInLineOfSightWithCriteria; - isPlaneIntersectingAABB: (origin: any, normal: any, minX: any, minY: any, minZ: any, maxX: any, maxY: any, maxZ: any) => boolean; - filterAnnotationsWithinSamePlane: typeof filterAnnotationsWithinSamePlane; - getPointsInLineOfSight: typeof getPointsInLineOfSight; -}; - -// @public (undocumented) -const _default_2: { - findContours: typeof findContours; - findContoursFromReducedSet: typeof findContoursFromReducedSet; -}; - -// @public (undocumented) -const _default_3: { - processContourHoles: typeof processContourHoles; -}; - -// @public (undocumented) -const _default_4: { - smoothAnnotation: typeof smoothAnnotation; -}; - -// @public (undocumented) -function deselectAnnotation(annotationUID?: string): void; - -// @public (undocumented) -export function destroy(): void; - -// @public (undocumented) -function destroy_2(): void; - -// @public (undocumented) -function destroy_3(): void; - -// @public (undocumented) -function destroy_4(): void; - -// @public (undocumented) -function destroySynchronizer(synchronizerId: string): void; - -// @public (undocumented) -function destroyToolGroup(toolGroupId: string): void; - -// @public (undocumented) -function distanceToPoint(aabb: Types_2.AABB2, point: Types_2.Point2): number; - -// @public (undocumented) -function distanceToPoint_2(lineStart: Types_2.Point2, lineEnd: Types_2.Point2, point: Types_2.Point2): number; - -// @public (undocumented) -function distanceToPoint_3(p1: Point, p2: Point): number; - -// @public (undocumented) -function distanceToPoint_4(rect: number[], point: Types_2.Point2): number; - -// @public (undocumented) -function distanceToPointSquared(aabb: Types_2.AABB2, point: Types_2.Point2): number; - -// @public (undocumented) -function distanceToPointSquared_2(lineStart: Types_2.Point2, lineEnd: Types_2.Point2, point: Types_2.Point2): number; - -// @public (undocumented) -function distanceToPointSquared_3(p1: Point_2, p2: Point_2): number; - -// @public (undocumented) -function distanceToPointSquaredInfo(lineStart: Types_2.Point2, lineEnd: Types_2.Point2, point: Types_2.Point2): { - point: Types_2.Point2; - distanceSquared: number; -}; - -// @public (undocumented) -export class DragProbeTool extends ProbeTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - newAnnotation?: boolean; - } | null; - // (undocumented) - eventDispatchDetail: { - viewportId: string; - renderingEngineId: string; - }; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - postMouseDownCallback: (evt: EventTypes_2.InteractionEventType) => ProbeAnnotation; - // (undocumented) - postTouchStartCallback: (evt: EventTypes_2.InteractionEventType) => ProbeAnnotation; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - static toolName: string; -} - -// @public (undocumented) -function draw(element: HTMLDivElement, fn: (svgDrawingElement: SVGDrawingHelper) => void): void; - -// @public (undocumented) -function drawArrow(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, arrowUID: string, start: Types_2.Point2, end: Types_2.Point2, options?: {}): void; - -// @public (undocumented) -function drawCircle(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, circleUID: string, center: Types_2.Point2, radius: number, options?: {}, dataId?: string): void; - -// @public (undocumented) -function drawEllipse(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, ellipseUID: string, corner1: Types_2.Point2, corner2: Types_2.Point2, options?: {}, dataId?: string): void; - -// @public (undocumented) -function drawEllipseByCoordinates(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, ellipseUID: string, canvasCoordinates: [Types_2.Point2, Types_2.Point2, Types_2.Point2, Types_2.Point2], options?: {}, dataId?: string): void; - -// @public (undocumented) -function drawHandle(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, handleGroupUID: string, handle: Types_2.Point2, options: {}, uniqueIndex: any): void; - -// @public (undocumented) -function drawHandles(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, handleGroupUID: string, handlePoints: Array, options?: {}): void; - -// @public (undocumented) -function drawHeight(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, heightUID: string, start: Types_2.Point2, end: Types_2.Point2, options?: {}): void; - -declare namespace drawing { - export { - draw, - drawCircle, - drawEllipse, - drawEllipseByCoordinates, - drawHandles, - drawHandle, - drawLine, - drawHeight, - drawPolyline, - drawPath, - drawLinkedTextBox, - drawRect, - drawRectByCoordinates, - drawTextBox, - drawArrow, - drawRedactionRect, - setAttributesIfNecessary, - setNewAttributesIfValid - } -} -export { drawing } - -declare namespace drawing_2 { - export { - getTextBoxCoordsCanvas - } -} - -// @public (undocumented) -function drawLine(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, lineUID: string, start: Types_2.Point2, end: Types_2.Point2, options?: {}, dataId?: string): void; - -// @public (undocumented) -function drawLinkedTextBox(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, textBoxUID: string, textLines: Array, textBoxPosition: Types_2.Point2, annotationAnchorPoints: Array, textBox: unknown, options?: {}): SVGRect; - -// @public (undocumented) -function drawPath(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, pathUID: string, points: Types_2.Point2[] | Types_2.Point2[][], options: { - color?: string; - fillColor?: string; - fillOpacity?: number; - width?: number; - lineWidth?: number; - lineDash?: string; - closePath?: boolean; -}): void; - -// @public (undocumented) -function drawPolyline(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, polylineUID: string, points: Types_2.Point2[], options: { - color?: string; - fillColor?: string; - fillOpacity?: number; - width?: number; - lineWidth?: number; - lineDash?: string; - closePath?: boolean; - markerStartId?: string; - markerEndId?: string; -}): void; - -// @public (undocumented) -function drawRect(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, rectangleUID: string, start: Types_2.Point2, end: Types_2.Point2, options?: {}, dataId?: string): void; - -// @public (undocumented) -function drawRectByCoordinates(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, rectangleUID: string, canvasCoordinates: Types_2.Point2[], options?: {}, dataId?: string): void; - -// @public (undocumented) -function drawRedactionRect(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, rectangleUID: string, start: Types_2.Point2, end: Types_2.Point2, options?: {}): void; - -// @public (undocumented) -function drawTextBox(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, textUID: string, textLines: Array, position: Types_2.Point2, options?: {}): SVGRect; - -declare namespace dynamicVolume { - export { - getDataInTime, - generateImageFromTimeData, - updateVolumeFromTimeData - } -} - -declare namespace elementCursor { - export { - initElementCursor, - resetElementCursor, - hideElementCursor, - _setElementCursor as setElementCursor - } -} - -declare namespace ellipse { - export { - pointInEllipse, - precalculatePointInEllipse, - getCanvasEllipseCorners - } -} - -// @public (undocumented) -interface EllipticalROIAnnotation extends Annotation { - // (undocumented) - data: { - handles: { - points: [Types_2.Point3, Types_2.Point3, Types_2.Point3, Types_2.Point3]; - activeHandleIndex: number | null; - textBox?: { - hasMoved: boolean; - worldPosition: Types_2.Point3; - worldBoundingBox: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - }; - label: string; - cachedStats?: ROICachedStats; - initialRotation: number; - }; -} - -// @public (undocumented) -export class EllipticalROITool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: any) => void; - // (undocumented) - _activateModify: (element: any) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => EllipticalROIAnnotation; - // (undocumented) - _calculateCachedStats: (annotation: any, viewport: any, renderingEngine: any) => any; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateDraw: (element: any) => void; - // (undocumented) - _deactivateModify: (element: any) => void; - // (undocumented) - _dragDrawCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _dragHandle: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _dragModifyCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: Array; - handleIndex?: number; - movingTextBox?: boolean; - centerWorld?: Array; - canvasWidth?: number; - canvasHeight?: number; - originalHandleCanvas?: Array; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _getCanvasEllipseCenter(ellipseCanvasPoints: Types_2.Point2[]): Types_2.Point2; - // (undocumented) - handleSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: EllipticalROIAnnotation, handle: ToolHandle) => void; - // (undocumented) - static hydrate: (viewportId: string, points: Types_2.Point3[], options?: { - annotationUID?: string; - }) => EllipticalROIAnnotation; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - _isInsideVolume: (index1: any, index2: any, dimensions: any) => boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: EllipticalROIAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - _pointInEllipseCanvas(ellipse: any, location: Types_2.Point2): boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: EllipticalROIAnnotation) => void; -} - -declare namespace Enums { - export { - MouseBindings, - KeyboardBindings, - ToolModes, - AnnotationStyleStates, - Events, - SegmentationRepresentations, - Swipe, - StrategyCallbacks, - ChangeTypes, - ChangeTypes_2 as WorkerTypes - } -} -export { Enums } - -declare namespace Enums_3 { - export { - ColorbarRangeTextPosition - } -} - -// @public (undocumented) -export class EraserTool extends BaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _deleteNearbyAnnotations(evt: EventTypes_2.InteractionEventType, interactionType: string): boolean; - // (undocumented) - preMouseDownCallback: (evt: EventTypes_2.InteractionEventType) => boolean; - // (undocumented) - preTouchStartCallback: (evt: EventTypes_2.InteractionEventType) => boolean; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -export class ETDRSGridTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: any) => void; - // (undocumented) - _activateModify: (element: any) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => ETDRSGridAnnotation; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateDraw: (element: any) => void; - // (undocumented) - _deactivateModify: (element: any) => void; - // (undocumented) - _dragDrawCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _dragHandle: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _dragModifyCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: Array; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - handleSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: ETDRSGridAnnotation) => void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: ETDRSGridAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - mouseDragCallback: unknown; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: ETDRSGridAnnotation) => void; - // (undocumented) - touchDragCallback: unknown; - // (undocumented) - worldMeasureToCanvas(measurement: any, viewport: any): number; -} - -// @public (undocumented) -enum Events { - // (undocumented) - ANNOTATION_ADDED = "CORNERSTONE_TOOLS_ANNOTATION_ADDED", - // (undocumented) - ANNOTATION_COMPLETED = "CORNERSTONE_TOOLS_ANNOTATION_COMPLETED", - // (undocumented) - ANNOTATION_INTERPOLATION_PROCESS_COMPLETED = "CORNERSTONE_TOOLS_ANNOTATION_INTERPOLATION_PROCESS_COMPLETED", - // (undocumented) - ANNOTATION_LOCK_CHANGE = "CORNERSTONE_TOOLS_ANNOTATION_LOCK_CHANGE", - // (undocumented) - ANNOTATION_MODIFIED = "CORNERSTONE_TOOLS_ANNOTATION_MODIFIED", - // (undocumented) - ANNOTATION_REMOVED = "CORNERSTONE_TOOLS_ANNOTATION_REMOVED", - // (undocumented) - ANNOTATION_RENDERED = "CORNERSTONE_TOOLS_ANNOTATION_RENDERED", - // (undocumented) - ANNOTATION_SELECTION_CHANGE = "CORNERSTONE_TOOLS_ANNOTATION_SELECTION_CHANGE", - // (undocumented) - ANNOTATION_VISIBILITY_CHANGE = "CORNERSTONE_TOOLS_ANNOTATION_VISIBILITY_CHANGE", - // (undocumented) - INTERPOLATED_ANNOTATIONS_REMOVED = "CORNERSTONE_TOOLS_INTERPOLATED_ANNOTATIONS_REMOVED", - // (undocumented) - KEY_DOWN = "CORNERSTONE_TOOLS_KEY_DOWN", - // (undocumented) - KEY_UP = "CORNERSTONE_TOOLS_KEY_UP", - // (undocumented) - MOUSE_CLICK = "CORNERSTONE_TOOLS_MOUSE_CLICK", - // (undocumented) - MOUSE_DOUBLE_CLICK = "CORNERSTONE_TOOLS_MOUSE_DOUBLE_CLICK", - // (undocumented) - MOUSE_DOWN = "CORNERSTONE_TOOLS_MOUSE_DOWN", - // (undocumented) - MOUSE_DOWN_ACTIVATE = "CORNERSTONE_TOOLS_MOUSE_DOWN_ACTIVATE", - // (undocumented) - MOUSE_DRAG = "CORNERSTONE_TOOLS_MOUSE_DRAG", - // (undocumented) - MOUSE_MOVE = "CORNERSTONE_TOOLS_MOUSE_MOVE", - // (undocumented) - MOUSE_UP = "CORNERSTONE_TOOLS_MOUSE_UP", - // (undocumented) - MOUSE_WHEEL = "CORNERSTONE_TOOLS_MOUSE_WHEEL", - // (undocumented) - SEGMENTATION_ADDED = "CORNERSTONE_TOOLS_SEGMENTATION_ADDED", - // (undocumented) - SEGMENTATION_DATA_MODIFIED = "CORNERSTONE_TOOLS_SEGMENTATION_DATA_MODIFIED", - // (undocumented) - SEGMENTATION_MODIFIED = "CORNERSTONE_TOOLS_SEGMENTATION_MODIFIED", - // (undocumented) - SEGMENTATION_REMOVED = "CORNERSTONE_TOOLS_SEGMENTATION_REMOVED", - // (undocumented) - SEGMENTATION_RENDERED = "CORNERSTONE_TOOLS_SEGMENTATION_RENDERED", - // (undocumented) - SEGMENTATION_REPRESENTATION_ADDED = "CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_ADDED", - // (undocumented) - SEGMENTATION_REPRESENTATION_MODIFIED = "CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_MODIFIED", - // (undocumented) - SEGMENTATION_REPRESENTATION_REMOVED = "CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_REMOVED", - // (undocumented) - TOOL_ACTIVATED = "CORNERSTONE_TOOLS_TOOL_ACTIVATED", - // (undocumented) - TOOL_MODE_CHANGED = "CORNERSTONE_TOOLS_TOOL_MODE_CHANGED", - // (undocumented) - TOOLGROUP_VIEWPORT_ADDED = "CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_ADDED", - // (undocumented) - TOOLGROUP_VIEWPORT_REMOVED = "CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_REMOVED", - // (undocumented) - TOUCH_DRAG = "CORNERSTONE_TOOLS_TOUCH_DRAG", - // (undocumented) - TOUCH_END = "CORNERSTONE_TOOLS_TOUCH_END", - // (undocumented) - TOUCH_PRESS = "CORNERSTONE_TOOLS_TOUCH_PRESS", - // (undocumented) - TOUCH_START = "CORNERSTONE_TOOLS_TOUCH_START", - // (undocumented) - TOUCH_START_ACTIVATE = "CORNERSTONE_TOOLS_TOUCH_START_ACTIVATE", - // (undocumented) - TOUCH_SWIPE = "CORNERSTONE_TOOLS_SWIPE", - // (undocumented) - TOUCH_TAP = "CORNERSTONE_TOOLS_TAP" -} - -// @public (undocumented) -enum Events_3 { - // (undocumented) - CLIP_STARTED = "CORNERSTONE_CINE_TOOL_STARTED", - // (undocumented) - CLIP_STOPPED = "CORNERSTONE_CINE_TOOL_STOPPED" -} - -declare namespace EventTypes_2 { - export { - InteractionStartType, - InteractionEndType, - InteractionEventType, - NormalizedInteractionEventDetail, - NormalizedMouseEventType, - NormalizedTouchEventType, - ToolModeChangedEventDetail, - ToolModeChangedEventType, - ToolActivatedEventDetail, - ToolActivatedEventType, - AnnotationAddedEventDetail, - AnnotationAddedEventType, - AnnotationCompletedEventDetail, - AnnotationCompletedEventType, - AnnotationModifiedEventDetail, - AnnotationModifiedEventType, - AnnotationRemovedEventDetail, - AnnotationRemovedEventType, - AnnotationSelectionChangeEventDetail, - AnnotationSelectionChangeEventType, - AnnotationRenderedEventDetail, - AnnotationRenderedEventType, - AnnotationLockChangeEventDetail, - AnnotationVisibilityChangeEventDetail, - AnnotationLockChangeEventType, - AnnotationVisibilityChangeEventType, - AnnotationInterpolationCompletedEventDetail, - AnnotationInterpolationCompletedEventType, - AnnotationInterpolationRemovedEventDetail, - AnnotationInterpolationRemovedEventType, - ContourAnnotationCompletedEventDetail, - SegmentationDataModifiedEventType, - SegmentationRepresentationModifiedEventDetail, - SegmentationRepresentationModifiedEventType, - SegmentationRepresentationRemovedEventDetail, - SegmentationRepresentationRemovedEventType, - SegmentationRemovedEventType, - SegmentationRemovedEventDetail, - SegmentationDataModifiedEventDetail, - SegmentationRenderedEventType, - SegmentationRenderedEventDetail, - SegmentationModifiedEventType, - SegmentationModifiedEventDetail, - KeyDownEventDetail, - KeyDownEventType, - KeyUpEventDetail, - KeyUpEventType, - MouseDownEventDetail, - TouchStartEventDetail, - MouseDownEventType, - TouchStartEventType, - MouseDownActivateEventDetail, - TouchStartActivateEventDetail, - MouseDownActivateEventType, - TouchStartActivateEventType, - MouseDragEventDetail, - TouchDragEventDetail, - MouseDragEventType, - TouchDragEventType, - MouseUpEventDetail, - TouchEndEventDetail, - MouseUpEventType, - TouchEndEventType, - MouseClickEventDetail, - MouseClickEventType, - TouchTapEventDetail, - TouchTapEventType, - TouchSwipeEventDetail, - TouchSwipeEventType, - TouchPressEventDetail, - TouchPressEventType, - MouseMoveEventDetail, - MouseMoveEventType, - MouseDoubleClickEventDetail, - MouseDoubleClickEventType, - MouseWheelEventDetail, - MouseWheelEventType, - SegmentationAddedEventDetail, - SegmentationAddedEventType - } -} - -// @public (undocumented) -function extend2DBoundingBoxInViewAxis(boundsIJK: [Types_2.Point2, Types_2.Point2, Types_2.Point2], numSlicesToProject: number): [Types_2.Point2, Types_2.Point2, Types_2.Point2]; - -// @public (undocumented) -function extractWindowLevelRegionToolData(viewport: Types_2.IVolumeViewport | Types_2.IStackViewport): { - scalarData: Types_2.PixelDataTypedArray; - minPixelValue: number; - maxPixelValue: number; - width: number; - height: number; - rows: number; - columns: number; -}; - -// @public (undocumented) -const fillInsideCircle: (enabledElement: any, operationData: any) => unknown; - -// @public (undocumented) -const fillInsideRectangle: (enabledElement: any, operationData: any) => unknown; - -// @public (undocumented) -function fillOutsideCircle(): void; - -// @public (undocumented) -function filterAnnotationsForDisplay(viewport: Types_2.IViewport, annotations: Annotations, filterOptions?: Types_2.ReferenceCompatibleOptions): Annotations; - -// @public (undocumented) -function filterAnnotationsWithinSamePlane(annotations: Annotations, camera: Types_2.ICamera): Annotations; - -// @public (undocumented) -function filterAnnotationsWithinSlice(annotations: Annotations, camera: Types_2.ICamera, spacingInNormalDirection: number): Annotations; - -// @public (undocumented) -function filterViewportsWithFrameOfReferenceUID(viewports: Array, FrameOfReferenceUID: string): Array; - -// @public (undocumented) -function filterViewportsWithParallelNormals(viewports: any, camera: any, EPS?: number): any; - -// @public (undocumented) -function filterViewportsWithToolEnabled(viewports: Array, toolName: string): Array; - -// @public (undocumented) -function findClosestPoint(sourcePoints: Array, targetPoint: Types_2.Point2): Types_2.Point2; - -// @public (undocumented) -function findHandlePolylineIndex(annotation: ContourAnnotation, handleIndex: number): number; - -// @public (undocumented) -function floodFill(getter: FloodFillGetter, seed: Types_2.Point2 | Types_2.Point3, options?: FloodFillOptions): FloodFillResult; - -// @public (undocumented) -type FloodFillGetter = FloodFillGetter2D | FloodFillGetter3D; - -// @public (undocumented) -type FloodFillOptions = { - onFlood?: (x: number, y: number, z?: number) => void; - onBoundary?: (x: number, y: number, z?: number) => void; - equals?: (a: any, b: any) => boolean; - diagonals?: boolean; - bounds?: Map; - filter?: (point: any) => boolean; -}; - -// @public (undocumented) -type FloodFillResult = { - flooded: Types_2.Point2[] | Types_2.Point3[]; -}; - -// @public (undocumented) -class FrameOfReferenceSpecificAnnotationManager implements IAnnotationManager { - constructor(uid?: string); - // (undocumented) - addAnnotation: (annotation: Annotation, groupKey?: string) => void; - // (undocumented) - getAllAnnotations: () => Annotations; - // (undocumented) - getAnnotation: (annotationUID: string) => Annotation | undefined; - // (undocumented) - getAnnotations: (groupKey: string, toolName?: string) => GroupSpecificAnnotations | Annotations; - // (undocumented) - getFramesOfReference: () => Array; - // (undocumented) - getGroupKey: (annotationGroupSelector: AnnotationGroupSelector) => string; - // (undocumented) - getNumberOfAllAnnotations: () => number; - // (undocumented) - getNumberOfAnnotations: (groupKey: string, toolName?: string) => number; - // (undocumented) - _imageVolumeModifiedHandler: (evt: Types_2.EventTypes.ImageVolumeModifiedEvent) => void; - // (undocumented) - removeAllAnnotations: () => Annotations; - // (undocumented) - removeAnnotation: (annotationUID: string) => void; - // (undocumented) - removeAnnotations: (groupKey: string, toolName?: string) => Annotations; - // (undocumented) - restoreAnnotations: (state: AnnotationState | GroupSpecificAnnotations | Annotations, groupKey?: string, toolName?: string) => void; - // (undocumented) - saveAnnotations: (groupKey?: string, toolName?: string) => AnnotationState | GroupSpecificAnnotations | Annotations; - // (undocumented) - setPreprocessingFn(preprocessingFn: (annotation: Annotation) => Annotation): void; - // (undocumented) - readonly uid: string; -} - -// @public (undocumented) -function generateContourSetsFromLabelmap({ segmentations }: { - segmentations: any; -}): any[]; - -// @public (undocumented) -function generateImageFromTimeData(dynamicVolume: Types_2.IDynamicImageVolume, operation: Enums_2.GenerateImageType, options: { - dimensionGroupNumbers?: number[]; - frameNumbers?: number[]; -}): Float32Array; - -// @public (undocumented) -function getAABB(polyline: Types_2.Point2[] | Types_2.Point3[] | number[], options?: { - numDimensions: number; -}): Types_2.AABB2 | Types_2.AABB3; - -// @public (undocumented) -function getActiveSegmentation(viewportId: string): Segmentation; - -// @public (undocumented) -function getActiveSegmentIndex(segmentationId: string): number | undefined; - -// @public (undocumented) -function getAllSynchronizers(): Array; - -// @public (undocumented) -function getAllToolGroups(): Array; - -// @public (undocumented) -function getAnnotationNearPoint(element: HTMLDivElement, canvasPoint: Types_2.Point2, proximity?: number): Annotation | null; - -// @public (undocumented) -function getAnnotationNearPointOnEnabledElement(enabledElement: Types_2.IEnabledElement, point: Types_2.Point2, proximity: number): Annotation | null; - -// @public (undocumented) -function getAnnotationsLocked(): Array; - -// @public (undocumented) -function getAnnotationsLockedCount(): number; - -// @public (undocumented) -function getAnnotationsSelected(): Array; - -// @public (undocumented) -function getAnnotationsSelectedByToolName(toolName: string): Array; - -// @public (undocumented) -function getAnnotationsSelectedCount(): number; - -// @public (undocumented) -function getArea(points: Types_2.Point2[]): number; - -// @public (undocumented) -function getBoundingBoxAroundShapeIJK(points: Types_2.Point2[] | Types_2.Point3[], dimensions?: Types_2.Point2 | Types_2.Point3): BoundingBox; - -// @public (undocumented) -function getBoundingBoxAroundShapeWorld(points: Types_2.Point2[] | Types_2.Point3[], clipBounds?: Types_2.Point2 | Types_2.Point3): BoundingBox; - -// @public (undocumented) -function getBoundsIJKFromRectangleAnnotations(annotations: any, referenceVolume: any, options?: Options_3): any; - -// @public (undocumented) -function getBrushSizeForToolGroup(toolGroupId: string, toolName?: string): void; - -// @public (undocumented) -function getBrushThresholdForToolGroup(toolGroupId: string): any; - -// @public (undocumented) -function getBrushToolInstances(toolGroupId: string, toolName?: string): any[]; - -// @public (undocumented) -const getCalibratedAspect: (image: any) => any; - -// @public (undocumented) -const getCalibratedLengthUnitsAndScale: (image: any, handles: any) => { - unit: string; - areaUnit: string; - scale: number; -}; - -// @public (undocumented) -const getCalibratedProbeUnitsAndValue: (image: any, handles: any) => { - units: string[]; - values: any[]; - calibrationType?: undefined; -} | { - units: string[]; - values: any[]; - calibrationType: string; -}; - -// @public (undocumented) -function getCanvasCircleCorners(circleCanvasPoints: canvasCoordinates): Array; - -// @public (undocumented) -function getCanvasCircleRadius(circleCanvasPoints: canvasCoordinates): number; - -// @public (undocumented) -function getCanvasEllipseCorners(ellipseCanvasPoints: CanvasCoordinates): Array; - -// @public (undocumented) -function getClosestImageIdForStackViewport(viewport: StackViewport, worldPos: Types_2.Point3, viewPlaneNormal: Types_2.Point3): string; - -// @public (undocumented) -function getClosestLineSegmentIntersection(points: Types_2.Point2[], p1: Types_2.Point2, q1: Types_2.Point2, closed?: boolean): { - segment: Types_2.Point2; - distance: number; -} | undefined; - -// @public (undocumented) -function getColorLUT(index: number): Types_2.ColorLUT | undefined; - -// @public (undocumented) -function getContourHolesDataCanvas(annotation: Annotation, viewport: Types_2.IViewport): Types_2.Point2[][]; - -// @public (undocumented) -function getContourHolesDataWorld(annotation: Annotation): Types_2.Point3[][]; - -// @public (undocumented) -function getCurrentLabelmapImageIdForViewport(viewportId: string, segmentationId: string): string; - -// @public (undocumented) -function getDataInTime(dynamicVolume: Types_2.IDynamicImageVolume, options: { - dimensionGroupNumbers?: number[]; - frameNumbers?: number[]; - maskVolumeId?: string; - worldCoordinate?: Types_2.Point3; -}): number[] | number[][]; - -// @public (undocumented) -function getDeduplicatedVTKPolyDataPoints(polyData: any, bypass?: boolean): { - points: any[]; - lines: { - a: any; - b: any; - }[]; -}; - -// @public (undocumented) -function getDeltaDistance(currentPoints: IPoints[], lastPoints: IPoints[]): IDistance; - -// @public (undocumented) -function getDeltaDistanceBetweenIPoints(currentPoints: IPoints[], lastPoints: IPoints[]): IDistance; - -// @public (undocumented) -function getDeltaPoints(currentPoints: IPoints[], lastPoints: IPoints[]): IPoints; - -// @public (undocumented) -function getDeltaRotation(currentPoints: ITouchPoints[], lastPoints: ITouchPoints[]): void; - -// @public (undocumented) -function getFirstLineSegmentIntersectionIndexes(points: Types_2.Point2[], p1: Types_2.Point2, q1: Types_2.Point2, closed?: boolean): Types_2.Point2 | undefined; - -// @public (undocumented) -function getFont(styleSpecifier: StyleSpecifier, state?: AnnotationStyleStates, mode?: ToolModes): string; - -// @public (undocumented) -function getHiddenSegmentIndices(viewportId: string, specifier: { - segmentationId: string; - type: SegmentationRepresentations; -}): Set; - -// @public (undocumented) -function getHoveredContourSegmentationAnnotation(segmentationId: any): number; - -// @public (undocumented) -function getLabelmapImageIds(segmentationId: string): string | undefined; - -// @public (undocumented) -function getLineSegmentIntersectionsCoordinates(points: Types_2.Point2[], p1: Types_2.Point2, q1: Types_2.Point2, closed?: boolean): Types_2.Point2[]; - -// @public (undocumented) -function getLineSegmentIntersectionsIndexes(polyline: Types_2.Point2[], p1: Types_2.Point2, q1: Types_2.Point2, closed?: boolean): Types_2.Point2[]; - -// @public (undocumented) -function getLockedSegmentIndices(segmentationId: string): number[] | []; - -// @public (undocumented) -function getLuminanceFromRegion(imageData: any, x: any, y: any, width: any, height: any): any[]; - -// @public (undocumented) -function getMeanPoints(points: IPoints[]): IPoints; - -// @public (undocumented) -function getMeanTouchPoints(points: ITouchPoints[]): ITouchPoints; - -// @public (undocumented) -function getNextColorLUTIndex(): number; - -// @public (undocumented) -function getNormal2(polyline: Types_2.Point2[]): Types_2.Point3; - -// @public (undocumented) -function getNormal3(polyline: Types_2.Point3[]): Types_2.Point3; - -// @public (undocumented) -function getOrientationStringLPS(vector: Types_2.Point3): string; - -// @public (undocumented) -function getPixelValueUnits(modality: string, imageId: string, options: pixelUnitsOptions): string; - -// @public (undocumented) -function getPoint(points: any, idx: any): Types_2.Point3; - -// @public (undocumented) -function getPointInLineOfSightWithCriteria(viewport: Types_2.IVolumeViewport, worldPos: Types_2.Point3, targetVolumeId: string, criteriaFunction: (intensity: number, point: Types_2.Point3) => Types_2.Point3, stepSize?: number): Types_2.Point3; - -// @public (undocumented) -function getPointsInLineOfSight(viewport: Types_2.IVolumeViewport, worldPos: Types_2.Point3, { targetVolumeId, stepSize }: { - targetVolumeId: string; - stepSize: number; -}): Types_2.Point3[]; - -// @public (undocumented) -function getPolyDataPointIndexes(polyData: vtkPolyData): any[]; - -// @public (undocumented) -function getPolyDataPoints(polyData: vtkPolyData): any[]; - -// @public (undocumented) -function getRenderInactiveSegmentations(viewportId: string): boolean; - -// @public (undocumented) -function getSegmentation(segmentationId: string): Segmentation | undefined; - -// @public (undocumented) -function getSegmentationRepresentation(viewportId: string, specifier: { - segmentationId: string; - type: SegmentationRepresentations; -}): SegmentationRepresentation | undefined; - -// @public (undocumented) -function getSegmentationRepresentations(viewportId: string, specifier?: { - segmentationId?: string; - type?: SegmentationRepresentations; -}): SegmentationRepresentation[] | []; - -// @public (undocumented) -function getSegmentationRepresentationsBySegmentationId(segmentationId: string): { - viewportId: string; - representations: SegmentationRepresentation[]; -}[]; - -// @public (undocumented) -function getSegmentationRepresentationVisibility(viewportId: string, specifier: { - segmentationId: string; - type: SegmentationRepresentations; -}): boolean | undefined; - -// @public (undocumented) -function getSegmentations(): Segmentation[] | []; - -// @public (undocumented) -function getSegmentIndexAtLabelmapBorder(segmentationId: string, worldPoint: Types_2.Point3, { viewport, searchRadius }: Options_2): number; - -// @public (undocumented) -function getSegmentIndexAtWorldPoint(segmentationId: string, worldPoint: Types_2.Point3, options?: Options): number; - -// @public (undocumented) -function getSegmentIndexColor(viewportId: string, segmentationId: string, segmentIndex: number): Types_2.Color; - -// @public (undocumented) -function getSegmentIndexVisibility(viewportId: string, specifier: { - segmentationId: string; - type: SegmentationRepresentations; -}, segmentIndex: number): boolean; - -// @public (undocumented) -function getSignedArea(polyline: Types_2.Point2[]): number; - -// @public (undocumented) -function getSphereBoundsInfo(circlePoints: [Types_2.Point3, Types_2.Point3], imageData: vtkImageData): SphereBoundsInfo; - -// @public (undocumented) -function getStackSegmentationImageIdsForViewport(viewportId: string, segmentationId: string): string[]; - -// @public (undocumented) -function getState(annotation?: Annotation): AnnotationStyleStates; - -// @public (undocumented) -function getStyle(specifier: SpecifierWithType): StyleForType; - -// @public (undocumented) -const getSubPixelSpacingAndXYDirections: (viewport: Types_2.IStackViewport | Types_2.IVolumeViewport, subPixelResolution: number) => { - spacing: Types_2.Point2; - xDir: Types_2.Point3; - yDir: Types_2.Point3; -}; - -// @public (undocumented) -function getSynchronizer(synchronizerId: string): Synchronizer | void; - -// @public (undocumented) -function getSynchronizersForViewport(viewportId: string, renderingEngineId: string): Array; - -// @public (undocumented) -function getTextBoxCoordsCanvas(annotationCanvasPoints: Array): Types_2.Point2; - -// @public (undocumented) -function getToolGroup(toolGroupId: string): ToolGroup | undefined; - -// @public (undocumented) -function getToolGroupForViewport(viewportId: string, renderingEngineId?: string): ToolGroup | undefined; - -// @public (undocumented) -function getToolGroupsWithToolName(toolName: string): ToolGroup[] | []; - -// @public (undocumented) -function getToolState(element: HTMLDivElement): CINETypes.ToolData | undefined; - -// @public (undocumented) -function getUniqueSegmentIndices(segmentationId: any): any; - -// @public (undocumented) -function getViewportForAnnotation(annotation: Annotation): Types_2.IStackViewport | Types_2.IVolumeViewport | undefined; - -// @public (undocumented) -function getViewportIdsWithSegmentation(segmentationId: string): string[]; - -// @public (undocumented) -function getViewportIdsWithToolToRender(element: HTMLDivElement, toolName: string, requireParallelNormals?: boolean): string[]; - -// @public (undocumented) -function getViewportSegmentations(viewportId: string, type?: SegmentationRepresentations): Segmentation[]; - -// @public (undocumented) -function getWindingDirection(polyline: Types_2.Point2[]): number; - -// @public (undocumented) -function getWorldWidthAndHeightFromCorners(viewPlaneNormal: Types_2.Point3, viewUp: Types_2.Point3, topLeftWorld: Types_2.Point3, bottomRightWorld: Types_2.Point3): { - worldWidth: number; - worldHeight: number; -}; - -// @public (undocumented) -function getWorldWidthAndHeightFromTwoPoints(viewPlaneNormal: Types_2.Point3, viewUp: Types_2.Point3, worldPos1: Types_2.Point3, worldPos2: Types_2.Point3): { - worldWidth: number; - worldHeight: number; -}; - -// @public (undocumented) -type GroupSpecificAnnotations = { - [toolName: string]: Annotations; -}; - -declare namespace growCut { - export { - runGrowCut as run, - runGrowCutForSphere, - runGrowCutForBoundingBox, - runOneClickGrowCut, - SphereInfo, - GrowCutOptions as GrowCutSphereOptions, - GrowCutBoundingBoxOptions, - GrowCutOneClickOptions - } -} - -// @public (undocumented) -type GrowCutBoundingBoxOptions = GrowCutOptions & { - negativePixelRange?: [number, number]; - positivePixelRange?: [number, number]; -}; - -// @public (undocumented) -type GrowCutOneClickOptions = GrowCutOptions & { - subVolumePaddingPercentage?: number | [number, number, number]; - subVolumeMinPadding?: number | [number, number, number]; -}; - -// @public (undocumented) -type GrowCutOptions = { - maxProcessingTime?: number; - windowSize?: number; - positiveSeedValue?: number; - negativeSeedValue?: number; - positiveSeedVariance?: number; - negativeSeedVariance?: number; - inspection?: { - numCyclesInterval?: number; - numCyclesBelowThreashold?: number; - threshold?: number; - }; -}; - -// @public (undocumented) -function hasCustomStyle(specifier: { - viewportId?: string; - segmentationId?: string; - type?: SegmentationRepresentations; - segmentIndex?: number; -}): boolean; - -// @public (undocumented) -function hasTool(ToolClass: any): boolean; - -// @public (undocumented) -export class HeightTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _activateModify: (element: HTMLDivElement) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => LengthAnnotation; - // (undocumented) - _calculateCachedStats(annotation: any, renderingEngine: any, enabledElement: any): any; - // (undocumented) - _calculateHeight(pos1: any, pos2: any): number; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _deactivateModify: (element: HTMLDivElement) => void; - // (undocumented) - _dragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - handleIndex?: number; - movingTextBox?: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: LengthAnnotation, handle: ToolHandle): void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - _isInsideVolume(index1: any, index2: any, dimensions: any): boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: LengthAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - midX: number; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: LengthAnnotation) => void; -} - -// @public (undocumented) -const helpers: { - clearSegmentValue: typeof clearSegmentValue; - convertStackToVolumeLabelmap: typeof convertStackToVolumeLabelmap; - computeVolumeLabelmapFromStack: typeof computeVolumeLabelmapFromStack; - convertVolumeToStackLabelmap: typeof convertVolumeToStackLabelmap; -}; - -// @public (undocumented) -function hideElementCursor(element: HTMLDivElement): void; - -// @public (undocumented) -interface IAnnotationManager { - // (undocumented) - addAnnotation: (annotation: Annotation, groupKey: string) => void; - // (undocumented) - getAnnotation: (annotationUID: string) => Annotation; - // (undocumented) - getAnnotations: (groupKey: string, toolName?: string) => GroupSpecificAnnotations | Annotations; - // (undocumented) - getGroupKey: (annotationGroupSelector: AnnotationGroupSelector) => string; - // (undocumented) - getNumberOfAllAnnotations: () => number; - // (undocumented) - getNumberOfAnnotations: (groupKey: string, toolName?: string) => number; - // (undocumented) - removeAllAnnotations: () => void; - // (undocumented) - removeAnnotation: (annotationUID: string) => void; - // (undocumented) - removeAnnotations: (groupKey: string) => void; -} - -// @public (undocumented) -type IBaseTool = BaseTool; - -// @public (undocumented) -type IDistance = { - page: number; - client: number; - canvas: number; - world: number; -}; - -// @public (undocumented) -type ImageInterpolationData = { - sliceIndex: number; - annotations?: Annotation[]; -}; - -// @public (undocumented) -class ImageMouseCursor extends MouseCursor { - constructor(url: string, x?: number, y?: number, name?: string | undefined, fallback?: MouseCursor | undefined); - // (undocumented) - getStyleProperty(): string; - // (undocumented) - static getUniqueInstanceName(prefix: string): string; -} - -// @public (undocumented) -export function init(defaultConfiguration?: {}): void; - -// @public (undocumented) -function initElementCursor(element: HTMLDivElement, cursor: MouseCursor | null): void; - -// @public (undocumented) -type InteractionEndType = Types_2.CustomEventType; - -// @public (undocumented) -type InteractionEventType = Types_2.CustomEventType; - -// @public (undocumented) -type InteractionStartType = Types_2.CustomEventType; - -// @public (undocumented) -type InteractionTypes = 'Mouse' | 'Touch'; - -// @public (undocumented) -function internalAddRepresentationData({ segmentationId, type, data, }: AddRepresentationData): void; - -// @public (undocumented) -type InterpolationROIAnnotation = ContourAnnotation & ContourSegmentationAnnotationData & { - metadata: { - annotationUID?: string; - }; - interpolationUID?: string; - interpolationCompleted?: boolean; - isInterpolationUpdate?: boolean; -}; - -// @public (undocumented) -type InterpolationViewportData = { - annotation: InterpolationROIAnnotation; - interpolationUID: string; - viewport: Types_2.IViewport; - sliceData: Types_2.ImageSliceData; - isInterpolationUpdate?: boolean; -}; - -// @public (undocumented) -function intersectAABB(aabb1: Types_2.AABB2, aabb2: Types_2.AABB2): boolean; - -// @public (undocumented) -function intersectLine(line1Start: Types_2.Point2, line1End: Types_2.Point2, line2Start: Types_2.Point2, line2End: Types_2.Point2): number[]; - -// @public (undocumented) -function intersectPolyline(sourcePolyline: Types_2.Point2[], targetPolyline: Types_2.Point2[]): boolean; - -// @public (undocumented) -function invalidateBrushCursor(toolGroupId: string): void; - -// @public (undocumented) -function invertOrientationStringLPS(orientationString: string): string; - -// @public (undocumented) -type IPoints = { - page: Types_2.Point2; - client: Types_2.Point2; - canvas: Types_2.Point2; - world: Types_2.Point3; -}; - -// @public (undocumented) -function isAnnotationLocked(annotationUID: string): boolean; - -// @public (undocumented) -function isAnnotationSelected(annotationUID: string): boolean; - -// @public (undocumented) -function isAnnotationVisible(annotationUID: string): boolean | undefined; - -// @public (undocumented) -function isAxisAlignedRectangle(rectangleCornersIJK: any): boolean; - -// @public (undocumented) -function isClosed(polyline: Types_2.Point2[]): boolean; - -// @public (undocumented) -function isContourSegmentationAnnotation(annotation: Annotation): annotation is ContourSegmentationAnnotation; - -// @public (undocumented) -interface ISculptToolShape { - // (undocumented) - configureToolSize(evt: EventTypes_2.InteractionEventType): void; - // (undocumented) - getInsertPosition(previousIndex: number, nextIndex: number, sculptData: SculptData): Types_2.Point3; - // (undocumented) - getMaxSpacing(minSpacing: number): number; - // (undocumented) - pushHandles(viewport: Types_2.IViewport, sculptData: SculptData): PushedHandles; - // (undocumented) - renderShape(svgDrawingHelper: SVGDrawingHelper, canvasLocation: Types_2.Point2, options: any): void; - // (undocumented) - updateToolSize(canvasCoords: Types_2.Point2, viewport: Types_2.IViewport, activeAnnotation: ContourAnnotation): void; -} - -// @public (undocumented) -class IslandRemoval { - constructor(options?: { - maxInternalRemove?: number; - fillInternalEdge?: boolean; - }); - // (undocumented) - static covers(rle: any, row: any): boolean; - // (undocumented) - fillSegments: (index: number) => boolean; - // (undocumented) - floodFillSegmentIsland(): number; - // (undocumented) - initialize(viewport: any, segmentationVoxels: any, options: any): boolean; - // (undocumented) - previewSegmentIndex: number; - // (undocumented) - previewVoxelManager: Types_2.VoxelManager; - // (undocumented) - removeExternalIslands(): void; - // (undocumented) - removeInternalIslands(): number[]; - // (undocumented) - segmentIndex: number; - // (undocumented) - segmentSet: Types_2.RLEVoxelMap; - // (undocumented) - selectedPoints: Types_2.Point3[]; -} - -// @public (undocumented) -function isObject(value: any): boolean; - -// @public (undocumented) -const isPlaneIntersectingAABB: (origin: any, normal: any, minX: any, minY: any, minZ: any, maxX: any, maxY: any, maxZ: any) => boolean; - -// @public (undocumented) -interface ISpline { - // (undocumented) - get aabb(): Types_2.AABB2; - // (undocumented) - addControlPoint(point: Types_2.Point2): void; - // (undocumented) - addControlPointAtU(u: number): ControlPointInfo; - // (undocumented) - addControlPoints(points: Types_2.Point2[]): void; - // (undocumented) - clearControlPoints(): void; - // (undocumented) - get closed(): boolean; - set closed(closed: boolean); - // (undocumented) - containsPoint(point: Types_2.Point2): boolean; - // (undocumented) - deleteControlPointByIndex(index: number): boolean; - // (undocumented) - get fixedResolution(): boolean; - // (undocumented) - getClosestControlPoint(point: Types_2.Point2): ClosestControlPoint; - // (undocumented) - getClosestControlPointWithinDistance(point: Types_2.Point2, range: number): ClosestControlPoint; - // (undocumented) - getClosestPoint(point: Types_2.Point2): ClosestSplinePoint; - // (undocumented) - getClosestPointOnControlPointLines(point: Types_2.Point2): ClosestPoint; - // (undocumented) - getControlPoints(): Types_2.Point2[]; - // (undocumented) - getPolylinePoints(): Types_2.Point2[]; - // (undocumented) - getPreviewPolylinePoints(controlPointPreview: Types_2.Point2, closeDistance: number): Types_2.Point2[]; - // (undocumented) - hasTangentPoints(): boolean; - // (undocumented) - get invalidated(): boolean; - // (undocumented) - isPointNearCurve(point: Types_2.Point2, maxDist: number): boolean; - // (undocumented) - get length(): number; - // (undocumented) - get numControlPoints(): number; - // (undocumented) - get resolution(): number; - set resolution(resolution: number); - // (undocumented) - setControlPoints(points: Types_2.Point2[]): void; - // (undocumented) - updateControlPoint(index: number, newControlPoint: Types_2.Point2): void; -} - -// @public (undocumented) -function isPointInsidePolyline3D(point: Types_2.Point3, polyline: Types_2.Point3[], options?: { - holes?: Types_2.Point3[][]; -}): boolean; - -// @public (undocumented) -function isPointOnLineSegment(lineStart: Types_2.Point2, lineEnd: Types_2.Point2, point: Types_2.Point2): boolean; - -// @public (undocumented) -function isSegmentIndexLocked(segmentationId: string, segmentIndex: number): boolean; - -// @public (undocumented) -function isViewportPreScaled(viewport: Types_2.IStackViewport | Types_2.IVolumeViewport, targetId: string): boolean; - -// @public (undocumented) -interface ISynchronizerEventHandler { - // (undocumented) - (synchronizer: Synchronizer, sourceViewport: Types_2.IViewportId, targetViewport: Types_2.IViewportId, sourceEvent: any, options?: unknown): Promise | void; -} - -// @public (undocumented) -type IToolBinding = { - mouseButton?: ToolBindingMouseType; - modifierKey?: ToolBindingKeyboardType; - numTouchPoints?: number; -}; - -// @public (undocumented) -type IToolClassReference = new (config: unknown) => T; - -// @public (undocumented) -type ITouchPoints = IPoints & { - touch: { - identifier: string; - radiusX: number; - radiusY: number; - force: number; - rotationAngle: number; - }; -}; - -// @public (undocumented) -enum KeyboardBindings { - // (undocumented) - Alt = 18, - // (undocumented) - AltMeta = 1891, - // (undocumented) - Ctrl = 17, - // (undocumented) - CtrlAlt = 1718, - // (undocumented) - CtrlMeta = 1791, - // (undocumented) - Meta = 91, - // (undocumented) - Shift = 16, - // (undocumented) - ShiftAlt = 1618, - // (undocumented) - ShiftCtrl = 1617, - // (undocumented) - ShiftMeta = 1691 -} - -// @public (undocumented) -type KeyDownEventDetail = { - element: HTMLDivElement; - viewportId: string; - renderingEngineId: string; - key: string; - keyCode: number; -}; - -// @public (undocumented) -type KeyDownEventType = Types_2.CustomEventType; - -// @public (undocumented) -export class KeyImageTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateModify: (element: HTMLDivElement) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => Annotation; - // (undocumented) - cancel(): void; - // (undocumented) - _deactivateModify: (element: HTMLDivElement) => void; - // (undocumented) - _doneChangingTextCallback(element: any, annotation: any, updatedText: any): void; - // (undocumented) - doubleClickCallback: (evt: EventTypes_2.TouchTapEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - handleIndex?: number; - movingTextBox?: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: Annotation, handle: ToolHandle): void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - _isInsideVolume(index1: any, index2: any, dimensions: any): boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: Annotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: Annotation) => void; -} - -// @public (undocumented) -type KeyUpEventDetail = KeyDownEventDetail; - -// @public (undocumented) -type KeyUpEventType = Types_2.CustomEventType; - -// @public (undocumented) -interface LabelAnnotation extends Annotation { - // (undocumented) - data: { - text: string; - handles: { - points: Types_2.Point3[]; - }; - }; -} - -// @public (undocumented) -export class LabelmapBaseTool extends BaseTool { - constructor(toolProps: any, defaultToolProps: any); - // (undocumented) - acceptPreview(element?: HTMLDivElement): void; - // (undocumented) - addPreview(element?: HTMLDivElement, options?: { - acceptReject: boolean; - }): unknown; - // (undocumented) - protected createEditData(element: any): EditDataReturnType; - // (undocumented) - protected createHoverData(element: any, centerCanvas?: any): { - brushCursor: { - metadata: { - viewPlaneNormal: Types_2.Point3; - viewUp: Types_2.Point3; - FrameOfReferenceUID: string; - referencedImageId: string; - toolName: string; - segmentColor: Types_2.Color; - }; - data: {}; - }; - centerCanvas: any; - segmentIndex: number; - viewport: Types_2.IStackViewport | VolumeViewport; - segmentationId: string; - segmentColor: Types_2.Color; - viewportIdsToRender: string[]; - }; - // (undocumented) - createMemo(segmentId: string, segmentationVoxelManager: any, preview: any): LabelmapMemo.LabelmapMemo; - // (undocumented) - protected _editData: { - override: { - voxelManager: Types_2.IVoxelManager; - imageData: vtkImageData; - }; - segmentsLocked: number[]; - imageId?: string; - imageIds?: string[]; - volumeId?: string; - referencedVolumeId?: string; - } | null; - // (undocumented) - protected getActiveSegmentationData(viewport: any): { - segmentIndex: number; - segmentationId: string; - segmentColor: Types_2.Color; - }; - // (undocumented) - protected getEditData({ viewport, representationData, segmentsLocked, segmentationId, volumeOperation, }: { - viewport: any; - representationData: any; - segmentsLocked: any; - segmentationId: any; - volumeOperation?: boolean; - }): EditDataReturnType; - // (undocumented) - protected getOperationData(element?: any): ModifiedLabelmapToolOperationData; - // (undocumented) - protected _hoverData?: { - brushCursor: any; - segmentationId: string; - segmentIndex: number; - segmentColor: [number, number, number, number]; - viewportIdsToRender: string[]; - centerCanvas?: Array; - viewport: Types_2.IViewport; - }; - // (undocumented) - static previewData?: PreviewData; - // (undocumented) - protected get _previewData(): PreviewData; - // (undocumented) - rejectPreview(element?: HTMLDivElement): void; - // (undocumented) - static viewportContoursToLabelmap(viewport: Types_2.IViewport, options?: { - removeContours: boolean; - }): void; -} - -declare namespace LabelmapMemo { - export { - createLabelmapMemo, - restoreMemo, - createRleMemo, - createPreviewMemo, - LabelmapMemo_2 as LabelmapMemo - } -} - -// @public (undocumented) -type LabelmapMemo_2 = Types_2.Memo & { - segmentationVoxelManager: Types_2.IVoxelManager; - voxelManager: Types_2.IVoxelManager; - redoVoxelManager?: Types_2.IVoxelManager; - undoVoxelManager?: Types_2.IVoxelManager; - memo?: LabelmapMemo_2; -}; - -// @public (undocumented) -type LabelmapStyle = BaseLabelmapStyle & InactiveLabelmapStyle; - -// @public (undocumented) -type LabelmapToolOperationData = { - segmentationId: string; - segmentIndex: number; - previewColors?: Record; - segmentsLocked: number[]; - viewPlaneNormal: number[]; - viewUp: number[]; - strategySpecificConfiguration: any; - points: Types_2.Point3[]; - voxelManager: any; - override: { - voxelManager: Types_2.IVoxelManager; - imageData: vtkImageData; - }; - preview: any; - toolGroupId: string; - createMemo: (segmentId: any, segmentVoxels: any, previewVoxels?: any, previewMemo?: any) => LabelmapMemo_2; -}; - -// @public (undocumented) -type LabelmapToolOperationDataStack = LabelmapToolOperationData & LabelmapSegmentationDataStack; - -// @public (undocumented) -type LabelmapToolOperationDataVolume = LabelmapToolOperationData & LabelmapSegmentationDataVolume; - -// @public (undocumented) -export class LabelTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _activateModify: (element: HTMLDivElement) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => LabelAnnotation; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _deactivateModify: (element: HTMLDivElement) => void; - // (undocumented) - _doneChangingTextCallback(element: any, annotation: any, updatedText: any): void; - // (undocumented) - _dragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - newAnnotation?: boolean; - hasMoved?: boolean; - offset: Types_2.Point3; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: Annotation, handle: ToolHandle, interactionType: InteractionTypes): void; - // (undocumented) - static hydrate: (viewportId: string, position: Types_2.Point3, text: string, options?: { - annotationUID?: string; - }) => LabelAnnotation; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - _isInsideVolume(index1: any, index2: any, dimensions: any): boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: LabelAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - static toolName: any; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: LabelAnnotation) => void; -} - -// @public (undocumented) -interface LengthAnnotation extends Annotation { - // (undocumented) - data: { - handles: { - points: Types_2.Point3[]; - activeHandleIndex: number | null; - textBox: { - hasMoved: boolean; - worldPosition: Types_2.Point3; - worldBoundingBox: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - }; - label: string; - cachedStats: { - [targetId: string]: { - length: number; - unit: string; - }; - }; - }; -} - -// @public (undocumented) -export class LengthTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _activateModify: (element: HTMLDivElement) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => LengthAnnotation; - // (undocumented) - _calculateCachedStats(annotation: any, renderingEngine: any, enabledElement: any): any; - // (undocumented) - _calculateLength(pos1: any, pos2: any): number; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _deactivateModify: (element: HTMLDivElement) => void; - // (undocumented) - _dragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - handleIndex?: number; - movingTextBox?: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: LengthAnnotation, handle: ToolHandle): void; - // (undocumented) - static hydrate: (viewportId: string, points: Types_2.Point3[], options?: { - annotationUID?: string; - }) => LengthAnnotation; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - _isInsideVolume(index1: any, index2: any, dimensions: any): boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: LengthAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: LengthAnnotation) => void; -} - -// @public (undocumented) -class LinearSpline extends CardinalSpline { - constructor(); -} - -declare namespace lineSegment { - export { - distanceToPoint_2 as distanceToPoint, - distanceToPointSquared_2 as distanceToPointSquared, - distanceToPointSquaredInfo, - intersectLine, - isPointOnLineSegment - } -} - -// @public (undocumented) -type LivewireContourAnnotation = ContourAnnotation; - -// @public (undocumented) -type LivewireContourSegmentationAnnotation = LivewireContourAnnotation & ContourSegmentationAnnotationData; - -// @public (undocumented) -export class LivewireContourSegmentationTool extends LivewireContourTool { - // (undocumented) - protected isContourSegmentationTool(): boolean; - // (undocumented) - protected renderAnnotationInstance(renderContext: any): boolean; - // (undocumented) - static toolName: string; - // (undocumented) - updateInterpolatedAnnotation(annotation: ContourSegmentationAnnotation, enabledElement: Types_2.IEnabledElement): void; -} - -// @public (undocumented) -export class LivewireContourTool extends ContourSegmentationBaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - addNewAnnotation(evt: EventTypes_2.InteractionEventType): LivewireContourAnnotation; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - cancelInProgress(element: any, config: any, evt: any): void; - // (undocumented) - protected clearEditData(): void; - // (undocumented) - protected createAnnotation(evt: EventTypes_2.InteractionEventType): ContourAnnotation; - // (undocumented) - editData: { - annotation: LivewireContourAnnotation; - viewportIdsToRender: Array; - handleIndex?: number; - movingTextBox?: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - lastCanvasPoint?: Types_2.Point2; - confirmedPath?: LivewirePath; - currentPath?: LivewirePath; - confirmedPathNext?: LivewirePath; - closed?: boolean; - worldToSlice?: (point: Types_2.Point3) => Types_2.Point2; - sliceToWorld?: (point: Types_2.Point2) => Types_2.Point3; - originalPath?: Types_2.Point3[]; - contourHoleProcessingEnabled?: boolean; - } | null; - // (undocumented) - editHandle(worldPos: Types_2.Point3, element: any, annotation: LivewireContourAnnotation, handleIndex: number): void; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType, clearAnnotation?: boolean) => void; - // (undocumented) - handleSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: LivewireContourAnnotation, handle: ToolHandle) => void; - // (undocumented) - protected isContourSegmentationTool(): boolean; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: LivewireContourAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - renderAnnotation(enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper): boolean; - // (undocumented) - protected renderAnnotationInstance(renderContext: { - enabledElement: Types_2.IEnabledElement; - targetId: string; - annotation: LivewireContourAnnotation; - annotationStyle: AnnotationStyle; - svgDrawingHelper: SVGDrawingHelper; - }): boolean; - // (undocumented) - protected scissors: LivewireScissors; - // (undocumented) - protected scissorsNext: LivewireScissors; - // (undocumented) - protected setupBaseEditData(worldPos: any, element: any, annotation: any, nextPos?: any, contourHoleProcessingEnabled?: any): void; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: LivewireContourAnnotation) => void; - // (undocumented) - triggerAnnotationModified: (annotation: LivewireContourAnnotation, enabledElement: Types_2.IEnabledElement, changeType?: ChangeTypes) => void; - // (undocumented) - triggerChangeEvent: (annotation: LivewireContourAnnotation, enabledElement: Types_2.IEnabledElement, changeType?: ChangeTypes, contourHoleProcessingEnabled?: boolean) => void; - // (undocumented) - protected updateAnnotation(livewirePath: LivewirePath): void; -} - -declare namespace locking { - export { - setAnnotationLocked, - getAnnotationsLocked, - getAnnotationsLockedCount, - unlockAllAnnotations, - isAnnotationLocked, - checkAndSetAnnotationLocked - } -} - -// @public (undocumented) -export class MagnifyTool extends BaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _createMagnificationViewport: () => void; - // (undocumented) - _deactivateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _dragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _dragEndCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - referencedImageId: string; - viewportIdsToRender: string[]; - enabledElement: Types_2.IEnabledElement; - renderingEngine: Types_2.IRenderingEngine; - currentPoints: IPoints; - } | null; - // (undocumented) - _getReferencedImageId(viewport: Types_2.IStackViewport | Types_2.IVolumeViewport): string; - // (undocumented) - preMouseDownCallback: (evt: EventTypes_2.InteractionEventType) => boolean; - // (undocumented) - preTouchStartCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - static toolName: any; -} - -declare namespace math { - export { - aabb, - BasicStatsCalculator, - circle, - ellipse, - lineSegment, - point, - polyline, - rectangle, - vec2, - angle - } -} - -// @public (undocumented) -function mergePolylines(targetPolyline: Types_2.Point2[], sourcePolyline: Types_2.Point2[]): Types_2.Point2[]; - -// @public (undocumented) -export class MIPJumpToClickTool extends BaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - mouseClickCallback(evt: any): void; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -function mirror(mirrorPoint: Types_2.Point2, staticPoint: Types_2.Point2): Types_2.Point2; - -// @public (undocumented) -enum MouseBindings { - // (undocumented) - Auxiliary = 4, - // (undocumented) - Fifth_Button = 16, - // (undocumented) - Fourth_Button = 8, - // (undocumented) - Primary = 1, - // (undocumented) - Primary_And_Auxiliary = 5, - // (undocumented) - Primary_And_Secondary = 3, - // (undocumented) - Primary_And_Secondary_And_Auxiliary = 7, - // (undocumented) - Secondary = 2, - // (undocumented) - Secondary_And_Auxiliary = 6, - // (undocumented) - Wheel = 524288, - // (undocumented) - Wheel_Primary = 524289 -} - -// @public (undocumented) -type MouseClickEventDetail = NormalizedInteractionEventDetail & MouseCustomEventDetail & MousePointsDetail & { - mouseButton: number; -}; - -// @public (undocumented) -type MouseClickEventType = Types_2.CustomEventType; - -// @public (undocumented) -class MouseCursor { - constructor(name: string, fallback?: MouseCursor | undefined); - // (undocumented) - addFallbackStyleProperty(style: string): string; - // (undocumented) - static getDefinedCursor(name: string): MouseCursor | undefined; - // (undocumented) - getName(): string; - // (undocumented) - getStyleProperty(): string; - // (undocumented) - static setDefinedCursor(name: string, cursor: MouseCursor): boolean; -} - -// @public (undocumented) -type MouseDoubleClickEventDetail = NormalizedInteractionEventDetail & MouseCustomEventDetail & MousePointsDetail; - -// @public (undocumented) -type MouseDoubleClickEventType = Types_2.CustomEventType; - -// @public (undocumented) -type MouseDownActivateEventDetail = NormalizedInteractionEventDetail & MousePointsDetail & MouseCustomEventDetail & { - mouseButton: number; -}; - -// @public (undocumented) -type MouseDownActivateEventType = Types_2.CustomEventType; - -// @public (undocumented) -type MouseDownEventDetail = NormalizedInteractionEventDetail & MouseCustomEventDetail & MousePointsDetail & { - mouseButton: number; -}; - -// @public (undocumented) -type MouseDownEventType = Types_2.CustomEventType; - -// @public (undocumented) -type MouseDragEventDetail = NormalizedInteractionEventDetail & MouseCustomEventDetail & MousePointsDetail & { - mouseButton: number; -}; - -// @public (undocumented) -type MouseDragEventType = Types_2.CustomEventType; - -// @public (undocumented) -type MouseMoveEventDetail = NormalizedInteractionEventDetail & MouseCustomEventDetail & { - currentPoints: IPoints; -}; - -// @public (undocumented) -type MouseMoveEventType = Types_2.CustomEventType; - -// @public (undocumented) -type MouseUpEventDetail = NormalizedInteractionEventDetail & MouseCustomEventDetail & MousePointsDetail & { - mouseButton: number; -}; - -// @public (undocumented) -type MouseUpEventType = Types_2.CustomEventType; - -// @public (undocumented) -type MouseWheelEventDetail = NormalizedInteractionEventDetail & MouseCustomEventDetail & { - detail: Record; - wheel: { - spinX: number; - spinY: number; - pixelX: number; - pixelY: number; - direction: number; - }; - points: IPoints; -}; - -// @public (undocumented) -type MouseWheelEventType = Types_2.CustomEventType; - -// @public (undocumented) -type NamedStatistics = { - mean: Statistics & { - name: 'mean'; - }; - max: Statistics & { - name: 'max'; - }; - min: Statistics & { - name: 'min'; - }; - stdDev: Statistics & { - name: 'stdDev'; - }; - count: Statistics & { - name: 'count'; - }; - area?: Statistics & { - name: 'area'; - }; - volume?: Statistics & { - name: 'volume'; - }; - circumference?: Statistics & { - name: 'circumference'; - }; - pointsInShape?: Types_2.IPointsManager; - maxIJKs?: Array<{ - value: number; - pointIJK: Types_2.Point3; - }>; - array: Statistics[]; -}; - -// @public (undocumented) -type NormalizedInteractionEventDetail = { - eventName: string; - renderingEngineId: string; - viewportId: string; - camera: Record; - element: HTMLDivElement; -}; - -// @public (undocumented) -type NormalizedMouseEventType = Types_2.CustomEventType; - -// @public (undocumented) -type NormalizedTouchEventType = Types_2.CustomEventType; - -// @public (undocumented) -function normalizeViewportPlane(viewport: Types_2.IViewport, boundsIJK: Types_2.BoundsIJK): { - toIJK: any; - boundsIJKPrime: any; - fromIJK: any; - error: string; -} | { - boundsIJKPrime: any; - toIJK: (ijkPrime: any) => any; - fromIJK: (ijk: any) => any; - type: string; - error?: undefined; -} | { - boundsIJKPrime: any; - toIJK: ([j, k, i]: [any, any, any]) => any[]; - fromIJK: ([i, j, k]: [any, any, any]) => any[]; - type: string; - error?: undefined; -}; - -declare namespace orientation_2 { - export { - getOrientationStringLPS, - invertOrientationStringLPS - } -} - -// @public (undocumented) -export class OrientationMarkerTool extends BaseTool { - constructor(toolProps?: {}, defaultToolProps?: { - configuration: { - orientationWidget: { - enabled: boolean; - viewportCorner: Corners; - viewportSize: number; - minPixelSize: number; - maxPixelSize: number; - }; - overlayMarkerType: OverlayMarkerType; - overlayConfiguration: OverlayConfiguration; - }; - }); - // (undocumented) - addAxisActorInViewport(viewport: any): Promise; - // (undocumented) - static AXIS: number; - // (undocumented) - createAnnotatedCubeActor(): Promise; - // (undocumented) - static CUBE: number; - // (undocumented) - _getViewportsInfo: () => any[]; - // (undocumented) - onSetToolActive: () => void; - // (undocumented) - onSetToolDisabled: () => void; - // (undocumented) - onSetToolEnabled: () => void; - // (undocumented) - orientationMarkers: any; - // (undocumented) - static OVERLAY_MARKER_TYPES: typeof OverlayMarkerType; - // (undocumented) - polyDataURL: any; - // (undocumented) - resize: (viewportId: any) => void; - // (undocumented) - _resizeObservers: Map; - // (undocumented) - _subscribeToViewportEvents(): void; - // (undocumented) - static toolName: any; - // (undocumented) - _unsubscribeToViewportNewVolumeSet(): void; - // (undocumented) - updatingOrientationMarker: any; - // (undocumented) - static VTPFILE: number; -} - -// @public (undocumented) -export class OverlayGridTool extends AnnotationDisplayTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - calculateImageIdPointSets: (imageId: string) => { - pointSet1: Types_2.Point3[]; - pointSet2: Types_2.Point3[]; - }; - // (undocumented) - _init: () => void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - onSetToolActive: () => void; - // (undocumented) - onSetToolEnabled: () => void; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -export class PaintFillTool extends BaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - preMouseDownCallback: (evt: EventTypes_2.InteractionEventType) => boolean; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -export class PanTool extends BaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _dragCallback(evt: EventTypes_2.InteractionEventType): void; - // (undocumented) - mouseDragCallback(evt: EventTypes_2.InteractionEventType): void; - // (undocumented) - static toolName: any; - // (undocumented) - touchDragCallback(evt: EventTypes_2.InteractionEventType): void; -} - -declare namespace planar_2 { - export { - _default as default, - filterAnnotationsWithinSlice, - getWorldWidthAndHeightFromCorners, - getWorldWidthAndHeightFromTwoPoints, - filterAnnotationsForDisplay, - getPointInLineOfSightWithCriteria, - isPlaneIntersectingAABB, - filterAnnotationsWithinSamePlane, - getPointsInLineOfSight - } -} - -// @public (undocumented) -type PlanarBoundingBox = { - x: number; - y: number; - width: number; - height: number; -}; - -// @public (undocumented) -type PlanarFreehandContourSegmentationAnnotation = PlanarFreehandROIAnnotation & ContourSegmentationAnnotationData; - -// @public (undocumented) -export class PlanarFreehandContourSegmentationTool extends PlanarFreehandROITool { - constructor(toolProps: PublicToolProps); - // (undocumented) - protected isContourSegmentationTool(): boolean; - // (undocumented) - protected renderAnnotationInstance(renderContext: AnnotationRenderContext): boolean; - // (undocumented) - static toolName: string; -} - -// @public (undocumented) -type PlanarFreehandROIAnnotation = ContourAnnotation & { - data: { - label?: string; - isOpenUShapeContour?: boolean; - openUShapeContourVectorToPeak?: Types_2.Point3[]; - cachedStats?: ROICachedStats; - }; -}; - -// @public (undocumented) -export class PlanarFreehandROITool extends ContourSegmentationBaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - protected activateDraw: (evt: EventTypes_2.InteractionEventType, annotation: PlanarFreehandROIAnnotation, viewportIdsToRender: string[]) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => PlanarFreehandROIAnnotation; - // (undocumented) - _calculateStatsIfActive(annotation: PlanarFreehandROIAnnotation, targetId: string, viewport: any, renderingEngine: any, enabledElement: any): void; - // (undocumented) - cancel: (element: HTMLDivElement) => void; - // (undocumented) - protected createAnnotation(evt: EventTypes_2.InteractionEventType): ContourAnnotation; - // (undocumented) - filterInteractableAnnotationsForElement(element: HTMLDivElement, annotations: Annotations): Annotations | undefined; - // (undocumented) - protected getAnnotationStyle(context: any): any; - // (undocumented) - handleSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: PlanarFreehandROIAnnotation, handle: ToolHandle) => void; - // (undocumented) - protected isContourSegmentationTool(): boolean; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isEditingClosed: boolean; - // (undocumented) - isEditingOpen: boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: PlanarFreehandROIAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - protected renderAnnotationInstance(renderContext: AnnotationRenderContext): boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: PlanarFreehandROIAnnotation) => void; - // (undocumented) - protected updateClosedCachedStats({ viewport, points, imageData, metadata, cachedStats, targetId, modalityUnit, canvasCoordinates, calibratedScale, }: { - viewport: any; - points: any; - imageData: any; - metadata: any; - cachedStats: any; - targetId: any; - modalityUnit: any; - canvasCoordinates: any; - calibratedScale: any; - }): void; - // (undocumented) - protected updateOpenCachedStats({ targetId, metadata, canvasCoordinates, cachedStats, modalityUnit, calibratedScale, }: { - targetId: any; - metadata: any; - canvasCoordinates: any; - cachedStats: any; - modalityUnit: any; - calibratedScale: any; - }): void; -} - -declare namespace planarFreehandROITool { - export { - _default_4 as default, - smoothAnnotation - } -} - -// @public (undocumented) -export class PlanarRotateTool extends BaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _dragCallback(evt: EventTypes_2.MouseDragEventType): void; - // (undocumented) - mouseDragCallback: (evt: EventTypes_2.MouseDragEventType) => void; - // (undocumented) - mouseWheelCallback: (evt: EventTypes_2.MouseWheelEventType) => void; - // (undocumented) - setAngle(viewport: any, angle: any): void; - // (undocumented) - static toolName: any; - // (undocumented) - touchDragCallback: (evt: EventTypes_2.MouseDragEventType) => void; -} - -// @public (undocumented) -function playClip(element: HTMLDivElement, playClipOptions: CINETypes.PlayClipOptions): void; - -// @public (undocumented) -type PlayClipOptions = { - framesPerSecond?: number; - frameTimeVector?: number[]; - reverse?: boolean; - loop?: boolean; - dynamicCineEnabled?: boolean; - frameTimeVectorSpeedMultiplier?: number; - waitForRendered?: number; -}; - -declare namespace point { - export { - distanceToPoint_3 as distanceToPoint, - distanceToPointSquared_3 as distanceToPointSquared, - mirror - } -} - -// @public (undocumented) -const pointCanProjectOnLine: (p: Types_2.Point2, p1: Types_2.Point2, p2: Types_2.Point2, proximity: number) => boolean; - -// @public (undocumented) -function pointInEllipse(ellipse: any, pointLPS: any, inverts?: Inverts): boolean; - -// @public (undocumented) -function pointInSurroundingSphereCallback(imageData: vtkImageData, circlePoints: [Types_2.Point3, Types_2.Point3], callback: (args: { - value: unknown; - index: number; - pointIJK: Types_2.Point3; - pointLPS: Types_2.Point3; -}) => void, viewport?: Types_2.IVolumeViewport): void; - -// @public (undocumented) -const pointsAreWithinCloseContourProximity: (p1: Types_2.Point2, p2: Types_2.Point2, closeContourProximity: number) => boolean; - -// @public (undocumented) -function pointToString(point: any, decimals?: number): string; - -declare namespace polyDataUtils { - export { - getPoint, - getPolyDataPointIndexes, - getPolyDataPoints - } -} - -declare namespace polyline { - export { - isClosed, - containsPoint, - containsPoints, - getAABB, - getArea, - getSignedArea, - getWindingDirection, - getNormal3, - getNormal2, - intersectPolyline, - decimate_2 as decimate, - getFirstLineSegmentIntersectionIndexes, - getLineSegmentIntersectionsIndexes, - getLineSegmentIntersectionsCoordinates, - getClosestLineSegmentIntersection, - getSubPixelSpacingAndXYDirections, - pointsAreWithinCloseContourProximity, - addCanvasPointsToArray, - pointCanProjectOnLine, - mergePolylines, - subtractPolylines, - isPointInsidePolyline3D, - projectTo2D - } -} - -// @public (undocumented) -type PolySegConversionOptions = { - segmentIndices?: number[]; - segmentationId?: string; - viewport?: Types_2.IStackViewport | Types_2.IVolumeViewport; -}; - -declare namespace polySegManager { - export { - canComputeRequestedRepresentation, - computeAndAddSurfaceRepresentation, - computeAndAddLabelmapRepresentation, - computeAndAddContourRepresentation - } -} - -// @public (undocumented) -const precalculatePointInEllipse: (ellipse: any, inverts?: Inverts) => Inverts; - -// @public (undocumented) -interface ProbeAnnotation extends Annotation { - // (undocumented) - data: { - handles: { - points: Types_2.Point3[]; - }; - cachedStats: { - [targetId: string]: { - Modality: string; - index: Types_2.Point3; - value: number; - }; - }; - label: string; - }; -} - -// @public (undocumented) -export class ProbeTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: any); - // (undocumented) - _activateModify: (element: any) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => ProbeAnnotation; - // (undocumented) - _calculateCachedStats(annotation: any, renderingEngine: any, enabledElement: any, changeType?: ChangeTypes): any; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateModify: (element: any) => void; - // (undocumented) - _dragCallback: (evt: any) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - newAnnotation?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - eventDispatchDetail: { - viewportId: string; - renderingEngineId: string; - }; - // (undocumented) - getHandleNearImagePoint(element: HTMLDivElement, annotation: ProbeAnnotation, canvasCoords: Types_2.Point2, proximity: number): ToolHandle | undefined; - // (undocumented) - handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: ProbeAnnotation): void; - // (undocumented) - static hydrate: (viewportId: string, points: Types_2.Point3[], options?: { - annotationUID?: string; - }) => ProbeAnnotation; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - isPointNearTool(element: HTMLDivElement, annotation: ProbeAnnotation, canvasCoords: Types_2.Point2, proximity: number): boolean; - // (undocumented) - static probeDefaults: { - supportedInteractionTypes: string[]; - configuration: { - shadow: boolean; - preventHandleOutsideImage: boolean; - getTextLines: typeof defaultGetTextLines; - handleRadius: string; - }; - }; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback(): void; -} - -// @public (undocumented) -function projectTo2D(polyline: Types_2.Point3[]): { - sharedDimensionIndex: any; - projectedPolyline: Types_2.Point2[]; -}; - -// @public (undocumented) -type PublicToolProps = SharedToolProp & { - name?: string; -}; - -// @public (undocumented) -class QuadraticBezier extends QuadraticSpline { - // (undocumented) - protected getTransformMatrix(): number[]; - // (undocumented) - hasTangentPoints(): boolean; -} - -// @public (undocumented) -abstract class QuadraticSpline extends Spline { - // (undocumented) - protected getLineSegments(): SplineLineSegment[]; - // (undocumented) - getPreviewCurveSegments(controlPointPreview: Types_2.Point2, closeSpline: boolean): SplineCurveSegment[]; - // (undocumented) - protected getSplineCurves(): SplineCurveSegment[]; -} - -declare namespace rectangle { - export { - distanceToPoint_4 as distanceToPoint - } -} - -// @public (undocumented) -interface RectangleROIAnnotation extends Annotation { - // (undocumented) - data: { - handles: { - points: Types_2.Point3[]; - activeHandleIndex: number | null; - textBox: { - hasMoved: boolean; - worldPosition: Types_2.Point3; - worldBoundingBox: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - }; - label: string; - cachedStats?: ROICachedStats | { - pointsInVolume?: Types_2.Point3[]; - projectionPoints?: Types_2.Point3[]; - projectionPointsImageIds?: string[]; - }; - }; -} - -// @public (undocumented) -interface RectangleROIStartEndThresholdAnnotation extends Annotation { - // (undocumented) - data: { - label: string; - startCoordinate: number; - endCoordinate: number; - cachedStats: { - pointsInVolume: Types_2.Point3[]; - projectionPoints: Types_2.Point3[][]; - projectionPointsImageIds: string[]; - statistics?: ROICachedStats; - }; - handles: { - points: Types_2.Point3[]; - activeHandleIndex: number | null; - textBox: { - hasMoved: boolean; - worldPosition: Types_2.Point3; - worldBoundingBox: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - }; - }; - // (undocumented) - metadata: { - cameraPosition?: Types_2.Point3; - cameraFocalPoint?: Types_2.Point3; - viewPlaneNormal?: Types_2.Point3; - viewUp?: Types_2.Point3; - annotationUID?: string; - FrameOfReferenceUID: string; - referencedImageId?: string; - toolName: string; - enabledElement: Types_2.IEnabledElement; - volumeId: string; - spacingInNormal: number; - }; -} - -// @public (undocumented) -export class RectangleROIStartEndThresholdTool extends RectangleROITool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => { - highlighted: boolean; - invalidated: boolean; - metadata: { - viewPlaneNormal: Types_2.Point3; - enabledElement: Types_2.IEnabledElement; - viewUp: Types_2.Point3; - FrameOfReferenceUID: string; - referencedImageId: any; - toolName: string; - volumeId: any; - spacingInNormal: number; - }; - data: { - label: string; - startCoordinate: number; - endCoordinate: number; - cachedStats: { - pointsInVolume: any[]; - projectionPoints: any[]; - projectionPointsImageIds: any[]; - statistics: ROICachedStats; - }; - handles: { - textBox: { - hasMoved: boolean; - worldPosition: Types_2.Point3; - worldBoundingBox: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - points: Types_2.Point3[]; - activeHandleIndex: any; - }; - labelmapUID: any; - }; - }; - // (undocumented) - _calculateCachedStatsTool(annotation: any, enabledElement: any): any; - // (undocumented) - _computePointsInsideVolume(annotation: any, targetId: any, imageVolume: any, enabledElement: any): void; - // (undocumented) - _computeProjectionPoints(annotation: RectangleROIStartEndThresholdAnnotation, imageVolume: Types_2.IImageVolume): void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - handleIndex?: number; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _getCoordinateForViewplaneNormal(pos: vec3 | number, viewPlaneNormal: Types_2.Point3): number | undefined; - // (undocumented) - _getEndCoordinate(worldPos: Types_2.Point3, spacingInNormal: number, viewPlaneNormal: Types_2.Point3): number | undefined; - // (undocumented) - _getIndexOfCoordinatesForViewplaneNormal(viewPlaneNormal: Types_2.Point3): number; - // (undocumented) - _getStartCoordinate(worldPos: Types_2.Point3, viewPlaneNormal: Types_2.Point3): number | undefined; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -interface RectangleROIThresholdAnnotation extends Annotation { - // (undocumented) - data: { - label: string; - handles: { - points: Types_2.Point3[]; - activeHandleIndex: number | null; - }; - }; - // (undocumented) - metadata: { - cameraPosition?: Types_2.Point3; - cameraFocalPoint?: Types_2.Point3; - viewPlaneNormal?: Types_2.Point3; - viewUp?: Types_2.Point3; - annotationUID?: string; - FrameOfReferenceUID: string; - referencedImageId?: string; - toolName: string; - enabledElement: Types_2.IEnabledElement; - volumeId: string; - }; -} - -// @public (undocumented) -export class RectangleROIThresholdTool extends RectangleROITool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => { - highlighted: boolean; - invalidated: boolean; - metadata: { - viewPlaneNormal: Types_2.Point3; - enabledElement: Types_2.IEnabledElement; - viewUp: Types_2.Point3; - FrameOfReferenceUID: string; - referencedImageId: any; - toolName: string; - volumeId: any; - }; - data: { - label: string; - handles: { - textBox: { - hasMoved: boolean; - worldPosition: any; - worldBoundingBox: any; - }; - points: Types_2.Point3[]; - activeHandleIndex: any; - }; - segmentationId: any; - }; - }; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - handleIndex?: number; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -function rectangleROIThresholdVolumeByRange(annotationUIDs: string[], segmentationVolume: Types_2.IImageVolume, thresholdVolumeInformation: ThresholdInformation[], options: ThresholdOptions): Types_2.IImageVolume; - -// @public (undocumented) -export class RectangleROITool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: any) => void; - // (undocumented) - _activateModify: (element: any) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => RectangleROIAnnotation; - // (undocumented) - _calculateCachedStats: (annotation: any, viewPlaneNormal: any, viewUp: any, renderingEngine: any, enabledElement: any) => any; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateDraw: (element: any) => void; - // (undocumented) - _deactivateModify: (element: any) => void; - // (undocumented) - _dragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - handleIndex?: number; - movingTextBox?: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _getRectangleImageCoordinates: (points: Array) => { - left: number; - top: number; - width: number; - height: number; - }; - // (undocumented) - handleSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: RectangleROIAnnotation, handle: ToolHandle) => void; - // (undocumented) - static hydrate: (viewportId: string, points: Types_2.Point3[], options?: { - annotationUID?: string; - }) => RectangleROIAnnotation; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - _isInsideVolume: (index1: any, index2: any, dimensions: any) => boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: RectangleROIAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: RectangleROIAnnotation) => void; -} - -declare namespace rectangleROITool { - export { - getBoundsIJKFromRectangleAnnotations, - isAxisAlignedRectangle - } -} - -// @public (undocumented) -export class RectangleScissorsTool extends LabelmapBaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: any) => void; - // (undocumented) - _deactivateDraw: (element: any) => void; - // (undocumented) - _dragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - volumeId: string; - referencedVolumeId: string; - imageId: string; - annotation: Annotation; - segmentationId: string; - segmentIndex: number; - segmentsLocked: number[]; - segmentColor: [number, number, number, number]; - viewportIdsToRender: string[]; - handleIndex?: number; - movingTextBox: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - preMouseDownCallback: (evt: EventTypes_2.InteractionEventType) => boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -interface ReferenceCursor extends Annotation { - // (undocumented) - data: { - handles: { - points: [Types_2.Point3]; - }; - }; -} - -// @public (undocumented) -export class ReferenceCursors extends AnnotationDisplayTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - createInitialAnnotation: (worldPos: Types_2.Point3, element: HTMLDivElement) => void; - // (undocumented) - _currentCanvasPosition: null | Types_2.Point2; - // (undocumented) - _currentCursorWorldPosition: null | Types_2.Point3; - // (undocumented) - _disableCursorEnabled: boolean; - // (undocumented) - _elementWithCursor: null | HTMLDivElement; - // (undocumented) - filterInteractableAnnotationsForElement(element: HTMLDivElement, annotations: Annotations): Annotations; - // (undocumented) - getActiveAnnotation(element: HTMLDivElement): null | Annotation; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - mouseMoveCallback: (evt: EventTypes_2.InteractionEventType) => boolean; - // (undocumented) - onCameraModified: (evt: Types_2.EventTypes.CameraModifiedEvent) => void; - // (undocumented) - onSetToolActive(): void; - // (undocumented) - onSetToolDisabled(): void; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - static toolName: any; - // (undocumented) - updateAnnotationPosition(element: HTMLDivElement, annotation: Annotation): void; - // (undocumented) - updateViewportImage(viewport: Types_2.IStackViewport | Types_2.IVolumeViewport): void; -} - -// @public (undocumented) -interface ReferenceLineAnnotation extends Annotation { - // (undocumented) - data: { - handles: { - points: Types_2.Point3[]; - }; - }; -} - -// @public (undocumented) -export class ReferenceLinesTool extends AnnotationDisplayTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - editData: { - renderingEngine: Types_2.IRenderingEngine; - sourceViewportId: string; - annotation: ReferenceLineAnnotation; - } | null; - // (undocumented) - _init: () => void; - // (undocumented) - intersectInfiniteLines(line1Start: Types_2.Point2, line1End: Types_2.Point2, line2Start: Types_2.Point2, line2End: Types_2.Point2): number[]; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - isInBound(point: number[], dimensions: Types_2.Point3): boolean; - // (undocumented) - isParallel(vec1: Types_2.Point3, vec2: Types_2.Point3): boolean; - // (undocumented) - isPerpendicular: (vec1: Types_2.Point3, vec2: Types_2.Point3) => boolean; - // (undocumented) - onCameraModified: (evt: Types_2.EventTypes.CameraModifiedEvent) => void; - // (undocumented) - onSetToolConfiguration: () => void; - // (undocumented) - onSetToolEnabled: () => void; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -export class RegionSegmentPlusTool extends GrowCutBaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - protected getGrowCutLabelmap(growCutData: any): Promise; - // (undocumented) - protected getRemoveIslandData(growCutData: RegionSegmentPlusToolData): RemoveIslandData; - // (undocumented) - protected growCutData: RegionSegmentPlusToolData | null; - // (undocumented) - preMouseDownCallback(evt: EventTypes_2.MouseDownActivateEventType): Promise; - // (undocumented) - static toolName: string; -} - -// @public (undocumented) -export class RegionSegmentTool extends GrowCutBaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - protected getGrowCutLabelmap(growCutData: any): Promise; - // (undocumented) - protected growCutData: RegionSegmentToolData | null; - // (undocumented) - preMouseDownCallback(evt: EventTypes_2.MouseDownActivateEventType): Promise; - // (undocumented) - renderAnnotation(enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper): void; - // (undocumented) - static toolName: string; -} - -// @public (undocumented) -function registerCursor(toolName: string, iconContent: string, viewBox: { - x: number; - y: number; -}): void; - -// @public (undocumented) -function removeAllSegmentationRepresentations(): void; - -// @public (undocumented) -function removeAllSegmentations(): void; - -// @public (undocumented) -function removeColorLUT(colorLUTIndex: number): void; - -// @public (undocumented) -function removeContourRepresentation(viewportId: string, segmentationId: string, immediate?: boolean): void; - -// @public (undocumented) -function removeContourSegmentationAnnotation(annotation: ContourSegmentationAnnotation): void; - -// @public (undocumented) -function removeEnabledElement(elementDisabledEvt: Types_2.EventTypes.ElementDisabledEvent): void; - -// @public (undocumented) -function removeLabelmapRepresentation(viewportId: string, segmentationId: string, immediate?: boolean): void; - -// @public (undocumented) -function removeSegment(segmentationId: string, segmentIndex: number, options?: { - setNextSegmentAsActive: boolean; -}): void; - -// @public (undocumented) -function removeSegmentation(segmentationId: string): void; - -// @public (undocumented) -function removeSegmentationRepresentation(viewportId: string, specifier: { - segmentationId: string; - type: SegmentationRepresentations; -}, immediate?: boolean): Array<{ - segmentationId: string; - type: SegmentationRepresentations; -}>; - -// @public (undocumented) -function removeSegmentationRepresentations(viewportId: string, specifier: { - segmentationId?: string; - type?: SegmentationRepresentations; -}, immediate?: boolean): Array<{ - segmentationId: string; - type: SegmentationRepresentations; -}>; - -// @public (undocumented) -function removeSurfaceRepresentation(viewportId: string, segmentationId: string, immediate?: boolean): void; - -// @public (undocumented) -export function removeTool(ToolClass: any): void; - -// @public (undocumented) -type RepresentationData = LabelmapSegmentationData | ContourSegmentationData | SurfaceSegmentationData; - -// @public (undocumented) -type RepresentationsData = { - [Enums.SegmentationRepresentations.Labelmap]?: LabelmapSegmentationData; - [Enums.SegmentationRepresentations.Contour]?: ContourSegmentationData; - [Enums.SegmentationRepresentations.Surface]?: SurfaceSegmentationData; -}; - -// @public (undocumented) -type RepresentationStyle = LabelmapStyle | ContourStyle | SurfaceStyle; - -// @public (undocumented) -function resetElementCursor(element: HTMLDivElement): void; - -// @public (undocumented) -function resetToGlobalStyle(): void; - -// @public (undocumented) -function restoreMemo(isUndo?: boolean): void; - -// @public (undocumented) -interface ROICachedStats { - // (undocumented) - [targetId: string]: { - Modality: string; - area: number; - areaUnit: string; - max: number; - mean: number; - stdDev: number; - }; -} - -// @public (undocumented) -const roundNumber_2: typeof utilities_2.roundNumber; - -// @public (undocumented) -function runGrowCut(referenceVolumeId: string, labelmapVolumeId: string, options?: GrowCutOptions): Promise; - -// @public (undocumented) -function runGrowCutForBoundingBox(referencedVolumeId: string, boundingBoxInfo: BoundingBoxInfo, options?: GrowCutBoundingBoxOptions): Promise; - -// @public (undocumented) -function runGrowCutForSphere(referencedVolumeId: string, sphereInfo: SphereInfo, viewport: Types_2.IViewport, options?: GrowCutOptions): Promise; - -// @public (undocumented) -function runOneClickGrowCut(referencedVolumeId: string, worldPosition: Types_2.Point3, viewport: Types_2.IViewport, options?: GrowCutOneClickOptions): Promise; - -// @public (undocumented) -interface ScaleOverlayAnnotation extends Annotation { - // (undocumented) - data: { - handles: { - points: Types_2.Point3[]; - }; - viewportId: string; - }; -} - -// @public (undocumented) -export class ScaleOverlayTool extends AnnotationDisplayTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - computeCanvasScaleCoordinates: (canvasSize: any, canvasCoordinates: any, vscaleBounds: any, hscaleBounds: any, location: any) => any; - // (undocumented) - computeEndScaleTicks: (canvasCoordinates: any, location: any) => { - endTick1: any[][]; - endTick2: any[][]; - }; - // (undocumented) - computeInnerScaleTicks: (scaleSize: number, location: string, annotationUID: string, leftTick: Types_2.Point2[], rightTick: Types_2.Point2[]) => { - tickIds: any[]; - tickUIDs: any[]; - tickCoordinates: any[]; - }; - // (undocumented) - computeScaleBounds: (canvasSize: any, horizontalReduction: any, verticalReduction: any, location: any) => { - height: any; - width: any; - }; - // (undocumented) - computeScaleSize: (worldWidthViewport: number, worldHeightViewport: number, location: string) => any; - // (undocumented) - computeWorldScaleCoordinates: (scaleSize: any, location: any, pointSet: any) => any; - // (undocumented) - editData: { - renderingEngine: Types_2.IRenderingEngine; - viewport: Types_2.IViewport; - annotation: ScaleOverlayAnnotation; - } | null; - // (undocumented) - _getTextLines(scaleSize: number): string[] | undefined; - // (undocumented) - _init: () => void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - onCameraModified: (evt: Types_2.EventTypes.CameraModifiedEvent) => void; - // (undocumented) - onSetToolEnabled: () => void; - // (undocumented) - renderAnnotation(enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper): boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -export class SculptorTool extends BaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - protected activateModify(element: HTMLDivElement): void; - // (undocumented) - protected deactivateModify(element: HTMLDivElement): void; - // (undocumented) - protected interpolatePointsWithinMaxSpacing(i: number, points: Array, indicesToInsertAfter: Array, maxSpacing: number): void; - // (undocumented) - mouseMoveCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - preMouseDownCallback: (evt: EventTypes_2.InteractionEventType) => boolean; - // (undocumented) - registeredShapes: Map; - // (undocumented) - registerShapes(shapeName: string, shapeClass: new () => T): void; - // (undocumented) - renderAnnotation(enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper): void; - // (undocumented) - protected sculpt(eventData: any, points: Array): void; - // (undocumented) - setToolShape(toolShape: string): void; - // (undocumented) - static toolName: string; -} - -// @public (undocumented) -type Segment = { - segmentIndex: number; - label: string; - locked: boolean; - cachedStats: { - [key: string]: unknown; - }; - active: boolean; -}; - -// @public (undocumented) -type Segmentation = { - segmentationId: string; - label: string; - segments: { - [segmentIndex: number]: Segment; - }; - representationData: RepresentationsData; - cachedStats: { - [key: string]: unknown; - }; -}; - -declare namespace segmentation { - export { - removeSegmentationRepresentation, - removeContourRepresentation, - removeLabelmapRepresentation, - removeSurfaceRepresentation, - removeAllSegmentations, - removeSegmentation, - removeSegmentationRepresentations, - addLabelmapRepresentationToViewport, - addLabelmapRepresentationToViewportMap, - addSegmentationRepresentations, - removeAllSegmentationRepresentations, - addContourRepresentationToViewport, - addContourRepresentationToViewportMap, - addSurfaceRepresentationToViewport, - addSurfaceRepresentationToViewportMap, - addSegmentations, - updateSegmentations, - state_3 as state, - activeSegmentation, - segmentLocking, - config_2 as config, - segmentIndex, - triggerSegmentationEvents, - helpers, - polySegManager as polySeg, - removeSegment, - getLabelmapImageIds, - internalAddRepresentationData as addRepresentationData, - strategies - } -} -export { segmentation } - -declare namespace segmentation_2 { - export { - thresholdVolumeByRange, - createMergedLabelmapForIndex, - createLabelmapVolumeForViewport, - rectangleROIThresholdVolumeByRange, - triggerSegmentationRender, - triggerSegmentationRenderBySegmentationId, - floodFill, - getBrushSizeForToolGroup, - setBrushSizeForToolGroup, - getBrushThresholdForToolGroup, - setBrushThresholdForToolGroup, - VolumetricCalculator, - thresholdSegmentationByRange, - contourAndFindLargestBidirectional, - createBidirectionalToolData, - segmentContourAction, - invalidateBrushCursor, - getUniqueSegmentIndices, - getSegmentIndexAtWorldPoint, - getSegmentIndexAtLabelmapBorder, - getHoveredContourSegmentationAnnotation, - getBrushToolInstances, - growCut, - LabelmapMemo, - IslandRemoval - } -} - -// @public (undocumented) -type SegmentationAddedEventDetail = { - segmentationId: string; -}; - -// @public (undocumented) -type SegmentationAddedEventType = Types_2.CustomEventType; - -// @public (undocumented) -type SegmentationDataModifiedEventDetail = { - segmentationId: string; - modifiedSlicesToUse?: number[]; - segmentIndex?: number; -}; - -// @public (undocumented) -type SegmentationDataModifiedEventType = Types_2.CustomEventType; - -// @public (undocumented) -export class SegmentationIntersectionTool extends AnnotationDisplayTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _init: () => void; - // (undocumented) - onCameraModified: (evt: Types_2.EventTypes.CameraModifiedEvent) => void; - // (undocumented) - onSetToolEnabled: () => void; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -type SegmentationModifiedEventDetail = { - segmentationId: string; -}; - -// @public (undocumented) -type SegmentationModifiedEventType = Types_2.CustomEventType; - -// @public (undocumented) -type SegmentationPublicInput = { - segmentationId: string; - representation: { - type: Enums.SegmentationRepresentations; - data?: RepresentationData; - }; - config?: { - segments?: { - [segmentIndex: number]: Partial; - }; - label?: string; - cachedStats?: { - [key: string]: unknown; - }; - }; -}; - -// @public (undocumented) -type SegmentationRemovedEventDetail = { - segmentationId: string; -}; - -// @public (undocumented) -type SegmentationRemovedEventType = Types_2.CustomEventType; - -// @public (undocumented) -type SegmentationRenderedEventDetail = { - viewportId: string; - segmentationId: string; - type: string; -}; - -// @public (undocumented) -type SegmentationRenderedEventType = Types_2.CustomEventType; - -// @public (undocumented) -type SegmentationRepresentation = LabelmapRepresentation | ContourRepresentation | SurfaceRepresentation; - -// @public (undocumented) -type SegmentationRepresentationModifiedEventDetail = { - segmentationId: string; - type: string; - viewportId: string; -}; - -// @public (undocumented) -type SegmentationRepresentationModifiedEventType = Types_2.CustomEventType; - -// @public (undocumented) -type SegmentationRepresentationRemovedEventDetail = { - segmentationId: string; - type: string; - viewportId: string; -}; - -// @public (undocumented) -type SegmentationRepresentationRemovedEventType = Types_2.CustomEventType; - -// @public (undocumented) -enum SegmentationRepresentations { - // (undocumented) - Contour = "Contour", - // (undocumented) - Labelmap = "Labelmap", - // (undocumented) - Surface = "Surface" -} - -// @public (undocumented) -type SegmentationState = { - colorLUT: Types_2.ColorLUT[]; - segmentations: Segmentation[]; - viewportSegRepresentations: { - [viewportId: string]: Array; - }; -}; - -// @public (undocumented) -function segmentContourAction(element: HTMLDivElement, configuration: any): any; - -declare namespace segmentIndex { - export { - setActiveSegmentIndex, - getActiveSegmentIndex - } -} - -declare namespace segmentLocking { - export { - isSegmentIndexLocked, - setSegmentIndexLocked, - getLockedSegmentIndices - } -} - -// @public (undocumented) -export class SegmentSelectTool extends BaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - mouseMoveCallback: (evt: EventTypes_2.InteractionEventType) => boolean; - // (undocumented) - onSetToolActive: () => void; - // (undocumented) - onSetToolDisabled: () => void; - // (undocumented) - onSetToolEnabled: () => void; - // (undocumented) - static SelectMode: { - Inside: string; - Border: string; - }; - // (undocumented) - _setActiveSegment(evt?: EventTypes_2.InteractionEventType): void; - // (undocumented) - _setActiveSegmentForType(activeSegmentation: Segmentation, worldPoint: Types_2.Point3, viewport: Types_2.IStackViewport | Types_2.IVolumeViewport): void; - // (undocumented) - static toolName: any; -} - -declare namespace selection { - export { - setAnnotationSelected, - getAnnotationsSelected, - getAnnotationsSelectedByToolName, - getAnnotationsSelectedCount, - deselectAnnotation, - isAnnotationSelected - } -} - -// @public (undocumented) -function setActiveSegmentation(viewportId: string, segmentationId: string): void; - -// @public (undocumented) -function setActiveSegmentIndex(segmentationId: string, segmentIndex: number): void; - -// @public (undocumented) -function setAnnotationLocked(annotationUID: string, locked?: boolean): void; - -// @public (undocumented) -function setAnnotationSelected(annotationUID: string, selected?: boolean, preserveSelected?: boolean): void; - -// @public (undocumented) -function setAnnotationVisibility(annotationUID: string, visible?: boolean): void; - -// @public (undocumented) -function setAttributesIfNecessary(attributes: any, svgNode: any): void; - -// @public (undocumented) -function setBrushSizeForToolGroup(toolGroupId: string, brushSize: number, toolName?: string): void; - -// @public (undocumented) -function setBrushThresholdForToolGroup(toolGroupId: string, threshold: Types_2.Point2, otherArgs?: Record): void; - -// @public (undocumented) -function setColorLUT(viewportId: string, segmentationId: string, colorLUTsIndex: number): void; - -// @public (undocumented) -function setCursorForElement(element: HTMLDivElement, cursorName: string): void; - -// @public (undocumented) -function _setElementCursor(element: HTMLDivElement, cursor: MouseCursor | null): void; - -// @public (undocumented) -function setNewAttributesIfValid(attributes: any, svgNode: any): void; - -// @public (undocumented) -function setRenderInactiveSegmentations(viewportId: string, renderInactiveSegmentations: boolean): void; - -// @public (undocumented) -function setSegmentationRepresentationVisibility(viewportId: string, specifier: { - segmentationId: string; - type?: SegmentationRepresentations; -}, visibility: boolean): void; - -// @public (undocumented) -function setSegmentIndexColor(viewportId: string, segmentationId: string, segmentIndex: number, color: Types_2.Color): void; - -// @public (undocumented) -function setSegmentIndexLocked(segmentationId: string, segmentIndex: number, locked?: boolean): void; - -// @public (undocumented) -function setSegmentIndexVisibility(viewportId: string, specifier: { - segmentationId: string; - type?: SegmentationRepresentations; -}, segmentIndex: number, visibility: boolean): void; - -// @public (undocumented) -function setStyle(specifier: SpecifierWithType, style: StyleForType): void; - -// @public (undocumented) -type SetToolBindingsType = { - bindings: IToolBinding[]; -}; - -// @public (undocumented) -function showAllAnnotations(): void; - -// @public (undocumented) -function smoothAnnotation(annotation: PlanarFreehandROIAnnotation, options?: SmoothOptions): boolean; - -// @public (undocumented) -type SphereInfo = { - center: Types_2.Point3; - radius: number; -}; - -// @public (undocumented) -export class SphereScissorsTool extends LabelmapBaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: any) => void; - // (undocumented) - _deactivateDraw: (element: any) => void; - // (undocumented) - _dragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - segmentIndex: number; - segmentsLocked: number[]; - segmentationId: string; - volumeId: string; - referencedVolumeId: string; - imageId: string; - toolGroupId: string; - segmentColor: [number, number, number, number]; - viewportIdsToRender: string[]; - handleIndex?: number; - movingTextBox: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - centerCanvas?: Array; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - preMouseDownCallback: (evt: EventTypes_2.InteractionEventType) => true; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -abstract class Spline implements ISpline { - constructor(props?: SplineProps); - // (undocumented) - get aabb(): Types_2.AABB2; - // (undocumented) - addControlPoint(point: Types_2.Point2): void; - // (undocumented) - addControlPointAtU(u: number): ControlPointInfo; - // (undocumented) - addControlPoints(points: Types_2.Point2[]): void; - // (undocumented) - clearControlPoints(): void; - // (undocumented) - get closed(): boolean; - set closed(closed: boolean); - // (undocumented) - containsPoint(point: Types_2.Point2): boolean; - // (undocumented) - protected get controlPoints(): Types_2.Point2[]; - // (undocumented) - deleteControlPointByIndex(index: number): boolean; - // (undocumented) - get fixedResolution(): boolean; - // (undocumented) - getClosestControlPoint(point: Types_2.Point2): ClosestControlPoint; - // (undocumented) - getClosestControlPointWithinDistance(point: Types_2.Point2, maxDist: number): ClosestControlPoint; - // (undocumented) - getClosestPoint(point: Types_2.Point2): ClosestSplinePoint; - // (undocumented) - getClosestPointOnControlPointLines(point: Types_2.Point2): ClosestPoint; - // (undocumented) - getControlPoints(): Types_2.Point2[]; - // (undocumented) - getPolylinePoints(): Types_2.Point2[]; - // (undocumented) - protected abstract getPreviewCurveSegments(controlPointPreview: Types_2.Point2, closeSpline: boolean): SplineCurveSegment[]; - // (undocumented) - getPreviewPolylinePoints(controlPointPreview: Types_2.Point2, closeDistance: number): Types_2.Point2[]; - // (undocumented) - protected abstract getSplineCurves(): SplineCurveSegment[]; - // (undocumented) - protected abstract getTransformMatrix(): number[]; - // (undocumented) - hasTangentPoints(): boolean; - // (undocumented) - get invalidated(): boolean; - protected set invalidated(invalidated: boolean); - // (undocumented) - isPointNearCurve(point: Types_2.Point2, maxDist: number): boolean; - // (undocumented) - get length(): number; - // (undocumented) - get numControlPoints(): number; - // (undocumented) - get resolution(): number; - set resolution(resolution: number); - // (undocumented) - setControlPoints(points: Types_2.Point2[]): void; - // (undocumented) - updateControlPoint(index: number, newControlPoint: Types_2.Point2): void; -} - -// @public (undocumented) -type SplineContourSegmentationAnnotation = SplineROIAnnotation & ContourSegmentationAnnotationData; - -// @public (undocumented) -export class SplineContourSegmentationTool extends SplineROITool { - constructor(toolProps: PublicToolProps); - // (undocumented) - protected isContourSegmentationTool(): boolean; - // (undocumented) - static toolName: string; -} - -// @public (undocumented) -type SplineCurveSegment = { - controlPoints: { - p0: Types_2.Point2; - p1: Types_2.Point2; - p2: Types_2.Point2; - p3: Types_2.Point2; - }; - aabb: Types_2.AABB2; - length: number; - previousCurveSegmentsLength: number; - lineSegments: SplineLineSegment[]; -}; - -// @public (undocumented) -type SplineLineSegment = { - points: { - start: Types_2.Point2; - end: Types_2.Point2; - }; - aabb: Types_2.AABB2; - length: number; - previousLineSegmentsLength: number; -}; - -// @public (undocumented) -type SplineProps = { - resolution?: number; - fixedResolution?: boolean; - closed?: boolean; -}; - -// @public (undocumented) -type SplineROIAnnotation = ContourAnnotation & { - data: { - label?: string; - spline: { - type: string; - instance: ISpline; - resolution: number; - }; - cachedStats?: { - [targetId: string]: { - Modality: string; - area: number; - areaUnit: string; - }; - }; - }; -}; - -// @public (undocumented) -export class SplineROITool extends ContourSegmentationBaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - static Actions: typeof SplineToolActions; - // (undocumented) - addControlPointCallback: (evt: EventTypes_2.InteractionEventType, annotation: SplineROIAnnotation) => void; - // (undocumented) - addNewAnnotation(evt: EventTypes_2.InteractionEventType): SplineROIAnnotation; - // (undocumented) - cancel(element: HTMLDivElement): string; - // (undocumented) - protected createAnnotation(evt: EventTypes_2.InteractionEventType): ContourAnnotation; - // (undocumented) - protected createInterpolatedSplineControl(annotation: any): void; - // (undocumented) - deleteControlPointCallback: (evt: EventTypes_2.InteractionEventType, annotation: SplineROIAnnotation) => void; - // (undocumented) - editData: { - annotation: SplineROIAnnotation; - viewportIdsToRender: Array; - handleIndex?: number; - movingTextBox?: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - lastCanvasPoint?: Types_2.Point2; - contourHoleProcessingEnabled?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - fireChangeOnUpdate: { - annotationUID: string; - changeType: ChangeTypes; - contourHoleProcessingEnabled: boolean; - }; - // (undocumented) - handleSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: SplineROIAnnotation, handle: ToolHandle) => void; - // (undocumented) - static hydrate: (viewportId: string, points: Types_2.Point3[], options?: { - annotationUID?: string; - splineType?: SplineTypesEnum; - }) => SplineROIAnnotation; - // (undocumented) - protected isContourSegmentationTool(): boolean; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: SplineROIAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - _isSplineROIAnnotation(annotation: Annotation): annotation is SplineROIAnnotation; - // (undocumented) - protected renderAnnotationInstance(renderContext: AnnotationRenderContext): boolean; - // (undocumented) - static SplineTypes: typeof SplineTypesEnum; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: EventTypes_2.InteractionEventType, annotation: SplineROIAnnotation) => void; - // (undocumented) - triggerAnnotationCompleted: (annotation: SplineROIAnnotation, contourHoleProcessingEnabled: boolean) => void; - // (undocumented) - triggerAnnotationModified: (annotation: SplineROIAnnotation, enabledElement: Types_2.IEnabledElement, changeType?: ChangeTypes) => void; - // (undocumented) - triggerChangeEvent: (annotation: SplineROIAnnotation, enabledElement: Types_2.IEnabledElement, changeType: ChangeTypes, contourHoleProcessingEnabled: any) => void; -} - -declare namespace splines { - export { - BSpline, - CardinalSpline, - CatmullRomSpline, - CubicSpline, - LinearSpline, - QuadraticBezier, - QuadraticSpline, - Spline - } -} -export { splines } - -// @public (undocumented) -const stackContextPrefetch: { - enable: (element: any) => void; - disable: typeof disable_2; - getConfiguration: typeof getConfiguration_2; - setConfiguration: typeof setConfiguration_2; -}; - -// @public (undocumented) -const stackPrefetch: { - enable: typeof enable; - disable: typeof disable; - getConfiguration: typeof getConfiguration; - setConfiguration: typeof setConfiguration; -}; - -// @public (undocumented) -export class StackScrollTool extends BaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - deltaY: number; - // (undocumented) - _dragCallback(evt: EventTypes_2.InteractionEventType): void; - // (undocumented) - _getPixelPerImage(viewport: any): number; - // (undocumented) - mouseDragCallback(evt: EventTypes_2.InteractionEventType): void; - // (undocumented) - mouseWheelCallback(evt: EventTypes_2.MouseWheelEventType): void; - // (undocumented) - _scroll(evt: EventTypes_2.MouseWheelEventType): void; - // (undocumented) - _scrollDrag(evt: EventTypes_2.InteractionEventType): void; - // (undocumented) - static toolName: any; - // (undocumented) - touchDragCallback(evt: EventTypes_2.InteractionEventType): void; -} - -// @public (undocumented) -export let state: ICornerstoneTools3dState; - -// @public (undocumented) -const state_2: { - resetAnnotationManager: typeof resetAnnotationManager; - triggerAnnotationAddedForElement: typeof annotationStateHelpers.triggerAnnotationAddedForElement; - triggerAnnotationAddedForFOR: typeof annotationStateHelpers.triggerAnnotationAddedForFOR; - triggerAnnotationRemoved: typeof annotationStateHelpers.triggerAnnotationRemoved; - triggerAnnotationModified: typeof annotationStateHelpers.triggerAnnotationModified; - triggerAnnotationCompleted: typeof annotationStateHelpers.triggerAnnotationCompleted; - triggerContourAnnotationCompleted: typeof annotationStateHelpers.triggerContourAnnotationCompleted; - getAllAnnotations: typeof annotationState.getAllAnnotations; - getAnnotations: typeof annotationState.getAnnotations; - getParentAnnotation: typeof annotationState.getParentAnnotation; - getChildAnnotations: typeof annotationState.getChildAnnotations; - clearParentAnnotation: typeof annotationState.clearParentAnnotation; - addChildAnnotation: typeof annotationState.addChildAnnotation; - getNumberOfAnnotations: typeof annotationState.getNumberOfAnnotations; - addAnnotation: typeof annotationState.addAnnotation; - removeAnnotation: typeof annotationState.removeAnnotation; - removeAnnotations: typeof annotationState.removeAnnotations; - removeAllAnnotations: typeof annotationState.removeAllAnnotations; - setAnnotationManager: typeof annotationState.setAnnotationManager; - getAnnotationManager: typeof annotationState.getAnnotationManager; - invalidateAnnotation: typeof annotationState.invalidateAnnotation; - getAnnotation: typeof annotationState.getAnnotation; -}; - -declare namespace state_3 { - export { - getColorLUT, - getCurrentLabelmapImageIdForViewport, - getNextColorLUTIndex, - getSegmentation, - getSegmentations, - getStackSegmentationImageIdsForViewport, - getViewportIdsWithSegmentation, - getSegmentationRepresentation, - getSegmentationRepresentations, - removeColorLUT, - getViewportSegmentations, - removeSegmentation, - removeLabelmapRepresentation, - removeContourRepresentation, - removeSurfaceRepresentation, - removeSegmentationRepresentation, - removeAllSegmentationRepresentations, - removeAllSegmentations, - addColorLUT, - addSegmentations, - updateLabelmapSegmentationImageReferences, - getSegmentationRepresentationsBySegmentationId, - destroy_4 as destroy - } -} - -// @public (undocumented) -type Statistics = { - name: string; - label?: string; - value: number | number[]; - unit: null | string; -}; - -// @public (undocumented) -function stopClip(element: HTMLDivElement, options?: StopClipOptions): void; - -declare namespace store { - export { - addTool, - hasTool, - removeTool, - addEnabledElement, - removeEnabledElement, - cancelActiveManipulations, - svgNodeCache, - ToolGroupManager, - SynchronizerManager, - Synchronizer, - state - } -} -export { store } - -declare namespace strategies { - export { - fillInsideRectangle, - thresholdInsideRectangle, - fillInsideCircle, - fillOutsideCircle - } -} - -// @public (undocumented) -enum StrategyCallbacks { - // (undocumented) - AcceptPreview = "acceptPreview", - // (undocumented) - AddPreview = "addPreview", - // (undocumented) - ComputeInnerCircleRadius = "computeInnerCircleRadius", - // (undocumented) - CreateIsInThreshold = "createIsInThreshold", - // (undocumented) - Fill = "fill", - // (undocumented) - GetStatistics = "getStatistics", - // (undocumented) - Initialize = "initialize", - // (undocumented) - INTERNAL_setValue = "setValue", - // (undocumented) - Interpolate = "interpolate", - // (undocumented) - OnInteractionEnd = "onInteractionEnd", - // (undocumented) - OnInteractionStart = "onInteractionStart", - // (undocumented) - Preview = "preview", - // (undocumented) - RejectPreview = "rejectPreview", - // (undocumented) - StrategyFunction = "strategyFunction" -} - -declare namespace style { - export { - getStyle, - setStyle, - setRenderInactiveSegmentations, - getRenderInactiveSegmentations, - resetToGlobalStyle, - hasCustomStyle - } -} - -// @public (undocumented) -type StyleConfig = { - annotations?: { - [annotationUID: string]: AnnotationStyle; - }; - viewports?: { - [viewportId: string]: ToolStyleConfig; - }; - toolGroups?: { - [toolGroupId: string]: ToolStyleConfig; - }; - default: ToolStyleConfig; -}; - -// @public (undocumented) -type StyleSpecifier = { - viewportId?: string; - toolGroupId?: string; - toolName?: string; - annotationUID?: string; -}; - -// @public (undocumented) -function subtractPolylines(targetPolyline: Types_2.Point2[], sourcePolyline: Types_2.Point2[]): Types_2.Point2[][]; - -// @public (undocumented) -type SurfaceStyle = {}; - -// @public (undocumented) -type SVGCursorDescriptor = { - name?: string; - iconContent: string; - iconSize?: number; - viewBox: { - x: number; - y: number; - }; - mousePoint?: { - x: number; - y: number; - }; - mousePointerGroupString?: string; -}; - -// @public (undocumented) -type SVGDrawingHelper = { - svgLayerElement: HTMLDivElement; - svgNodeCacheForCanvas: Record; - getSvgNode: (cacheKey: string) => SVGGElement | undefined; - appendNode: (svgNode: SVGElement, cacheKey: string) => void; - setNodeTouched: (cacheKey: string) => void; - clearUntouched: () => void; -}; - -// @public (undocumented) -class SVGMouseCursor extends ImageMouseCursor { - constructor(url: string, x?: number, y?: number, name?: string | undefined, fallback?: MouseCursor | undefined); - // (undocumented) - static getDefinedCursor(name: string, pointer?: boolean, color?: string): MouseCursor; -} - -// @public (undocumented) -let svgNodeCache: {}; - -// @public (undocumented) -type SVGPoint_2 = { - x: number; - y: number; -}; - -// @public (undocumented) -enum Swipe { - // (undocumented) - DOWN = "DOWN", - // (undocumented) - LEFT = "LEFT", - // (undocumented) - RIGHT = "RIGHT", - // (undocumented) - UP = "UP" -} - -// @public (undocumented) -export class Synchronizer { - constructor(synchronizerId: string, eventName: string, eventHandler: ISynchronizerEventHandler, options?: SynchronizerOptions); - // (undocumented) - add(viewportInfo: Types_2.IViewportId): void; - // (undocumented) - addSource(viewportInfo: Types_2.IViewportId): void; - // (undocumented) - addTarget(viewportInfo: Types_2.IViewportId): void; - // (undocumented) - destroy(): void; - // (undocumented) - getOptions(viewportId: string): Record | undefined; - // (undocumented) - getSourceViewports(): Array; - // (undocumented) - getTargetViewports(): Array; - // (undocumented) - hasSourceViewport(renderingEngineId: string, viewportId: string): boolean; - // (undocumented) - hasTargetViewport(renderingEngineId: string, viewportId: string): boolean; - // (undocumented) - id: string; - // (undocumented) - isDisabled(): boolean; - // (undocumented) - remove(viewportInfo: Types_2.IViewportId): void; - // (undocumented) - removeSource(viewportInfo: Types_2.IViewportId): void; - // (undocumented) - removeTarget(viewportInfo: Types_2.IViewportId): void; - // (undocumented) - setEnabled(enabled: boolean): void; - // (undocumented) - setOptions(viewportId: string, options?: Record): void; -} - -declare namespace SynchronizerManager { - export { - createSynchronizer, - destroy_2 as destroy, - getSynchronizer, - getSynchronizersForViewport, - getAllSynchronizers, - destroySynchronizer - } -} -export { SynchronizerManager } - -declare namespace synchronizers { - export { - createCameraPositionSynchronizer, - createPresentationViewSynchronizer, - createVOISynchronizer, - createZoomPanSynchronizer, - createImageSliceSynchronizer, - createStackImageSynchronizer, - createPresentationViewSynchronizer_2 as createSlabThicknessSynchronizer - } -} -export { synchronizers } - -// @public (undocumented) -type TextBoxHandle = { - hasMoved: boolean; - worldBoundingBox: { - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - }; - worldPosition: Types_2.Point3; -}; - -// @public (undocumented) -const thresholdInsideRectangle: (enabledElement: any, operationData: any) => unknown; - -// @public (undocumented) -function thresholdSegmentationByRange(segmentationVolume: Types_2.IImageVolume, segmentationIndex: number, thresholdVolumeInformation: ThresholdInformation[], overlapType: number): Types_2.IImageVolume; - -// @public (undocumented) -function thresholdVolumeByRange(segmentationVolume: Types_2.IImageVolume, thresholdVolumeInformation: ThresholdInformation[], options: ThresholdRangeOptions): Types_2.IImageVolume; - -// @public (undocumented) -function throttle(func: Function, wait?: number, options?: { - leading?: boolean; - trailing?: boolean; -}): Function; - -// @public (undocumented) -type ToolAction = { - method: string | ((evt: InteractionEventType, annotation: Annotation) => void); - bindings: SetToolBindingsType[]; -}; - -// @public (undocumented) -type ToolActivatedEventDetail = { - toolGroupId: string; - toolName: string; - toolBindingsOptions: SetToolBindingsType; -}; - -// @public (undocumented) -type ToolActivatedEventType = Types_2.CustomEventType; - -// @public (undocumented) -type ToolConfiguration = Record & { - statsCalculator?: Calculator; -}; - -// @public (undocumented) -interface ToolData { - // (undocumented) - dynamicCineEnabled?: boolean; - // (undocumented) - framesPerSecond: number; - // (undocumented) - frameTimeVector: number[] | undefined; - // (undocumented) - ignoreFrameTimeVector: boolean; - // (undocumented) - intervalId: number | undefined; - // (undocumented) - lastFrameTimeStamp: number | undefined; - // (undocumented) - loop: boolean; - // (undocumented) - reverse: boolean; - // (undocumented) - speed: number; - // (undocumented) - usingFrameTimeVector: boolean; -} - -// @public (undocumented) -class ToolGroup { - constructor(id: string); - // (undocumented) - addTool(toolName: string, configuration?: ToolConfiguration): void; - // (undocumented) - addToolInstance(toolName: string, parentClassName: string, configuration?: {}): void; - // (undocumented) - addViewport(viewportId: string, renderingEngineId?: string): void; - // (undocumented) - clone(newToolGroupId: any, fnToolFilter?: (toolName: string) => void): ToolGroup; - // (undocumented) - currentActivePrimaryToolName: string | null; - // (undocumented) - getActivePrimaryMouseButtonTool(): string; - // (undocumented) - getCurrentActivePrimaryToolName(): string; - // (undocumented) - getDefaultMousePrimary(): MouseBindings; - // (undocumented) - getDefaultPrimaryBindings(): IToolBinding[]; - // (undocumented) - getPrevActivePrimaryToolName(): string; - // (undocumented) - getToolConfiguration(toolName: string, configurationPath?: string): unknown; - // (undocumented) - getToolInstance(toolInstanceName: string): any; - // (undocumented) - getToolInstances(): Record; - // (undocumented) - getToolOptions(toolName: string): ToolOptionsType; - // (undocumented) - getViewportIds(): string[]; - // (undocumented) - getViewportsInfo(): Array; - // (undocumented) - hasTool(toolName: string): boolean; - // (undocumented) - id: string; - // (undocumented) - prevActivePrimaryToolName: string | null; - // (undocumented) - removeViewports(renderingEngineId: string, viewportId?: string): void; - // (undocumented) - restoreToolOptions: {}; - // (undocumented) - setActivePrimaryTool(toolName: string): void; - // (undocumented) - setActiveStrategy(toolName: string, strategyName: string): void; - // (undocumented) - _setCursorForViewports(cursor: MouseCursor): void; - // (undocumented) - setToolActive(toolName: string, toolBindingsOptions?: SetToolBindingsType): void; - // (undocumented) - setToolConfiguration(toolName: string, configuration: ToolConfiguration, overwrite?: boolean): boolean; - // (undocumented) - setToolDisabled(toolName: string): void; - // (undocumented) - setToolEnabled(toolName: string): void; - // (undocumented) - setToolMode(toolName: string, mode: ToolModes, options?: SetToolBindingsType): void; - // (undocumented) - setToolPassive(toolName: string, options?: { - removeAllBindings?: boolean | IToolBinding[]; - }): void; - // (undocumented) - setViewportsCursorByToolName(toolName: string, strategyName?: string): void; - // (undocumented) - _toolInstances: {}; - // (undocumented) - toolOptions: {}; - // (undocumented) - viewportsInfo: any[]; -} - -declare namespace ToolGroupManager { - export { - createToolGroup, - destroy_3 as destroy, - destroyToolGroup, - getToolGroup, - getToolGroupForViewport, - getAllToolGroups, - getToolGroupsWithToolName - } -} -export { ToolGroupManager } - -// @public (undocumented) -type ToolHandle = AnnotationHandle | TextBoxHandle; - -// @public (undocumented) -type ToolModeChangedEventDetail = { - toolGroupId: string; - toolName: string; - mode: ToolModes; - toolBindingsOptions?: SetToolBindingsType; -}; - -// @public (undocumented) -type ToolModeChangedEventType = Types_2.CustomEventType; - -// @public (undocumented) -enum ToolModes { - // (undocumented) - Active = "Active", - // (undocumented) - Disabled = "Disabled", - // (undocumented) - Enabled = "Enabled", - // (undocumented) - Passive = "Passive" -} - -// @public (undocumented) -type ToolOptionsType = { - bindings: IToolBinding[]; - mode: ToolModes; -}; - -// @public (undocumented) -type ToolProps = SharedToolProp; - -declare namespace ToolSpecificAnnotationTypes { - export { - ROICachedStats, - RectangleROIAnnotation, - ProbeAnnotation, - LengthAnnotation, - AdvancedMagnifyAnnotation, - CircleROIAnnotation, - SplineROIAnnotation, - SplineContourSegmentationAnnotation, - LivewireContourAnnotation, - LivewireContourSegmentationAnnotation, - EllipticalROIAnnotation, - BidirectionalAnnotation, - RectangleROIThresholdAnnotation, - RectangleROIStartEndThresholdAnnotation, - CircleROIStartEndThresholdAnnotation, - PlanarFreehandROIAnnotation, - PlanarFreehandContourSegmentationAnnotation, - InterpolationROIAnnotation, - ArrowAnnotation, - LabelAnnotation, - AngleAnnotation, - UltrasoundDirectionalAnnotation, - CobbAngleAnnotation, - ReferenceCursor, - ReferenceLineAnnotation, - ScaleOverlayAnnotation, - VideoRedactionAnnotation, - ContourAnnotation - } -} - -// @public (undocumented) -const toolStyle: ToolStyle; - -// @public (undocumented) -type ToolStyleConfig = { - [toolName: string]: AnnotationStyle; -} & { - global?: AnnotationStyle; -}; - -declare namespace touch { - export { - getMeanPoints, - getMeanTouchPoints, - copyPoints, - copyPointsList, - getDeltaDistanceBetweenIPoints, - getDeltaPoints, - getDeltaDistance, - getDeltaRotation - } -} - -// @public (undocumented) -type TouchDragEventDetail = NormalizedInteractionEventDetail & TouchCustomEventDetail & TouchPointsDetail; - -// @public (undocumented) -type TouchDragEventType = Types_2.CustomEventType; - -// @public (undocumented) -type TouchEndEventDetail = NormalizedInteractionEventDetail & TouchPointsDetail & TouchCustomEventDetail; - -// @public (undocumented) -type TouchEndEventType = Types_2.CustomEventType; - -// @public (undocumented) -type TouchPressEventDetail = NormalizedInteractionEventDetail & TouchCustomEventDetail & { - startPointsList: ITouchPoints[]; - lastPointsList: ITouchPoints[]; - startPoints: ITouchPoints; - lastPoints: ITouchPoints; -}; - -// @public (undocumented) -type TouchPressEventType = Types_2.CustomEventType; - -// @public (undocumented) -type TouchStartActivateEventDetail = NormalizedInteractionEventDetail & TouchCustomEventDetail & TouchPointsDetail; - -// @public (undocumented) -type TouchStartActivateEventType = Types_2.CustomEventType; - -// @public (undocumented) -type TouchStartEventDetail = NormalizedInteractionEventDetail & TouchCustomEventDetail & TouchPointsDetail; - -// @public (undocumented) -type TouchStartEventType = Types_2.CustomEventType; - -// @public (undocumented) -type TouchSwipeEventDetail = NormalizedInteractionEventDetail & TouchCustomEventDetail & { - swipe: Swipe; -}; - -// @public (undocumented) -type TouchSwipeEventType = Types_2.CustomEventType; - -// @public (undocumented) -type TouchTapEventDetail = NormalizedInteractionEventDetail & TouchCustomEventDetail & { - currentPointsList: ITouchPoints[]; - currentPoints: ITouchPoints; - taps: number; -}; - -// @public (undocumented) -type TouchTapEventType = Types_2.CustomEventType; - -// @public (undocumented) -export class TrackballRotateTool extends BaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - cleanUp: () => void; - // (undocumented) - _dragCallback(evt: EventTypes_2.InteractionEventType): void; - // (undocumented) - _getViewportsInfo: () => any[]; - // (undocumented) - _hasResolutionChanged: boolean; - // (undocumented) - mouseDragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - onSetToolActive: () => void; - // (undocumented) - onSetToolDisabled: () => void; - // (undocumented) - preMouseDownCallback: (evt: EventTypes_2.InteractionEventType) => boolean; - // (undocumented) - _resizeObservers: Map; - // (undocumented) - rotateCamera: (viewport: any, centerWorld: any, axis: any, angle: any) => void; - // (undocumented) - static toolName: any; - // (undocumented) - touchDragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _viewportAddedListener: (evt: any) => void; -} - -// @public (undocumented) -function triggerAnnotationRender(element: HTMLDivElement): void; - -// @public (undocumented) -function triggerAnnotationRenderForToolGroupIds(toolGroupIds: string[]): void; - -// @public (undocumented) -function triggerAnnotationRenderForViewportIds(viewportIdsToRender: string[]): void; - -// @public (undocumented) -function triggerEvent(el: EventTarget, type: string, detail?: unknown): boolean; - -// @public (undocumented) -function triggerSegmentationDataModified(segmentationId: string, modifiedSlicesToUse?: number[], segmentIndex?: number): void; - -declare namespace triggerSegmentationEvents { - export { - triggerSegmentationDataModified, - triggerSegmentationModified, - triggerSegmentationRemoved, - triggerSegmentationRepresentationModified, - triggerSegmentationRepresentationRemoved - } -} - -// @public (undocumented) -function triggerSegmentationModified(segmentationId: string): void; - -// @public (undocumented) -function triggerSegmentationRemoved(segmentationId: string): void; - -// @public (undocumented) -function triggerSegmentationRender(viewportId?: string): void; - -// @public (undocumented) -function triggerSegmentationRenderBySegmentationId(segmentationId?: string): void; - -// @public (undocumented) -function triggerSegmentationRepresentationModified(viewportId: string, segmentationId: string, type?: SegmentationRepresentations): void; - -// @public (undocumented) -function triggerSegmentationRepresentationRemoved(viewportId: string, segmentationId: string, type: SegmentationRepresentations): void; - -declare namespace Types { - export { - Annotation, - Annotations, - ContourAnnotationData, - ContourAnnotation, - ContourSegmentationAnnotationData, - ContourSegmentationAnnotation, - BidirectionalData, - CanvasCoordinates, - IAnnotationManager, - InterpolationViewportData, - ImageInterpolationData, - GroupSpecificAnnotations, - AnnotationState, - AnnotationStyle_2 as AnnotationStyle, - ToolSpecificAnnotationTypes, - AnnotationGroupSelector, - AnnotationRenderContext, - PlanarBoundingBox, - ToolProps, - PublicToolProps, - ToolConfiguration, - EventTypes_2 as EventTypes, - IPoints, - ITouchPoints, - IDistance, - IToolBinding, - SetToolBindingsType, - ToolOptionsType, - InteractionTypes, - ToolAction, - ToolGroup as IToolGroup, - IToolClassReference, - ISynchronizerEventHandler, - ToolHandle, - AnnotationHandle, - TextBoxHandle, - Segmentation, - SegmentationRepresentation, - SegmentationState, - RepresentationData, - RepresentationsData, - SVGCursorDescriptor, - SVGPoint_2 as SVGPoint, - CINETypes, - BoundsIJK_2 as BoundsIJK, - SVGDrawingHelper, - FloodFillResult, - FloodFillGetter, - FloodFillOptions, - ContourSegmentationData, - ISculptToolShape, - Statistics, - NamedStatistics, - LabelmapToolOperationData, - LabelmapToolOperationDataStack, - LabelmapToolOperationDataVolume, - CardinalSplineProps, - ClosestControlPoint, - ClosestPoint, - ClosestSplinePoint, - ControlPointInfo, - ISpline, - SplineCurveSegment, - SplineLineSegment, - SplineProps, - PolySegConversionOptions, - IBaseTool, - RepresentationStyle, - Segment, - SegmentationPublicInput, - LabelmapStyle, - ContourStyle, - SurfaceStyle - } -} -export { Types } - -declare namespace Types_3 { - export { - ColorbarCommonProps, - ColorbarProps, - ColorbarImageRange, - ColorbarVOIRange, - ColorbarSize, - ColorbarTicksProps, - ColorbarTicksStyle, - ViewportColorbarProps - } -} - -// @public (undocumented) -interface UltrasoundDirectionalAnnotation extends Annotation { - // (undocumented) - data: { - handles: { - points: Types_2.Point3[]; - activeHandleIndex: number | null; - textBox: { - hasMoved: boolean; - worldPosition: Types_2.Point3; - worldBoundingBox: { - topLeft: Types_2.Point3; - topRight: Types_2.Point3; - bottomLeft: Types_2.Point3; - bottomRight: Types_2.Point3; - }; - }; - }; - label: string; - cachedStats: { - [targetId: string]: { - xValues: number[]; - yValues: number[]; - units: string[]; - isHorizontal: boolean; - isUnitless: boolean; - }; - }; - }; -} - -// @public (undocumented) -export class UltrasoundDirectionalTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _activateModify: (element: HTMLDivElement) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => UltrasoundDirectionalAnnotation; - // (undocumented) - _calculateCachedStats(annotation: any, renderingEngine: any, enabledElement: any): any; - // (undocumented) - cancel: (element: HTMLDivElement) => string; - // (undocumented) - _deactivateDraw: (element: HTMLDivElement) => void; - // (undocumented) - _deactivateModify: (element: HTMLDivElement) => void; - // (undocumented) - _dragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - handleIndex?: number; - movingTextBox?: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - handleSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: UltrasoundDirectionalAnnotation, handle: ToolHandle): void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - isPointNearTool: (element: HTMLDivElement, annotation: UltrasoundDirectionalAnnotation, canvasCoords: Types_2.Point2, proximity: number) => boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - startedDrawing: boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback(evt: EventTypes_2.InteractionEventType, annotation: Annotation, interactionType: InteractionTypes, canvasCoords?: Types_2.Point2): void; -} - -// @public (undocumented) -function unlockAllAnnotations(): void; - -// @public (undocumented) -function updateContourPolyline(annotation: ContourAnnotation, polylineData: { - points: Types_2.Point2[]; - closed?: boolean; - targetWindingDirection?: ContourWindingDirection; -}, transforms: { - canvasToWorld: (point: Types_2.Point2) => Types_2.Point3; - worldToCanvas: (point: Types_2.Point3) => Types_2.Point2; -}, options?: { - updateWindingDirection?: boolean; - decimate?: { - enabled?: boolean; - epsilon?: number; - }; -}): void; - -// @public (undocumented) -function updateLabelmapSegmentationImageReferences(viewportId: string, segmentationId: string): string | undefined; - -// @public (undocumented) -function updateSegmentations(segmentationUpdateArray: { - segmentationId: string; - payload: Partial; -}[], suppressEvents?: boolean): void; - -// @public (undocumented) -function updateVolumeFromTimeData(dynamicVolume: Types_2.IDynamicImageVolume, operation: Enums_2.GenerateImageType, options: { - dimensionGroupNumbers?: number[]; - frameNumbers?: number[]; - targetVolume: Types_2.IImageVolume; -}): void; - -declare namespace utilities { - export { - math, - planar_2 as planar, - viewportFilters, - drawing_2 as drawing, - debounce, - dynamicVolume, - throttle, - orientation_2 as orientation, - isObject, - touch, - triggerEvent, - calibrateImageSpacing, - getCalibratedLengthUnitsAndScale, - getCalibratedProbeUnitsAndValue, - getCalibratedAspect, - getPixelValueUnits, - segmentation_2 as segmentation, - contours, - triggerAnnotationRenderForViewportIds, - triggerAnnotationRenderForToolGroupIds, - triggerAnnotationRender, - getSphereBoundsInfo, - getAnnotationNearPoint, - getViewportForAnnotation, - getAnnotationNearPointOnEnabledElement, - viewport, - cine, - boundingBox, - rectangleROITool, - planarFreehandROITool, - stackPrefetch, - stackContextPrefetch, - roundNumber_2 as roundNumber, - pointToString, - polyDataUtils, - voi, - AnnotationMultiSlice, - contourSegmentation, - annotationHydration, - getClosestImageIdForStackViewport, - pointInSurroundingSphereCallback, - normalizeViewportPlane, - IslandRemoval - } -} -export { utilities } - -declare namespace vec2 { - export { - findClosestPoint, - clip_2 as liangBarksyClip - } -} - -// @public (undocumented) -interface VideoRedactionAnnotation extends Annotation { - // (undocumented) - data: { - invalidated: boolean; - handles: { - points: Types_2.Point3[]; - activeHandleIndex: number | null; - }; - cachedStats: { - [key: string]: unknown; - }; - active: boolean; - }; - // (undocumented) - metadata: { - viewPlaneNormal: Types_2.Point3; - viewUp: Types_2.Point3; - FrameOfReferenceUID: string; - referencedImageId: string; - toolName: string; - }; -} - -// @public (undocumented) -export class VideoRedactionTool extends AnnotationTool { - constructor(toolConfiguration?: {}); - // (undocumented) - _activateDraw: (element: any) => void; - // (undocumented) - _activateModify: (element: any) => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => VideoRedactionAnnotation; - // (undocumented) - _calculateCachedStats: (annotation: any, viewPlaneNormal: any, viewUp: any, renderingEngine: any, enabledElement: any) => any; - // (undocumented) - cancel(element: any): any; - // (undocumented) - _deactivateDraw: (element: any) => void; - // (undocumented) - _deactivateModify: (element: any) => void; - // (undocumented) - _dragCallback: (evt: any) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportUIDsToRender: string[]; - handleIndex?: number; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - // (undocumented) - _endCallback: (evt: any) => void; - // (undocumented) - getHandleNearImagePoint: (element: any, annotation: any, canvasCoords: any, proximity: any) => any; - // (undocumented) - _getImageVolumeFromTargetUID(targetUID: any, renderingEngine: any): { - imageVolume: any; - viewport: any; - }; - // (undocumented) - _getRectangleImageCoordinates: (points: Array) => { - left: number; - top: number; - width: number; - height: number; - }; - // (undocumented) - _getTargetStackUID(viewport: any): string; - // (undocumented) - _getTargetVolumeUID: (scene: any) => any; - // (undocumented) - handleSelectedCallback: (evt: any, annotation: any, handle: any, interactionType?: string) => void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isHandleOutsideImage: boolean; - // (undocumented) - _isInsideVolume: (index1: any, index2: any, dimensions: any) => boolean; - // (undocumented) - isPointNearTool: (element: any, annotation: any, canvasCoords: any, proximity: any) => boolean; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - _throttledCalculateCachedStats: Function; - // (undocumented) - static toolName: string; - // (undocumented) - toolSelectedCallback: (evt: any, annotation: any, interactionType?: string) => void; -} - -declare namespace viewport { - export { - isViewportPreScaled - } -} - -// @public (undocumented) -class ViewportColorbar extends Colorbar { - constructor(props: ViewportColorbarProps); - // (undocumented) - destroy(): void; - // (undocumented) - get element(): HTMLDivElement; - // (undocumented) - get enabledElement(): Types_2.IEnabledElement; - // (undocumented) - protected getVOIMultipliers(): [number, number]; - // (undocumented) - protected onVoiChange(voiRange: ColorbarVOIRange): void; -} - -// @public (undocumented) -type ViewportColorbarProps = ColorbarProps & { - element: HTMLDivElement; - volumeId?: string; -}; - -declare namespace viewportFilters { - export { - filterViewportsWithToolEnabled, - filterViewportsWithFrameOfReferenceUID, - getViewportIdsWithToolToRender, - filterViewportsWithParallelNormals - } -} - -declare namespace visibility { - export { - setAnnotationVisibility, - showAllAnnotations, - isAnnotationVisible, - checkAndSetAnnotationVisibility - } -} - -declare namespace visibility_2 { - export { - setSegmentationRepresentationVisibility, - getSegmentationRepresentationVisibility, - setSegmentIndexVisibility, - getSegmentIndexVisibility, - getHiddenSegmentIndices - } -} - -declare namespace voi { - export { - colorbar, - windowLevel_2 as windowLevel - } -} - -// @public (undocumented) -export class VolumeRotateTool extends BaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _configuration: unknown; - // (undocumented) - mouseWheelCallback(evt: MouseWheelEventType): void; - // (undocumented) - static toolName: any; -} - -// @public (undocumented) -class VolumetricCalculator extends BasicStatsCalculator_2 { - // (undocumented) - static getStatistics(options: { - spacing?: number; - unit?: string; - }): NamedStatistics; - // (undocumented) - static statsCallback(data: { - value: number | Types_2.RGB; - pointLPS?: Types_2.Point3; - pointIJK?: Types_2.Point3; - }): void; -} - -// @public (undocumented) -export class WholeBodySegmentTool extends GrowCutBaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - protected getGrowCutLabelmap(growCutData: any): Promise; - // (undocumented) - protected getRemoveIslandData(): RemoveIslandData; - // (undocumented) - protected growCutData: WholeBodySegmentToolData | null; - // (undocumented) - preMouseDownCallback(evt: EventTypes_2.MouseDownActivateEventType): Promise; - // (undocumented) - renderAnnotation(enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper): void; - // (undocumented) - static toolName: any; -} - -declare namespace windowLevel_2 { - export { - getLuminanceFromRegion, - calculateMinMaxMean, - extractWindowLevelRegionToolData - } -} - -// @public (undocumented) -export class WindowLevelRegionTool extends AnnotationTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - _activateDraw: (element: any) => void; - // (undocumented) - _activateModify: () => void; - // (undocumented) - addNewAnnotation: (evt: EventTypes_2.InteractionEventType) => Annotation; - // (undocumented) - applyWindowLevelRegion: (annotation: any, element: any) => void; - // (undocumented) - cancel: () => void; - // (undocumented) - _deactivateDraw: (element: any) => void; - // (undocumented) - _deactivateModify: () => void; - // (undocumented) - _dragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - } | null; - // (undocumented) - _endCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - handleSelectedCallback: () => void; - // (undocumented) - isDrawing: boolean; - // (undocumented) - isPointNearTool: () => any; - // (undocumented) - renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean; - // (undocumented) - static toolName: any; - // (undocumented) - toolSelectedCallback: () => void; -} - -// @public (undocumented) -export class WindowLevelTool extends BaseTool { - constructor(toolProps?: {}, defaultToolProps?: { - supportedInteractionTypes: string[]; - }); - // (undocumented) - _getImageDynamicRangeFromMiddleSlice: (scalarData: any, dimensions: any) => number; - // (undocumented) - _getImageDynamicRangeFromViewport(viewport: any): number; - // (undocumented) - _getMultiplierFromDynamicRange(viewport: any, volumeId: any): number; - // (undocumented) - getNewRange({ viewport, deltaPointsCanvas, volumeId, lower, upper }: { - viewport: any; - deltaPointsCanvas: any; - volumeId: any; - lower: any; - upper: any; - }): { - lower: number; - upper: number; - }; - // (undocumented) - getPTScaledNewRange({ deltaPointsCanvas, lower, upper, clientHeight, viewport, volumeId, isPreScaled, }: { - deltaPointsCanvas: any; - lower: any; - upper: any; - clientHeight: any; - viewport: any; - volumeId: any; - isPreScaled: any; - }): { - lower: any; - upper: any; - }; - // (undocumented) - mouseDragCallback(evt: EventTypes_2.InteractionEventType): void; - // (undocumented) - static toolName: any; - // (undocumented) - touchDragCallback(evt: EventTypes_2.InteractionEventType): void; -} - -// @public (undocumented) -export class ZoomTool extends BaseTool { - constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps); - // (undocumented) - dirVec: Types_2.Point3; - // (undocumented) - _dragCallback(evt: EventTypes_2.InteractionEventType): void; - // (undocumented) - _dragParallelProjection: (evt: EventTypes_2.InteractionEventType, viewport: Types_2.IStackViewport | Types_2.IVolumeViewport, camera: Types_2.ICamera, pinch?: boolean) => void; - // (undocumented) - _dragPerspectiveProjection: (evt: EventTypes_2.InteractionEventType, viewport: Types_2.IStackViewport | Types_2.IVolumeViewport, camera: Types_2.ICamera, pinch?: boolean) => void; - // (undocumented) - initialMousePosWorld: Types_2.Point3; - // (undocumented) - mouseDragCallback: (evt: EventTypes_2.InteractionEventType) => void; - // (undocumented) - _panCallback(evt: EventTypes_2.InteractionEventType): void; - // (undocumented) - _pinchCallback(evt: EventTypes_2.InteractionEventType): void; - // (undocumented) - preMouseDownCallback: (evt: EventTypes_2.InteractionEventType) => boolean; - // (undocumented) - preTouchStartCallback: (evt: EventTypes_2.InteractionEventType) => boolean; - // (undocumented) - static toolName: any; - // (undocumented) - touchDragCallback: (evt: EventTypes_2.InteractionEventType) => void; -} - -// (No @packageDocumentation comment for this package) - -``` diff --git a/jest.config.base.js b/jest.config.base.js index 944a17e4b7..cac2667b25 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -18,6 +18,14 @@ module.exports = { // Setup // setupFiles: ["jest-canvas-mock/lib/index.js"], // Coverage + transform: { + '^.+\\.(js|jsx|ts|tsx)$': [ + 'babel-jest', + { + plugins: ['babel-plugin-transform-import-meta'], + }, + ], + }, collectCoverageFrom: [ '/src/**/*.{js,jsx}', // Not diff --git a/lerna.json b/lerna.json index a5ed1c091c..ca503de86f 100644 --- a/lerna.json +++ b/lerna.json @@ -1,12 +1,14 @@ { - "version": "2.19.7", + "version": "3.0.5", "packages": [ "packages/core", "packages/tools", "packages/adapters", "packages/nifti-volume-loader", "packages/dicomImageLoader", - "packages/ai" + "packages/ai", + "packages/labelmap-interpolation", + "packages/polymorphic-segmentation" ], "npmClient": "yarn" } diff --git a/package.json b/package.json index c8086e38e0..c02a47d5fe 100644 --- a/package.json +++ b/package.json @@ -15,16 +15,11 @@ }, "scripts": { "api-check": "npx lerna run api-check", - "format-check": "npx lerna run format-check", + "format-check": "cross-env NODE_OPTIONS=--max_old_space_size=32896 npx lerna run format-check", "build": "npx lerna run build --stream && npx lerna run build:loader", "build:esm": "npx lerna run build:esm --stream", "watch": "npx lerna watch -- lerna run build --scope=$LERNA_PACKAGE_NAME --include-dependents", - "build:update-api:ai": "cd packages/ai && npm run build:update-api", - "build:update-api:core": "cd packages/core && npm run build:update-api", - "build:update-api:tools": "cd packages/tools && npm run build:update-api", - "build:update-api:nifti": "cd packages/nifti-volume-loader && npm run build:update-api", - "build:update-api:dicomImageLoader": "cd packages/dicomImageLoader && npm run build:update-api", - "build:update-api": "npm run build && npm run build:update-api:ai && npm run build:update-api:core && npm run build:update-api:tools && npm run build:update-api:nifti && npm run build:update-api:dicomImageLoader", + "build:update-api": "echo not needed anymore", "clean": "npx lerna run clean --stream", "clean:deep": "npx lerna run clean:deep --stream", "example": "node ./utils/ExampleRunner/example-runner-cli.js", @@ -38,7 +33,7 @@ "docs:watch": "npx lerna run docs:watch", "preinstall": "node preinstall.js", "prepare": "husky", - "commit:prepare": "yarn build:update-api && yarn test:ci && yarn test:unit", + "commit:prepare": "yarn test:ci && yarn test:unit", "start": "yarn run dev", "test:e2e:ci": "npx playwright test", "test:e2e:ui": "npx playwright test --ui", @@ -95,6 +90,7 @@ "autoprefixer": "^10.4.14", "babel-loader": "9.1.2", "babel-plugin-istanbul": "^6.1.1", + "babel-plugin-transform-import-meta": "2.3.2", "chai": "^5.1.2", "clean-webpack-plugin": "^4.0.0", "commander": "^10.0.1", @@ -184,5 +180,6 @@ "not ie < 11", "not op_mini all" ], - "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e", + "dependencies": {} } diff --git a/packages/adapters/.babelrc b/packages/adapters/.babelrc deleted file mode 100644 index d15bf49ffb..0000000000 --- a/packages/adapters/.babelrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": [ - ["@babel/preset-env", { - "targets": { - "browsers": ["ie 11"] - } - }] - ] -} \ No newline at end of file diff --git a/packages/adapters/CHANGELOG.md b/packages/adapters/CHANGELOG.md index d377e2ca15..e5706c244d 100644 --- a/packages/adapters/CHANGELOG.md +++ b/packages/adapters/CHANGELOG.md @@ -3,89 +3,39 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -## [2.19.7](https://github.com/dcmjs-org/dcmjs/compare/v2.19.6...v2.19.7) (2025-02-06) +## [3.0.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.4...v3.0.5) (2025-03-06) **Note:** Version bump only for package @cornerstonejs/adapters -## [2.19.6](https://github.com/dcmjs-org/dcmjs/compare/v2.19.5...v2.19.6) (2025-02-05) +## [3.0.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.3...v3.0.4) (2025-03-05) **Note:** Version bump only for package @cornerstonejs/adapters -## [2.19.5](https://github.com/dcmjs-org/dcmjs/compare/v2.19.4...v2.19.5) (2025-02-04) +## [3.0.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.2...v3.0.3) (2025-03-04) **Note:** Version bump only for package @cornerstonejs/adapters -## [2.19.4](https://github.com/dcmjs-org/dcmjs/compare/v2.19.3...v2.19.4) (2025-02-04) +## [3.0.2](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.1...v3.0.2) (2025-03-04) -**Note:** Version bump only for package @cornerstonejs/adapters - -## [2.19.3](https://github.com/dcmjs-org/dcmjs/compare/v2.19.2...v2.19.3) (2025-02-04) - -**Note:** Version bump only for package @cornerstonejs/adapters - -## [2.19.2](https://github.com/dcmjs-org/dcmjs/compare/v2.19.1...v2.19.2) (2025-02-03) - -**Note:** Version bump only for package @cornerstonejs/adapters - -## [2.19.1](https://github.com/dcmjs-org/dcmjs/compare/v2.19.0...v2.19.1) (2025-02-03) - -**Note:** Version bump only for package @cornerstonejs/adapters - -# [2.19.0](https://github.com/dcmjs-org/dcmjs/compare/v2.18.9...v2.19.0) (2025-02-03) - -**Note:** Version bump only for package @cornerstonejs/adapters - -## [2.18.9](https://github.com/dcmjs-org/dcmjs/compare/v2.18.8...v2.18.9) (2025-02-03) - -**Note:** Version bump only for package @cornerstonejs/adapters - -## [2.18.8](https://github.com/dcmjs-org/dcmjs/compare/v2.18.7...v2.18.8) (2025-02-03) - -**Note:** Version bump only for package @cornerstonejs/adapters - -## [2.18.7](https://github.com/dcmjs-org/dcmjs/compare/v2.18.6...v2.18.7) (2025-02-03) - -**Note:** Version bump only for package @cornerstonejs/adapters - -## [2.18.6](https://github.com/dcmjs-org/dcmjs/compare/v2.18.5...v2.18.6) (2025-02-03) - -**Note:** Version bump only for package @cornerstonejs/adapters - -## [2.18.5](https://github.com/dcmjs-org/dcmjs/compare/v2.18.4...v2.18.5) (2025-02-03) - -**Note:** Version bump only for package @cornerstonejs/adapters - -## [2.18.4](https://github.com/dcmjs-org/dcmjs/compare/v2.18.3...v2.18.4) (2025-02-03) - -**Note:** Version bump only for package @cornerstonejs/adapters - -## [2.18.3](https://github.com/dcmjs-org/dcmjs/compare/v2.18.2...v2.18.3) (2025-01-31) - -**Note:** Version bump only for package @cornerstonejs/adapters - -## [2.18.2](https://github.com/dcmjs-org/dcmjs/compare/v2.18.1...v2.18.2) (2025-01-31) - -**Note:** Version bump only for package @cornerstonejs/adapters - -## [2.18.1](https://github.com/dcmjs-org/dcmjs/compare/v2.18.0...v2.18.1) (2025-01-31) +### Features -**Note:** Version bump only for package @cornerstonejs/adapters +- **surface-segmentation:** add visibilty configuration for surface segmentation ([#1846](https://github.com/cornerstonejs/cornerstone3D/issues/1846)) ([e1b5bc6](https://github.com/cornerstonejs/cornerstone3D/commit/e1b5bc646f3997be88ec237f86406c310420379a)) -# [2.18.0](https://github.com/dcmjs-org/dcmjs/compare/v2.17.6...v2.18.0) (2025-01-30) +## [3.0.1](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0...v3.0.1) (2025-02-27) **Note:** Version bump only for package @cornerstonejs/adapters -## [2.17.6](https://github.com/dcmjs-org/dcmjs/compare/v2.17.5...v2.17.6) (2025-01-29) +# [3.0.0](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.16...v3.0.0) (2025-02-27) -**Note:** Version bump only for package @cornerstonejs/adapters +### Features -## [2.17.5](https://github.com/dcmjs-org/dcmjs/compare/v2.17.4...v2.17.5) (2025-01-27) +- Cornerstone3D 3.0 ([#1865](https://github.com/cornerstonejs/cornerstone3D/issues/1865)) ([fe65459](https://github.com/cornerstonejs/cornerstone3D/commit/fe654590d16414e76361e1b2826fd64c3734ae87)) -**Note:** Version bump only for package @cornerstonejs/adapters +# [3.0.0-beta.6](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2025-02-27) -## [2.17.4](https://github.com/dcmjs-org/dcmjs/compare/v2.17.3...v2.17.4) (2025-01-24) +### Features -**Note:** Version bump only for package @cornerstonejs/adapters +- Add key image adapters for key image point mark ([#1754](https://github.com/cornerstonejs/cornerstone3D/issues/1754)) ([a1fd3f9](https://github.com/cornerstonejs/cornerstone3D/commit/a1fd3f9d0ea40d53cafd792d59bc1dbfc90663a5)) ## [2.17.3](https://github.com/dcmjs-org/dcmjs/compare/v2.17.2...v2.17.3) (2025-01-22) diff --git a/packages/adapters/api-extractor.json b/packages/adapters/api-extractor.json deleted file mode 100644 index 4ddb5f44d3..0000000000 --- a/packages/adapters/api-extractor.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../api-extractor.json", - "projectFolder": ".", - "mainEntryPointFilePath": "/dist/esm/index.d.ts", - "apiReport": { - "reportFileName": ".api.md", - "reportFolder": "../../common/reviews/api" - } -} diff --git a/packages/adapters/babel.config.js b/packages/adapters/babel.config.js new file mode 100644 index 0000000000..fed6f05fec --- /dev/null +++ b/packages/adapters/babel.config.js @@ -0,0 +1 @@ +module.exports = require("../../babel.config.js"); diff --git a/packages/adapters/package.json b/packages/adapters/package.json index 4c8a09d0d3..407738cb4e 100644 --- a/packages/adapters/package.json +++ b/packages/adapters/package.json @@ -1,6 +1,6 @@ { "name": "@cornerstonejs/adapters", - "version": "2.19.7", + "version": "3.0.5", "description": "Adapters for Cornerstone3D to/from formats including DICOM SR and others", "module": "./dist/esm/index.js", "types": "./dist/esm/index.d.ts", @@ -68,9 +68,9 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/dcmjs-org/dcmjs.git" + "url": "git+https://github.com/cornerstonejs/cornerstone3D.git" }, - "author": "@cornerstonejs (formerly Steve Pieper from dcmjs)", + "author": "@cornerstonejs adapters package", "license": "MIT", "bugs": { "url": "https://github.com/cornerstonejs/cornerstone3D/issues" @@ -84,7 +84,7 @@ "ndarray": "^1.0.19" }, "peerDependencies": { - "@cornerstonejs/core": "^2.19.7", - "@cornerstonejs/tools": "^2.19.7" + "@cornerstonejs/core": "^3.0.5", + "@cornerstonejs/tools": "^3.0.5" } } diff --git a/packages/adapters/rollup.config.mjs b/packages/adapters/rollup.config.mjs index 30bac3ad56..ac7da0b622 100644 --- a/packages/adapters/rollup.config.mjs +++ b/packages/adapters/rollup.config.mjs @@ -49,7 +49,7 @@ export default [ }), babel({ exclude: "node_modules/**", - babelHelpers: "bundled", + babelHelpers: "runtime", extensions: [".js", ".ts"] }), json() diff --git a/packages/adapters/src/adapters/Cornerstone/ArrowAnnotate.js b/packages/adapters/src/adapters/Cornerstone/ArrowAnnotate.js index bf37e4edd3..46d7a026bc 100644 --- a/packages/adapters/src/adapters/Cornerstone/ArrowAnnotate.js +++ b/packages/adapters/src/adapters/Cornerstone/ArrowAnnotate.js @@ -61,7 +61,8 @@ class ArrowAnnotate { static getTID300RepresentationArguments(tool) { const points = [tool.handles.start, tool.handles.end]; - let { finding, findingSites } = tool; + const { findingSites } = tool; + let { finding } = tool; const TID300RepresentationArguments = { points, diff --git a/packages/adapters/src/adapters/Cornerstone/MeasurementReport.js b/packages/adapters/src/adapters/Cornerstone/MeasurementReport.js index 929980af68..6c8a9aea6a 100644 --- a/packages/adapters/src/adapters/Cornerstone/MeasurementReport.js +++ b/packages/adapters/src/adapters/Cornerstone/MeasurementReport.js @@ -31,16 +31,11 @@ const codeValueMatch = (group, code, oldCode) => { ); }; -function getTID300ContentItem( - tool, - toolType, - ReferencedSOPSequence, - toolClass -) { - const args = toolClass.getTID300RepresentationArguments(tool); +function getTID300ContentItem(tool, ReferencedSOPSequence, adapterClass) { + const args = adapterClass.getTID300RepresentationArguments(tool); args.ReferencedSOPSequence = ReferencedSOPSequence; - const TID300Measurement = new toolClass.TID300Representation(args); + const TID300Measurement = new adapterClass.TID300Representation(args); return TID300Measurement; } @@ -61,12 +56,7 @@ function getMeasurementGroup(toolType, toolData, ReferencedSOPSequence) { // Loop through the array of tool instances // for this tool const Measurements = toolTypeData.data.map(tool => { - return getTID300ContentItem( - tool, - toolType, - ReferencedSOPSequence, - toolClass - ); + return getTID300ContentItem(tool, ReferencedSOPSequence, toolClass); }); return new TID1501MeasurementGroup(Measurements); diff --git a/packages/adapters/src/adapters/Cornerstone3D/Angle.ts b/packages/adapters/src/adapters/Cornerstone3D/Angle.ts index 4464d80a13..327e09599a 100644 --- a/packages/adapters/src/adapters/Cornerstone3D/Angle.ts +++ b/packages/adapters/src/adapters/Cornerstone3D/Angle.ts @@ -1,29 +1,14 @@ import { utilities } from "dcmjs"; -import CORNERSTONE_3D_TAG from "./cornerstone3DTag"; import MeasurementReport from "./MeasurementReport"; +import BaseAdapter3D from "./BaseAdapter3D"; const { CobbAngle: TID300CobbAngle } = utilities.TID300; -const MEASUREMENT_TYPE = "Angle"; -const trackingIdentifierTextValue = `${CORNERSTONE_3D_TAG}:${MEASUREMENT_TYPE}`; - -class Angle { - public static toolType = MEASUREMENT_TYPE; - public static utilityToolType = MEASUREMENT_TYPE; - public static TID300Representation = TID300CobbAngle; - public static isValidCornerstoneTrackingIdentifier = TrackingIdentifier => { - if (!TrackingIdentifier.includes(":")) { - return false; - } - - const [cornerstone3DTag, toolType] = TrackingIdentifier.split(":"); - - if (cornerstone3DTag !== CORNERSTONE_3D_TAG) { - return false; - } - - return toolType === MEASUREMENT_TYPE; - }; +class Angle extends BaseAdapter3D { + static { + this.init("Angle", TID300CobbAngle); + this.registerLegacy(); + } // TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport. public static getMeasurementData( @@ -107,13 +92,11 @@ class Angle { point3, point4, rAngle: angle, - trackingIdentifierTextValue, + trackingIdentifierTextValue: this.trackingIdentifierTextValue, finding, findingSites: findingSites || [] }; } } -MeasurementReport.registerTool(Angle); - export default Angle; diff --git a/packages/adapters/src/adapters/Cornerstone3D/ArrowAnnotate.js b/packages/adapters/src/adapters/Cornerstone3D/ArrowAnnotate.ts similarity index 77% rename from packages/adapters/src/adapters/Cornerstone3D/ArrowAnnotate.js rename to packages/adapters/src/adapters/Cornerstone3D/ArrowAnnotate.ts index 7514a181d0..736af13519 100644 --- a/packages/adapters/src/adapters/Cornerstone3D/ArrowAnnotate.js +++ b/packages/adapters/src/adapters/Cornerstone3D/ArrowAnnotate.ts @@ -1,21 +1,23 @@ import MeasurementReport from "./MeasurementReport"; import { utilities } from "dcmjs"; -import CORNERSTONE_3D_TAG from "./cornerstone3DTag"; +import BaseAdapter3D from "./BaseAdapter3D"; import CodingScheme from "./CodingScheme"; const { Point: TID300Point } = utilities.TID300; +const { codeValues } = CodingScheme; -const ARROW_ANNOTATE = "ArrowAnnotate"; -const trackingIdentifierTextValue = `${CORNERSTONE_3D_TAG}:${ARROW_ANNOTATE}`; - -const { codeValues, CodingSchemeDesignator } = CodingScheme; +class ArrowAnnotate extends BaseAdapter3D { + static { + this.init("ArrowAnnotate", TID300Point); + this.registerLegacy(); + } -class ArrowAnnotate { static getMeasurementData( MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, - metadata + metadata, + _trackingIdentifier ) { const { defaultState, SCOORDGroup, ReferencedFrameNumber } = MeasurementReport.getSetupMeasurementData( @@ -85,8 +87,8 @@ class ArrowAnnotate { } static getTID300RepresentationArguments(tool, worldToImageCoords) { - const { data, metadata } = tool; - let { finding, findingSites } = tool; + const { data, metadata, findingSites } = tool; + let { finding } = tool; const { referencedImageId } = metadata; if (!referencedImageId) { @@ -122,42 +124,22 @@ class ArrowAnnotate { y: pointImage2[1] } ], - trackingIdentifierTextValue, - findingSites: findingSites || [] + trackingIdentifierTextValue: this.trackingIdentifierTextValue, + findingSites: findingSites || [], + finding }; // If freetext finding isn't present, add it from the tool text. if (!finding || finding.CodeValue !== codeValues.CORNERSTONEFREETEXT) { finding = { CodeValue: codeValues.CORNERSTONEFREETEXT, - CodingSchemeDesignator, + CodingSchemeDesignator: CodingScheme.CodingSchemeDesignator, CodeMeaning: data.text }; } - TID300RepresentationArguments.finding = finding; - return TID300RepresentationArguments; } } -ArrowAnnotate.toolType = ARROW_ANNOTATE; -ArrowAnnotate.utilityToolType = ARROW_ANNOTATE; -ArrowAnnotate.TID300Representation = TID300Point; -ArrowAnnotate.isValidCornerstoneTrackingIdentifier = TrackingIdentifier => { - if (!TrackingIdentifier.includes(":")) { - return false; - } - - const [cornerstone3DTag, toolType] = TrackingIdentifier.split(":"); - - if (cornerstone3DTag !== CORNERSTONE_3D_TAG) { - return false; - } - - return toolType === ARROW_ANNOTATE; -}; - -MeasurementReport.registerTool(ArrowAnnotate); - export default ArrowAnnotate; diff --git a/packages/adapters/src/adapters/Cornerstone3D/BaseAdapter3D.ts b/packages/adapters/src/adapters/Cornerstone3D/BaseAdapter3D.ts new file mode 100644 index 0000000000..40c33c28d0 --- /dev/null +++ b/packages/adapters/src/adapters/Cornerstone3D/BaseAdapter3D.ts @@ -0,0 +1,178 @@ +import CORNERSTONE_3D_TAG from "./cornerstone3DTag"; +import MeasurementReport, { + type AdapterOptions, + type MeasurementAdapter +} from "./MeasurementReport"; + +export type Point = { + x: number; + y: number; + z?: number; +}; + +export type TID300Arguments = { + points?: Point[]; + point1?: Point; + point2?: Point; + trackingIdentifierTextValue: string; + findingSites: []; + finding; + + [key: string]: unknown; +}; + +/** + * This is a basic definition of adapters to be inherited for other adapters. + */ +export default class BaseAdapter3D { + public static toolType: string; + public static TID300Representation; + public static trackingIdentifierTextValue: string; + public static trackingIdentifiers: Set; + + /** + * The parent type is another type which could be used to parse this instance, + * but for which this sub-class has a better representation. For example, + * key images are parseable as Probe instances, but are represented as a different tool + * Thus, the name for the key image is `Cornerstone3DTag:Probe:KeyImage` so that + * a prefix query testing just the Probe could parse this object and display it, + * but a better/full path key could also be done. + */ + public static parentType: string; + + public static init( + toolType: string, + representation, + options?: AdapterOptions + ) { + this.toolType = toolType; + if (BaseAdapter3D.toolType) { + throw new Error( + `Base adapter tool type set to ${this.toolType} while setting ${toolType}` + ); + } + this.parentType = options?.parentType; + this.trackingIdentifiers = new Set(); + + this.TID300Representation = representation; + if (this.parentType) { + this.trackingIdentifierTextValue = `${CORNERSTONE_3D_TAG}:${this.parentType}:${this.toolType}`; + const alternateTrackingIdentifier = `${CORNERSTONE_3D_TAG}:${this.toolType}`; + this.trackingIdentifiers.add(alternateTrackingIdentifier); + } else { + this.trackingIdentifierTextValue = `${CORNERSTONE_3D_TAG}:${toolType}`; + } + this.trackingIdentifiers.add(this.trackingIdentifierTextValue); + MeasurementReport.registerTool(this); + } + + /** + * registerLegacy registers the given tool adapter using the legacy/old + * cornerstone 1.x adapter names so that the adapter class will be used to load + * those older adapters. + */ + public static registerLegacy() { + this.trackingIdentifiers.add( + `cornerstoneTools@^4.0.0:${this.toolType}` + ); + } + + /** Registers a new copy of the given type that has the prefix path the + * same as that of adapter, but adds the toolType to this path to create + * a new tool instance of the given type. This preserves compatibility + * with parsing in other versions, without need to replace the original parent + * type. + */ + public static registerSubType( + adapter: MeasurementAdapter, + toolType: string, + replace? + ) { + const subAdapter = Object.create(adapter); + subAdapter.init(toolType, adapter.TID300Representation, { + parentType: adapter.parentType || adapter.toolType, + replace + }); + return subAdapter; + } + + /** + * @returns true if the tool is of the given tool type based on the tracking identifier + */ + public static isValidCornerstoneTrackingIdentifier( + trackingIdentifier: string + ) { + if (this.trackingIdentifiers.has(trackingIdentifier)) { + return true; + } + if (!trackingIdentifier.includes(":")) { + return false; + } + + return trackingIdentifier.startsWith(this.trackingIdentifierTextValue); + } + + /** + * Returns annotation data for CS3D to use based on the underlying + * DICOM SR annotation data. + */ + public static getMeasurementData( + MeasurementGroup, + sopInstanceUIDToImageIdMap, + _imageToWorldCoords, + metadata, + trackingIdentifier?: string + ) { + const { defaultState: state, ReferencedFrameNumber } = + MeasurementReport.getSetupMeasurementData( + MeasurementGroup, + sopInstanceUIDToImageIdMap, + metadata, + this.toolType + ); + + state.annotation.data = { + cachedStats: {}, + frameNumber: ReferencedFrameNumber, + seriesLevel: trackingIdentifier?.indexOf(":Series") > 0 + }; + + return state; + } + + public static getTID300RepresentationArguments( + tool, + worldToImageCoords + ): TID300Arguments { + const { data, metadata } = tool; + const { finding, findingSites } = tool; + const { referencedImageId } = metadata; + + if (!referencedImageId) { + throw new Error( + "Probe.getTID300RepresentationArguments: referencedImageId is not defined" + ); + } + + const { + handles: { points = [] } + } = data; + + const pointsImage = points.map(point => { + const pointImage = worldToImageCoords(referencedImageId, point); + return { + x: pointImage[0], + y: pointImage[1] + }; + }); + + const tidArguments = { + points: pointsImage, + trackingIdentifierTextValue: this.trackingIdentifierTextValue, + findingSites: findingSites || [], + finding + }; + + return tidArguments; + } +} diff --git a/packages/adapters/src/adapters/Cornerstone3D/Bidirectional.ts b/packages/adapters/src/adapters/Cornerstone3D/Bidirectional.ts index 5253bfeffa..a19bfe9f57 100644 --- a/packages/adapters/src/adapters/Cornerstone3D/Bidirectional.ts +++ b/packages/adapters/src/adapters/Cornerstone3D/Bidirectional.ts @@ -2,31 +2,18 @@ import { utilities } from "dcmjs"; import CORNERSTONE_3D_TAG from "./cornerstone3DTag"; import MeasurementReport from "./MeasurementReport"; import { toArray } from "../helpers"; +import BaseAdapter3D from "./BaseAdapter3D"; const { Bidirectional: TID300Bidirectional } = utilities.TID300; -const BIDIRECTIONAL = "Bidirectional"; const LONG_AXIS = "Long Axis"; const SHORT_AXIS = "Short Axis"; -const trackingIdentifierTextValue = `${CORNERSTONE_3D_TAG}:${BIDIRECTIONAL}`; - -class Bidirectional { - public static toolType = BIDIRECTIONAL; - public static utilityToolType = BIDIRECTIONAL; - public static TID300Representation = TID300Bidirectional; - public static isValidCornerstoneTrackingIdentifier = TrackingIdentifier => { - if (!TrackingIdentifier.includes(":")) { - return false; - } - - const [cornerstone3DTag, toolType] = TrackingIdentifier.split(":"); - - if (cornerstone3DTag !== CORNERSTONE_3D_TAG) { - return false; - } - return toolType === BIDIRECTIONAL; - }; +class Bidirectional extends BaseAdapter3D { + static { + this.init("Bidirectional", TID300Bidirectional); + this.registerLegacy(); + } public static getMeasurementData( MeasurementGroup, @@ -184,13 +171,11 @@ class Bidirectional { }, longAxisLength: length, shortAxisLength: width, - trackingIdentifierTextValue, + trackingIdentifierTextValue: this.trackingIdentifierTextValue, finding: finding, findingSites: findingSites || [] }; } } -MeasurementReport.registerTool(Bidirectional); - export default Bidirectional; diff --git a/packages/adapters/src/adapters/Cornerstone3D/CircleROI.ts b/packages/adapters/src/adapters/Cornerstone3D/CircleROI.ts index a48d388481..29ecf85fa9 100644 --- a/packages/adapters/src/adapters/Cornerstone3D/CircleROI.ts +++ b/packages/adapters/src/adapters/Cornerstone3D/CircleROI.ts @@ -1,19 +1,14 @@ import { utilities } from "dcmjs"; import MeasurementReport from "./MeasurementReport"; -import CORNERSTONE_3D_TAG from "./cornerstone3DTag"; -import isValidCornerstoneTrackingIdentifier from "./isValidCornerstoneTrackingIdentifier"; +import BaseAdapter3D from "./BaseAdapter3D"; const { Circle: TID300Circle } = utilities.TID300; -const CIRCLEROI = "CircleROI"; - -class CircleROI { - static trackingIdentifierTextValue = `${CORNERSTONE_3D_TAG}:${CIRCLEROI}`; - static toolType = CIRCLEROI; - static utilityToolType = CIRCLEROI; - static TID300Representation = TID300Circle; - static isValidCornerstoneTrackingIdentifier = - isValidCornerstoneTrackingIdentifier; +class CircleROI extends BaseAdapter3D { + static { + this.init("CircleROI", TID300Circle); + this.registerLegacy(); + } /** Gets the measurement data for cornerstone, given DICOM SR measurement data. */ static getMeasurementData( @@ -113,6 +108,4 @@ class CircleROI { } } -MeasurementReport.registerTool(CircleROI); - export default CircleROI; diff --git a/packages/adapters/src/adapters/Cornerstone3D/CobbAngle.ts b/packages/adapters/src/adapters/Cornerstone3D/CobbAngle.ts index 2e13b64978..6f40cdbf22 100644 --- a/packages/adapters/src/adapters/Cornerstone3D/CobbAngle.ts +++ b/packages/adapters/src/adapters/Cornerstone3D/CobbAngle.ts @@ -1,29 +1,15 @@ import { utilities } from "dcmjs"; -import CORNERSTONE_3D_TAG from "./cornerstone3DTag"; import MeasurementReport from "./MeasurementReport"; +import BaseAdapter3D from "./BaseAdapter3D"; const { CobbAngle: TID300CobbAngle } = utilities.TID300; -const MEASUREMENT_TYPE = "CobbAngle"; -const trackingIdentifierTextValue = `${CORNERSTONE_3D_TAG}:${MEASUREMENT_TYPE}`; - -class CobbAngle { - public static toolType = MEASUREMENT_TYPE; - public static utilityToolType = MEASUREMENT_TYPE; - public static TID300Representation = TID300CobbAngle; - public static isValidCornerstoneTrackingIdentifier = TrackingIdentifier => { - if (!TrackingIdentifier.includes(":")) { - return false; - } - - const [cornerstone3DTag, toolType] = TrackingIdentifier.split(":"); - - if (cornerstone3DTag !== CORNERSTONE_3D_TAG) { - return false; - } - - return toolType === MEASUREMENT_TYPE; - }; +class CobbAngle extends BaseAdapter3D { + static { + this.init("CobbAngle", TID300CobbAngle); + // Register using the Cornerstone 1.x name so this tool is used to load it + this.registerLegacy(); + } // TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport. public static getMeasurementData( @@ -112,13 +98,11 @@ class CobbAngle { point3, point4, rAngle: angle, - trackingIdentifierTextValue, + trackingIdentifierTextValue: this.trackingIdentifierTextValue, finding, findingSites: findingSites || [] }; } } -MeasurementReport.registerTool(CobbAngle); - export default CobbAngle; diff --git a/packages/adapters/src/adapters/Cornerstone3D/EllipticalROI.ts b/packages/adapters/src/adapters/Cornerstone3D/EllipticalROI.ts index 1a910201cf..7628023ce8 100644 --- a/packages/adapters/src/adapters/Cornerstone3D/EllipticalROI.ts +++ b/packages/adapters/src/adapters/Cornerstone3D/EllipticalROI.ts @@ -1,23 +1,18 @@ import { vec3 } from "gl-matrix"; import { utilities } from "dcmjs"; -import CORNERSTONE_3D_TAG from "./cornerstone3DTag"; import MeasurementReport from "./MeasurementReport"; -import isValidCornerstoneTrackingIdentifier from "./isValidCornerstoneTrackingIdentifier"; +import BaseAdapter3D from "./BaseAdapter3D"; type Point3 = [number, number, number]; const { Ellipse: TID300Ellipse } = utilities.TID300; -const ELLIPTICALROI = "EllipticalROI"; const EPSILON = 1e-4; -class EllipticalROI { - static trackingIdentifierTextValue = `${CORNERSTONE_3D_TAG}:${ELLIPTICALROI}`; - static toolType = ELLIPTICALROI; - static utilityToolType = ELLIPTICALROI; - static TID300Representation = TID300Ellipse; - static isValidCornerstoneTrackingIdentifier = - isValidCornerstoneTrackingIdentifier; +class EllipticalROI extends BaseAdapter3D { + static { + this.init("EllipticalROI", TID300Ellipse); + } static getMeasurementData( MeasurementGroup, @@ -199,6 +194,4 @@ class EllipticalROI { } } -MeasurementReport.registerTool(EllipticalROI); - export default EllipticalROI; diff --git a/packages/adapters/src/adapters/Cornerstone3D/KeyImage.ts b/packages/adapters/src/adapters/Cornerstone3D/KeyImage.ts new file mode 100644 index 0000000000..57e59b20d4 --- /dev/null +++ b/packages/adapters/src/adapters/Cornerstone3D/KeyImage.ts @@ -0,0 +1,59 @@ +import { utilities } from "dcmjs"; +import Probe from "./Probe"; +const { Point: TID300Point } = utilities.TID300; + +export default class KeyImage extends Probe { + static { + this.init("KeyImage", TID300Point, { parentType: Probe.toolType }); + } + static trackingSeriesIdentifier = `${this.trackingIdentifierTextValue}:Series`; + static trackingPointIdentifier = `${this.trackingIdentifierTextValue}:Point`; + static trackingSeriesPointIdentifier = `${this.trackingIdentifierTextValue}:SeriesPoint`; + + static getMeasurementData( + measurementGroup, + sopInstanceUIDToImageIdMap, + imageToWorldCoords, + metadata, + trackingIdentifier + ) { + const baseData = super.getMeasurementData( + measurementGroup, + sopInstanceUIDToImageIdMap, + imageToWorldCoords, + metadata, + trackingIdentifier + ); + const { data } = baseData.annotation; + data.isPoint = trackingIdentifier.indexOf("Point") !== -1; + + return baseData; + } + + public static getTID300RepresentationArguments(tool, worldToImageCoords) { + const tid300Arguments = super.getTID300RepresentationArguments( + tool, + worldToImageCoords + ); + const { data } = tool; + if (data.isPoint) { + if (data.seriesLevel) { + tid300Arguments.trackingIdentifierTextValue = + this.trackingSeriesPointIdentifier; + } else { + tid300Arguments.trackingIdentifierTextValue = + this.trackingPointIdentifier; + } + } + if (data.seriesLevel) { + tid300Arguments.trackingIdentifierTextValue = + this.trackingSeriesIdentifier; + } + if (!tid300Arguments.points.length) { + tid300Arguments.points.push({ x: 0, y: 0 }); + } + return tid300Arguments; + } +} + +export { KeyImage }; diff --git a/packages/adapters/src/adapters/Cornerstone3D/Length.js b/packages/adapters/src/adapters/Cornerstone3D/Length.ts similarity index 79% rename from packages/adapters/src/adapters/Cornerstone3D/Length.js rename to packages/adapters/src/adapters/Cornerstone3D/Length.ts index 4d409ed264..733265409d 100644 --- a/packages/adapters/src/adapters/Cornerstone3D/Length.js +++ b/packages/adapters/src/adapters/Cornerstone3D/Length.ts @@ -1,13 +1,18 @@ import { utilities } from "dcmjs"; -import CORNERSTONE_3D_TAG from "./cornerstone3DTag"; import MeasurementReport from "./MeasurementReport"; +import BaseAdapter3D from "./BaseAdapter3D"; const { Length: TID300Length } = utilities.TID300; const LENGTH = "Length"; -const trackingIdentifierTextValue = `${CORNERSTONE_3D_TAG}:${LENGTH}`; -class Length { +export default class Length extends BaseAdapter3D { + static { + this.init(LENGTH, TID300Length); + // Register using the Cornerstone 1.x name so this tool is used to load it + this.registerLegacy(); + } + // TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport. static getMeasurementData( MeasurementGroup, @@ -20,7 +25,7 @@ class Length { MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, - Length.toolType + this.toolType ); const referencedImageId = @@ -84,30 +89,9 @@ class Length { point1, point2, distance, - trackingIdentifierTextValue, + trackingIdentifierTextValue: this.trackingIdentifierTextValue, finding, findingSites: findingSites || [] }; } } - -Length.toolType = LENGTH; -Length.utilityToolType = LENGTH; -Length.TID300Representation = TID300Length; -Length.isValidCornerstoneTrackingIdentifier = TrackingIdentifier => { - if (!TrackingIdentifier.includes(":")) { - return false; - } - - const [cornerstone3DTag, toolType] = TrackingIdentifier.split(":"); - - if (cornerstone3DTag !== CORNERSTONE_3D_TAG) { - return false; - } - - return toolType === LENGTH; -}; - -MeasurementReport.registerTool(Length); - -export default Length; diff --git a/packages/adapters/src/adapters/Cornerstone3D/MeasurementReport.ts b/packages/adapters/src/adapters/Cornerstone3D/MeasurementReport.ts index d7e5fd28c4..2067df144f 100644 --- a/packages/adapters/src/adapters/Cornerstone3D/MeasurementReport.ts +++ b/packages/adapters/src/adapters/Cornerstone3D/MeasurementReport.ts @@ -18,77 +18,136 @@ const FINDING = { CodingSchemeDesignator: "DCM", CodeValue: "121071" }; const FINDING_SITE = { CodingSchemeDesignator: "SCT", CodeValue: "363698007" }; const FINDING_SITE_OLD = { CodingSchemeDesignator: "SRT", CodeValue: "G-C0E3" }; -const codeValueMatch = (group, code, oldCode?) => { - const { ConceptNameCodeSequence } = group; - if (!ConceptNameCodeSequence) { - return; - } - const { CodingSchemeDesignator, CodeValue } = ConceptNameCodeSequence; - return ( - (CodingSchemeDesignator == code.CodingSchemeDesignator && - CodeValue == code.CodeValue) || - (oldCode && - CodingSchemeDesignator == oldCode.CodingSchemeDesignator && - CodeValue == oldCode.CodeValue) - ); +export type AdapterOptions = { + /** + * The parent type is another type which could be used to parse this instance, + * but for which this sub-class has a better representation. For example, + * key images are parseable as Probe instances, but are represented as a different tool + * Thus, the name for the key image is `Cornerstone3DTag:Probe:KeyImage` so that + * a prefix query testing just the Probe could parse this object and display it, + * but a better/full path key could also be done. + */ + parentType?: string; + + /** + * If set, then replace this + */ + replace?: boolean | ((original: MeasurementAdapter) => void); }; -function getTID300ContentItem( - tool, - toolType, - ReferencedSOPSequence, - toolClass, - worldToImageCoords -) { - const args = toolClass.getTID300RepresentationArguments( - tool, - worldToImageCoords +/** + * A measurement adapter parses/creates data for DICOM SR measurements + */ +export interface MeasurementAdapter { + toolType: string; + TID300Representation; + trackingIdentifierTextValue: string; + trackingIdentifiers: Set; + + /** + * The parent type is the base type of the adapter that is used for the + * identifier, being compatible with older versions to read that subtype. + */ + parentType: string; + + /** + * Applies the options and registers this tool + */ + init(toolType: string, representation, options?: AdapterOptions); + + getMeasurementData( + measurementGroup, + sopInstanceUIDToImageIdMap, + imageToWorldCoords, + metadata, + trackingIdentifier: string ); - args.ReferencedSOPSequence = ReferencedSOPSequence; - const TID300Measurement = new toolClass.TID300Representation(args); + isValidCornerstoneTrackingIdentifier(trackingIdentifier: string): boolean; - return TID300Measurement; + getTID300RepresentationArguments( + tool, + worldToImageCoords + ): Record; } -function getMeasurementGroup( - toolType, - toolData, - ReferencedSOPSequence, - worldToImageCoords -) { - const toolTypeData = toolData[toolType]; - const toolClass = - MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE[toolType]; - if ( - !toolTypeData || - !toolTypeData.data || - !toolTypeData.data.length || - !toolClass - ) { - return; - } +export default class MeasurementReport { + public static CORNERSTONE_3D_TAG = CORNERSTONE_3D_TAG; + + /** Maps tool type to the adapter name used to serialize this item to SR */ + public static measurementAdapterByToolType = new Map< + string, + MeasurementAdapter + >(); - // Loop through the array of tool instances - // for this tool - const Measurements = toolTypeData.data.map(tool => { - return getTID300ContentItem( + /** Maps tracking identifier to tool class to deserialize from SR into a tool instance */ + public static measurementAdapterByTrackingIdentifier = new Map< + string, + MeasurementAdapter + >(); + + public static getTID300ContentItem( + tool, + ReferencedSOPSequence, + toolClass, + worldToImageCoords + ) { + const args = toolClass.getTID300RepresentationArguments( tool, - toolType, - ReferencedSOPSequence, - toolClass, worldToImageCoords ); - }); + args.ReferencedSOPSequence = ReferencedSOPSequence; - return new TID1501MeasurementGroup(Measurements); -} + const TID300Measurement = new toolClass.TID300Representation(args); -export default class MeasurementReport { - public static CORNERSTONE_3D_TAG = CORNERSTONE_3D_TAG; - public static MEASUREMENT_BY_TOOLTYPE = {}; - public static CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE = {}; - public static CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE = {}; + return TID300Measurement; + } + + public static codeValueMatch = (group, code, oldCode?) => { + const { ConceptNameCodeSequence } = group; + if (!ConceptNameCodeSequence) { + return; + } + const { CodingSchemeDesignator, CodeValue } = ConceptNameCodeSequence; + return ( + (CodingSchemeDesignator == code.CodingSchemeDesignator && + CodeValue == code.CodeValue) || + (oldCode && + CodingSchemeDesignator == oldCode.CodingSchemeDesignator && + CodeValue == oldCode.CodeValue) + ); + }; + + public static getMeasurementGroup( + toolType, + toolData, + ReferencedSOPSequence, + worldToImageCoords + ) { + const toolTypeData = toolData[toolType]; + const toolClass = this.measurementAdapterByToolType.get(toolType); + if ( + !toolTypeData || + !toolTypeData.data || + !toolTypeData.data.length || + !toolClass + ) { + return; + } + + // Loop through the array of tool instances + // for this tool + const Measurements = toolTypeData.data.map(tool => { + return this.getTID300ContentItem( + tool, + ReferencedSOPSequence, + toolClass, + worldToImageCoords + ); + }); + + return new TID1501MeasurementGroup(Measurements); + } static getCornerstoneLabelFromDefaultState(defaultState) { const { findingSites = [], finding } = defaultState; @@ -156,7 +215,7 @@ export default class MeasurementReport { return derivationSourceDataset; }; - static getSetupMeasurementData( + public static getSetupMeasurementData( MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, @@ -166,11 +225,11 @@ export default class MeasurementReport { const contentSequenceArr = toArray(ContentSequence); const findingGroup = contentSequenceArr.find(group => - codeValueMatch(group, FINDING) + this.codeValueMatch(group, FINDING) ); const findingSiteGroups = contentSequenceArr.filter(group => - codeValueMatch(group, FINDING_SITE, FINDING_SITE_OLD) + this.codeValueMatch(group, FINDING_SITE, FINDING_SITE_OLD) ) || []; const NUMGroup = contentSequenceArr.find( group => group.ValueType === "NUM" @@ -300,7 +359,7 @@ export default class MeasurementReport { const measurementGroups = []; toolTypes.forEach(toolType => { - const group = getMeasurementGroup( + const group = this.getMeasurementGroup( toolType, toolData, ReferencedSOPSequence, @@ -370,69 +429,58 @@ export default class MeasurementReport { // For each of the supported measurement types, compute the measurement data const measurementData = {}; - const cornerstoneToolClasses = - MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE; - - const registeredToolClasses = []; - - Object.keys(cornerstoneToolClasses).forEach(key => { - registeredToolClasses.push(cornerstoneToolClasses[key]); - measurementData[key] = []; - }); - measurementGroups.forEach(measurementGroup => { try { const measurementGroupContentSequence = toArray( measurementGroup.ContentSequence ); - const TrackingIdentifierGroup = + const trackingIdentifierGroup = measurementGroupContentSequence.find( contentItem => contentItem.ConceptNameCodeSequence.CodeMeaning === TRACKING_IDENTIFIER ); - const TrackingIdentifierValue = - TrackingIdentifierGroup.TextValue; + const { TextValue: trackingIdentifierValue } = + trackingIdentifierGroup; - const TrackingUniqueIdentifierGroup = + const trackingUniqueIdentifierGroup = measurementGroupContentSequence.find( contentItem => contentItem.ConceptNameCodeSequence.CodeMeaning === TRACKING_UNIQUE_IDENTIFIER ); - const TrackingUniqueIdentifierValue = - TrackingUniqueIdentifierGroup?.UID; + const trackingUniqueIdentifierValue = + trackingUniqueIdentifierGroup?.UID; - const toolClass = + const toolAdapter = hooks?.getToolClass?.( measurementGroup, dataset, - registeredToolClasses + this.measurementAdapterByToolType ) || - registeredToolClasses.find(tc => - tc.isValidCornerstoneTrackingIdentifier( - TrackingIdentifierValue - ) + this.getAdapterForTrackingIdentifier( + trackingIdentifierValue ); - if (toolClass) { - const measurement = toolClass.getMeasurementData( + if (toolAdapter) { + const measurement = toolAdapter.getMeasurementData( measurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, - metadata + metadata, + trackingIdentifierValue ); measurement.TrackingUniqueIdentifier = - TrackingUniqueIdentifierValue; + trackingUniqueIdentifierValue; - console.log(`=== ${toolClass.toolType} ===`); + console.log(`=== ${toolAdapter.toolType} ===`); console.log(measurement); - - measurementData[toolClass.toolType].push(measurement); + measurementData[toolAdapter.toolType] ||= []; + measurementData[toolAdapter.toolType].push(measurement); } } catch (e) { console.warn( @@ -450,16 +498,66 @@ export default class MeasurementReport { /** * Register a new tool type. - * @param toolClass to perform I/O to DICOM for this tool + * @param toolAdapter to perform I/O to DICOM for this tool */ - public static registerTool(toolClass) { - MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE[ - toolClass.utilityToolType - ] = toolClass; - MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE[ - toolClass.toolType - ] = toolClass; - MeasurementReport.MEASUREMENT_BY_TOOLTYPE[toolClass.toolType] = - toolClass.utilityToolType; + public static registerTool( + toolAdapter: MeasurementAdapter, + replace: boolean | ((original) => void) = false + ) { + const registerName = toolAdapter.toolType; + if (this.measurementAdapterByToolType.has(registerName)) { + if (!replace) { + throw new Error( + `The registered tool name ${registerName} already exists in adapters, use a different toolType or use replace` + ); + } + if (typeof replace === "function") { + // Call the function so it can call parent output + replace(this.measurementAdapterByToolType.get(registerName)); + } + } + this.measurementAdapterByToolType.set( + toolAdapter.toolType, + toolAdapter + ); + this.measurementAdapterByTrackingIdentifier.set( + toolAdapter.trackingIdentifierTextValue, + toolAdapter + ); + } + + public static registerTrackingIdentifier( + toolClass, + ...trackingIdentifiers: string[] + ) { + for (const identifier of trackingIdentifiers) { + this.measurementAdapterByTrackingIdentifier.set( + identifier, + toolClass + ); + } + } + + public static getAdapterForTrackingIdentifier(trackingIdentifier: string) { + const adapter = + this.measurementAdapterByTrackingIdentifier.get(trackingIdentifier); + if (adapter) { + return adapter; + } + for (const adapterTest of [ + ...this.measurementAdapterByToolType.values() + ]) { + if ( + adapterTest.isValidCornerstoneTrackingIdentifier( + trackingIdentifier + ) + ) { + this.measurementAdapterByTrackingIdentifier.set( + trackingIdentifier, + adapterTest + ); + return adapterTest; + } + } } } diff --git a/packages/adapters/src/adapters/Cornerstone3D/PlanarFreehandROI.ts b/packages/adapters/src/adapters/Cornerstone3D/PlanarFreehandROI.ts index 25abb55488..4ea174d9bd 100644 --- a/packages/adapters/src/adapters/Cornerstone3D/PlanarFreehandROI.ts +++ b/packages/adapters/src/adapters/Cornerstone3D/PlanarFreehandROI.ts @@ -1,31 +1,16 @@ import MeasurementReport from "./MeasurementReport"; import { utilities } from "dcmjs"; -import CORNERSTONE_3D_TAG from "./cornerstone3DTag"; import { vec3 } from "gl-matrix"; +import BaseAdapter3D from "./BaseAdapter3D"; const { Polyline: TID300Polyline } = utilities.TID300; -const PLANARFREEHANDROI = "PlanarFreehandROI"; -const trackingIdentifierTextValue = `${CORNERSTONE_3D_TAG}:${PLANARFREEHANDROI}`; -const closedContourThreshold = 1e-5; - -class PlanarFreehandROI { - public static toolType = PLANARFREEHANDROI; - public static utilityToolType = PLANARFREEHANDROI; - public static TID300Representation = TID300Polyline; - public static isValidCornerstoneTrackingIdentifier = TrackingIdentifier => { - if (!TrackingIdentifier.includes(":")) { - return false; - } - - const [cornerstone3DTag, toolType] = TrackingIdentifier.split(":"); - - if (cornerstone3DTag !== CORNERSTONE_3D_TAG) { - return false; - } +class PlanarFreehandROI extends BaseAdapter3D { + public static closedContourThreshold = 1e-5; - return toolType === PLANARFREEHANDROI; - }; + static { + this.init("PlanarFreehandROI", TID300Polyline); + } static getMeasurementData( MeasurementGroup, @@ -64,7 +49,7 @@ class PlanarFreehandROI { let isOpenContour = true; // If the contour is closed, this should have been encoded as exactly the same point, so check for a very small difference. - if (distanceBetweenFirstAndLastPoint < closedContourThreshold) { + if (distanceBetweenFirstAndLastPoint < this.closedContourThreshold) { worldCoords.pop(); // Remove the last element which is duplicated. isOpenContour = false; @@ -140,13 +125,11 @@ class PlanarFreehandROI { max, stdDev, /** Other */ - trackingIdentifierTextValue, + trackingIdentifierTextValue: this.trackingIdentifierTextValue, finding, findingSites: findingSites || [] }; } } -MeasurementReport.registerTool(PlanarFreehandROI); - export default PlanarFreehandROI; diff --git a/packages/adapters/src/adapters/Cornerstone3D/Probe.js b/packages/adapters/src/adapters/Cornerstone3D/Probe.js deleted file mode 100644 index 553ae3797c..0000000000 --- a/packages/adapters/src/adapters/Cornerstone3D/Probe.js +++ /dev/null @@ -1,106 +0,0 @@ -import { utilities } from "dcmjs"; -import CORNERSTONE_3D_TAG from "./cornerstone3DTag"; -import MeasurementReport from "./MeasurementReport"; - -const { Point: TID300Point } = utilities.TID300; - -const PROBE = "Probe"; -const trackingIdentifierTextValue = `${CORNERSTONE_3D_TAG}:${PROBE}`; - -class Probe { - static getMeasurementData( - MeasurementGroup, - sopInstanceUIDToImageIdMap, - imageToWorldCoords, - metadata - ) { - const { defaultState, SCOORDGroup, ReferencedFrameNumber } = - MeasurementReport.getSetupMeasurementData( - MeasurementGroup, - sopInstanceUIDToImageIdMap, - metadata, - Probe.toolType - ); - - const referencedImageId = - defaultState.annotation.metadata.referencedImageId; - - const { GraphicData } = SCOORDGroup; - - const worldCoords = []; - for (let i = 0; i < GraphicData.length; i += 2) { - const point = imageToWorldCoords(referencedImageId, [ - GraphicData[i], - GraphicData[i + 1] - ]); - worldCoords.push(point); - } - - const state = defaultState; - - state.annotation.data = { - handles: { - points: worldCoords, - activeHandleIndex: null, - textBox: { - hasMoved: false - } - }, - frameNumber: ReferencedFrameNumber - }; - - return state; - } - - static getTID300RepresentationArguments(tool, worldToImageCoords) { - const { data, metadata } = tool; - let { finding, findingSites } = tool; - const { referencedImageId } = metadata; - - if (!referencedImageId) { - throw new Error( - "Probe.getTID300RepresentationArguments: referencedImageId is not defined" - ); - } - - const { points } = data.handles; - - const pointsImage = points.map(point => { - const pointImage = worldToImageCoords(referencedImageId, point); - return { - x: pointImage[0], - y: pointImage[1] - }; - }); - - const TID300RepresentationArguments = { - points: pointsImage, - trackingIdentifierTextValue, - findingSites: findingSites || [], - finding - }; - - return TID300RepresentationArguments; - } -} - -Probe.toolType = PROBE; -Probe.utilityToolType = PROBE; -Probe.TID300Representation = TID300Point; -Probe.isValidCornerstoneTrackingIdentifier = TrackingIdentifier => { - if (!TrackingIdentifier.includes(":")) { - return false; - } - - const [cornerstone3DTag, toolType] = TrackingIdentifier.split(":"); - - if (cornerstone3DTag !== CORNERSTONE_3D_TAG) { - return false; - } - - return toolType === PROBE; -}; - -MeasurementReport.registerTool(Probe); - -export default Probe; diff --git a/packages/adapters/src/adapters/Cornerstone3D/Probe.ts b/packages/adapters/src/adapters/Cornerstone3D/Probe.ts new file mode 100644 index 0000000000..e881dbf21d --- /dev/null +++ b/packages/adapters/src/adapters/Cornerstone3D/Probe.ts @@ -0,0 +1,65 @@ +import { utilities } from "dcmjs"; +import MeasurementReport from "./MeasurementReport"; +import BaseAdapter3D from "./BaseAdapter3D"; + +const { Point: TID300Point } = utilities.TID300; + +class Probe extends BaseAdapter3D { + static { + this.init("Probe", TID300Point); + this.registerLegacy(); + } + + static getMeasurementData( + MeasurementGroup, + sopInstanceUIDToImageIdMap, + imageToWorldCoords, + metadata, + trackingIdentifier + ) { + const state = super.getMeasurementData( + MeasurementGroup, + sopInstanceUIDToImageIdMap, + imageToWorldCoords, + metadata, + trackingIdentifier + ); + + const { defaultState, SCOORDGroup } = + MeasurementReport.getSetupMeasurementData( + MeasurementGroup, + sopInstanceUIDToImageIdMap, + metadata, + Probe.toolType + ); + + const referencedImageId = + defaultState.annotation.metadata.referencedImageId; + + const { GraphicData } = SCOORDGroup; + + const worldCoords = []; + for (let i = 0; i < GraphicData.length; i += 2) { + const point = imageToWorldCoords(referencedImageId, [ + GraphicData[i], + GraphicData[i + 1] + ]); + worldCoords.push(point); + } + + state.annotation.data = { + ...state.annotation.data, + handles: { + points: worldCoords, + activeHandleIndex: null, + textBox: { + hasMoved: false + } + } + }; + + return state; + } +} + +export default Probe; diff --git a/packages/adapters/src/adapters/Cornerstone3D/RectangleROI.ts b/packages/adapters/src/adapters/Cornerstone3D/RectangleROI.ts index e26e247918..f659a62e47 100644 --- a/packages/adapters/src/adapters/Cornerstone3D/RectangleROI.ts +++ b/packages/adapters/src/adapters/Cornerstone3D/RectangleROI.ts @@ -1,31 +1,15 @@ import { utilities } from "dcmjs"; -import CORNERSTONE_3D_TAG from "./cornerstone3DTag"; import MeasurementReport from "./MeasurementReport"; +import BaseAdapter3D from "./BaseAdapter3D"; const { Polyline: TID300Polyline } = utilities.TID300; -const TOOLTYPE = "RectangleROI"; -const trackingIdentifierTextValue = `${CORNERSTONE_3D_TAG}:${TOOLTYPE}`; - -class RectangleROI { - public static toolType = TOOLTYPE; - public static utilityToolType = TOOLTYPE; - public static TID300Representation = TID300Polyline; - - public static isValidCornerstoneTrackingIdentifier = TrackingIdentifier => { - if (!TrackingIdentifier.includes(":")) { - return false; - } - - const [cornerstone3DTag, toolType] = TrackingIdentifier.split(":"); - - if (cornerstone3DTag !== CORNERSTONE_3D_TAG) { - return false; - } - - return toolType === TOOLTYPE; - }; - +class RectangleROI extends BaseAdapter3D { + static { + this.init("RectangleROI", TID300Polyline); + // Register using the Cornerstone 1.x name so this tool is used to load it + this.registerLegacy(); + } public static getMeasurementData( MeasurementGroup, sopInstanceUIDToImageIdMap, @@ -109,13 +93,11 @@ class RectangleROI { ], area, perimeter, - trackingIdentifierTextValue, + trackingIdentifierTextValue: this.trackingIdentifierTextValue, finding, findingSites: findingSites || [] }; } } -MeasurementReport.registerTool(RectangleROI); - export default RectangleROI; diff --git a/packages/adapters/src/adapters/Cornerstone3D/UltrasoundDirectional.ts b/packages/adapters/src/adapters/Cornerstone3D/UltrasoundDirectional.ts index d502c8063e..affef4a1d2 100644 --- a/packages/adapters/src/adapters/Cornerstone3D/UltrasoundDirectional.ts +++ b/packages/adapters/src/adapters/Cornerstone3D/UltrasoundDirectional.ts @@ -1,30 +1,13 @@ import { utilities } from "dcmjs"; -import CORNERSTONE_3D_TAG from "./cornerstone3DTag"; import MeasurementReport from "./MeasurementReport"; +import BaseAdapter3D from "./BaseAdapter3D"; const { Length: TID300Length } = utilities.TID300; -const ULTRASOUND_DIRECTIONAL = "UltrasoundDirectionalTool"; -const trackingIdentifierTextValue = `${CORNERSTONE_3D_TAG}:${ULTRASOUND_DIRECTIONAL}`; - -class UltrasoundDirectional { - public static toolType = ULTRASOUND_DIRECTIONAL; - public static utilityToolType = ULTRASOUND_DIRECTIONAL; - public static TID300Representation = TID300Length; - public static isValidCornerstoneTrackingIdentifier = TrackingIdentifier => { - if (!TrackingIdentifier.includes(":")) { - return false; - } - - const [cornerstone3DTag, toolType] = TrackingIdentifier.split(":"); - - if (cornerstone3DTag !== CORNERSTONE_3D_TAG) { - return false; - } - - return toolType === ULTRASOUND_DIRECTIONAL; - }; - +class UltrasoundDirectional extends BaseAdapter3D { + static { + this.init("UltrasoundDirectionalTool", TID300Length); + } // TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport. static getMeasurementData( MeasurementGroup, @@ -91,13 +74,11 @@ class UltrasoundDirectional { return { point1, point2, - trackingIdentifierTextValue, + trackingIdentifierTextValue: this.trackingIdentifierTextValue, finding, findingSites: findingSites || [] }; } } -MeasurementReport.registerTool(UltrasoundDirectional); - export default UltrasoundDirectional; diff --git a/packages/adapters/src/adapters/Cornerstone3D/index.ts b/packages/adapters/src/adapters/Cornerstone3D/index.ts index ef0e057a1c..a2a6489489 100644 --- a/packages/adapters/src/adapters/Cornerstone3D/index.ts +++ b/packages/adapters/src/adapters/Cornerstone3D/index.ts @@ -13,12 +13,15 @@ import Length from "./Length"; import PlanarFreehandROI from "./PlanarFreehandROI"; import Probe from "./Probe"; import UltrasoundDirectional from "./UltrasoundDirectional"; +import BaseAdapter3D from "./BaseAdapter3D"; import * as Segmentation from "./Segmentation"; import * as ParametricMap from "./ParametricMap"; import * as RTSS from "./RTStruct"; +import KeyImage from "./KeyImage"; const Cornerstone3DSR = { + BaseAdapter3D, Bidirectional, CobbAngle, Angle, @@ -30,6 +33,7 @@ const Cornerstone3DSR = { Probe, PlanarFreehandROI, UltrasoundDirectional, + KeyImage, MeasurementReport, CodeScheme, CORNERSTONE_3D_TAG diff --git a/packages/adapters/test/KeyImage.jest.js b/packages/adapters/test/KeyImage.jest.js new file mode 100644 index 0000000000..1396fc6753 --- /dev/null +++ b/packages/adapters/test/KeyImage.jest.js @@ -0,0 +1,28 @@ +import { describe, it, expect, beforeEach } from "@jest/globals"; +import { Cornerstone3DSR } from "../src/adapters/Cornerstone3D"; + +const { KeyImage, Probe } = Cornerstone3DSR; + +describe("KeyImage", () => { + beforeEach(() => { + // Setup adapters + }); + + it("Must define tool type", () => { + expect(KeyImage.toolType).toBe("KeyImage"); + // Even after registering a sub-type of Probe, the Probe type should be correct + expect(Probe.toolType).toBe("Probe"); + }); + + it("Must define tracking identifiers", () => { + expect(KeyImage.trackingIdentifierTextValue).toBe( + "Cornerstone3DTools@^0.1.0:Probe:KeyImage" + ); + // Even after registering a sub-type of Probe, the Probe tracking identifier should be unchanged + expect(Probe.trackingIdentifierTextValue).toBe( + "Cornerstone3DTools@^0.1.0:Probe" + ); + }); +}); + +// diff --git a/packages/adapters/test/Probe.jest.js b/packages/adapters/test/Probe.jest.js new file mode 100644 index 0000000000..c2c4f99968 --- /dev/null +++ b/packages/adapters/test/Probe.jest.js @@ -0,0 +1,16 @@ +import { describe, it, expect, beforeEach } from "@jest/globals"; +import { Cornerstone3DSR } from "../src/adapters/Cornerstone3D"; + +const { Probe } = Cornerstone3DSR; + +describe("Probe", () => { + beforeEach(() => { + // Setup adapters + }); + + it("Must define tool type", () => { + expect(Probe.toolType).toBe("Probe"); + }); +}); + +// diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md index fe798e3dc3..cff2eab9a8 100644 --- a/packages/ai/CHANGELOG.md +++ b/packages/ai/CHANGELOG.md @@ -3,6 +3,84 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.0.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.4...v3.0.5) (2025-03-06) + +**Note:** Version bump only for package @cornerstonejs/ai + +## [3.0.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.3...v3.0.4) (2025-03-05) + +**Note:** Version bump only for package @cornerstonejs/ai + +## [3.0.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.2...v3.0.3) (2025-03-04) + +**Note:** Version bump only for package @cornerstonejs/ai + +## [3.0.2](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.1...v3.0.2) (2025-03-04) + +### Features + +- **surface-segmentation:** add visibilty configuration for surface segmentation ([#1846](https://github.com/cornerstonejs/cornerstone3D/issues/1846)) ([e1b5bc6](https://github.com/cornerstonejs/cornerstone3D/commit/e1b5bc646f3997be88ec237f86406c310420379a)) + +## [3.0.1](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0...v3.0.1) (2025-02-27) + +**Note:** Version bump only for package @cornerstonejs/ai + +# [3.0.0](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.16...v3.0.0) (2025-02-27) + +### Features + +- Cornerstone3D 3.0 ([#1865](https://github.com/cornerstonejs/cornerstone3D/issues/1865)) ([fe65459](https://github.com/cornerstonejs/cornerstone3D/commit/fe654590d16414e76361e1b2826fd64c3734ae87)) + +# [3.0.0-beta.6](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2025-02-27) + +**Note:** Version bump only for package @cornerstonejs/ai + +# [3.0.0-beta.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/ai + +# [3.0.0-beta.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/ai + +# [3.0.0-beta.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/ai + +# [3.0.0-beta.2](https://github.com/dcmjs-org/dcmjs/compare/v2.19.14...v3.0.0-beta.2) (2025-02-24) + +### Bug Fixes + +- publish beta for 3.0 ([8bf65df](https://github.com/dcmjs-org/dcmjs/commit/8bf65df9bec5f52459de1c49c4834b316f680f1b)) + +## [2.19.14](https://github.com/dcmjs-org/dcmjs/compare/v2.19.13...v2.19.14) (2025-02-24) + +**Note:** Version bump only for package @cornerstonejs/ai + +## [2.19.13](https://github.com/dcmjs-org/dcmjs/compare/v2.19.12...v2.19.13) (2025-02-21) + +**Note:** Version bump only for package @cornerstonejs/ai + +## [2.19.12](https://github.com/dcmjs-org/dcmjs/compare/v2.19.11...v2.19.12) (2025-02-20) + +**Note:** Version bump only for package @cornerstonejs/ai + +## [2.19.11](https://github.com/dcmjs-org/dcmjs/compare/v2.19.10...v2.19.11) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/ai + +## [2.19.10](https://github.com/dcmjs-org/dcmjs/compare/v2.19.9...v2.19.10) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/ai + +## [2.19.9](https://github.com/dcmjs-org/dcmjs/compare/v2.19.8...v2.19.9) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/ai + +## [2.19.8](https://github.com/dcmjs-org/dcmjs/compare/v2.19.7...v2.19.8) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/ai + ## [2.19.7](https://github.com/dcmjs-org/dcmjs/compare/v2.19.6...v2.19.7) (2025-02-06) **Note:** Version bump only for package @cornerstonejs/ai diff --git a/packages/ai/api-extractor.json b/packages/ai/api-extractor.json deleted file mode 100644 index 4ddb5f44d3..0000000000 --- a/packages/ai/api-extractor.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../api-extractor.json", - "projectFolder": ".", - "mainEntryPointFilePath": "/dist/esm/index.d.ts", - "apiReport": { - "reportFileName": ".api.md", - "reportFolder": "../../common/reviews/api" - } -} diff --git a/packages/ai/package.json b/packages/ai/package.json index 1830a63c23..e1951c671d 100644 --- a/packages/ai/package.json +++ b/packages/ai/package.json @@ -1,6 +1,6 @@ { "name": "@cornerstonejs/ai", - "version": "2.19.7", + "version": "3.0.5", "description": "AI and ML Interfaces for Cornerstone3D", "files": [ "dist" @@ -21,20 +21,23 @@ }, "scripts": { "test": "jest --testTimeout 60000", - "clean": "rimraf dist", + "clean": "rm -rf node_modules/.cache/storybook && shx rm -rf dist", + "clean:deep": "yarn run clean && shx rm -rf node_modules", "build": "yarn run build:esm", "build:esm": "tsc --project ./tsconfig.json", "build:esm:watch": "tsc --project ./tsconfig.json --watch", "dev": "tsc --project ./tsconfig.json --watch", "build:all": "yarn run build:esm", - "build:update-api": "yarn run build:esm && api-extractor run --local", "start": "tsc --project ./tsconfig.json --watch", "format": "prettier --write 'src/**/*.js' 'test/**/*.js'", - "lint": "eslint --fix ." + "lint": "eslint --fix .", + "format-check": "npx eslint ./src --quiet", + "api-check": "api-extractor --debug run ", + "prepublishOnly": "yarn clean && yarn build" }, "repository": { "type": "git", - "url": "git+https://github.com/dcmjs-org/dcmjs.git" + "url": "git+https://github.com/cornerstonejs/cornerstone3D.git" }, "author": "@cornerstonejs", "license": "MIT", @@ -53,7 +56,7 @@ "onnxruntime-web": "1.17.1" }, "peerDependencies": { - "@cornerstonejs/core": "^2.19.7", - "@cornerstonejs/tools": "^2.19.7" + "@cornerstonejs/core": "^3.0.5", + "@cornerstonejs/tools": "^3.0.5" } } diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index efa6301e54..ccd08b468d 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -3,6 +3,90 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.0.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.4...v3.0.5) (2025-03-06) + +**Note:** Version bump only for package @cornerstonejs/core + +## [3.0.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.3...v3.0.4) (2025-03-05) + +### Bug Fixes + +- **worker:** should not change type of input ([#1877](https://github.com/cornerstonejs/cornerstone3D/issues/1877)) ([a97effd](https://github.com/cornerstonejs/cornerstone3D/commit/a97effd52abe35eaf532a5634a69b76f932099e7)) + +## [3.0.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.2...v3.0.3) (2025-03-04) + +**Note:** Version bump only for package @cornerstonejs/core + +## [3.0.2](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.1...v3.0.2) (2025-03-04) + +### Features + +- **surface-segmentation:** add visibilty configuration for surface segmentation ([#1846](https://github.com/cornerstonejs/cornerstone3D/issues/1846)) ([e1b5bc6](https://github.com/cornerstonejs/cornerstone3D/commit/e1b5bc646f3997be88ec237f86406c310420379a)) + +## [3.0.1](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0...v3.0.1) (2025-02-27) + +**Note:** Version bump only for package @cornerstonejs/core + +# [3.0.0](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.16...v3.0.0) (2025-02-27) + +### Features + +- Cornerstone3D 3.0 ([#1865](https://github.com/cornerstonejs/cornerstone3D/issues/1865)) ([fe65459](https://github.com/cornerstonejs/cornerstone3D/commit/fe654590d16414e76361e1b2826fd64c3734ae87)) + +# [3.0.0-beta.6](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2025-02-27) + +### Features + +- Add key image adapters for key image point mark ([#1754](https://github.com/cornerstonejs/cornerstone3D/issues/1754)) ([a1fd3f9](https://github.com/cornerstonejs/cornerstone3D/commit/a1fd3f9d0ea40d53cafd792d59bc1dbfc90663a5)) + +# [3.0.0-beta.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/core + +# [3.0.0-beta.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/core + +# [3.0.0-beta.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/core + +# [3.0.0-beta.2](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.14...v3.0.0-beta.2) (2025-02-24) + +### Bug Fixes + +- publish beta for 3.0 ([8bf65df](https://github.com/cornerstonejs/cornerstone3D/commit/8bf65df9bec5f52459de1c49c4834b316f680f1b)) + +## [2.19.14](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.13...v2.19.14) (2025-02-24) + +**Note:** Version bump only for package @cornerstonejs/core + +## [2.19.13](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.12...v2.19.13) (2025-02-21) + +**Note:** Version bump only for package @cornerstonejs/core + +## [2.19.12](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.11...v2.19.12) (2025-02-20) + +**Note:** Version bump only for package @cornerstonejs/core + +## [2.19.11](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.10...v2.19.11) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/core + +## [2.19.10](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.9...v2.19.10) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/core + +## [2.19.9](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.8...v2.19.9) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/core + +## [2.19.8](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.7...v2.19.8) (2025-02-18) + +### Bug Fixes + +- **rendering:** fix image overflow issues by restoring data type check ([#1829](https://github.com/cornerstonejs/cornerstone3D/issues/1829)) ([f5ff886](https://github.com/cornerstonejs/cornerstone3D/commit/f5ff886cbc7fce190f943880c180533f3af97065)) + ## [2.19.7](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.6...v2.19.7) (2025-02-06) **Note:** Version bump only for package @cornerstonejs/core diff --git a/packages/core/api-extractor.json b/packages/core/api-extractor.json deleted file mode 100644 index 4ddb5f44d3..0000000000 --- a/packages/core/api-extractor.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../api-extractor.json", - "projectFolder": ".", - "mainEntryPointFilePath": "/dist/esm/index.d.ts", - "apiReport": { - "reportFileName": ".api.md", - "reportFolder": "../../common/reviews/api" - } -} diff --git a/packages/core/jest.config.js b/packages/core/jest.config.js index 10f5cc4456..be56fc7a06 100644 --- a/packages/core/jest.config.js +++ b/packages/core/jest.config.js @@ -5,6 +5,7 @@ const path = require('path'); module.exports = { ...base, displayName: 'core', + setupFiles: ['jest-canvas-mock'], moduleNameMapper: { '^@cornerstonejs/(.*)$': path.resolve(__dirname, '../$1/src'), }, diff --git a/packages/core/package.json b/packages/core/package.json index b813171608..bc4ee48f41 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@cornerstonejs/core", - "version": "2.19.7", + "version": "3.0.5", "description": "Cornerstone3D Core", "module": "./dist/esm/index.js", "types": "./dist/esm/index.d.ts", @@ -63,7 +63,6 @@ "dev": "tsc --project ./tsconfig.json --watch", "format-check": "npx eslint ./src --quiet", "api-check": "api-extractor --debug run ", - "build:update-api": "yarn run build:esm && api-extractor run --local", "prepublishOnly": "yarn run build" }, "dependencies": { diff --git a/packages/core/src/RenderingEngine/BaseVolumeViewport.ts b/packages/core/src/RenderingEngine/BaseVolumeViewport.ts index fdf85b44f5..6bfcccd8ba 100644 --- a/packages/core/src/RenderingEngine/BaseVolumeViewport.ts +++ b/packages/core/src/RenderingEngine/BaseVolumeViewport.ts @@ -151,7 +151,8 @@ abstract class BaseVolumeViewport extends Viewport { this.initialViewUp = viewUp; if (resetCamera) { - this.resetCamera(); + const t = this as unknown as IVolumeViewport; + t.resetCamera({ resetOrientation: false, resetRotation: false }); } } diff --git a/packages/core/src/RenderingEngine/StackViewport.ts b/packages/core/src/RenderingEngine/StackViewport.ts index 9822568fa1..ab03d4ce56 100644 --- a/packages/core/src/RenderingEngine/StackViewport.ts +++ b/packages/core/src/RenderingEngine/StackViewport.ts @@ -1940,6 +1940,8 @@ class StackViewport extends Viewport { imagePlaneModule.columnCosines, columnCosines as Point3 ); + const isDataTypeMatching = + dataType === image.voxelManager.getScalarData().constructor.name; const result = isXSpacingValid && @@ -1947,7 +1949,8 @@ class StackViewport extends Viewport { isXVoxelsMatching && isYVoxelsMatching && isRowCosinesMatching && - isColumnCosinesMatching; + isColumnCosinesMatching && + isDataTypeMatching; return result; } @@ -2540,7 +2543,7 @@ class StackViewport extends Viewport { private _getInitialVOIRange(image: IImage) { if (this.voiRange && this.voiUpdatedWithSetProperties) { - return this.globalDefaultProperties.voiRange; + return this.voiRange; } const { windowCenter, windowWidth, voiLUTFunction } = image; diff --git a/packages/core/src/cache/cache.ts b/packages/core/src/cache/cache.ts index 5c2db60a51..21576891ca 100644 --- a/packages/core/src/cache/cache.ts +++ b/packages/core/src/cache/cache.ts @@ -16,6 +16,7 @@ import imageIdToURI from '../utilities/imageIdToURI'; import eventTarget from '../eventTarget'; import Events from '../enums/Events'; import { ImageQualityStatus } from '../enums'; +import fnv1aHash from '../utilities/fnv1aHash'; const ONE_GB = 1073741824; @@ -33,6 +34,8 @@ class Cache { private readonly _imageCache = new Map(); // used to store volume data (3d) private readonly _volumeCache = new Map(); + // used to store the reverse lookup from imageIds to volumeId + private readonly _imageIdsToVolumeIdCache = new Map(); // Todo: contour for now, but will be used for surface, etc. private readonly _geometryCache = new Map(); @@ -40,6 +43,36 @@ class Cache { private _maxCacheSize = 3 * ONE_GB; private _geometryCacheSize = 0; + /** + * Generates a deterministic volume ID from a list of image IDs + * @param imageIds - Array of image IDs + * @returns A deterministic volume ID + */ + public generateVolumeId(imageIds: string[]): string { + const imageURIs = imageIds.map(imageIdToURI).sort(); + + let combinedHash = 0x811c9dc5; + for (const id of imageURIs) { + const idHash = fnv1aHash(id); + for (let i = 0; i < idHash.length; i++) { + combinedHash ^= idHash.charCodeAt(i); + combinedHash += + (combinedHash << 1) + + (combinedHash << 4) + + (combinedHash << 7) + + (combinedHash << 8) + + (combinedHash << 24); + } + } + return `volume-${(combinedHash >>> 0).toString(36)}`; + } + + public getImageIdsForVolumeId(volumeId: string): string[] { + return Array.from(this._imageIdsToVolumeIdCache.entries()) + .filter(([_, id]) => id === volumeId) + .map(([key]) => key); + } + /** * Set the maximum cache Size * diff --git a/packages/core/src/cache/classes/Surface.ts b/packages/core/src/cache/classes/Surface.ts index a3e2bb1965..b97a8383a2 100644 --- a/packages/core/src/cache/classes/Surface.ts +++ b/packages/core/src/cache/classes/Surface.ts @@ -15,6 +15,7 @@ export class Surface { private _polys: number[]; private _segmentIndex: number; private _centroid: Point3; + private _visible: boolean; /** * Creates an instance of Surface. @@ -29,6 +30,7 @@ export class Surface { this._segmentIndex = props.segmentIndex; this.sizeInBytes = this._getSizeInBytes(); this._updateCentroid(); + this._visible = true; } /** @@ -120,6 +122,21 @@ export class Surface { return this._segmentIndex; } + /** + * Gets the visibility of the surface. + */ + get visible(): boolean { + return this._visible; + } + + /** + * Sets the visibility of the surface. + * @param {boolean} visible - The new visibility for the surface. + */ + set visible(visible: boolean) { + this._visible = visible; + } + /** * Gets the centroid of the surface. * @returns {Point3} The centroid of the surface. diff --git a/packages/core/src/enums/Events.ts b/packages/core/src/enums/Events.ts index 1f7aadd32e..d6ba3dacbb 100644 --- a/packages/core/src/enums/Events.ts +++ b/packages/core/src/enums/Events.ts @@ -239,13 +239,8 @@ enum Events { /** * Triggers when the webworker has made progress * You should use it with a workerType to indicate the type of worker that is making progress - * Checkout the polySEG convertors in the cornerstone tools - * to lean how to use it */ WEB_WORKER_PROGRESS = 'CORNERSTONE_WEB_WORKER_PROGRESS', - // IMAGE_CACHE_FULL = 'CORNERSTONE_IMAGE_CACHE_FULL', - // PRE_RENDER = 'CORNERSTONE_PRE_RENDER', - // ELEMENT_RESIZED = 'CORNERSTONE_ELEMENT_RESIZED', /** * Triggers on the HTML element when viewport modifies its colormap diff --git a/packages/core/src/utilities/VoxelManager.ts b/packages/core/src/utilities/VoxelManager.ts index e805e5b4c1..a6a6b0f145 100644 --- a/packages/core/src/utilities/VoxelManager.ts +++ b/packages/core/src/utilities/VoxelManager.ts @@ -1,4 +1,3 @@ -import { vec3 } from 'gl-matrix'; import cache from '../cache/cache'; import type { BoundsIJK, @@ -893,7 +892,20 @@ export default class VoxelManager { const sliceData = new SliceDataConstructor(sliceSize); // @ts-ignore sliceData.set(scalarData.subarray(sliceStart, sliceEnd)); - imageVoxelManager.scalarData = sliceData; + + // Instead of directly assigning scalarData, use TypedArray's set method + // previously here we were using imageVoxelManager.scalarData = sliceData + // which had some weird side effects + if (imageVoxelManager.scalarData) { + imageVoxelManager.scalarData.set(sliceData); + // Ensure the voxel manager knows about the changes + imageVoxelManager.modifiedSlices.add(sliceIndex); + } else { + // Fallback to individual updates if scalarData is not directly accessible + for (let i = 0; i < sliceSize; i++) { + imageVoxelManager.setAtIndex(i, sliceData[i]); + } + } // Update min/max values for this slice for (let i = 0; i < sliceData.length; i++) { @@ -939,7 +951,7 @@ export default class VoxelManager { public static createScalarVolumeVoxelManager({ dimensions, scalarData, - numberOfComponents = 1, + numberOfComponents, }: { dimensions: Point3; scalarData; diff --git a/packages/core/src/utilities/calculateSpacingBetweenImageIds.ts b/packages/core/src/utilities/calculateSpacingBetweenImageIds.ts new file mode 100644 index 0000000000..de154ea969 --- /dev/null +++ b/packages/core/src/utilities/calculateSpacingBetweenImageIds.ts @@ -0,0 +1,150 @@ +import { vec3 } from 'gl-matrix'; +import * as metaData from '../metaData'; +import { getConfiguration } from '../init'; + +/** + * Calculates the spacing between images in a series based on their positions + * + * @param imageIds - array of imageIds + * @returns The calculated spacing value between images + */ +export default function calculateSpacingBetweenImageIds( + imageIds: string[] +): number { + const { + imagePositionPatient: referenceImagePositionPatient, + imageOrientationPatient, + } = metaData.get('imagePlaneModule', imageIds[0]); + + // Calculate scan axis normal from image orientation + const rowCosineVec = vec3.fromValues( + imageOrientationPatient[0], + imageOrientationPatient[1], + imageOrientationPatient[2] + ); + const colCosineVec = vec3.fromValues( + imageOrientationPatient[3], + imageOrientationPatient[4], + imageOrientationPatient[5] + ); + + const scanAxisNormal = vec3.create(); + vec3.cross(scanAxisNormal, rowCosineVec, colCosineVec); + + // Convert referenceImagePositionPatient to vec3 + const refIppVec = vec3.fromValues( + referenceImagePositionPatient[0], + referenceImagePositionPatient[1], + referenceImagePositionPatient[2] + ); + + // Check if we are using wadouri scheme + const usingWadoUri = imageIds[0].split(':')[0] === 'wadouri'; + let spacing: number; + + function getDistance(imageId: string) { + const { imagePositionPatient } = metaData.get('imagePlaneModule', imageId); + const positionVector = vec3.create(); + + // Convert imagePositionPatient to vec3 + const ippVec = vec3.fromValues( + imagePositionPatient[0], + imagePositionPatient[1], + imagePositionPatient[2] + ); + + vec3.sub(positionVector, refIppVec, ippVec); + return vec3.dot(positionVector, scanAxisNormal); + } + + if (!usingWadoUri) { + const distanceImagePairs = imageIds.map((imageId) => { + const distance = getDistance(imageId); + return { + distance, + imageId, + }; + }); + + distanceImagePairs.sort((a, b) => b.distance - a.distance); + const numImages = distanceImagePairs.length; + + // Calculated average spacing. + // We would need to resample if these are not similar. + // It should be up to the host app to do this if it needed to. + spacing = + Math.abs( + distanceImagePairs[numImages - 1].distance - + distanceImagePairs[0].distance + ) / + (numImages - 1); + } else { + // Using wadouri, so we have only prefetched the first, middle, and last + // images for metadata. Assume initial imageId array order is pre-sorted, + // but check orientation. + const prefetchedImageIds = [ + imageIds[0], + imageIds[Math.floor(imageIds.length / 2)], + ]; + + const firstImageDistance = getDistance(prefetchedImageIds[0]); + const middleImageDistance = getDistance(prefetchedImageIds[1]); + + const metadataForMiddleImage = metaData.get( + 'imagePlaneModule', + prefetchedImageIds[1] + ); + + if (!metadataForMiddleImage) { + throw new Error('Incomplete metadata required for volume construction.'); + } + + const positionVector = vec3.create(); + + // Convert metadataForMiddleImage.imagePositionPatient to vec3 + const middleIppVec = vec3.fromValues( + metadataForMiddleImage.imagePositionPatient[0], + metadataForMiddleImage.imagePositionPatient[1], + metadataForMiddleImage.imagePositionPatient[2] + ); + + vec3.sub(positionVector, refIppVec, middleIppVec); + const distanceBetweenFirstAndMiddleImages = vec3.dot( + positionVector, + scanAxisNormal + ); + spacing = + Math.abs(distanceBetweenFirstAndMiddleImages) / + Math.floor(imageIds.length / 2); + } + + const { sliceThickness, spacingBetweenSlices } = metaData.get( + 'imagePlaneModule', + imageIds[0] + ); + + const { strictZSpacingForVolumeViewport } = getConfiguration().rendering; + + // We implemented these lines for multiframe dicom files that does not have + // position for each frame, leading to incorrect calculation of spacing = 0 + // If possible, we use the sliceThickness, but we warn about this dicom file + // weirdness. If sliceThickness is not available, we set to 1 just to render + if (spacing === 0 && !strictZSpacingForVolumeViewport) { + if (spacingBetweenSlices) { + console.debug('Could not calculate spacing. Using spacingBetweenSlices'); + spacing = spacingBetweenSlices; + } else if (sliceThickness) { + console.debug( + 'Could not calculate spacing and no spacingBetweenSlices. Using sliceThickness' + ); + spacing = sliceThickness; + } else { + console.debug( + 'Could not calculate spacing. The VolumeViewport visualization is compromised. Setting spacing to 1 to render' + ); + spacing = 1; + } + } + + return spacing; +} diff --git a/packages/core/src/utilities/fnv1aHash.ts b/packages/core/src/utilities/fnv1aHash.ts new file mode 100644 index 0000000000..713787a143 --- /dev/null +++ b/packages/core/src/utilities/fnv1aHash.ts @@ -0,0 +1,14 @@ +/** + * Generates a hash for a string using FNV-1a algorithm + * @param str - string to hash + * @returns the hashed string in base 36 + */ +export default function fnv1aHash(str: string): string { + let hash = 0x811c9dc5; + for (let i = 0; i < str.length; i++) { + hash ^= str.charCodeAt(i); + hash += + (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24); + } + return (hash >>> 0).toString(36); +} diff --git a/packages/core/src/utilities/index.ts b/packages/core/src/utilities/index.ts index ca345f5322..86db4f8cd9 100644 --- a/packages/core/src/utilities/index.ts +++ b/packages/core/src/utilities/index.ts @@ -80,6 +80,7 @@ import * as color from './color'; import { deepEqual } from './deepEqual'; import type { IViewport } from '../types/IViewport'; import FrameRange from './FrameRange'; +import fnv1aHash from './fnv1aHash'; // solving the circular dependency issue import { _getViewportModality } from './getViewportModality'; @@ -94,7 +95,7 @@ import scroll from './scroll'; import clip from './clip'; import createSubVolume from './createSubVolume'; import getVolumeDirectionVectors from './getVolumeDirectionVectors'; - +import calculateSpacingBetweenImageIds from './calculateSpacingBetweenImageIds'; const getViewportModality = (viewport: IViewport, volumeId?: string) => _getViewportModality(viewport, volumeId, cache.getVolume); @@ -108,6 +109,7 @@ export { scaleRgbTransferFunction, triggerEvent, imageIdToURI, + fnv1aHash, calibratedPixelSpacingMetadataProvider, clamp, uuidv4, @@ -193,4 +195,5 @@ export { transformWorldToIndexContinuous, createSubVolume, getVolumeDirectionVectors, + calculateSpacingBetweenImageIds, }; diff --git a/packages/core/src/utilities/pointInShapeCallback.ts b/packages/core/src/utilities/pointInShapeCallback.ts index 3ef5200d65..7851b2bda2 100644 --- a/packages/core/src/utilities/pointInShapeCallback.ts +++ b/packages/core/src/utilities/pointInShapeCallback.ts @@ -73,10 +73,17 @@ export function pointInShapeCallback( if ((imageData as CPUImageData).getScalarData) { scalarData = (imageData as CPUImageData).getScalarData(); } else { - scalarData = (imageData as vtkImageData) - .getPointData() - .getScalars() - .getData(); + const scalars = (imageData as vtkImageData).getPointData().getScalars(); + + if (scalars) { + scalarData = scalars.getData(); + } else { + // @ts-ignore + const { voxelManager } = imageData.get('voxelManager') || {}; + if (voxelManager) { + scalarData = voxelManager.getCompleteScalarDataArray(); + } + } } const dimensions = imageData.getDimensions(); diff --git a/packages/core/src/utilities/sortImageIdsAndGetSpacing.ts b/packages/core/src/utilities/sortImageIdsAndGetSpacing.ts index ef5fba217c..216ac1c784 100644 --- a/packages/core/src/utilities/sortImageIdsAndGetSpacing.ts +++ b/packages/core/src/utilities/sortImageIdsAndGetSpacing.ts @@ -1,6 +1,6 @@ import { vec3 } from 'gl-matrix'; import * as metaData from '../metaData'; -import { getConfiguration } from '../init'; +import calculateSpacingBetweenImageIds from './calculateSpacingBetweenImageIds'; import type { Point3 } from '../types'; interface SortedImageIdsItem { @@ -15,7 +15,7 @@ interface SortedImageIdsItem { * @param imageIds - array of imageIds * @param scanAxisNormal - [x, y, z] array or gl-matrix vec3 * - * @returns The sortedImageIds, zSpacing, and origin of the first image in the series. + * @returns The sortedImageIds, spacing, and origin of the first image in the series. */ export default function sortImageIdsAndGetSpacing( imageIds: string[], @@ -42,20 +42,12 @@ export default function sortImageIdsAndGetSpacing( vec3.cross(scanAxisNormal, rowCosineVec, colCosineVec); } - const refIppVec = vec3.create(); - // Check if we are using wadouri scheme const usingWadoUri = imageIds[0].split(':')[0] === 'wadouri'; - vec3.set( - refIppVec, - referenceImagePositionPatient[0], - referenceImagePositionPatient[1], - referenceImagePositionPatient[2] - ); + const zSpacing = calculateSpacingBetweenImageIds(imageIds); let sortedImageIds: string[]; - let zSpacing: number; function getDistance(imageId: string) { const { imagePositionPatient } = metaData.get('imagePlaneModule', imageId); @@ -89,19 +81,7 @@ export default function sortImageIdsAndGetSpacing( }); distanceImagePairs.sort((a, b) => b.distance - a.distance); - sortedImageIds = distanceImagePairs.map((a) => a.imageId); - const numImages = distanceImagePairs.length; - - // Calculated average spacing. - // We would need to resample if these are not similar. - // It should be up to the host app to do this if it needed to. - zSpacing = - Math.abs( - distanceImagePairs[numImages - 1].distance - - distanceImagePairs[0].distance - ) / - (numImages - 1); } else { // Using wadouri, so we have only prefetched the first, middle, and last // images for metadata. Assume initial imageId array order is pre-sorted, @@ -116,62 +96,13 @@ export default function sortImageIdsAndGetSpacing( if (firstImageDistance - middleImageDistance < 0) { sortedImageIds.reverse(); } - - // Calculate average spacing between the first and middle prefetched images, - // otherwise fall back to DICOM `spacingBetweenSlices` - const metadataForMiddleImage = metaData.get( - 'imagePlaneModule', - prefetchedImageIds[1] - ); - - if (!metadataForMiddleImage) { - throw new Error('Incomplete metadata required for volume construction.'); - } - - const positionVector = vec3.create(); - - vec3.sub( - positionVector, - referenceImagePositionPatient, - metadataForMiddleImage.imagePositionPatient - ); - const distanceBetweenFirstAndMiddleImages = vec3.dot( - positionVector, - scanAxisNormal - ); - zSpacing = - Math.abs(distanceBetweenFirstAndMiddleImages) / - Math.floor(imageIds.length / 2); } - const { - imagePositionPatient: origin, - sliceThickness, - spacingBetweenSlices, - } = metaData.get('imagePlaneModule', sortedImageIds[0]); - - const { strictZSpacingForVolumeViewport } = getConfiguration().rendering; - - // We implemented these lines for multiframe dicom files that does not have - // position for each frame, leading to incorrect calculation of zSpacing = 0 - // If possible, we use the sliceThickness, but we warn about this dicom file - // weirdness. If sliceThickness is not available, we set to 1 just to render - if (zSpacing === 0 && !strictZSpacingForVolumeViewport) { - if (spacingBetweenSlices) { - console.log('Could not calculate zSpacing. Using spacingBetweenSlices'); - zSpacing = spacingBetweenSlices; - } else if (sliceThickness) { - console.log( - 'Could not calculate zSpacing and no spacingBetweenSlices. Using sliceThickness' - ); - zSpacing = sliceThickness; - } else { - console.log( - 'Could not calculate zSpacing. The VolumeViewport visualization is compromised. Setting zSpacing to 1 to render' - ); - zSpacing = 1; - } - } + const { imagePositionPatient: origin } = metaData.get( + 'imagePlaneModule', + sortedImageIds[0] + ); + const result: SortedImageIdsItem = { zSpacing, origin, diff --git a/packages/core/test/stackViewport_node_render.jest.js b/packages/core/test/stackViewport_node_render.jest.js new file mode 100644 index 0000000000..3175697d65 --- /dev/null +++ b/packages/core/test/stackViewport_node_render.jest.js @@ -0,0 +1,117 @@ +import * as cornerstone3D from '../src/index'; +import { + fakeImageLoader, + fakeMetaDataProvider, +} from '../../../utils/test/testUtilsImageLoader'; + +import { describe, it, expect } from '@jest/globals'; +import { render } from 'react-dom'; + +const { + utilities, + setUseCPURendering, + RenderingEngine, + Enums, + imageLoader, + metaData, + init, +} = cornerstone3D; +const { ViewportType, Events } = Enums; + +const renderingEngineId = utilities.uuidv4(); +const viewportId = 'VIEWPORT'; + +function encodeImageIdInfo(info) { + return `fakeImageLoader:${encodeURIComponent(JSON.stringify(info))}`; +} + +const imageInfo = { + loader: 'fakeImageLoader', + name: 'imageURI', + rows: 64, + columns: 64, + barStart: 20, + barWidth: 5, + xSpacing: 1, + ySpacing: 1, + sliceIndex: 0, +}; + +const imageId = encodeImageIdInfo(imageInfo); + +function setSize(element, width, height) { + Object.defineProperty(element, 'offsetWidth', { value: width }); + Object.defineProperty(element, 'offsetHeight', { value: height }); + Object.defineProperty(element, 'clientWidth', { value: width }); + Object.defineProperty(element, 'clientHeight', { value: height }); + Object.defineProperty(element, 'getBoundingClientRect', { + value: () => ({ width, height }), + }); +} + +function initCore() { + init({}); + imageLoader.registerImageLoader('fakeImageLoader', fakeImageLoader); + + metaData.addProvider(utilities.calibratedPixelSpacingMetadataProvider.get); + metaData.addProvider(utilities.genericMetadataProvider.get); + metaData.addProvider(fakeMetaDataProvider, 10000); + + document.body.innerHTML = `
+
+ +
+
`; + const renderingEngine = new RenderingEngine(renderingEngineId); + const element = document.getElementById('elementId'); + setSize(element, 100, 100); + const viewportElement = document.getElementById('viewport-element'); + setSize(viewportElement, 100, 100); + const canvasElement = document.getElementById('cornerstone-canvas'); + setSize(canvasElement, 100, 100); + return { renderingEngine, element }; +} + +describe('stackViewport_node_render', function () { + let viewport, element, renderingEngine; + + beforeEach(() => { + setUseCPURendering(true); + window.devicePixelRatio = 1; + + const initData = initCore(); + element = initData.element; + renderingEngine = initData.renderingEngine; + + const viewportInput = { + viewportId, + type: ViewportType.STACK, + element, + defaultOptions: { + background: [0.2, 0, 0.2], + }, + }; + + renderingEngine.enableElement(viewportInput); + viewport = renderingEngine.getViewport(viewportId); + }); + + it('Basic Viewport Creation', () => { + expect(viewport).not.toBeUndefined(); + }); + + it('Should render simple stack', () => { + let promise = new Promise((resolve) => { + element.addEventListener(Events.IMAGE_RENDERED, () => { + const canvas = viewport.getCanvas(); + const image = canvas.toDataURL('image/png'); + // console.error('Rendered image', image); + expect(image).toBeTruthy(); + resolve(image); + }); + }); + viewport.setStack([imageId], 0); + viewport.render(); + return promise; + }); +}); diff --git a/packages/dicomImageLoader/CHANGELOG.md b/packages/dicomImageLoader/CHANGELOG.md index d7b3170344..4aaa22196f 100644 --- a/packages/dicomImageLoader/CHANGELOG.md +++ b/packages/dicomImageLoader/CHANGELOG.md @@ -3,6 +3,86 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.0.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.4...v3.0.5) (2025-03-06) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + +## [3.0.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.3...v3.0.4) (2025-03-05) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + +## [3.0.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.2...v3.0.3) (2025-03-04) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + +## [3.0.2](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.1...v3.0.2) (2025-03-04) + +### Features + +- **surface-segmentation:** add visibilty configuration for surface segmentation ([#1846](https://github.com/cornerstonejs/cornerstone3D/issues/1846)) ([e1b5bc6](https://github.com/cornerstonejs/cornerstone3D/commit/e1b5bc646f3997be88ec237f86406c310420379a)) + +## [3.0.1](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0...v3.0.1) (2025-02-27) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + +# [3.0.0](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.16...v3.0.0) (2025-02-27) + +### Features + +- Cornerstone3D 3.0 ([#1865](https://github.com/cornerstonejs/cornerstone3D/issues/1865)) ([fe65459](https://github.com/cornerstonejs/cornerstone3D/commit/fe654590d16414e76361e1b2826fd64c3734ae87)) + +# [3.0.0-beta.6](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2025-02-27) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + +# [3.0.0-beta.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + +# [3.0.0-beta.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + +# [3.0.0-beta.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + +# [3.0.0-beta.2](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.14...v3.0.0-beta.2) (2025-02-24) + +### Bug Fixes + +- publish beta for 3.0 ([8bf65df](https://github.com/cornerstonejs/cornerstone3D/commit/8bf65df9bec5f52459de1c49c4834b316f680f1b)) + +## [2.19.14](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.13...v2.19.14) (2025-02-24) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + +## [2.19.13](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.12...v2.19.13) (2025-02-21) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + +## [2.19.12](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.11...v2.19.12) (2025-02-20) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + +## [2.19.11](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.10...v2.19.11) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + +## [2.19.10](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.9...v2.19.10) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + +## [2.19.9](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.8...v2.19.9) (2025-02-18) + +### Bug Fixes + +- incorrect check for validating pixel data array type ([#1830](https://github.com/cornerstonejs/cornerstone3D/issues/1830)) ([f9d5b79](https://github.com/cornerstonejs/cornerstone3D/commit/f9d5b79c75a4125bbf4e646752ad2071ddc76c41)) + +## [2.19.8](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.7...v2.19.8) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/dicom-image-loader + ## [2.19.7](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.6...v2.19.7) (2025-02-06) **Note:** Version bump only for package @cornerstonejs/dicom-image-loader diff --git a/packages/dicomImageLoader/README.md b/packages/dicomImageLoader/README.md index 02ae654364..67e06e98dc 100644 --- a/packages/dicomImageLoader/README.md +++ b/packages/dicomImageLoader/README.md @@ -1,173 +1,3 @@ # DICOM Image Loader -This package provides a DICOM image loader for the Cornerstone library. -This is the successor to the [cornerstoneDICOMImageLoader] which provides the following -added features: - -- Typescript support (and type definitions) -- Better developer experience (e.g. mono repo, linting, etc) - - - -A [cornerstone](https://github.com/cornerstonejs/cornerstone) Image Loader for -DICOM P10 instances over HTTP (WADO-URI) or DICOMWeb (WADO-RS) and Local filedisk. This can be used -to integrate cornerstone with WADO-URI servers, DICOMWeb servers or any other -HTTP based server that returns DICOM P10 instances (e.g. -[Orthanc](http://www.orthanc-server.com/) or custom servers) - -## Key Features - -- Implements a - [cornerstone ImageLoader](https://www.cornerstonejs.org/docs/concepts/cornerstone-core/imageLoader) - for DICOM P10 Instances via a HTTP get request. - - Can be used with a WADO-URI server - - Can be used with Orthanc's file endpoint - - Can be used with any server that returns DICOM P10 instances via HTTP GET -- Implements a - [cornerstone ImageLoader](https://www.cornerstonejs.org/docs/concepts/cornerstone-core/imageLoader) - for WADO-RS (DICOMWeb) -- Supports many popular transfer syntaxes and photometric interpretations - [see full list](docs/TransferSyntaxes.md) - and [codec](docs/Codecs.md) for more information. -- Dynamicly Utilizes WebAssembly (WASM) builds of each codec which sgnificantly improves image decoding performance and enables us to load codec at runtime when needed dynamically, which reduces the build time and complexity. -- Framework to execute CPU intensive tasks in [web workers](docs/WebWorkers.md) - - Used for image decoding - - Can be used for your own CPU intensive tasks (e.g. image processing) - - -## Install - -### NPM - -```bash -yarn add @cornerstonejs/dicom-image-loader -``` - - - -## Usage - -Specify the cornerstone instance you want to register the loader with. - -```javascript -cornerstoneDICOMImageLoader.external.cornerstone = cornerstone; -``` - -Have your code configure the web worker framework: - -```javascript -var config = { - maxWebWorkers: navigator.hardwareConcurrency || 1, - startWebWorkersOnDemand: true, -}; -cornerstoneDICOMImageLoader.webWorkerManager.initialize(config); -``` - -See the [web workers](docs/WebWorkers.md) documentation for more details on -configuring. - - - -#### Dynamic Import - -To be able to use the dynamic import feature for CDIL, instead of - -```js -import cornerstoneDICOMImageLoader from '@cornerstonejs/dicom-image-loader'; -``` - -you need to do: - -```js -import cornerstoneDICOMImageLoader from '@cornerstonejs/dicom-image-loader/dist/dynamic-import/cornerstoneDICOMImageLoader.min.js'; -``` - -This way, codecs are loaded dynamically when needed. You have another option to -create an alias in the webpack config file: - -```js -resolve: { - alias: { - '@cornerstonejs/dicom-image-loader': - '@cornerstonejs/dicom-image-loader/dist/dynamic-import/cornerstoneDICOMImageLoader.min.js', - }, -}, -``` - -In addition WASM builds of the codec files should be made available in the build -folder. You can use `CopyWebpackPlugin` to copy the WASM files to the build folder. - - -```js - plugins: [ - new CopyWebpackPlugin([ - { - from: - '../../../node_modules/@cornerstonejs/dicom-image-loader/dist/dynamic-import', - to: DIST_DIR, - }, - ]), -``` - -Note 1: You need to give the correct path in the `CopyWebpackPlugin`, the above -path is relative to the `node_modules` folder in the OHIF Viewer. - -Note 2: For other http servers like IIS, you need to configure it to serve WASM -files with the correct MIME type. - -## Loading - -![Alt text](assets/load.png) - -## Backlog - -- ESM build for the library -- Make the examples work again -- Free up DICOM P10 instance after decoding to reduce memory consumption -- Look at using EMSCRIPTEN based build of IJG for JPEG -- Add support for bulk data items to WADO-RS Loader -- WebWorker Manager - - Better handling of web worker loading - - Add events to webWorkerManager so its activity can be monitored - - Add support for issuing progress events from web worker tasks - -# FAQ - -_Why is this a separate library from cornerstone?_ - -Mainly to avoid adding a dependency to cornerstone for the DICOM parsing -library. While cornerstone is intended to be used to display medical images that -are stored in DICOM, cornerstone aims to simplify the use of medical imaging and -therefore tries to hide some of the complexity that exists within DICOM. It is -also desirable to support display of non DICOM images so a DICOM independent -image model makes sense. - -_How do I build this library myself?_ - -See the documentation [here](docs/Building.md) - -_How do I add my own custom web worker tasks?_ - -See the documentation [here](docs/WebWorkers.md) - -_How do I create imageIds that work with this image loader?_ - -See the documentation [here](docs/ImageIds.md) - -# What Transfer Syntaxes are supported? - -See [transfer syntaxes](docs/TransferSyntaxes.md) - - -[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat -[license-url]: LICENSE - -[npm-url]: https://npmjs.org/package/@cornerstonejs/dicom-image-loader -[npm-version-image]: http://img.shields.io/npm/v/@cornerstonejs/dicom-image-loader.svg?style=flat -[npm-downloads-image]: http://img.shields.io/npm/dm/@cornerstonejs/dicom-image-loader.svg?style=flat - -[travis-url]: http://travis-ci.org/cornerstonejs/cornerstoneDICOMImageLoader -[travis-image]: https://travis-ci.org/cornerstonejs/cornerstoneDICOMImageLoader.svg?branch=master - -[coverage-url]: https://coveralls.io/github/cornerstonejs/cornerstoneDICOMImageLoader?branch=master -[coverage-image]: https://coveralls.io/repos/github/cornerstonejs/cornerstoneDICOMImageLoader/badge.svg?branch=master +See full guide on [cornerstonejs.org](https://cornerstonejs.org/) diff --git a/packages/dicomImageLoader/api-extractor.json b/packages/dicomImageLoader/api-extractor.json deleted file mode 100644 index 4ddb5f44d3..0000000000 --- a/packages/dicomImageLoader/api-extractor.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../api-extractor.json", - "projectFolder": ".", - "mainEntryPointFilePath": "/dist/esm/index.d.ts", - "apiReport": { - "reportFileName": ".api.md", - "reportFolder": "../../common/reviews/api" - } -} diff --git a/packages/dicomImageLoader/package.json b/packages/dicomImageLoader/package.json index a50003e0c1..ad5bdb30f9 100644 --- a/packages/dicomImageLoader/package.json +++ b/packages/dicomImageLoader/package.json @@ -1,6 +1,6 @@ { "name": "@cornerstonejs/dicom-image-loader", - "version": "2.19.7", + "version": "3.0.5", "description": "Cornerstone Image Loader for DICOM WADO-URI and WADO-RS and Local file", "keywords": [ "DICOM", @@ -76,7 +76,6 @@ "clean:deep": "yarn run clean && shx rm -rf node_modules", "format-check": "npx eslint ./src --quiet", "api-check": "api-extractor --debug run ", - "build:update-api": "yarn run build:esm && api-extractor run --local", "cm": "npx git-cz", "clean:dist": "shx rm -rf dist", "clean:docs": "shx rm -rf documentation", @@ -116,7 +115,7 @@ "uuid": "^9.0.0" }, "peerDependencies": { - "@cornerstonejs/core": "^2.19.7", + "@cornerstonejs/core": "^3.0.5", "dicom-parser": "^1.8.9" }, "lint-staged": { diff --git a/packages/dicomImageLoader/src/decodeImageFrameWorker.js b/packages/dicomImageLoader/src/decodeImageFrameWorker.js index 708a8a491b..99a6add366 100644 --- a/packages/dicomImageLoader/src/decodeImageFrameWorker.js +++ b/packages/dicomImageLoader/src/decodeImageFrameWorker.js @@ -89,7 +89,11 @@ function postProcessDecodedPixels(imageFrame, options, start, decodeConfig) { options.preScale.scalingParameters; const minAfterScale = rescaleSlope * minBeforeScale + rescaleIntercept; const maxAfterScale = rescaleSlope * maxBeforeScale + rescaleIntercept; - invalidType = !validatePixelDataType(minAfterScale, maxAfterScale, type); + invalidType = !validatePixelDataType( + minAfterScale, + maxAfterScale, + typedArrayConstructors[type] + ); } if (type && !invalidType) { diff --git a/packages/dicomImageLoader/src/imageLoader/createImage.ts b/packages/dicomImageLoader/src/imageLoader/createImage.ts index 8d1cb0e427..d178597ab8 100644 --- a/packages/dicomImageLoader/src/imageLoader/createImage.ts +++ b/packages/dicomImageLoader/src/imageLoader/createImage.ts @@ -1,6 +1,5 @@ import type { ByteArray } from 'dicom-parser'; import getMinMax from '../shared/getMinMax'; -import getPixelDataTypeFromMinMax from '../shared/getPixelDataTypeFromMinMax'; import type { DICOMLoaderImageOptions, DICOMLoaderIImage } from '../types'; import type { Types } from '@cornerstonejs/core'; import { @@ -16,68 +15,12 @@ import getImageFrame from './getImageFrame'; import getScalingParameters from './getScalingParameters'; import { getOptions } from './internal/options'; import isColorImageFn from '../shared/isColorImage'; +import removeAFromRGBA from './removeAFromRGBA'; +import isModalityLUTForDisplay from './isModalityLutForDisplay'; +import setPixelDataType from './setPixelDataType'; let lastImageIdDrawn = ''; -function isModalityLUTForDisplay(sopClassUid: string): boolean { - // special case for XA and XRF - // https://groups.google.com/forum/#!searchin/comp.protocols.dicom/Modality$20LUT$20XA/comp.protocols.dicom/UBxhOZ2anJ0/D0R_QP8V2wIJ - return ( - sopClassUid !== '1.2.840.10008.5.1.4.1.1.12.1' && // XA - sopClassUid !== '1.2.840.10008.5.1.4.1.1.12.2.1' - ); // XRF -} - -/** - * Helper function to set the right typed array. - * This is needed because web workers can transfer array buffers but not typed arrays - * - * Here we are setting the pixel data to the right typed array based on the final - * min and max values - */ -function setPixelDataType(imageFrame) { - const minValue = imageFrame.smallestPixelValue; - const maxValue = imageFrame.largestPixelValue; - - const TypedArray = getPixelDataTypeFromMinMax(minValue, maxValue); - - if (TypedArray) { - // @ts-ignore - const typedArray = new TypedArray(imageFrame.pixelData); - imageFrame.pixelData = typedArray; - } else { - throw new Error('Could not apply a typed array to the pixel data'); - } -} - -/** - * Removes the A from RGBA to return RGB buffer, this is used when the - * decoding happens with browser API which results in RGBA, but if useRGBA flag - * is set to false, we want to return RGB - * - * @param pixelData - decoded image in RGBA - * @param targetBuffer - target buffer to write to - */ -function removeAFromRGBA( - pixelData: Types.PixelDataTypedArray, - targetBuffer: Uint8ClampedArray | Uint8Array -) { - const numPixels = pixelData.length / 4; - - let rgbIndex = 0; - - let bufferIndex = 0; - - for (let i = 0; i < numPixels; i++) { - targetBuffer[bufferIndex++] = pixelData[rgbIndex++]; // red - targetBuffer[bufferIndex++] = pixelData[rgbIndex++]; // green - targetBuffer[bufferIndex++] = pixelData[rgbIndex++]; // blue - rgbIndex++; // skip alpha - } - - return targetBuffer; -} - function createImage( imageId: string, pixelData: ByteArray, diff --git a/packages/dicomImageLoader/src/imageLoader/index.ts b/packages/dicomImageLoader/src/imageLoader/index.ts index d443701e02..68f062752e 100644 --- a/packages/dicomImageLoader/src/imageLoader/index.ts +++ b/packages/dicomImageLoader/src/imageLoader/index.ts @@ -17,6 +17,11 @@ import { default as getMinMax } from '../shared/getMinMax'; import { default as isColorImage } from '../shared/isColorImage'; import { default as isJPEGBaseline8BitColor } from './isJPEGBaseline8BitColor'; import { default as getPixelData } from './wadors/getPixelData'; +import { default as getScalingParameters } from './getScalingParameters'; +import { default as isColorConversionRequired } from './isColorConversionRequired'; +import { default as removeAFromRGBA } from './removeAFromRGBA'; +import { default as isModalityLUTForDisplay } from './isModalityLutForDisplay'; +import { default as setPixelDataType } from './setPixelDataType'; import { internal } from './internal/index'; const cornerstoneDICOMImageLoader = { @@ -36,6 +41,11 @@ const cornerstoneDICOMImageLoader = { getMinMax, isColorImage, isJPEGBaseline8BitColor, + getScalingParameters, + isColorConversionRequired, + removeAFromRGBA, + isModalityLUTForDisplay, + setPixelDataType, internal, }; diff --git a/packages/dicomImageLoader/src/imageLoader/isModalityLutForDisplay.ts b/packages/dicomImageLoader/src/imageLoader/isModalityLutForDisplay.ts new file mode 100644 index 0000000000..33dce11dd0 --- /dev/null +++ b/packages/dicomImageLoader/src/imageLoader/isModalityLutForDisplay.ts @@ -0,0 +1,10 @@ +function isModalityLUTForDisplay(sopClassUid: string): boolean { + // special case for XA and XRF + // https://groups.google.com/forum/#!searchin/comp.protocols.dicom/Modality$20LUT$20XA/comp.protocols.dicom/UBxhOZ2anJ0/D0R_QP8V2wIJ + return ( + sopClassUid !== '1.2.840.10008.5.1.4.1.1.12.1' && // XA + sopClassUid !== '1.2.840.10008.5.1.4.1.1.12.2.1' + ); // XRF +} + +export default isModalityLUTForDisplay; diff --git a/packages/dicomImageLoader/src/imageLoader/removeAFromRGBA.ts b/packages/dicomImageLoader/src/imageLoader/removeAFromRGBA.ts new file mode 100644 index 0000000000..4757f72e69 --- /dev/null +++ b/packages/dicomImageLoader/src/imageLoader/removeAFromRGBA.ts @@ -0,0 +1,31 @@ +import type { Types } from '@cornerstonejs/core'; + +/** + * Removes the A from RGBA to return RGB buffer, this is used when the + * decoding happens with browser API which results in RGBA, but if useRGBA flag + * is set to false, we want to return RGB + * + * @param pixelData - decoded image in RGBA + * @param targetBuffer - target buffer to write to + */ +function removeAFromRGBA( + pixelData: Types.PixelDataTypedArray, + targetBuffer: Uint8ClampedArray | Uint8Array +) { + const numPixels = pixelData.length / 4; + + let rgbIndex = 0; + + let bufferIndex = 0; + + for (let i = 0; i < numPixels; i++) { + targetBuffer[bufferIndex++] = pixelData[rgbIndex++]; // red + targetBuffer[bufferIndex++] = pixelData[rgbIndex++]; // green + targetBuffer[bufferIndex++] = pixelData[rgbIndex++]; // blue + rgbIndex++; // skip alpha + } + + return targetBuffer; +} + +export default removeAFromRGBA; diff --git a/packages/dicomImageLoader/src/imageLoader/setPixelDataType.ts b/packages/dicomImageLoader/src/imageLoader/setPixelDataType.ts new file mode 100644 index 0000000000..397c102b4d --- /dev/null +++ b/packages/dicomImageLoader/src/imageLoader/setPixelDataType.ts @@ -0,0 +1,25 @@ +import getPixelDataTypeFromMinMax from '../shared/getPixelDataTypeFromMinMax'; + +/** + * Helper function to set the right typed array. + * This is needed because web workers can transfer array buffers but not typed arrays + * + * Here we are setting the pixel data to the right typed array based on the final + * min and max values + */ +function setPixelDataType(imageFrame) { + const minValue = imageFrame.smallestPixelValue; + const maxValue = imageFrame.largestPixelValue; + + const TypedArray = getPixelDataTypeFromMinMax(minValue, maxValue); + + if (TypedArray) { + // @ts-ignore + const typedArray = new TypedArray(imageFrame.pixelData); + imageFrame.pixelData = typedArray; + } else { + throw new Error('Could not apply a typed array to the pixel data'); + } +} + +export default setPixelDataType; diff --git a/packages/docs/docs/contribute/update-api.md b/packages/docs/docs/contribute/update-api.md deleted file mode 100644 index 8bbb78bd42..0000000000 --- a/packages/docs/docs/contribute/update-api.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -id: update-api ---- - -# API Updating - -We have adopted the [api-extractor](https://api-extractor.com/) tool to extract the public API from the codebase. -Having a consistent API is the key to making our library easy to use and build upon; therefore, -for each Pull Request (PR) we extract the API for the PR and compare it to the API of the base branch. - -If you have unintentionally changed the public API of the library, one of our checks in Github would -catch it and notify you by an Error. - -If the change to the API is intentional, you need to run `yarn run build:update-api` to update the API. -This will create set of new API summary files (located at `common/reviews/api/*`) and you need to add and commit them -with your changes, in order for the Error to be fixed. diff --git a/packages/docs/docs/getting-started/vue-angular-react-etc.md b/packages/docs/docs/getting-started/vue-angular-react-etc.md deleted file mode 100644 index e6d235fed9..0000000000 --- a/packages/docs/docs/getting-started/vue-angular-react-etc.md +++ /dev/null @@ -1,127 +0,0 @@ ---- -id: vue-angular-react-etc -title: 'React, Vue, Angular, etc.' ---- - -Here are some examples of how to use cornerstone3D with React, Vue, Angular, etc. -We have made it easy to use cornerstone3D with your favorite framework. - -Follow the links below to see how to use cornerstone3D with your favorite framework. - -- [Cornerstone3D with React](https://github.com/cornerstonejs/vite-react-cornerstone3d) -- [Cornerstone3D with Vue](https://github.com/cornerstonejs/vue-cornerstone3d) -- [Cornerstone3D with Angular](https://github.com/cornerstonejs/angular-cornerstone3d) - - [Community maintained project](https://github.com/yanqzsu/ng-cornerstone) -- [Cornerstone3D with Next.js](https://github.com/cornerstonejs/nextjs-cornerstone3d) - -## Vite - -To update your Vite configuration, use the CommonJS plugin, exclude `dicom-image-loader` from optimization, and include `dicom-parser`. We plan to convert `dicom-image-loader` to an ES module, eliminating the need for exclusion in the future. - -```javascript -import { viteCommonjs } from '@originjs/vite-plugin-commonjs'; - -export default defineConfig({ - plugins: [viteCommonjs()], - optimizeDeps: { - exclude: ['@cornerstonejs/dicom-image-loader'], - include: ['dicom-parser'], - }, -}); -``` - -## Troubleshooting - -### 1. Polyseg & Labelmap interpolation - -By default, we don't include the `@icr/polyseg-wasm`, `itk-wasm`, and `@itk-wasm/morphological-contour-interpolation` libraries in our bundle to keep the size pretty small. If you need these features, you'll need to install them separately and import them into your project. You can do this by running - -```bash -yarn install @icr/polyseg-wasm itk-wasm @itk-wasm/morphological-contour-interpolation -``` - -### 1. Build Issues - -If you're using 3D segmentation features and encounter issues with `@icr/polyseg-wasm`, add the following to your Vite configuration: - -```javascript -build: { - rollupOptions: { - external: ["@icr/polyseg-wasm"], - } -}, -``` - -:::note -You might need to add `external: ["itk-wasm", "@itk-wasm/morphological-contour-interpolation"],` to the rollupOptions as well -::: - -### 2. Path Resolution Issues with @cornerstonejs/core - -If you encounter the error "No known conditions for "./types" specifier in "@cornerstonejs/core" package" during build (while development works fine), add the following alias to your Vite configuration: - -```javascript -resolve: { - alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)), - '@root': fileURLToPath(new URL('./', import.meta.url)), - "@cornerstonejs/core": fileURLToPath(new URL('node_modules/@cornerstonejs/core/dist/esm', import.meta.url)), - }, -}, -``` - -### 3. Tool Name Minification Issues - -If you experience issues with tool names being minified (e.g., LengthTool being registered as "FE"), you can prevent minification by adding: - -```javascript -build: { - minify: false, -} -``` - -:::note -These solutions have been tested primarily on macOS but may also apply to other operating systems. If you're using Vuetify or other Vue frameworks, these configurations might need to be adjusted based on your specific setup. -::: - -### 4. Webpack - -For webpack, simply install the cornerstone3D library and import it into your project. - -If you previously used - -`noParse: [/(codec)/],` - -to avoid parsing codecs in your webpack module, remove that line. The cornerstone3D library now includes the codecs as an ES module. - -Also since we are using wasm, you will need to add the following to your webpack configuration in the `module.rules` section: - -```javascript -{ - test: /\.wasm/, - type: 'asset/resource', -}, -``` - -## Svelte + Vite - -Similar to the configuration above, use the CommonJS plugin converting commonjs to esm. Otherwise, it will be pending at `await viewport.setStack(stack);`, the image will not be rendered. - -```javascript -import { defineConfig } from 'vite'; -import { svelte } from '@sveltejs/vite-plugin-svelte'; -import { viteCommonjs } from '@originjs/vite-plugin-commonjs'; - -export default defineConfig({ - plugins: [svelte(), viteCommonjs()], - optimizeDeps: { - exclude: ['@cornerstonejs/dicom-image-loader'], - include: ['dicom-parser'], - }, -}); -``` - -:::note Tip -If you are using `sveltekit`, and config like `plugins: [ sveltekit(), viteCommonjs() ]`, `viteCommonjs()` may not work. -Try replace `sveltekit` with `vite-plugin-svelte` and it will work. -::: diff --git a/packages/docs/docs/getting-started/vue-angular-react-vite.md b/packages/docs/docs/getting-started/vue-angular-react-vite.md new file mode 100644 index 0000000000..9e9c61e509 --- /dev/null +++ b/packages/docs/docs/getting-started/vue-angular-react-vite.md @@ -0,0 +1,244 @@ +--- +id: vue-angular-react-etc +title: 'React, Vue, Angular, etc.' +--- + +Here are some examples of how to use cornerstone3D with React, Vue, Angular, vite-based frameworks, etc. +We have made it easy to use cornerstone3D with your favorite framework. + +Follow the links below to see how to use cornerstone3D with your favorite framework. + +- [Cornerstone3D with vite-based React](https://github.com/cornerstonejs/vite-react-cornerstone3d) +- [Cornerstone3D with vite-based Vue](https://github.com/cornerstonejs/vite-vue-cornerstone3d) +- [Cornerstone3D with Angular](https://github.com/cornerstonejs/angular-cornerstone3d) + - [Community maintained project](https://github.com/yanqzsu/ng-cornerstone) +- [Cornerstone3D with Next.js](https://github.com/cornerstonejs/nextjs-cornerstone3d) + +## Vite + +### Basic Setup + +The following is an example of a Vite configuration for a vite-based project that works with cornerstone3D. + +```javascript +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; +import { viteCommonjs } from '@originjs/vite-plugin-commonjs'; + +export default defineConfig({ + plugins: [ + react(), + // for dicom-parser + viteCommonjs(), + ], + // seems like only required in dev mode + optimizeDeps: { + exclude: ['@cornerstonejs/dicom-image-loader'], + include: ['dicom-parser'], + }, + worker: { + format: 'es', + }, +}); +``` + +:::note +This configuration is for basic usage of cornerstone3D tools, no polySeg and no labelmap interpolation +::: + +### Advanced Setup + +#### PolySeg + +If you need to use polyseg to convert between segmentation representations, you can add the following as a dependency and initialize the cornerstoneTools with the following configuration: + +```bash +yarn add @cornerstonejs/polymorphic-segmentation +``` + +```js +import * as polySeg from '@cornerstonejs/polymorphic-segmentation'; +import { init } from '@cornerstonejs/tools'; + +initialize({ + addons: { + polySeg, + }, +}); +``` + +Next, you'll need to edit the Vite configuration to include the following. Keep in mind that we're including the WASM files in the build and excluding them from dependency optimization. There is an ongoing issue in vite with `import.meta.url` ([check their GitHub issue](https://github.com/vitejs/vite/issues/8427)), which force us to exclude the wasm files from optimization of dependencies. + +```js +export default defineConfig({ + assetsInclude: ['**/*.wasm'], + plugins: [ + react(), + // for dicom-parser + viteCommonjs(), + ], + // seems like only required in dev mode + optimizeDeps: { + exclude: [ + '@cornerstonejs/dicom-image-loader', + '@cornerstonejs/polymorphic-segmentation', + ], + include: ['dicom-parser'], + }, + worker: { + format: 'es', + }, +}); +``` + +#### Labelmap Interpolation + +you need to add the following to your vite config: + +```bash +yarn add @cornerstonejs/labelmap-interpolation +``` + +and then you need to edit the vite config to include the following: + +```js +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; +import { viteCommonjs } from '@originjs/vite-plugin-commonjs'; + +export default defineConfig({ + assetsInclude: ['**/*.wasm'], + plugins: [ + react(), + // for dicom-parser + viteCommonjs(), + ], + // seems like only required in dev mode + optimizeDeps: { + exclude: [ + '@cornerstonejs/dicom-image-loader', + '@cornerstonejs/polymorphic-segmentation', + '@cornerstonejs/labelmap-interpolation', + ], + include: ['dicom-parser'], + }, + worker: { + format: 'es', + }, +}); +``` + +## Webpack + +### Basic Setup + +It should work out of the box with no configuration, so the following `nextjs.config.js` is the only thing you need to add. + +```js +/** @type {import('next').NextConfig} */ +const nextConfig = { + webpack: (config) => { + // resolve fs for one of the dependencies + config.resolve.fallback = { + fs: false, + }; + + return config; + }, +}; + +export default nextConfig; +``` + +### Advanced Setup (PolySeg & Labelmap Interpolation) + +You might need to add + +```js + +``` + +## Troubleshooting + +### 1. Rollup Options + +By default, we don't include the `@icr/polyseg-wasm`, `itk-wasm`, and `@itk-wasm/morphological-contour-interpolation` libraries in our bundle to keep the size pretty small. +Rollup **might** complain about these libraries, so you can add the following to the rollupOptions: + +```js +worker: { + format: "es", + rollupOptions: { + external: ["@icr/polyseg-wasm"], + }, + }, +``` + +### 2. Path Resolution Issues with @cornerstonejs/core + +If you encounter the error "No known conditions for "./types" specifier in "@cornerstonejs/core" package" during build (while development works fine), add the following alias to your Vite configuration: + +```javascript +resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)), + '@root': fileURLToPath(new URL('./', import.meta.url)), + "@cornerstonejs/core": fileURLToPath(new URL('node_modules/@cornerstonejs/core/dist/esm', import.meta.url)), + }, +}, +``` + +### 3. Tool Name Minification Issues + +If you experience issues with tool names being minified (e.g., LengthTool being registered as "FE"), you can prevent minification by adding: + +```javascript +build: { + minify: false, +} +``` + +:::note +These solutions have been tested primarily on macOS but may also apply to other operating systems. If you're using Vuetify or other Vue frameworks, these configurations might need to be adjusted based on your specific setup. +::: + +### 4. Webpack + +For webpack, simply install the cornerstone3D library and import it into your project. + +If you previously used + +`noParse: [/(codec)/],` + +to avoid parsing codecs in your webpack module, remove that line. The cornerstone3D library now includes the codecs as an ES module. + +Also since we are using wasm, you will need to add the following to your webpack configuration in the `module.rules` section: + +```javascript +{ + test: /\.wasm/, + type: 'asset/resource', +}, +``` + +### 5. Svelte + Vite + +Similar to the configuration above, use the CommonJS plugin converting commonjs to esm. Otherwise, it will be pending at `await viewport.setStack(stack);`, the image will not be rendered. + +```javascript +import { defineConfig } from 'vite'; +import { svelte } from '@sveltejs/vite-plugin-svelte'; +import { viteCommonjs } from '@originjs/vite-plugin-commonjs'; + +export default defineConfig({ + plugins: [svelte(), viteCommonjs()], + optimizeDeps: { + exclude: ['@cornerstonejs/dicom-image-loader'], + include: ['dicom-parser'], + }, +}); +``` + +:::note Tip +If you are using `sveltekit`, and config like `plugins: [ sveltekit(), viteCommonjs() ]`, `viteCommonjs()` may not work. +Try replace `sveltekit` with `vite-plugin-svelte` and it will work. diff --git a/packages/docs/docs/migration-guides/2x/1-general.md b/packages/docs/docs/migration-guides/2x/1-general.md index 6d85d265e9..7ccbe7a9e5 100644 --- a/packages/docs/docs/migration-guides/2x/1-general.md +++ b/packages/docs/docs/migration-guides/2x/1-general.md @@ -28,7 +28,7 @@ Watch this video guide for a [visual walkthrough](https://www.youtube.com/embed/ We have worked hard to enhance the developer experience when using Cornerstone3D with various frameworks like React, Vue, Angular, Vite, and Webpack. -For more information, please refer to the [frameworks](../../getting-started/vue-angular-react-etc.md) page. +For more information, please refer to the [frameworks](../../getting-started/vue-angular-react-vite.md) page. You need to modify your Vite and Webpack configurations to correctly import the Cornerstone3D library. Check each framework's repository for more details. @@ -39,7 +39,6 @@ We have streamlined the process of loading volumes without sacrificing speed by You can remove `Cross-Origin-Opener-Policy` and `Cross-Origin-Embedder-Policy` from your custom headers if you don't need them in other aspects of your app. - ## Typescript Version We have upgraded the typescript version from 4.6 to 5.5 in the 2.0 version of the cornerstone3D. @@ -76,10 +75,9 @@ Both Node.js and modern browsers now support ECMAScript Modules (ESM) by default :::note Tip -If you must use CJS, for example, if you are using `dicom-image-loader` and `dicom-parser`, you need to use `vite-plugin-commonjs` to convert CommonJS to ESM. For more information, please refer to the [Frameworks](../../getting-started/vue-angular-react-etc.md) page. +If you must use CJS, for example, if you are using `dicom-image-loader` and `dicom-parser`, you need to use `vite-plugin-commonjs` to convert CommonJS to ESM. For more information, please refer to the [Frameworks](../../getting-started/vue-angular-react-vite.md) page. ::: - ## Package Exports The Cornerstone libraries now utilize the `exports` field in their `package.json` files. This allows for more precise control over how modules are imported and ensures compatibility with different build systems. diff --git a/packages/docs/docs/migration-guides/2x/8-deverloper-experience.md b/packages/docs/docs/migration-guides/2x/8-deverloper-experience.md index f398c4300d..cd1a20000a 100644 --- a/packages/docs/docs/migration-guides/2x/8-deverloper-experience.md +++ b/packages/docs/docs/migration-guides/2x/8-deverloper-experience.md @@ -13,9 +13,6 @@ import TabItem from '@theme/TabItem'; We have removed all dependency cycles in the library, ensuring it is now free of any such issues. To maintain this, we have added rules in our linters that will catch any dependency cycles in pull requests during continuous integration. Additionally, you can run `yarn run format-check` to ensure that the formatting is correct and to check for dependencies as well. -### Published APIs - -We have now published the APIs for the DICOM Image Loader and Nifti Volume Loader. So in creating your PRs don't forget to run `yarn run build:update-api` and include the generated files in your PR. ### Karma tests diff --git a/packages/docs/docs/migration-guides/3x/1-polyseg.md b/packages/docs/docs/migration-guides/3x/1-polyseg.md new file mode 100644 index 0000000000..381f078d88 --- /dev/null +++ b/packages/docs/docs/migration-guides/3x/1-polyseg.md @@ -0,0 +1,91 @@ +--- +id: polyseg +title: 'PolySeg' +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Externalized PolySeg + +PolySeg has been moved from the `cornerstoneTools` package and is now a standalone package called @cornerstonejs/polymorphic-segmentation. + +## Usage + +Now, it's not included in the `cornerstoneTools` package anymore. If you need to enable polymorphic conversions, you'll have to install it and initialize `cornerstoneTools` with it. + +```js +import * as polyseg from '@cornerstonejs/polymorphic-segmentation'; +import { init } from '@cornerstonejs/tools'; + +init({ + addons: { + polyseg, + }, +}); +``` + +:::note +This change was made because we weren't shipping the cornerstone tools with our `polyseg-wasm` dependencies. There were a few issues with bundlers complaining about the static assets included. Now, those who don't want to use it are fine, and those who do will need to install it and initialize `cornerstoneTools` themselves. +::: + +## Exports + +We weren't exposing any functions from the `tools` directory. If you need something, import it from `@cornerstonejs/polymorphic-segmentation`. +It exports the following: + +```js +import { + canComputeRequestedRepresentation, + // computes + computeContourData, + computeLabelmapData, + computeSurfaceData, + // updates + updateSurfaceData, + // init + init, +} from '@cornerstonejs/polymorphic-segmentation'; +``` + +### computeAndAddContourRepresentation, computeAndAddLabelmapRepresentation, computeAndAddSurfaceRepresentation + +have been removed from the `tools` directory. If you happen to need them (unlikely), you'll have to build them yourself. + +```js +import { utilities } from '@cornerstonejs/tools'; +import { computeLabelmapData } from '@cornerstonejs/polymorphic-segmentation'; + +const { computeAndAddRepresentation } = utilities.segmentation; + +// for labelmap +const labelmapData = await computeAndAddRepresentation( + segmentationId, + Representations.Labelmap, + () => computeLabelmapData(segmentationId, { viewport }), + () => null +); + +// for surface +import { + computeSurfaceData, + updateSurfaceData, +} from '@cornerstonejs/polymorphic-segmentation'; + +const SurfaceData = await computeAndAddRepresentation( + segmentationId, + Representations.Surface, + () => computeSurfaceData(segmentationId, { viewport }), + () => updateSurfaceData(segmentationId, { viewport }) +); + +// same for contour +import { computeContourData } from '@cornerstonejs/polymorphic-segmentation'; + +const contourData = await computeAndAddRepresentation( + segmentationId, + Representations.Contour, + () => computeContourData(segmentationId, { viewport }), + () => undefined +); +``` diff --git a/packages/docs/docs/migration-guides/3x/2-threshold-tools.md b/packages/docs/docs/migration-guides/3x/2-threshold-tools.md new file mode 100644 index 0000000000..866d90714c --- /dev/null +++ b/packages/docs/docs/migration-guides/3x/2-threshold-tools.md @@ -0,0 +1,99 @@ +--- +id: threshold-tools +title: 'Labelmap Thresholding Tools' +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## Key Changes: + +* The nested `strategySpecificConfiguration` object has been removed completely +* Configuration properties have been moved to the root level of the configuration object +* Threshold configuration has been restructured: + * `threshold` array is now a `range` property inside a `threshold` object + * Additional threshold properties (`isDynamic`, `dynamicRadius`) are part of the same object +* `setBrushThresholdForToolGroup()` function signature has changed to accept a structured threshold object +* Strategy-specific properties like `useCenterSegmentIndex` have been moved to the root configuration level +* `activeStrategy` is now a standalone property in tool operations data, no longer inside a nested configuration + +## Migration Steps: + +### 1. Replace strategySpecificConfiguration with direct properties + +**Before:** +```diff +- configuration: { +- activeStrategy: 'THRESHOLD_INSIDE_SPHERE_WITH_ISLAND_REMOVAL', +- strategySpecificConfiguration: { +- THRESHOLD: { +- threshold: [-150, -70], +- // other threshold properties +- }, +- useCenterSegmentIndex: true, +- }, +- } +``` + +**After:** +```diff ++ configuration: { ++ activeStrategy: 'THRESHOLD_INSIDE_SPHERE_WITH_ISLAND_REMOVAL', ++ threshold: { ++ range: [-150, -70], ++ isDynamic: false, ++ // other threshold properties directly here ++ }, ++ useCenterSegmentIndex: true, ++ } +``` + +### 2. Update threshold configuration structure + +**Before:** +```diff +- strategySpecificConfiguration: { +- THRESHOLD: { +- threshold: [-150, -70], // Previous threshold array format +- isDynamic: false, +- dynamicRadius: 5 +- } +- } +``` + +**After:** +```diff ++ threshold: { ++ range: [-150, -70], // New 'range' property replaces 'threshold' ++ isDynamic: false, ++ dynamicRadius: 5 ++ } +``` + +### 3. Update setBrushThresholdForToolGroup calls + +**Before:** +```diff +- segmentationUtils.setBrushThresholdForToolGroup( +- toolGroupId, +- thresholdArgs.threshold, +- thresholdArgs +- ); +``` + +**After:** +```diff ++ segmentationUtils.setBrushThresholdForToolGroup( ++ toolGroupId, ++ fullThresholdArgs ++ ); +``` + +Note that `thresholdArgs` should now be an object with the structure: +```javascript +{ + range: [min, max], // Previously 'threshold' + isDynamic: boolean, + dynamicRadius: number +} +``` diff --git a/packages/docs/docs/migration-guides/3x/3-labelmap-interpolation.md b/packages/docs/docs/migration-guides/3x/3-labelmap-interpolation.md new file mode 100644 index 0000000000..461c90ef22 --- /dev/null +++ b/packages/docs/docs/migration-guides/3x/3-labelmap-interpolation.md @@ -0,0 +1,71 @@ +--- +id: labelmap-interpolation +title: 'Labelmap Interpolation' +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Not a composition but a utility + +Previously, interpolation was a brush composition, restricting its use to tools inheriting from a brush. However, interpolation should really be a utility anyone can use, even without a tool. + +Before, you had to use this workaround for interpolation: + +```js +addButtonToToolbar({ + title: 'Run Overlapping Interpolation', + onClick: () => { + const toolGroup = ToolGroupManager.getToolGroup(toolGroupId); + const activeName = toolGroup.getActivePrimaryMouseButtonTool(); + const brush = toolGroup.getToolInstance(activeName); + brush.interpolate?.(element1, { extendedConfig: false }); + }, +}); +``` + +Now it's as simple as this: + +```js +import * as labelmapInterpolation from '@cornerstonejs/labelmap-interpolation'; + +labelmapInterpolation.interpolate({ + segmentationId, + segmentIndex, +}); +``` + +:::note +We once again had to implement a workaround for `itk-wasm` as a dynamic dependency to prevent bundler problems in cornerstone3D 2.0. However, this caused numerous issues. Now, it's a separate, standalone utility package that doesn't need to be bundled with cornerstone3D. +::: + +## Migration + +Remove the `labelmap` interpolation from your custom tools composition. + +Before: + +```javascript +const RECTANGLE_STRATEGY = new BrushStrategy( + 'Rectangle', + compositions.regionFill, + compositions.setValue, + initializeRectangle, + compositions.determineSegmentIndex, + compositions.preview, + compositions.labelmapInterpolation +); +``` + +After: + +```javascript +const RECTANGLE_STRATEGY = new BrushStrategy( + 'Rectangle', + compositions.regionFill, + compositions.setValue, + initializeRectangle, + compositions.determineSegmentIndex, + compositions.preview +); +``` diff --git a/packages/docs/docs/migration-guides/3x/4-get-statistics.md b/packages/docs/docs/migration-guides/3x/4-get-statistics.md new file mode 100644 index 0000000000..f3aed9181c --- /dev/null +++ b/packages/docs/docs/migration-guides/3x/4-get-statistics.md @@ -0,0 +1,40 @@ +--- +id: statistics +title: 'Segmentation Statistics API' +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + +## Key Changes: + +* Statistics calculation has been moved from brush tool methods to a dedicated utility function +* Statistics are now calculated asynchronously using web workers +* The function signature for getting statistics has changed completely +* Progress events are now emitted during statistics calculation + +## Migration Steps: + +### 1. Replace tool-based statistics methods with the standalone utility + +**Before:** +```diff +- const toolGroup = ToolGroupManager.getToolGroup(toolGroupId); +- const activeName = toolGroup.getActivePrimaryMouseButtonTool(); +- const brush = toolGroup.getToolInstance(activeName); +- const stats = brush.getStatistics(viewport.element, { indices }); +``` + +**After:** +```diff ++ const stats = await segmentationUtils.getStatistics({ ++ segmentationId, ++ segmentIndices: indices, ++ viewportId: viewport.id, ++ }); +``` + +:::note +ViewportId is needed since some statistics calculations are performed regarding the base image in the viewport. +::: diff --git a/packages/docs/docs/migration-guides/3x/5-adapters.md b/packages/docs/docs/migration-guides/3x/5-adapters.md new file mode 100644 index 0000000000..4160751e23 --- /dev/null +++ b/packages/docs/docs/migration-guides/3x/5-adapters.md @@ -0,0 +1,64 @@ +--- +id: adapters +title: 'Adapters API' +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + +## Key Changes: + +* MeasurementsReport has two maps instead of objects for setting the + adapter classes, mapping the tool type to adapter class and the + tracking id to adapter class. +* A new register additional tracking id method exists to allow adding + custom adapter methods. +* Adapter implementations now have a base class to handle some of the + definition. This allows calling into the base class to handle some of the + definition such as the is tracking handling. +* The MeasurementsReport class is now extensible to create a new class with + completely different default handling. To do this, the two map attributes + need to be redeclared, and the new instance registered for the handlers. +* There is now an init method to create tracking identifiers and register a new + handler. +* The annotation changed event no longer requires the viewport id/rendering id + * This change is done so that measurements can be updated when not visible + +## Migration Steps: + +### 1. Replace MeasurementsReports.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE + +**Before:** +```diff +- const toolClass = MeasurementReports.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE[toolType]; +``` + +**After:** +```diff +- const toolClass = MeasurementReports.measurementAdapterByToolType.get(toolType); +``` + +### 2. Replace Tool instance adapter registration which is identical to existing registration + +**Before:** +```diff +- class MyNewToolAdapter { ... identical to eg Probe Adapter } +``` + +**After:** +```diff +- const MyNewToolAdapter = Probe.initCopy('MyNewTool'); +``` + +### 3. Replace old tool registration with registerTrackingIdentifier + +**Before:** +```diff +- class OldToolAdapter { ... identical to eg Length v1.0 except has :v1.0 at end of tracking identifier } +``` + +**After:** +```diff +- MeasurementReport.registerTrackingIdentifier(Length, `${Length.trackingIdentifierTextValue}:v1.0`); +``` diff --git a/packages/docs/docusaurus.config.js b/packages/docs/docusaurus.config.js index 0fe47fb297..744f789db8 100644 --- a/packages/docs/docusaurus.config.js +++ b/packages/docs/docusaurus.config.js @@ -1,4 +1,3 @@ -const path = require('path'); const lightCodeTheme = require('prism-react-renderer').themes.github; const darkCodeTheme = require('prism-react-renderer').themes.dracula; @@ -74,8 +73,8 @@ module.exports = { ], }, { - to: '/docs/migration-guides/2x/general', - label: '2.0 Migration Guides', + to: '/docs/migration-guides/3x/polyseg', + label: '3.0 Migration Guides', position: 'left', className: 'new-badge', }, @@ -87,6 +86,10 @@ module.exports = { type: 'html', value: '', }, + { + href: 'https://v2.cornerstonejs.org/', + label: '2.0', + }, { href: 'https://v1.cornerstonejs.org/', label: '1.0', @@ -216,7 +219,7 @@ module.exports = { onlyIncludeVersions: ['current'], versions: { current: { - label: `2.0 (Latest)`, + label: `3.0 (Latest)`, }, }, }, diff --git a/packages/docs/package.json b/packages/docs/package.json index 2dae79b34d..03a25f9d9a 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -1,6 +1,6 @@ { "name": "docs", - "version": "2.1.10", + "version": "3.0.0", "private": true, "repository": "https://github.com/cornerstonejs/cornerstone3D", "scripts": { @@ -33,11 +33,11 @@ "write-heading-ids": "docusaurus write-heading-ids" }, "dependencies": { - "@cornerstonejs/adapters": "^2.19.7", - "@cornerstonejs/core": "^2.19.7", - "@cornerstonejs/dicom-image-loader": "^2.19.7", - "@cornerstonejs/nifti-volume-loader": "^2.19.7", - "@cornerstonejs/tools": "^2.19.7", + "@cornerstonejs/adapters": "^3.0.5", + "@cornerstonejs/core": "^3.0.5", + "@cornerstonejs/dicom-image-loader": "^3.0.5", + "@cornerstonejs/nifti-volume-loader": "^3.0.5", + "@cornerstonejs/tools": "^3.0.5", "@docusaurus/core": "3.6.3", "@docusaurus/faster": "3.6.3", "@docusaurus/module-type-aliases": "3.6.3", diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js index d86738ec15..43b8fab24f 100644 --- a/packages/docs/sidebars.js +++ b/packages/docs/sidebars.js @@ -251,7 +251,6 @@ module.exports = { collapsed: true, items: [ 'contribute/pull-request', - 'contribute/update-api', 'contribute/documentation', 'contribute/playwright-tests', 'contribute/karma-tests', @@ -269,6 +268,16 @@ module.exports = { }, collapsed: true, items: [ + { + type: 'category', + label: '2.x -> 3.x', + collapsed: false, + link: { + type: 'doc', + id: 'migration-guides/3x/polyseg', + }, + items: [{ type: 'autogenerated', dirName: 'migration-guides/3x' }], + }, { type: 'category', label: '1.x -> 2.x', diff --git a/packages/docs/src/pages/index.js b/packages/docs/src/pages/index.js index 99e6be998f..8eb1112578 100644 --- a/packages/docs/src/pages/index.js +++ b/packages/docs/src/pages/index.js @@ -5,28 +5,9 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import styles from './index.module.css'; import HomepageFeatures from '../components/HomepageFeatures'; -function NewAnnouncementBar() { - return ( -
-
NEW
-
- {/* Cornerstone 3D is now available! */} - Major Release: Cornerstone3D 2.0 is now available! -
-
- 🎉 Major Release: Cornerstone3D 2.0 is now available! 🎉 - {/* Cornerstone3D, released as - public beta on April 1st, 2022, represents a major improvement to the - framework */} -
-
- ); -} - function HomepageHeader() { return (
- ' +); + +const { + ToolGroupManager, + ZoomTool, + StackScrollTool, + Enums: csToolsEnums, + RectangleScissorsTool, + CircleScissorsTool, + BrushTool, + PaintFillTool, + PanTool, + segmentation, + utilities: cstUtils, +} = cornerstoneTools; + +const { MouseBindings, KeyboardBindings, Events } = csToolsEnums; +const { ViewportType } = Enums; +const { segmentation: segmentationUtils, roundNumber } = cstUtils; + +// Define a unique id for the volume +let renderingEngine; +const renderingEngineId = 'myRenderingEngine'; +const viewportId = 'STACK_VIEWPORT'; +const toolGroupId = 'TOOL_GROUP_ID'; + +// ======== Set up page ======== // +setTitleAndDescription( + 'Stack Segmentation Statistics', + 'Here we demonstrate how to calculate statistics for a stack segmentation.' +); + +const size = '500px'; +const content = document.getElementById('content'); + +const statsGrid = document.createElement('div'); +statsGrid.style.display = 'flex'; +statsGrid.style.flexDirection = 'row'; +statsGrid.style.fontSize = 'smaller'; + +const statsIds = ['segment1', 'segment2', 'segmentCombined']; +const statsStyle = { + width: '20em', + height: '10em', +}; + +for (const statsId of statsIds) { + const statsDiv = document.createElement('div'); + statsDiv.id = statsId; + statsDiv.innerText = statsId; + Object.assign(statsDiv.style, statsStyle); + statsGrid.appendChild(statsDiv); +} + +content.appendChild(statsGrid); + +const viewportGrid = document.createElement('div'); +viewportGrid.style.display = 'flex'; +viewportGrid.style.flexDirection = 'row'; + +const element = document.createElement('div'); +element.style.width = size; +element.style.height = size; +element.oncontextmenu = () => false; + +viewportGrid.appendChild(element); +content.appendChild(viewportGrid); + +const instructions = document.createElement('p'); +instructions.innerText = ` + Left Click: Use selected Segmentation Tool. + Middle Click: Pan + Right Click: Zoom + Mouse wheel: Scroll Stack + `; + +content.append(instructions); + +// ============================= // + +function displayStat(stat) { + if (!stat) { + return; + } + return `${stat.label || stat.name}: ${roundNumber(stat.value)} ${ + stat.unit ? stat.unit : '' + }`; +} + +async function calculateStatistics(id, indices) { + const viewport = renderingEngine.getViewport(viewportId); + const stats = await segmentationUtils.getStatistics({ + segmentationId: 'SEGMENTATION_ID', + segmentIndices: indices, + viewportId: viewport.id, + }); + + if (!stats) { + return; + } + const items = [`Statistics on ${indices.join(', ')}`]; + stats.count.label = 'Voxels'; + + items.push( + displayStat(stats.volume), + displayStat(stats.count), + displayStat(stats.mean), + displayStat(stats.max), + displayStat(stats.min), + displayStat(stats.peakValue) + ); + const statsDiv = document.getElementById(id); + statsDiv.innerHTML = items.map((span) => `${span}
\n`).join('\n'); +} + +let timeoutId; + +function segmentationModifiedCallback(evt) { + const { detail } = evt; + if (!detail || !detail.segmentIndex || detail.segmentIndex === 255) { + return; + } + + const statsId = detail.segmentIndex === 1 ? statsIds[0] : statsIds[1]; + + const debounced = () => { + calculateStatistics(statsId, [detail.segmentIndex]); + // Also update combined stats + calculateStatistics(statsIds[2], [1, 2]); + }; + + if (timeoutId) { + window.clearTimeout(timeoutId); + } + + timeoutId = window.setTimeout(debounced, 1000); +} + +// ============================= // + +function setupTools() { + // Add tools to Cornerstone3D + cornerstoneTools.addTool(PanTool); + cornerstoneTools.addTool(ZoomTool); + cornerstoneTools.addTool(StackScrollTool); + cornerstoneTools.addTool(RectangleScissorsTool); + cornerstoneTools.addTool(CircleScissorsTool); + cornerstoneTools.addTool(PaintFillTool); + cornerstoneTools.addTool(BrushTool); + + // Define a tool group + const toolGroup = ToolGroupManager.createToolGroup(toolGroupId); + + // Add tools to the group + toolGroup.addTool(PanTool.toolName); + toolGroup.addTool(ZoomTool.toolName); + toolGroup.addTool(StackScrollTool.toolName); + toolGroup.addTool(RectangleScissorsTool.toolName); + toolGroup.addTool(CircleScissorsTool.toolName); + toolGroup.addTool(PaintFillTool.toolName); + toolGroup.addTool(BrushTool.toolName); + + // Set tool modes + toolGroup.setToolActive(BrushTool.toolName, { + bindings: [{ mouseButton: MouseBindings.Primary }], + }); + + toolGroup.setToolActive(PanTool.toolName, { + bindings: [ + { + mouseButton: MouseBindings.Auxiliary, + }, + { + mouseButton: MouseBindings.Primary, + modifierKey: KeyboardBindings.Ctrl, + }, + ], + }); + + toolGroup.setToolActive(ZoomTool.toolName, { + bindings: [ + { + mouseButton: MouseBindings.Secondary, + }, + { + mouseButton: MouseBindings.Primary, + modifierKey: KeyboardBindings.Shift, + }, + ], + }); + + toolGroup.setToolActive(StackScrollTool.toolName, { + bindings: [{ mouseButton: MouseBindings.Wheel }], + }); + + return toolGroup; +} + +// ============================= // + +/** + * Runs the demo + */ +async function run() { + // Init Cornerstone and related libraries + await initDemo(); + + const toolGroup = setupTools(); + + // Get Cornerstone imageIds and fetch metadata into RAM + const imageIds = await createImageIdsAndCacheMetaData({ + StudyInstanceUID: + '1.3.6.1.4.1.14519.5.2.1.7009.2403.334240657131972136850343327463', + SeriesInstanceUID: + '1.3.6.1.4.1.14519.5.2.1.7009.2403.226151125820845824875394858561', + wadoRsRoot: 'https://d14fa38qiwhyfd.cloudfront.net/dicomweb', + }); + + // Create a stack of images + const imageIdsArray = imageIds.slice(0, 10); + // Create segmentation images for the stack + const segImages = await imageLoader.createAndCacheDerivedLabelmapImages( + imageIdsArray + ); + + // Instantiate a rendering engine + renderingEngine = new RenderingEngine(renderingEngineId); + + // Create the viewport + const viewportInput = { + viewportId, + type: ViewportType.STACK, + element, + }; + + renderingEngine.setViewports([viewportInput]); + + // Set the stack of images + const viewport = renderingEngine.getViewport(viewportId); + await viewport.setStack(imageIdsArray, 0); + + // Add the viewport to the toolgroup + toolGroup.addViewport(viewportId, renderingEngineId); + + // Add segmentation + segmentation.addSegmentations([ + { + segmentationId: 'SEGMENTATION_ID', + representation: { + type: csToolsEnums.SegmentationRepresentations.Labelmap, + data: { + imageIds: segImages.map((it) => it.imageId), + }, + }, + }, + ]); + + // Add the segmentation representation to the viewport + await segmentation.addSegmentationRepresentations(viewportId, [ + { + segmentationId: 'SEGMENTATION_ID', + type: csToolsEnums.SegmentationRepresentations.Labelmap, + }, + ]); + + // Add brush size slider + addBrushSizeSlider({ + toolGroupId, + }); + + cornerstoneTools.utilities.stackContextPrefetch.enable(element); + + // Add segmentation modified callback + eventTarget.addEventListener( + Events.SEGMENTATION_DATA_MODIFIED, + segmentationModifiedCallback + ); + + // Render the image + renderingEngine.render(); +} + +run(); diff --git a/packages/labelmap-interpolation/package.json b/packages/labelmap-interpolation/package.json new file mode 100644 index 0000000000..b759c6c079 --- /dev/null +++ b/packages/labelmap-interpolation/package.json @@ -0,0 +1,57 @@ +{ + "name": "@cornerstonejs/labelmap-interpolation", + "version": "3.0.5", + "description": "Labelmap Interpolation utility for Cornerstone3D", + "files": [ + "dist" + ], + "module": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + "directories": { + "build": "dist" + }, + "exports": { + ".": { + "import": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts" + } + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "test": "jest --testTimeout 60000", + "clean": "rimraf dist", + "clean:deep": "yarn run clean && shx rm -rf node_modules", + "build": "yarn run build:esm", + "build:esm": "tsc --project ./tsconfig.json", + "build:esm:watch": "tsc --project ./tsconfig.json --watch", + "dev": "tsc --project ./tsconfig.json --watch", + "build:all": "yarn run build:esm", + "start": "tsc --project ./tsconfig.json --watch", + "format": "prettier --write 'src/**/*.js' 'test/**/*.js'", + "lint": "eslint --fix .", + "format-check": "npx eslint ./src --quiet", + "api-check": "api-extractor --debug run ", + "prepublishOnly": "yarn clean && yarn build" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/cornerstonejs/cornerstone3D.git" + }, + "author": "@cornerstonejs", + "license": "MIT", + "bugs": { + "url": "https://github.com/cornerstonejs/cornerstone3D/issues" + }, + "homepage": "https://github.com/cornerstonejs/cornerstone3D/blob/main/packages/labelmap-interpolation/README.md", + "dependencies": { + "@itk-wasm/morphological-contour-interpolation": "1.1.0", + "itk-wasm": "1.0.0-b.165" + }, + "peerDependencies": { + "@cornerstonejs/core": "^3.0.5", + "@cornerstonejs/tools": "^3.0.5", + "@kitware/vtk.js": "^32.9.0" + } +} diff --git a/packages/labelmap-interpolation/src/index.ts b/packages/labelmap-interpolation/src/index.ts new file mode 100644 index 0000000000..d90f681bfa --- /dev/null +++ b/packages/labelmap-interpolation/src/index.ts @@ -0,0 +1,3 @@ +import interpolate from './utilities/interpolateLabelmap'; + +export { interpolate }; diff --git a/packages/labelmap-interpolation/src/registerWorker.ts b/packages/labelmap-interpolation/src/registerWorker.ts new file mode 100644 index 0000000000..f63326bdb5 --- /dev/null +++ b/packages/labelmap-interpolation/src/registerWorker.ts @@ -0,0 +1,34 @@ +import { getWebWorkerManager } from '@cornerstonejs/core'; +let registered = false; + +export function registerInterpolationWorker() { + if (registered) { + return; + } + + registered = true; + + const workerFn = () => { + // @ts-ignore + return new Worker( + // @ts-ignore + new URL('./workers/interpolationWorker.js', import.meta.url), + { + name: 'interpolation', + type: 'module', + } + ); + }; + + const workerManager = getWebWorkerManager(); + + const options = { + maxWorkerInstances: 1, + autoTerminateOnIdle: { + enabled: true, + idleTimeThreshold: 2000, + }, + }; + + workerManager.registerWorker('interpolation', workerFn, options); +} diff --git a/packages/labelmap-interpolation/src/utilities/interpolateLabelmap.ts b/packages/labelmap-interpolation/src/utilities/interpolateLabelmap.ts new file mode 100644 index 0000000000..fe12459894 --- /dev/null +++ b/packages/labelmap-interpolation/src/utilities/interpolateLabelmap.ts @@ -0,0 +1,99 @@ +import { + getWebWorkerManager, + eventTarget, + Enums, + triggerEvent, +} from '@cornerstonejs/core'; +import { + segmentation, + Enums as csToolsEnums, + utilities, +} from '@cornerstonejs/tools'; +import { registerInterpolationWorker } from '../registerWorker'; + +type MorphologicalContourInterpolationOptions = { + label?: number; + axis?: number; + noHeuristicAlignment?: boolean; + noUseDistanceTransform?: boolean; + useCustomSlicePositions?: boolean; +}; + +const { triggerSegmentationEvents } = segmentation; +const { getOrCreateSegmentationVolume } = utilities.segmentation; + +const { triggerSegmentationDataModified } = triggerSegmentationEvents; +const { WorkerTypes } = csToolsEnums; + +const workerManager = getWebWorkerManager(); + +const triggerWorkerProgress = (eventTarget, progress) => { + triggerEvent(eventTarget, Enums.Events.WEB_WORKER_PROGRESS, { + progress, + type: WorkerTypes.INTERPOLATE_LABELMAP, + }); +}; + +async function interpolateLabelmap({ + segmentationId, + segmentIndex, + configuration = { preview: false }, +}: { + segmentationId: string; + segmentIndex: number; + configuration?: MorphologicalContourInterpolationOptions & { + preview: boolean; + }; +}) { + registerInterpolationWorker(); + + triggerWorkerProgress(eventTarget, 0); + + const segVolume = getOrCreateSegmentationVolume(segmentationId); + + const { + voxelManager: segmentationVoxelManager, + imageData: segmentationImageData, + } = segVolume; + + const segmentationInfo = { + scalarData: segmentationVoxelManager.getCompleteScalarDataArray(), + dimensions: segmentationImageData.getDimensions(), + spacing: segmentationImageData.getSpacing(), + origin: segmentationImageData.getOrigin(), + direction: segmentationImageData.getDirection(), + }; + + try { + const { data: outputScalarData } = await workerManager.executeTask( + 'interpolation', + 'interpolateLabelmap', + { + segmentationInfo, + configuration: { + ...configuration, + label: segmentIndex, + }, + } + ); + + // Update the segmentation with the modified data + segmentationVoxelManager.setCompleteScalarDataArray(outputScalarData); + + triggerSegmentationDataModified( + segmentationId, + segmentationVoxelManager.getArrayOfModifiedSlices(), + segmentIndex + ); + + triggerWorkerProgress(eventTarget, 100); + } catch (error) { + console.warn( + 'Warning: Failed to perform morphological contour interpolation', + error + ); + triggerWorkerProgress(eventTarget, 100); + } +} + +export default interpolateLabelmap; diff --git a/packages/labelmap-interpolation/src/workers/interpolationWorker.js b/packages/labelmap-interpolation/src/workers/interpolationWorker.js new file mode 100644 index 0000000000..fba8d144d7 --- /dev/null +++ b/packages/labelmap-interpolation/src/workers/interpolationWorker.js @@ -0,0 +1,174 @@ +import { expose } from 'comlink'; +import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData'; +import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray'; + +/** + * Dynamically imports ITK WASM modules needed for labelmap interpolation + * @param moduleId - The module ID to import ('itk-wasm' or '@itk-wasm/morphological-contour-interpolation') + * @returns Promise that resolves to the imported module + */ +async function peerImport(moduleId) { + try { + switch (moduleId) { + case 'itk-wasm': + return import('itk-wasm'); + case '@itk-wasm/morphological-contour-interpolation': + return import('@itk-wasm/morphological-contour-interpolation'); + default: + throw new Error(`Unknown module ID: ${moduleId}`); + } + } catch (error) { + console.warn(`Error importing ${moduleId}:`, error); + return null; + } +} + +const computeWorker = { + getITKImage: async (args) => { + const { imageData, options } = args; + + const { imageName, scalarData } = options; + + let Image, ImageType, IntTypes, FloatTypes, PixelTypes; + + try { + const itkModule = await peerImport('itk-wasm'); + if (!itkModule) { + throw new Error('Module not found'); + } + ({ Image, ImageType, IntTypes, FloatTypes, PixelTypes } = itkModule); + } catch (error) { + console.warn( + "Warning: 'itk-wasm' module not found. Please install it separately." + ); + return null; + } + + const dataTypesMap = { + Int8: IntTypes.Int8, + UInt8: IntTypes.UInt8, + Int16: IntTypes.Int16, + UInt16: IntTypes.UInt16, + Int32: IntTypes.Int32, + UInt32: IntTypes.UInt32, + Int64: IntTypes.Int64, + UInt64: IntTypes.UInt64, + Float32: FloatTypes.Float32, + Float64: FloatTypes.Float64, + }; + + const { numberOfComponents } = imageData.get('numberOfComponents'); + + const dimensions = imageData.getDimensions(); + const origin = imageData.getOrigin(); + const spacing = imageData.getSpacing(); + const directionArray = imageData.getDirection(); + const direction = new Float64Array(directionArray); + const dataType = scalarData.constructor.name + .replace(/^Ui/, 'UI') + .replace(/Array$/, ''); + const metadata = undefined; + + const imageType = new ImageType( + dimensions.length, + dataTypesMap[dataType], + PixelTypes.Scalar, + numberOfComponents + ); + + const image = new Image(imageType); + image.name = imageName; + image.origin = origin; + image.spacing = spacing; + image.direction = direction; + image.size = dimensions; + image.metadata = metadata; + image.data = scalarData; + + return image; + }, + interpolateLabelmap: async (args) => { + const { segmentationInfo, configuration } = args; + const { scalarData, dimensions, spacing, origin, direction } = + segmentationInfo; + + let itkModule; + try { + itkModule = await peerImport( + '@itk-wasm/morphological-contour-interpolation' + ); + if (!itkModule) { + throw new Error('Module not found'); + } + } catch (error) { + console.warn( + "Warning: '@itk-wasm/morphological-contour-interpolation' module not found. Please install it separately." + ); + return { data: scalarData }; + } + + const imageData = vtkImageData.newInstance(); + imageData.setDimensions(dimensions); + imageData.setOrigin(origin); + imageData.setDirection(direction || [1, 0, 0, 0, 1, 0, 0, 0, 1]); + imageData.setSpacing(spacing); + + const scalarArray = vtkDataArray.newInstance({ + name: 'Pixels', + numberOfComponents: 1, + values: scalarData, + }); + + imageData.getPointData().setScalars(scalarArray); + imageData.modified(); + + try { + const inputImage = await computeWorker.getITKImage({ + imageData, + options: { + imageName: 'interpolation', + scalarData: scalarData, + }, + }); + + if (!inputImage) { + throw new Error('Failed to get ITK image'); + } + + const { outputImage } = await itkModule.morphologicalContourInterpolation( + inputImage, + { + ...configuration, + // since we already have a web worker, we don't need to create another one + webWorker: false, + } + ); + + const outputScalarData = outputImage.data; + const modifiedScalarData = new Uint16Array(scalarData.length); + + // Copy the original data first + modifiedScalarData.set(scalarData); + + // Only update values that are different + for (let i = 0; i < outputScalarData.length; i++) { + const newValue = outputScalarData[i]; + const originalValue = scalarData[i]; + + if (newValue !== originalValue) { + modifiedScalarData[i] = newValue; + } + } + + return { data: modifiedScalarData }; + } catch (error) { + console.error(error); + console.warn( + 'Warning: Failed to perform morphological contour interpolation' + ); + return { data: scalarData }; + } + }, +}; + +expose(computeWorker); diff --git a/packages/labelmap-interpolation/tsconfig.json b/packages/labelmap-interpolation/tsconfig.json new file mode 100644 index 0000000000..bc915f1e65 --- /dev/null +++ b/packages/labelmap-interpolation/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist/esm", + "rootDir": "./src" + }, + "include": ["./src/**/*"] +} diff --git a/packages/nifti-volume-loader/CHANGELOG.md b/packages/nifti-volume-loader/CHANGELOG.md index 5b9134b8c1..264b66b701 100644 --- a/packages/nifti-volume-loader/CHANGELOG.md +++ b/packages/nifti-volume-loader/CHANGELOG.md @@ -3,6 +3,84 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.0.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.4...v3.0.5) (2025-03-06) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +## [3.0.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.3...v3.0.4) (2025-03-05) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +## [3.0.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.2...v3.0.3) (2025-03-04) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +## [3.0.2](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.1...v3.0.2) (2025-03-04) + +### Features + +- **surface-segmentation:** add visibilty configuration for surface segmentation ([#1846](https://github.com/cornerstonejs/cornerstone3D/issues/1846)) ([e1b5bc6](https://github.com/cornerstonejs/cornerstone3D/commit/e1b5bc646f3997be88ec237f86406c310420379a)) + +## [3.0.1](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0...v3.0.1) (2025-02-27) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +# [3.0.0](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.16...v3.0.0) (2025-02-27) + +### Features + +- Cornerstone3D 3.0 ([#1865](https://github.com/cornerstonejs/cornerstone3D/issues/1865)) ([fe65459](https://github.com/cornerstonejs/cornerstone3D/commit/fe654590d16414e76361e1b2826fd64c3734ae87)) + +# [3.0.0-beta.6](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2025-02-27) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +# [3.0.0-beta.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +# [3.0.0-beta.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +# [3.0.0-beta.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +# [3.0.0-beta.2](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.14...v3.0.0-beta.2) (2025-02-24) + +### Bug Fixes + +- publish beta for 3.0 ([8bf65df](https://github.com/cornerstonejs/cornerstone3D/commit/8bf65df9bec5f52459de1c49c4834b316f680f1b)) + +## [2.19.14](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.13...v2.19.14) (2025-02-24) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +## [2.19.13](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.12...v2.19.13) (2025-02-21) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +## [2.19.12](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.11...v2.19.12) (2025-02-20) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +## [2.19.11](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.10...v2.19.11) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +## [2.19.10](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.9...v2.19.10) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +## [2.19.9](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.8...v2.19.9) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + +## [2.19.8](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.7...v2.19.8) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/nifti-volume-loader + ## [2.19.7](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.6...v2.19.7) (2025-02-06) **Note:** Version bump only for package @cornerstonejs/nifti-volume-loader diff --git a/packages/nifti-volume-loader/api-extractor.json b/packages/nifti-volume-loader/api-extractor.json deleted file mode 100644 index 4ddb5f44d3..0000000000 --- a/packages/nifti-volume-loader/api-extractor.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../api-extractor.json", - "projectFolder": ".", - "mainEntryPointFilePath": "/dist/esm/index.d.ts", - "apiReport": { - "reportFileName": ".api.md", - "reportFolder": "../../common/reviews/api" - } -} diff --git a/packages/nifti-volume-loader/package.json b/packages/nifti-volume-loader/package.json index fa29db34ce..12bd2c7aed 100644 --- a/packages/nifti-volume-loader/package.json +++ b/packages/nifti-volume-loader/package.json @@ -1,6 +1,6 @@ { "name": "@cornerstonejs/nifti-volume-loader", - "version": "2.19.7", + "version": "3.0.5", "description": "Nifti Image Loader for Cornerstone3D", "module": "./dist/esm/index.js", "types": "./dist/esm/index.d.ts", @@ -53,7 +53,6 @@ "format-check": "npx eslint ./src --quiet", "api-check": "api-extractor --debug run ", "copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" dist/esm", - "build:update-api": "yarn run build:esm && api-extractor run --local", "prepublishOnly": "yarn run build", "webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js" }, @@ -61,7 +60,7 @@ "nifti-reader-js": "^0.6.8" }, "peerDependencies": { - "@cornerstonejs/core": "^2.19.7" + "@cornerstonejs/core": "^3.0.5" }, "contributors": [ { diff --git a/packages/polymorphic-segmentation/CHANGELOG.md b/packages/polymorphic-segmentation/CHANGELOG.md new file mode 100644 index 0000000000..bb070c82ab --- /dev/null +++ b/packages/polymorphic-segmentation/CHANGELOG.md @@ -0,0 +1,50 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [3.0.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.4...v3.0.5) (2025-03-06) + +**Note:** Version bump only for package @cornerstonejs/polymorphic-segmentation + +## [3.0.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.3...v3.0.4) (2025-03-05) + +**Note:** Version bump only for package @cornerstonejs/polymorphic-segmentation + +## [3.0.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.2...v3.0.3) (2025-03-04) + +**Note:** Version bump only for package @cornerstonejs/polymorphic-segmentation + +## [3.0.2](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.1...v3.0.2) (2025-03-04) + +### Features + +- **surface-segmentation:** add visibilty configuration for surface segmentation ([#1846](https://github.com/cornerstonejs/cornerstone3D/issues/1846)) ([e1b5bc6](https://github.com/cornerstonejs/cornerstone3D/commit/e1b5bc646f3997be88ec237f86406c310420379a)) + +## [3.0.1](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0...v3.0.1) (2025-02-27) + +**Note:** Version bump only for package @cornerstonejs/polymorphic-segmentation + +# [3.0.0](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.16...v3.0.0) (2025-02-27) + +### Features + +- Cornerstone3D 3.0 ([#1865](https://github.com/cornerstonejs/cornerstone3D/issues/1865)) ([fe65459](https://github.com/cornerstonejs/cornerstone3D/commit/fe654590d16414e76361e1b2826fd64c3734ae87)) + +# [3.0.0-beta.6](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2025-02-27) + +**Note:** Version bump only for package @cornerstonejs/polymorphic-segmentation + +# [3.0.0-beta.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/polymorphic-segmentation + +# [3.0.0-beta.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/polymorphic-segmentation + +# [3.0.0-beta.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/polymorphic-segmentation + +# Change Log diff --git a/packages/polymorphic-segmentation/README.md b/packages/polymorphic-segmentation/README.md new file mode 100644 index 0000000000..bdd71bfc3a --- /dev/null +++ b/packages/polymorphic-segmentation/README.md @@ -0,0 +1,40 @@ +# Cornerstone Segmentation Polymorphic Segmentation + +A powerful and flexible segmentation addon for Cornerstone3D that provides polymorphic segmentation capabilities. + +## Overview + +The Polymorphic Segmentation package extends Cornerstone3D's segmentation capabilities with advanced features for creating, manipulating, and visualizing segmentations across different modalities and use cases. + +## Installation + +```bash +npm install @cornerstonejs/polymorphic-segmentation +``` + +## Initialization + +To use the Polymorphic Segmentation package with Cornerstone Tools, you need to initialize it as an addon during the Cornerstone Tools initialization process. + +### Basic Initialization + +```js +import { init } from '@cornerstonejs/tools'; +import * as polySeg from '@cornerstonejs/polymorphic-segmentation'; + +// Initialize Cornerstone Tools with the Polymorphic Segmentation addon +await init({ + addons: { + polySeg, + }, +}); +``` + +:::note +If you don't initialize polySeg as an addon, you will not be able to use the polymorphic segmentation features. But the +rest of the Cornerstone3D components will work as expected. +::: + +## License + +MIT diff --git a/packages/tools/examples/PolySegWasmContourToStackLabelmap/index.ts b/packages/polymorphic-segmentation/examples/PolySegWasmContourToStackLabelmap/index.ts similarity index 100% rename from packages/tools/examples/PolySegWasmContourToStackLabelmap/index.ts rename to packages/polymorphic-segmentation/examples/PolySegWasmContourToStackLabelmap/index.ts diff --git a/packages/tools/examples/PolySegWasmContourToSurface/index.ts b/packages/polymorphic-segmentation/examples/PolySegWasmContourToSurface/index.ts similarity index 100% rename from packages/tools/examples/PolySegWasmContourToSurface/index.ts rename to packages/polymorphic-segmentation/examples/PolySegWasmContourToSurface/index.ts diff --git a/packages/tools/examples/PolySegWasmContourToVolumeLabelmap/index.ts b/packages/polymorphic-segmentation/examples/PolySegWasmContourToVolumeLabelmap/index.ts similarity index 100% rename from packages/tools/examples/PolySegWasmContourToVolumeLabelmap/index.ts rename to packages/polymorphic-segmentation/examples/PolySegWasmContourToVolumeLabelmap/index.ts diff --git a/packages/tools/examples/PolySegWasmStackLabelmapToSurface/index.ts b/packages/polymorphic-segmentation/examples/PolySegWasmStackLabelmapToSurface/index.ts similarity index 100% rename from packages/tools/examples/PolySegWasmStackLabelmapToSurface/index.ts rename to packages/polymorphic-segmentation/examples/PolySegWasmStackLabelmapToSurface/index.ts diff --git a/packages/tools/examples/PolySegWasmSurfaceToContour/index.ts b/packages/polymorphic-segmentation/examples/PolySegWasmSurfaceToContour/index.ts similarity index 100% rename from packages/tools/examples/PolySegWasmSurfaceToContour/index.ts rename to packages/polymorphic-segmentation/examples/PolySegWasmSurfaceToContour/index.ts diff --git a/packages/tools/examples/PolySegWasmSurfaceToStackLabelmap/index.ts b/packages/polymorphic-segmentation/examples/PolySegWasmSurfaceToStackLabelmap/index.ts similarity index 98% rename from packages/tools/examples/PolySegWasmSurfaceToStackLabelmap/index.ts rename to packages/polymorphic-segmentation/examples/PolySegWasmSurfaceToStackLabelmap/index.ts index 844dae4752..ccd731f73c 100644 --- a/packages/tools/examples/PolySegWasmSurfaceToStackLabelmap/index.ts +++ b/packages/polymorphic-segmentation/examples/PolySegWasmSurfaceToStackLabelmap/index.ts @@ -178,7 +178,7 @@ async function run() { const surfaces = await downloadSurfacesData(); - const geometriesInfo = createAndCacheGeometriesFromSurfaces(surfaces); + const geometriesInfo = await createAndCacheGeometriesFromSurfaces(surfaces); // Add the segmentations to state segmentation.addSegmentations([ diff --git a/packages/tools/examples/PolySegWasmSurfaceToVolumeLabelmap/index.ts b/packages/polymorphic-segmentation/examples/PolySegWasmSurfaceToVolumeLabelmap/index.ts similarity index 100% rename from packages/tools/examples/PolySegWasmSurfaceToVolumeLabelmap/index.ts rename to packages/polymorphic-segmentation/examples/PolySegWasmSurfaceToVolumeLabelmap/index.ts diff --git a/packages/tools/examples/PolySegWasmVolumeLabelmapToContour/index.ts b/packages/polymorphic-segmentation/examples/PolySegWasmVolumeLabelmapToContour/index.ts similarity index 100% rename from packages/tools/examples/PolySegWasmVolumeLabelmapToContour/index.ts rename to packages/polymorphic-segmentation/examples/PolySegWasmVolumeLabelmapToContour/index.ts diff --git a/packages/tools/examples/PolySegWasmVolumeLabelmapToSurface/index.ts b/packages/polymorphic-segmentation/examples/PolySegWasmVolumeLabelmapToSurface/index.ts similarity index 100% rename from packages/tools/examples/PolySegWasmVolumeLabelmapToSurface/index.ts rename to packages/polymorphic-segmentation/examples/PolySegWasmVolumeLabelmapToSurface/index.ts diff --git a/packages/polymorphic-segmentation/package.json b/packages/polymorphic-segmentation/package.json new file mode 100644 index 0000000000..ac20db348d --- /dev/null +++ b/packages/polymorphic-segmentation/package.json @@ -0,0 +1,55 @@ +{ + "name": "@cornerstonejs/polymorphic-segmentation", + "version": "3.0.5", + "description": "Polymorphic Segmentation utility for Cornerstone3D", + "files": [ + "dist" + ], + "module": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + "directories": { + "build": "dist" + }, + "exports": { + ".": { + "import": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts" + } + }, + "publishConfig": { + "access": "public" + }, + "scripts": { + "test": "jest --testTimeout 60000", + "clean": "rimraf dist", + "build": "yarn run build:esm", + "build:esm": "tsc --project ./tsconfig.json", + "build:esm:watch": "tsc --project ./tsconfig.json --watch", + "dev": "tsc --project ./tsconfig.json --watch", + "build:all": "yarn run build:esm", + "start": "tsc --project ./tsconfig.json --watch", + "format": "prettier --write 'src/**/*.js' 'test/**/*.js'", + "lint": "eslint --fix .", + "format-check": "npx eslint ./src --quiet", + "api-check": "api-extractor --debug run ", + "prepublishOnly": "yarn clean && yarn build" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/cornerstonejs/cornerstone3D.git" + }, + "author": "@cornerstonejs", + "license": "MIT", + "bugs": { + "url": "https://github.com/cornerstonejs/cornerstone3D/issues" + }, + "homepage": "https://github.com/cornerstonejs/cornerstone3D/blob/main/packages/polymorphic-segmentation/README.md", + "dependencies": { + "@icr/polyseg-wasm": "0.4.0" + }, + "peerDependencies": { + "@cornerstonejs/core": "^3.0.5", + "@cornerstonejs/tools": "^3.0.5", + "@kitware/vtk.js": "^32.9.0" + } +} diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.ts b/packages/polymorphic-segmentation/src/Contour/contourComputationStrategies.ts similarity index 90% rename from packages/tools/src/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.ts rename to packages/polymorphic-segmentation/src/Contour/contourComputationStrategies.ts index 390fa04fb9..24357952c7 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Contour/contourComputationStrategies.ts +++ b/packages/polymorphic-segmentation/src/Contour/contourComputationStrategies.ts @@ -1,15 +1,18 @@ -import { cache } from '@cornerstonejs/core'; import type { Types } from '@cornerstonejs/core'; -import { getUniqueSegmentIndices } from '../../../../utilities/segmentation/getUniqueSegmentIndices'; -import type { PolySegConversionOptions } from '../../../../types'; -import { computeSurfaceFromLabelmapSegmentation } from '../Surface/surfaceComputationStrategies'; -import type { SurfaceClipResult } from '../../helpers/clipAndCacheSurfacesForViewport'; -import { clipAndCacheSurfacesForViewport } from '../../helpers/clipAndCacheSurfacesForViewport'; +import { cache } from '@cornerstonejs/core'; +import { Enums, segmentation, utilities } from '@cornerstonejs/tools'; import { extractContourData } from './utils/extractContourData'; + +import type { PolySegConversionOptions } from '../types'; +import { computeSurfaceFromLabelmapSegmentation } from '../Surface/surfaceComputationStrategies'; +import type { SurfaceClipResult } from '../utilities/clipAndCacheSurfacesForViewport'; +import { clipAndCacheSurfacesForViewport } from '../utilities/clipAndCacheSurfacesForViewport'; import { createAndAddContourSegmentationsFromClippedSurfaces } from './utils/createAndAddContourSegmentationsFromClippedSurfaces'; -import { getSegmentation } from '../../getSegmentation'; -import { segmentationStyle } from '../../SegmentationStyle'; -import { SegmentationRepresentations } from '../../../../enums'; + +const { getUniqueSegmentIndices } = utilities.segmentation; +const { getSegmentation } = segmentation.state; +const { segmentationStyle } = segmentation; +const { SegmentationRepresentations } = Enums; // the map between segment index and the intersection points and lines export type RawContourData = Map; diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.ts b/packages/polymorphic-segmentation/src/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.ts similarity index 93% rename from packages/tools/src/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.ts rename to packages/polymorphic-segmentation/src/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.ts index 3c4f626bb1..ee082d427b 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.ts +++ b/packages/polymorphic-segmentation/src/Contour/utils/createAndAddContourSegmentationsFromClippedSurfaces.ts @@ -1,8 +1,11 @@ -import PlanarFreehandContourSegmentationTool from '../../../../../tools/annotation/PlanarFreehandContourSegmentationTool'; -import { addAnnotation } from '../../../../annotation/annotationState'; -import type { RawContourData } from '../contourComputationStrategies'; import { utilities, type Types } from '@cornerstonejs/core'; +import { + PlanarFreehandContourSegmentationTool, + annotation, +} from '@cornerstonejs/tools'; +import type { RawContourData } from '../contourComputationStrategies'; +const { addAnnotation } = annotation.state; /** * Creates and adds contour segmentations from a clipped surface. * diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.ts b/packages/polymorphic-segmentation/src/Contour/utils/extractContourData.ts similarity index 90% rename from packages/tools/src/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.ts rename to packages/polymorphic-segmentation/src/Contour/utils/extractContourData.ts index 05a2b0e8d4..7d41a49574 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Contour/utils/extractContourData.ts +++ b/packages/polymorphic-segmentation/src/Contour/utils/extractContourData.ts @@ -1,4 +1,4 @@ -import type { PolyDataClipCacheType } from '../../../helpers/clipAndCacheSurfacesForViewport'; +import type { PolyDataClipCacheType } from '../../utilities/clipAndCacheSurfacesForViewport'; import type { RawContourData } from '../contourComputationStrategies'; /** diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.ts b/packages/polymorphic-segmentation/src/Contour/utils/updateContoursOnCameraModified.ts similarity index 94% rename from packages/tools/src/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.ts rename to packages/polymorphic-segmentation/src/Contour/utils/updateContoursOnCameraModified.ts index 20332071ae..cdbf1cd136 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Contour/utils/updateContoursOnCameraModified.ts +++ b/packages/polymorphic-segmentation/src/Contour/utils/updateContoursOnCameraModified.ts @@ -1,6 +1,6 @@ import { utilities, type Types, Enums } from '@cornerstonejs/core'; import { extractContourData } from './extractContourData'; -import { clipAndCacheSurfacesForViewport } from '../../../helpers/clipAndCacheSurfacesForViewport'; +import { clipAndCacheSurfacesForViewport } from '../../utilities'; import { createAndAddContourSegmentationsFromClippedSurfaces } from './createAndAddContourSegmentationsFromClippedSurfaces'; const currentViewportNormal = new Map(); diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.ts b/packages/polymorphic-segmentation/src/Labelmap/convertContourToLabelmap.ts similarity index 91% rename from packages/tools/src/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.ts rename to packages/polymorphic-segmentation/src/Labelmap/convertContourToLabelmap.ts index a678389f36..23311897ce 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Labelmap/convertContourToLabelmap.ts +++ b/packages/polymorphic-segmentation/src/Labelmap/convertContourToLabelmap.ts @@ -11,14 +11,12 @@ import { triggerEvent, eventTarget, } from '@cornerstonejs/core'; -import type { - Annotation, - ContourAnnotation, - ContourSegmentationData, - PolySegConversionOptions, -} from '../../../../types'; -import { getAnnotation } from '../../../annotation/annotationState'; -import { WorkerTypes } from '../../../../enums'; +import type { Types as ToolsTypes } from '@cornerstonejs/tools'; +import * as cornerstoneTools from '@cornerstonejs/tools'; +import type { PolySegConversionOptions } from '../types'; + +const { WorkerTypes } = cornerstoneTools.Enums; +const { getAnnotation } = cornerstoneTools.annotation.state; const workerManager = getWebWorkerManager(); @@ -30,7 +28,7 @@ const triggerWorkerProgress = (eventTarget, progress) => { }; export async function convertContourToVolumeLabelmap( - contourRepresentationData: ContourSegmentationData, + contourRepresentationData: ToolsTypes.ContourSegmentationData, options: PolySegConversionOptions = {} ) { const viewport = options.viewport as Types.IVolumeViewport; @@ -94,7 +92,7 @@ export async function convertContourToVolumeLabelmap( } export async function convertContourToStackLabelmap( - contourRepresentationData: ContourSegmentationData, + contourRepresentationData: ToolsTypes.ContourSegmentationData, options: PolySegConversionOptions = {} ) { if (!options.viewport) { @@ -236,7 +234,7 @@ export async function convertContourToStackLabelmap( } function _getAnnotationMapFromSegmentation( - contourRepresentationData: ContourSegmentationData, + contourRepresentationData: ToolsTypes.ContourSegmentationData, options: PolySegConversionOptions = {} ) { const annotationMap = contourRepresentationData.annotationUIDsMap; @@ -256,11 +254,12 @@ function _getAnnotationMapFromSegmentation( let uids = Array.from(annotationUIDsInSegment); uids = uids.filter( - (uid) => !(getAnnotation(uid) as Annotation).parentAnnotationUID + (uid) => + !(getAnnotation(uid) as ToolsTypes.Annotation).parentAnnotationUID ); const annotations = uids.map((uid) => { - const annotation = getAnnotation(uid) as ContourAnnotation; + const annotation = getAnnotation(uid) as ToolsTypes.ContourAnnotation; const hasChildAnnotations = annotation.childAnnotationUIDs?.length; return { @@ -271,7 +270,7 @@ function _getAnnotationMapFromSegmentation( annotation.childAnnotationUIDs.map((childUID) => { const childAnnotation = getAnnotation( childUID - ) as ContourAnnotation; + ) as ToolsTypes.ContourAnnotation; return childAnnotation.data.contour.polyline; }), }; diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.ts b/packages/polymorphic-segmentation/src/Labelmap/convertSurfaceToLabelmap.ts similarity index 88% rename from packages/tools/src/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.ts rename to packages/polymorphic-segmentation/src/Labelmap/convertSurfaceToLabelmap.ts index 2ed19c6f97..08967fab8f 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Labelmap/convertSurfaceToLabelmap.ts +++ b/packages/polymorphic-segmentation/src/Labelmap/convertSurfaceToLabelmap.ts @@ -6,8 +6,10 @@ import { getWebWorkerManager, triggerEvent, } from '@cornerstonejs/core'; -import type { SurfaceSegmentationData } from '../../../../types/SurfaceTypes'; -import { WorkerTypes } from '../../../../enums'; +import * as cornerstoneTools from '@cornerstonejs/tools'; +import type { Types as ToolsTypes } from '@cornerstonejs/tools'; + +const { WorkerTypes } = cornerstoneTools.Enums; const workerManager = getWebWorkerManager(); @@ -19,7 +21,7 @@ const triggerWorkerProgress = (eventTarget, progress) => { }; export async function convertSurfaceToVolumeLabelmap( - surfaceRepresentationData: SurfaceSegmentationData, + surfaceRepresentationData: ToolsTypes.SurfaceSegmentationData, segmentationVolume: Types.IImageVolume ) { const { geometryIds } = surfaceRepresentationData; diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.ts b/packages/polymorphic-segmentation/src/Labelmap/labelmapComputationStrategies.ts similarity index 85% rename from packages/tools/src/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.ts rename to packages/polymorphic-segmentation/src/Labelmap/labelmapComputationStrategies.ts index a82fdc884a..d5f0c7be69 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Labelmap/labelmapComputationStrategies.ts +++ b/packages/polymorphic-segmentation/src/Labelmap/labelmapComputationStrategies.ts @@ -1,22 +1,22 @@ -import { VolumeViewport, volumeLoader, imageLoader } from '@cornerstonejs/core'; import type { Types } from '@cornerstonejs/core'; -import { getUniqueSegmentIndices } from '../../../../utilities/segmentation/getUniqueSegmentIndices'; -import { getSegmentation } from '../../getSegmentation'; -import type { - LabelmapSegmentationDataStack, - LabelmapSegmentationDataVolume, -} from '../../../../types/LabelmapTypes'; +import { volumeLoader, imageLoader, VolumeViewport } from '@cornerstonejs/core'; +import { utilities } from '@cornerstonejs/tools'; +import * as cornerstoneTools from '@cornerstonejs/tools'; +import type { Types as ToolsTypes } from '@cornerstonejs/tools'; import { convertContourToStackLabelmap, convertContourToVolumeLabelmap, } from './convertContourToLabelmap'; import { convertSurfaceToVolumeLabelmap } from './convertSurfaceToLabelmap'; -import type { PolySegConversionOptions } from '../../../../types'; -import { computeStackLabelmapFromVolume } from '../../helpers/computeStackLabelmapFromVolume'; +import type { PolySegConversionOptions } from '../types'; + +const { computeStackLabelmapFromVolume, getUniqueSegmentIndices } = + utilities.segmentation; +const { getSegmentation } = cornerstoneTools.segmentation.state; export type RawLabelmapData = - | LabelmapSegmentationDataVolume - | LabelmapSegmentationDataStack; + | ToolsTypes.LabelmapSegmentationDataVolume + | ToolsTypes.LabelmapSegmentationDataStack; export async function computeLabelmapData( segmentationId: string, @@ -65,7 +65,10 @@ export async function computeLabelmapData( async function computeLabelmapFromContourSegmentation( segmentationId, options: PolySegConversionOptions = {} -): Promise { +): Promise< + | ToolsTypes.LabelmapSegmentationDataVolume + | ToolsTypes.LabelmapSegmentationDataStack +> { const isVolume = options.viewport ? options.viewport instanceof VolumeViewport : true; @@ -103,7 +106,10 @@ async function computeLabelmapFromContourSegmentation( async function computeLabelmapFromSurfaceSegmentation( segmentationId, options: PolySegConversionOptions = {} -): Promise { +): Promise< + | ToolsTypes.LabelmapSegmentationDataVolume + | ToolsTypes.LabelmapSegmentationDataStack +> { const { viewport } = options; const isVolume = viewport ? viewport instanceof VolumeViewport : true; @@ -161,7 +167,7 @@ async function computeLabelmapFromSurfaceSegmentation( // we need to convert the volume labelmap to a stack labelmap const stackData = (await computeStackLabelmapFromVolume({ volumeId: segmentationVolume.volumeId, - })) as LabelmapSegmentationDataStack; + })) as ToolsTypes.LabelmapSegmentationDataStack; return stackData; } diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.ts b/packages/polymorphic-segmentation/src/Surface/convertContourToSurface.ts similarity index 80% rename from packages/tools/src/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.ts rename to packages/polymorphic-segmentation/src/Surface/convertContourToSurface.ts index 400de46526..6b2588035e 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Surface/convertContourToSurface.ts +++ b/packages/polymorphic-segmentation/src/Surface/convertContourToSurface.ts @@ -5,12 +5,11 @@ import { triggerEvent, getWebWorkerManager, } from '@cornerstonejs/core'; -import type { - ContourSegmentationAnnotation, - ContourSegmentationData, -} from '../../../../types'; -import { getAnnotation } from '../../../annotation/annotationState'; -import { WorkerTypes } from '../../../../enums'; +import type { Types as ToolsTypes } from '@cornerstonejs/tools'; +import * as cornerstoneTools from '@cornerstonejs/tools'; + +const { WorkerTypes } = cornerstoneTools.Enums; +const { getAnnotation } = cornerstoneTools.annotation.state; const workerManager = getWebWorkerManager(); @@ -30,7 +29,7 @@ const triggerWorkerProgress = (eventTarget, progress, id) => { * @returns A promise that resolves to the surface data. */ export async function convertContourToSurface( - contourRepresentationData: ContourSegmentationData, + contourRepresentationData: ToolsTypes.ContourSegmentationData, segmentIndex: number ): Promise { const { annotationUIDsMap } = contourRepresentationData; @@ -42,8 +41,9 @@ export async function convertContourToSurface( for (const annotationUID of annotationUIDs) { const annotation = getAnnotation(annotationUID); - const { polyline } = (annotation as ContourSegmentationAnnotation).data - .contour; + const { polyline } = ( + annotation as ToolsTypes.ContourSegmentationAnnotation + ).data.contour; numPointsArray.push(polyline.length); polyline.forEach((polyline) => polylines.push(...polyline)); } diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.ts b/packages/polymorphic-segmentation/src/Surface/convertLabelmapToSurface.ts similarity index 73% rename from packages/tools/src/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.ts rename to packages/polymorphic-segmentation/src/Surface/convertLabelmapToSurface.ts index 855ec9ad8a..c8bfb62983 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Surface/convertLabelmapToSurface.ts +++ b/packages/polymorphic-segmentation/src/Surface/convertLabelmapToSurface.ts @@ -6,13 +6,13 @@ import { triggerEvent, Enums, } from '@cornerstonejs/core'; -import type { - LabelmapSegmentationData, - LabelmapSegmentationDataStack, - LabelmapSegmentationDataVolume, -} from '../../../../types/LabelmapTypes'; -import { computeVolumeLabelmapFromStack } from '../../helpers/computeVolumeLabelmapFromStack'; -import { WorkerTypes } from '../../../../enums'; + +import * as cornerstoneTools from '@cornerstonejs/tools'; +import type { Types as ToolsTypes } from '@cornerstonejs/tools'; + +const { WorkerTypes } = cornerstoneTools.Enums; +const { computeVolumeLabelmapFromStack } = + cornerstoneTools.utilities.segmentation; const workerManager = getWebWorkerManager(); @@ -33,17 +33,21 @@ const triggerWorkerProgress = (eventTarget, progress, id) => { * @returns A promise that resolves to the surface data. */ export async function convertLabelmapToSurface( - labelmapRepresentationData: LabelmapSegmentationData, + labelmapRepresentationData: ToolsTypes.LabelmapSegmentationData, segmentIndex: number ): Promise { let volumeId; - if ((labelmapRepresentationData as LabelmapSegmentationDataVolume).volumeId) { - volumeId = (labelmapRepresentationData as LabelmapSegmentationDataVolume) - .volumeId; + if ( + (labelmapRepresentationData as ToolsTypes.LabelmapSegmentationDataVolume) + .volumeId + ) { + volumeId = ( + labelmapRepresentationData as ToolsTypes.LabelmapSegmentationDataVolume + ).volumeId; } else { const { imageIds } = - labelmapRepresentationData as LabelmapSegmentationDataStack; + labelmapRepresentationData as ToolsTypes.LabelmapSegmentationDataStack; ({ volumeId } = await computeVolumeLabelmapFromStack({ imageIds, diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.ts b/packages/polymorphic-segmentation/src/Surface/createAndCacheSurfacesFromRaw.ts similarity index 88% rename from packages/tools/src/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.ts rename to packages/polymorphic-segmentation/src/Surface/createAndCacheSurfacesFromRaw.ts index 8d6b91c5a9..e13ce49d6a 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Surface/createAndCacheSurfacesFromRaw.ts +++ b/packages/polymorphic-segmentation/src/Surface/createAndCacheSurfacesFromRaw.ts @@ -1,9 +1,11 @@ import type { Types } from '@cornerstonejs/core'; import { Enums, geometryLoader } from '@cornerstonejs/core'; -import { getSegmentIndexColor } from '../../config/segmentationColor'; import type { RawSurfacesData } from './surfaceComputationStrategies'; -import type { PolySegConversionOptions } from '../../../../types'; -import { getSegmentation } from '../../getSegmentation'; +import type { PolySegConversionOptions } from '../types'; +import * as cornerstoneTools from '@cornerstonejs/tools'; + +const { getSegmentation } = cornerstoneTools.segmentation.state; +const { getSegmentIndexColor } = cornerstoneTools.segmentation.config.color; /** * Creates and caches surfaces from raw surface data. diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.ts b/packages/polymorphic-segmentation/src/Surface/surfaceComputationStrategies.ts similarity index 86% rename from packages/tools/src/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.ts rename to packages/polymorphic-segmentation/src/Surface/surfaceComputationStrategies.ts index b1f2d8d380..8e2a20a8ad 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Surface/surfaceComputationStrategies.ts +++ b/packages/polymorphic-segmentation/src/Surface/surfaceComputationStrategies.ts @@ -1,18 +1,14 @@ import type { Types } from '@cornerstonejs/core'; -import type { - ContourSegmentationData, - PolySegConversionOptions, -} from '../../../../types'; -import { getUniqueSegmentIndices } from '../../../../utilities/segmentation/getUniqueSegmentIndices'; -import { getSegmentation } from '../../getSegmentation'; +import type { PolySegConversionOptions } from '../types'; +import * as cornerstoneTools from '@cornerstonejs/tools'; + import { convertContourToSurface } from './convertContourToSurface'; import { createAndCacheSurfacesFromRaw } from './createAndCacheSurfacesFromRaw'; -import type { - LabelmapSegmentationData, - LabelmapSegmentationDataStack, - LabelmapSegmentationDataVolume, -} from '../../../../types/LabelmapTypes'; import { convertLabelmapToSurface } from './convertLabelmapToSurface'; +import type { Types as ToolsTypes } from '@cornerstonejs/tools'; + +const { getUniqueSegmentIndices } = cornerstoneTools.utilities.segmentation; +const { getSegmentation } = cornerstoneTools.segmentation.state; export type RawSurfacesData = { segmentIndex: number; @@ -47,7 +43,9 @@ export async function computeSurfaceData( ...options, } ); - } else if (representationData.Labelmap as LabelmapSegmentationData) { + } else if ( + representationData.Labelmap as ToolsTypes.LabelmapSegmentationData + ) { // convert volume labelmap to surface rawSurfacesData = await computeSurfaceFromLabelmapSegmentation( segmentation.segmentationId, @@ -97,8 +95,8 @@ async function computeSurfaceFromLabelmapSegmentation( const promises = segmentIndices.map((index) => { const surface = convertLabelmapToSurface( labelmapRepresentationData as - | LabelmapSegmentationDataVolume - | LabelmapSegmentationDataStack, + | ToolsTypes.LabelmapSegmentationDataVolume + | ToolsTypes.LabelmapSegmentationDataStack, index ); @@ -143,7 +141,7 @@ async function computeSurfaceFromContourSegmentation( const promises = segmentIndices.map(async (index) => { const surface = await convertContourToSurface( - contourRepresentationData as ContourSegmentationData, + contourRepresentationData as ToolsTypes.ContourSegmentationData, index ); diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.ts b/packages/polymorphic-segmentation/src/Surface/updateSurfaceData.ts similarity index 84% rename from packages/tools/src/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.ts rename to packages/polymorphic-segmentation/src/Surface/updateSurfaceData.ts index 86b75f03cd..5648331df3 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Surface/updateSurfaceData.ts +++ b/packages/polymorphic-segmentation/src/Surface/updateSurfaceData.ts @@ -1,14 +1,25 @@ import type { Types } from '@cornerstonejs/core'; import { cache } from '@cornerstonejs/core'; -import { getUniqueSegmentIndices } from '../../../../utilities/segmentation/getUniqueSegmentIndices'; -import { getViewportIdsWithSegmentation } from '../../getViewportIdsWithSegmentation'; -import { getSegmentation } from '../../getSegmentation'; -import { triggerSegmentationModified } from '../../triggerSegmentationEvents'; -import { getSegmentationRepresentation } from '../../getSegmentationRepresentation'; -import { SegmentationRepresentations } from '../../../../enums'; +import * as cornerstoneTools from '@cornerstonejs/tools'; + import { computeSurfaceFromLabelmapSegmentation } from './surfaceComputationStrategies'; import { createAndCacheSurfacesFromRaw } from './createAndCacheSurfacesFromRaw'; +const { + utilities: { + segmentation: { getUniqueSegmentIndices }, + }, + segmentation: { + state: { + getViewportIdsWithSegmentation, + getSegmentation, + getSegmentationRepresentation, + }, + triggerSegmentationEvents: { triggerSegmentationModified }, + }, + Enums: { SegmentationRepresentations }, +} = cornerstoneTools; + export async function updateSurfaceData(segmentationId) { const surfacesObj = await computeSurfaceFromLabelmapSegmentation( segmentationId diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.ts b/packages/polymorphic-segmentation/src/canComputeRequestedRepresentation.ts similarity index 86% rename from packages/tools/src/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.ts rename to packages/polymorphic-segmentation/src/canComputeRequestedRepresentation.ts index be7ce91e03..1c34b83653 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/canComputeRequestedRepresentation.ts +++ b/packages/polymorphic-segmentation/src/canComputeRequestedRepresentation.ts @@ -1,14 +1,15 @@ -import { SegmentationRepresentations } from '../../../enums'; -import type { RepresentationsData } from '../../../types'; -import { getSegmentation } from '../getSegmentation'; -import { validate as validateLabelmap } from '../../../tools/displayTools/Labelmap/validateLabelmap'; +import type { Types as ToolsTypes } from '@cornerstonejs/tools'; +import { Enums, segmentation, utilities } from '@cornerstonejs/tools'; + +type RepresentationsData = ToolsTypes.RepresentationsData; + +const { SegmentationRepresentations } = Enums; +const { getSegmentation } = segmentation.state; +const { validateLabelmap } = utilities.segmentation; // Map of conversion paths between source and target representations // You should read it as "source" -> "targets" -const conversionPaths = new Map< - SegmentationRepresentations, - Set ->([ +const conversionPaths = new Map([ [ SegmentationRepresentations.Labelmap, new Set([ @@ -43,7 +44,7 @@ const conversionPaths = new Map< */ function canComputeRequestedRepresentation( segmentationId: string, - type: SegmentationRepresentations + type: typeof SegmentationRepresentations ): boolean { const { representationData } = getSegmentation(segmentationId); @@ -73,7 +74,7 @@ function getExistingRepresentationTypes( let validateFn; switch (representationType) { case SegmentationRepresentations.Labelmap: - validateFn = validateLabelmap; + validateFn = validateLabelmap.validate; break; // Todo: add validation for other representation types } diff --git a/packages/polymorphic-segmentation/src/index.ts b/packages/polymorphic-segmentation/src/index.ts new file mode 100644 index 0000000000..313f9c322a --- /dev/null +++ b/packages/polymorphic-segmentation/src/index.ts @@ -0,0 +1,25 @@ +import { computeContourData } from './Contour/contourComputationStrategies'; +import { computeLabelmapData } from './Labelmap/labelmapComputationStrategies'; +import { computeSurfaceData } from './Surface/surfaceComputationStrategies'; +import { canComputeRequestedRepresentation } from './canComputeRequestedRepresentation'; + +// updates +import { updateSurfaceData } from './Surface/updateSurfaceData'; +import { registerPolySegWorker } from './registerPolySegWorker'; + +function init() { + // register the worker if it hasn't been registered yet + registerPolySegWorker(); +} + +export { + canComputeRequestedRepresentation, + // computes + computeContourData, + computeLabelmapData, + computeSurfaceData, + // updates + updateSurfaceData, + // init + init, +}; diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/registerPolySegWorker.ts b/packages/polymorphic-segmentation/src/registerPolySegWorker.ts similarity index 81% rename from packages/tools/src/stateManagement/segmentation/polySeg/registerPolySegWorker.ts rename to packages/polymorphic-segmentation/src/registerPolySegWorker.ts index 400f6c954c..dfbdaaa89e 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/registerPolySegWorker.ts +++ b/packages/polymorphic-segmentation/src/registerPolySegWorker.ts @@ -13,7 +13,7 @@ export function registerPolySegWorker() { // @ts-ignore return new Worker( // @ts-ignore - new URL('../../../workers/polySegConverters', import.meta.url), + new URL('./workers/polySegConverters.js', import.meta.url), { name: 'polySeg', type: 'module', @@ -24,7 +24,7 @@ export function registerPolySegWorker() { const workerManager = getWebWorkerManager(); const options = { - maxWorkerInstances: 1, // Todo, make this configurable + maxWorkerInstances: 1, autoTerminateOnIdle: { enabled: true, idleTimeThreshold: 2000, diff --git a/packages/tools/src/types/PolySeg.ts b/packages/polymorphic-segmentation/src/types/PolySegConversionOptions.ts similarity index 100% rename from packages/tools/src/types/PolySeg.ts rename to packages/polymorphic-segmentation/src/types/PolySegConversionOptions.ts diff --git a/packages/polymorphic-segmentation/src/types/index.ts b/packages/polymorphic-segmentation/src/types/index.ts new file mode 100644 index 0000000000..99b89a7394 --- /dev/null +++ b/packages/polymorphic-segmentation/src/types/index.ts @@ -0,0 +1,3 @@ +import type { PolySegConversionOptions } from './PolySegConversionOptions'; + +export type { PolySegConversionOptions }; diff --git a/packages/tools/src/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.ts b/packages/polymorphic-segmentation/src/utilities/clipAndCacheSurfacesForViewport.ts similarity index 95% rename from packages/tools/src/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.ts rename to packages/polymorphic-segmentation/src/utilities/clipAndCacheSurfacesForViewport.ts index 40ca5ee187..265d5b7ec9 100644 --- a/packages/tools/src/stateManagement/segmentation/helpers/clipAndCacheSurfacesForViewport.ts +++ b/packages/polymorphic-segmentation/src/utilities/clipAndCacheSurfacesForViewport.ts @@ -6,12 +6,14 @@ import { triggerEvent, } from '@cornerstonejs/core'; -import { WorkerTypes } from '../../../enums'; -import { pointToString } from '../../../utilities/pointToString'; -import { registerPolySegWorker } from '../polySeg/registerPolySegWorker'; -import { getSurfaceActorEntry } from './getSegmentationActor'; +import { Enums as ToolsEnums, utilities } from '@cornerstonejs/tools'; +import { registerPolySegWorker } from '../registerPolySegWorker'; + const workerManager = getWebWorkerManager(); +const { WorkerTypes } = ToolsEnums; +const { pointToString } = utilities; + /** * Surfaces info for clipping */ diff --git a/packages/polymorphic-segmentation/src/utilities/index.ts b/packages/polymorphic-segmentation/src/utilities/index.ts new file mode 100644 index 0000000000..5823f559ac --- /dev/null +++ b/packages/polymorphic-segmentation/src/utilities/index.ts @@ -0,0 +1,3 @@ +import { clipAndCacheSurfacesForViewport } from './clipAndCacheSurfacesForViewport'; + +export { clipAndCacheSurfacesForViewport }; diff --git a/packages/tools/src/workers/polySegConverters.js b/packages/polymorphic-segmentation/src/workers/polySegConverters.js similarity index 97% rename from packages/tools/src/workers/polySegConverters.js rename to packages/polymorphic-segmentation/src/workers/polySegConverters.js index a2d2b5370c..fff909f58d 100644 --- a/packages/tools/src/workers/polySegConverters.js +++ b/packages/polymorphic-segmentation/src/workers/polySegConverters.js @@ -1,5 +1,6 @@ import { expose } from 'comlink'; import { utilities } from '@cornerstonejs/core'; +import { utilities as ToolsUtilities } from '@cornerstonejs/tools'; import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData'; import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray'; import vtkPlane from '@kitware/vtk.js/Common/DataModel/Plane'; @@ -7,14 +8,25 @@ import vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData'; import vtkContourLoopExtraction from '@kitware/vtk.js/Filters/General/ContourLoopExtraction'; import vtkCutter from '@kitware/vtk.js/Filters/Core/Cutter'; -import { getBoundingBoxAroundShapeWorld } from '../utilities/boundingBox'; -import { - containsPoint, - getAABB, - projectTo2D, -} from '../utilities/math/polyline'; -import { isPlaneIntersectingAABB } from '../utilities/planar'; -import { checkStandardBasis, rotatePoints } from '../geometricSurfaceUtils'; +const { + math: { + polyline: { containsPoint, getAABB, projectTo2D }, + }, + geometricSurfaceUtils: { checkStandardBasis, rotatePoints }, + boundingBox: { getBoundingBoxAroundShapeWorld }, + planar: { isPlaneIntersectingAABB }, +} = ToolsUtilities; + +async function peerImport(moduleId) { + try { + if (moduleId === '@icr/polyseg-wasm') { + return import('@icr/polyseg-wasm'); + } + } catch (error) { + console.warn('Error importing module:', error); + return null; + } +} /** * Object containing methods for converting between different representations of @@ -43,7 +55,7 @@ const polySegConverters = { async initializePolySeg(progressCallback) { let ICRPolySeg; try { - ICRPolySeg = (await import('@icr/polyseg-wasm')).default; + ICRPolySeg = (await peerImport('@icr/polyseg-wasm')).default; } catch (error) { console.error(error); console.debug( diff --git a/packages/polymorphic-segmentation/tsconfig.json b/packages/polymorphic-segmentation/tsconfig.json new file mode 100644 index 0000000000..bc915f1e65 --- /dev/null +++ b/packages/polymorphic-segmentation/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist/esm", + "rootDir": "./src" + }, + "include": ["./src/**/*"] +} diff --git a/packages/tools/CHANGELOG.md b/packages/tools/CHANGELOG.md index be03acb536..6f6617614f 100644 --- a/packages/tools/CHANGELOG.md +++ b/packages/tools/CHANGELOG.md @@ -3,6 +3,105 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.0.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.4...v3.0.5) (2025-03-06) + +### Bug Fixes + +- **segmentation:** Add segmentation ID requirement for threshold operations ([#1879](https://github.com/cornerstonejs/cornerstone3D/issues/1879)) ([eae9577](https://github.com/cornerstonejs/cornerstone3D/commit/eae957729848d44971050ca40d684dae8f919170)) + +## [3.0.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.3...v3.0.4) (2025-03-05) + +### Bug Fixes + +- **worker:** should not change type of input ([#1877](https://github.com/cornerstonejs/cornerstone3D/issues/1877)) ([a97effd](https://github.com/cornerstonejs/cornerstone3D/commit/a97effd52abe35eaf532a5634a69b76f932099e7)) + +## [3.0.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.2...v3.0.3) (2025-03-04) + +### Bug Fixes + +- try to pass the fake version number ([#1873](https://github.com/cornerstonejs/cornerstone3D/issues/1873)) ([06c82fb](https://github.com/cornerstonejs/cornerstone3D/commit/06c82fba65c1cf578eb322642dfe080d39ce0719)) + +## [3.0.2](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.1...v3.0.2) (2025-03-04) + +### Bug Fixes + +- **CrosshairsTool:** support HPDI screens in CrosshairsTool ([#1824](https://github.com/cornerstonejs/cornerstone3D/issues/1824)) ([cd299e4](https://github.com/cornerstonejs/cornerstone3D/commit/cd299e40723fb94a6f2568a8008935d8e01ff4f4)), closes [#1822](https://github.com/cornerstonejs/cornerstone3D/issues/1822) +- **segmentation:** resolve variable declaration and null check issues ([#1872](https://github.com/cornerstonejs/cornerstone3D/issues/1872)) ([029966d](https://github.com/cornerstonejs/cornerstone3D/commit/029966d0a3ffc86fa38d3e089d9b0d7d5c105f32)) + +### Features + +- **surface-segmentation:** add visibilty configuration for surface segmentation ([#1846](https://github.com/cornerstonejs/cornerstone3D/issues/1846)) ([e1b5bc6](https://github.com/cornerstonejs/cornerstone3D/commit/e1b5bc646f3997be88ec237f86406c310420379a)) + +## [3.0.1](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0...v3.0.1) (2025-02-27) + +**Note:** Version bump only for package @cornerstonejs/tools + +# [3.0.0](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.16...v3.0.0) (2025-02-27) + +### Features + +- Cornerstone3D 3.0 ([#1865](https://github.com/cornerstonejs/cornerstone3D/issues/1865)) ([fe65459](https://github.com/cornerstonejs/cornerstone3D/commit/fe654590d16414e76361e1b2826fd64c3734ae87)) + +# [3.0.0-beta.6](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2025-02-27) + +### Features + +- Add key image adapters for key image point mark ([#1754](https://github.com/cornerstonejs/cornerstone3D/issues/1754)) ([a1fd3f9](https://github.com/cornerstonejs/cornerstone3D/commit/a1fd3f9d0ea40d53cafd792d59bc1dbfc90663a5)) + +# [3.0.0-beta.5](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/tools + +# [3.0.0-beta.4](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/tools + +# [3.0.0-beta.3](https://github.com/cornerstonejs/cornerstone3D/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2025-02-25) + +**Note:** Version bump only for package @cornerstonejs/tools + +# [3.0.0-beta.2](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.14...v3.0.0-beta.2) (2025-02-24) + +### Bug Fixes + +- publish beta for 3.0 ([8bf65df](https://github.com/cornerstonejs/cornerstone3D/commit/8bf65df9bec5f52459de1c49c4834b316f680f1b)) + +## [2.19.14](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.13...v2.19.14) (2025-02-24) + +### Bug Fixes + +- **seg:** revert change ([#1843](https://github.com/cornerstonejs/cornerstone3D/issues/1843)) ([c483e81](https://github.com/cornerstonejs/cornerstone3D/commit/c483e811e12e494b3d764810f182b2be71b43645)) + +## [2.19.13](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.12...v2.19.13) (2025-02-21) + +**Note:** Version bump only for package @cornerstonejs/tools + +## [2.19.12](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.11...v2.19.12) (2025-02-20) + +### Bug Fixes + +- planar freehand roi undefined unit ([#1839](https://github.com/cornerstonejs/cornerstone3D/issues/1839)) ([ace8933](https://github.com/cornerstonejs/cornerstone3D/commit/ace893349ed4d066adf035ca776511ac9c394a86)) + +## [2.19.11](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.10...v2.19.11) (2025-02-18) + +### Bug Fixes + +- changing opacity based on segment index ([#1833](https://github.com/cornerstonejs/cornerstone3D/issues/1833)) ([6bf44cf](https://github.com/cornerstonejs/cornerstone3D/commit/6bf44cf0e151f239dbc41ca4277f0360e2c873f7)) + +## [2.19.10](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.9...v2.19.10) (2025-02-18) + +### Bug Fixes + +- Prevent overwriting existing inactive styles ([#1831](https://github.com/cornerstonejs/cornerstone3D/issues/1831)) ([8e8c29e](https://github.com/cornerstonejs/cornerstone3D/commit/8e8c29e6d6276936b1be5e4fb116a4ec2585dfd8)) + +## [2.19.9](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.8...v2.19.9) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/tools + +## [2.19.8](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.7...v2.19.8) (2025-02-18) + +**Note:** Version bump only for package @cornerstonejs/tools + ## [2.19.7](https://github.com/cornerstonejs/cornerstone3D/compare/v2.19.6...v2.19.7) (2025-02-06) ### Bug Fixes diff --git a/packages/tools/api-extractor.json b/packages/tools/api-extractor.json deleted file mode 100644 index 4ddb5f44d3..0000000000 --- a/packages/tools/api-extractor.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../api-extractor.json", - "projectFolder": ".", - "mainEntryPointFilePath": "/dist/esm/index.d.ts", - "apiReport": { - "reportFileName": ".api.md", - "reportFolder": "../../common/reviews/api" - } -} diff --git a/packages/tools/examples/annotationSelectionAndLocking/index.ts b/packages/tools/examples/annotationSelectionAndLocking/index.ts index 4712e234c0..49701b7cba 100644 --- a/packages/tools/examples/annotationSelectionAndLocking/index.ts +++ b/packages/tools/examples/annotationSelectionAndLocking/index.ts @@ -79,12 +79,8 @@ addButtonToToolbar({ if (annotationUIDs && annotationUIDs.length) { const annotationUID = annotationUIDs[0]; - const annotation = - defaultFrameOfReferenceSpecificAnnotationManager.getAnnotation( - annotationUID - ); - locking.setAnnotationLocked(annotation, true); + locking.setAnnotationLocked(annotationUID, true); selection.deselectAnnotation(); // Render the image to see it was selected diff --git a/packages/tools/examples/labelmapInterpolation/index.ts b/packages/tools/examples/labelmapInterpolation/index.ts deleted file mode 100644 index 1a477f0808..0000000000 --- a/packages/tools/examples/labelmapInterpolation/index.ts +++ /dev/null @@ -1,338 +0,0 @@ -import type { Types } from '@cornerstonejs/core'; -import { - RenderingEngine, - Enums, - setVolumesForViewports, - volumeLoader, -} from '@cornerstonejs/core'; -import { - initDemo, - createImageIdsAndCacheMetaData, - setTitleAndDescription, - addDropdownToToolbar, - addSliderToToolbar, - setCtTransferFunctionForVolumeActor, - addButtonToToolbar, - addManipulationBindings, -} from '../../../../utils/demo/helpers'; -import * as cornerstoneTools from '@cornerstonejs/tools'; - -// This is for debugging purposes -console.warn( - 'Click on index.ts to open source code for this example --------->' -); - -const { - ToolGroupManager, - Enums: csToolsEnums, - segmentation, - RectangleScissorsTool, - SphereScissorsTool, - CircleScissorsTool, - BrushTool, - PaintFillTool, - utilities: cstUtils, -} = cornerstoneTools; - -const { MouseBindings } = csToolsEnums; -const { ViewportType } = Enums; -const { segmentation: segmentationUtils } = cstUtils; - -// Define a unique id for the volume -const volumeName = 'CT_VOLUME_ID'; // Id of the volume less loader prefix -const volumeLoaderScheme = 'cornerstoneStreamingImageVolume'; // Loader id which defines which volume loader to use -const volumeId = `${volumeLoaderScheme}:${volumeName}`; // VolumeId with loader id + volume id -const segmentationId = 'MY_SEGMENTATION_ID'; -const toolGroupId = 'MY_TOOLGROUP_ID'; - -// ======== Set up page ======== // -setTitleAndDescription( - 'Labelmap Interpolation', - 'Here we demonstrate interpolation between slices for labelmaps' -); - -const size = '500px'; -const content = document.getElementById('content'); -const viewportGrid = document.createElement('div'); - -viewportGrid.style.display = 'flex'; -viewportGrid.style.display = 'flex'; -viewportGrid.style.flexDirection = 'row'; - -const element1 = document.createElement('div'); -const element2 = document.createElement('div'); -const element3 = document.createElement('div'); -element1.style.width = size; -element1.style.height = size; -element2.style.width = size; -element2.style.height = size; -element3.style.width = size; -element3.style.height = size; - -// Disable right click context menu so we can have right click tools -element1.oncontextmenu = (e) => e.preventDefault(); -element2.oncontextmenu = (e) => e.preventDefault(); -element3.oncontextmenu = (e) => e.preventDefault(); - -viewportGrid.appendChild(element1); -viewportGrid.appendChild(element2); -viewportGrid.appendChild(element3); - -content.appendChild(viewportGrid); - -const instructions = document.createElement('p'); -instructions.innerText = ` - Use the labelmap tools in the normal way. Note preview is turned off for those - tools to simplify initial segment creation. -
Segments are interpolated BETWEEN slices, so you need to create two or more - segments of the same segment index on slices in a viewport separated by at least - one empty segment. - Use "Extended Interpolation" button to interpolate segments which don't - overlap (assuming the segments were drawn on the same slice). - Use "Overlapping Interpolation" button to interpolate overlapping segments - that is, the segment must - overlap if drawn on the same slice to interpolate between them. This is a good choice - for multiple segments. - Accept the interpolation by hitting enter, or use the "Reject Preview/Interpolation" button. - `; - -content.append(instructions); - -const interpolationTools = new Map(); - -const configuration = {}; - -interpolationTools.set('CircularBrush', { - baseTool: BrushTool.toolName, - configuration: { - ...configuration, - activeStrategy: 'FILL_INSIDE_CIRCLE', - }, -}); - -const optionsValues = [ - ...interpolationTools.keys(), - RectangleScissorsTool.toolName, - CircleScissorsTool.toolName, - SphereScissorsTool.toolName, - PaintFillTool.toolName, -]; - -// ============================= // -addDropdownToToolbar({ - options: { values: optionsValues, defaultValue: BrushTool.toolName }, - onSelectedValueChange: (nameAsStringOrNumber) => { - const name = String(nameAsStringOrNumber); - const toolGroup = ToolGroupManager.getToolGroup(toolGroupId); - - // Set the currently active tool disabled - const toolName = toolGroup.getActivePrimaryMouseButtonTool(); - - if (toolName) { - toolGroup.setToolDisabled(toolName); - } - - toolGroup.setToolActive(name, { - bindings: [{ mouseButton: MouseBindings.Primary }], - }); - }, -}); - -addSliderToToolbar({ - title: 'Brush Size', - range: [5, 100], - defaultValue: 25, - onSelectedValueChange: (valueAsStringOrNumber) => { - const value = Number(valueAsStringOrNumber); - segmentationUtils.setBrushSizeForToolGroup(toolGroupId, value); - }, -}); - -// ============================= // -addDropdownToToolbar({ - options: { values: ['1', '2', '3'], defaultValue: '1' }, - labelText: 'Segment', - onSelectedValueChange: (segmentIndex) => { - segmentation.segmentIndex.setActiveSegmentIndex( - segmentationId, - Number(segmentIndex) - ); - }, -}); - -addButtonToToolbar({ - title: 'Run Extended Interpolation', - onClick: () => { - const toolGroup = ToolGroupManager.getToolGroup(toolGroupId); - const activeName = toolGroup.getActivePrimaryMouseButtonTool(); - const brush = toolGroup.getToolInstance(activeName); - brush.interpolate?.(element1, { extendedConfig: true }); - }, -}); - -addButtonToToolbar({ - title: 'Run Overlapping Interpolation', - onClick: () => { - const toolGroup = ToolGroupManager.getToolGroup(toolGroupId); - const activeName = toolGroup.getActivePrimaryMouseButtonTool(); - const brush = toolGroup.getToolInstance(activeName); - brush.interpolate?.(element1, { extendedConfig: false }); - }, -}); - -// ============================= // - -async function addSegmentationsToState() { - // Create a segmentation of the same resolution as the source data - await volumeLoader.createAndCacheDerivedLabelmapVolume(volumeId, { - volumeId: segmentationId, - }); - - // Add the segmentations to state - segmentation.addSegmentations([ - { - segmentationId, - representation: { - // The type of segmentation - type: csToolsEnums.SegmentationRepresentations.Labelmap, - // The actual segmentation data, in the case of labelmap this is a - // reference to the source volume of the segmentation. - data: { - volumeId: segmentationId, - }, - }, - }, - ]); -} - -/** - * Runs the demo - */ -async function run() { - // Init Cornerstone and related libraries - await initDemo(); - - // Add tools to Cornerstone3D - cornerstoneTools.addTool(RectangleScissorsTool); - cornerstoneTools.addTool(CircleScissorsTool); - cornerstoneTools.addTool(SphereScissorsTool); - cornerstoneTools.addTool(PaintFillTool); - cornerstoneTools.addTool(BrushTool); - - // Define tool groups to add the segmentation display tool to - const toolGroup = ToolGroupManager.createToolGroup(toolGroupId); - - // Manipulation Tools - addManipulationBindings(toolGroup); - - // Segmentation Tools - toolGroup.addTool(RectangleScissorsTool.toolName); - toolGroup.addTool(CircleScissorsTool.toolName); - toolGroup.addTool(SphereScissorsTool.toolName); - toolGroup.addTool(PaintFillTool.toolName); - toolGroup.addTool(BrushTool.toolName); - - for (const [toolName, config] of interpolationTools.entries()) { - if (config.baseTool) { - toolGroup.addToolInstance( - toolName, - config.baseTool, - config.configuration - ); - } else { - toolGroup.addTool(toolName, config.configuration); - } - if (config.passive) { - // This can be applied during add/remove contours - toolGroup.setToolPassive(toolName); - } - } - - toolGroup.setToolActive(interpolationTools.keys().next().value, { - bindings: [{ mouseButton: MouseBindings.Primary }], - }); - - // Get Cornerstone imageIds for the source data and fetch metadata into RAM - const imageIds = await createImageIdsAndCacheMetaData({ - StudyInstanceUID: - '1.3.6.1.4.1.14519.5.2.1.7009.2403.334240657131972136850343327463', - SeriesInstanceUID: - '1.3.6.1.4.1.14519.5.2.1.7009.2403.226151125820845824875394858561', - wadoRsRoot: 'https://d14fa38qiwhyfd.cloudfront.net/dicomweb', - }); - - // Define a volume in memory - const volume = await volumeLoader.createAndCacheVolume(volumeId, { - imageIds, - }); - - // Add some segmentations based on the source data volume - await addSegmentationsToState(); - - // Instantiate a rendering engine - const renderingEngineId = 'myRenderingEngine'; - const renderingEngine = new RenderingEngine(renderingEngineId); - - // Create the viewports - const viewportId1 = 'CT_AXIAL'; - const viewportId2 = 'CT_SAGITTAL'; - const viewportId3 = 'CT_CORONAL'; - - const viewportInputArray = [ - { - viewportId: viewportId1, - type: ViewportType.ORTHOGRAPHIC, - element: element1, - defaultOptions: { - orientation: Enums.OrientationAxis.AXIAL, - background: [0, 0, 0], - }, - }, - { - viewportId: viewportId2, - type: ViewportType.ORTHOGRAPHIC, - element: element2, - defaultOptions: { - orientation: Enums.OrientationAxis.SAGITTAL, - background: [0, 0, 0], - }, - }, - { - viewportId: viewportId3, - type: ViewportType.ORTHOGRAPHIC, - element: element3, - defaultOptions: { - orientation: Enums.OrientationAxis.CORONAL, - background: [0, 0, 0], - }, - }, - ]; - - renderingEngine.setViewports(viewportInputArray); - - toolGroup.addViewport(viewportId1, renderingEngineId); - toolGroup.addViewport(viewportId2, renderingEngineId); - toolGroup.addViewport(viewportId3, renderingEngineId); - - // Set the volume to load - volume.load(); - - // Set volumes on the viewports - await setVolumesForViewports( - renderingEngine, - [{ volumeId, callback: setCtTransferFunctionForVolumeActor }], - [viewportId1, viewportId2, viewportId3] - ); - - // Add the segmentation representation to the toolgroup - const segMap = { - [viewportId1]: [{ segmentationId }], - [viewportId2]: [{ segmentationId }], - [viewportId3]: [{ segmentationId }], - }; - await segmentation.addLabelmapRepresentationToViewportMap(segMap); - - // Render the image - renderingEngine.render(); -} - -run(); diff --git a/packages/tools/examples/labelmapSegmentationDynamicThreshold/index.ts b/packages/tools/examples/labelmapSegmentationDynamicThreshold/index.ts index b96a751704..234cf1947c 100644 --- a/packages/tools/examples/labelmapSegmentationDynamicThreshold/index.ts +++ b/packages/tools/examples/labelmapSegmentationDynamicThreshold/index.ts @@ -109,7 +109,7 @@ const viewportId1 = viewportIds[0]; const viewportId2 = viewportIds[1]; const viewportId3 = viewportIds[2]; -const defaultThresholdOption = [...labelmapTools.thresholdOptions.keys()][2]; +const defaultThresholdOption = [...labelmapTools.thresholdOptions.keys()][5]; const thresholdArgs = labelmapTools.thresholdOptions.get( defaultThresholdOption ); @@ -119,9 +119,7 @@ interpolationTools.set('ThresholdSphereIsland', { configuration: { ...configuration, activeStrategy: 'THRESHOLD_INSIDE_SPHERE_WITH_ISLAND_REMOVAL', - strategySpecificConfiguration: { - THRESHOLD: { ...thresholdArgs }, - }, + threshold: thresholdArgs, }, }); @@ -130,9 +128,7 @@ interpolationTools.set('ThresholdCircle', { configuration: { ...configuration, activeStrategy: 'THRESHOLD_INSIDE_CIRCLE', - strategySpecificConfiguration: { - THRESHOLD: { ...thresholdArgs }, - }, + threshold: thresholdArgs, }, }); @@ -141,9 +137,7 @@ interpolationTools.set('ThresholdSphere', { configuration: { ...configuration, activeStrategy: 'THRESHOLD_INSIDE_SPHERE', - strategySpecificConfiguration: { - THRESHOLD: { ...thresholdArgs }, - }, + threshold: thresholdArgs, }, }); @@ -174,11 +168,7 @@ addDropdownToToolbar({ map: labelmapTools.thresholdOptions, }, onSelectedValueChange: (name, thresholdArgs) => { - segmentationUtils.setBrushThresholdForToolGroup( - toolGroupId, - thresholdArgs.threshold, - thresholdArgs - ); + segmentationUtils.setBrushThresholdForToolGroup(toolGroupId, thresholdArgs); }, }); diff --git a/packages/tools/examples/labelmapStatistics/index.ts b/packages/tools/examples/labelmapStatistics/index.ts index 082fc530df..f719dfd7a9 100644 --- a/packages/tools/examples/labelmapStatistics/index.ts +++ b/packages/tools/examples/labelmapStatistics/index.ts @@ -1,58 +1,52 @@ -import type { Types } from '@cornerstonejs/core'; import { RenderingEngine, Enums, - setVolumesForViewports, - volumeLoader, + imageLoader, eventTarget, } from '@cornerstonejs/core'; +import * as cornerstoneTools from '@cornerstonejs/tools'; import { - initDemo, createImageIdsAndCacheMetaData, - setTitleAndDescription, + initDemo, addDropdownToToolbar, - addSliderToToolbar, - setCtTransferFunctionForVolumeActor, - getLocalUrl, - addManipulationBindings, + setTitleAndDescription, + addButtonToToolbar, + addBrushSizeSlider, } from '../../../../utils/demo/helpers'; -import * as cornerstoneTools from '@cornerstonejs/tools'; // This is for debugging purposes -console.warn( +console.debug( 'Click on index.ts to open source code for this example --------->' ); const { ToolGroupManager, + ZoomTool, + StackScrollTool, Enums: csToolsEnums, - segmentation, RectangleScissorsTool, - SphereScissorsTool, CircleScissorsTool, BrushTool, PaintFillTool, + PanTool, + segmentation, utilities: cstUtils, } = cornerstoneTools; -const { MouseBindings, Events } = csToolsEnums; +const { MouseBindings, KeyboardBindings, Events } = csToolsEnums; const { ViewportType } = Enums; const { segmentation: segmentationUtils, roundNumber } = cstUtils; // Define a unique id for the volume -const volumeName = 'CT_VOLUME_ID'; // Id of the volume less loader prefix -const volumeLoaderScheme = 'cornerstoneStreamingImageVolume'; // Loader id which defines which volume loader to use -const volumeId = `${volumeLoaderScheme}:${volumeName}`; // VolumeId with loader id + volume id -const segmentationId = 'MY_SEGMENTATION_ID'; -const toolGroupId = 'MY_TOOLGROUP_ID'; -const viewports = []; - -const DEFAULT_BRUSH_SIZE = 20; +let renderingEngine; +const renderingEngineId = 'myRenderingEngine'; +const viewportId = 'STACK_VIEWPORT'; +const toolGroupId = 'TOOL_GROUP_ID'; // ======== Set up page ======== // setTitleAndDescription( - 'Labelmap Segmentation Statistics', - 'Here we demonstrate calculating labelmap statistics' + 'Stack Segmentation Statistics', + 'Here we demonstrate how to calculate statistics for a stack segmentation.' ); const size = '500px'; @@ -60,7 +54,6 @@ const content = document.getElementById('content'); const statsGrid = document.createElement('div'); statsGrid.style.display = 'flex'; -statsGrid.style.display = 'flex'; statsGrid.style.flexDirection = 'row'; statsGrid.style.fontSize = 'smaller'; @@ -81,179 +74,29 @@ for (const statsId of statsIds) { content.appendChild(statsGrid); const viewportGrid = document.createElement('div'); - -viewportGrid.style.display = 'flex'; viewportGrid.style.display = 'flex'; viewportGrid.style.flexDirection = 'row'; -const element1 = document.createElement('div'); -const element2 = document.createElement('div'); -const element3 = document.createElement('div'); -element1.style.width = size; -element1.style.height = size; -element2.style.width = size; -element2.style.height = size; -element3.style.width = size; -element3.style.height = size; - -// Disable right click context menu so we can have right click tools -element1.oncontextmenu = (e) => e.preventDefault(); -element2.oncontextmenu = (e) => e.preventDefault(); -element3.oncontextmenu = (e) => e.preventDefault(); - -viewportGrid.appendChild(element1); -viewportGrid.appendChild(element2); -viewportGrid.appendChild(element3); +const element = document.createElement('div'); +element.style.width = size; +element.style.height = size; +element.oncontextmenu = () => false; +viewportGrid.appendChild(element); content.appendChild(viewportGrid); const instructions = document.createElement('p'); instructions.innerText = ` - Hover - show preview of segmentation tool - Left drag to extend preview - Left Click (or enter) to accept preview - Reject preview by button (or esc) - Hover outside of region to reset to hovered over segment index - Shift Left - zoom, Ctrl Left - Pan, Alt Left - Stack Scroll + Left Click: Use selected Segmentation Tool. + Middle Click: Pan + Right Click: Zoom + Mouse wheel: Scroll Stack `; content.append(instructions); -const interpolationTools = new Map(); -const configuration = { - preview: { - enabled: true, - }, -}; - -const thresholdOptions = new Map(); -thresholdOptions.set('Dynamic Radius 0', { isDynamic: true, dynamicRadius: 0 }); -thresholdOptions.set('Dynamic Radius 1', { isDynamic: true, dynamicRadius: 1 }); -thresholdOptions.set('Dynamic Radius 3', { isDynamic: true, dynamicRadius: 3 }); -thresholdOptions.set('Dynamic Radius 5', { isDynamic: true, dynamicRadius: 5 }); -thresholdOptions.set('Use Existing Threshold', { - isDynamic: false, - dynamicRadius: 5, -}); -thresholdOptions.set('CT Fat: (-150, -70)', { - threshold: [-150, -70], - isDynamic: false, -}); -thresholdOptions.set('CT Bone: (200, 1000)', { - threshold: [200, 1000], - isDynamic: false, -}); -const defaultThresholdOption = [...thresholdOptions.keys()][2]; -const thresholdArgs = thresholdOptions.get(defaultThresholdOption); - -interpolationTools.set('ThresholdSphere', { - baseTool: BrushTool.toolName, - configuration: { - ...configuration, - activeStrategy: 'THRESHOLD_INSIDE_SPHERE_WITH_ISLAND_REMOVAL', - strategySpecificConfiguration: { - useCenterSegmentIndex: true, - THRESHOLD: { ...thresholdArgs }, - }, - }, -}); - -interpolationTools.set('SphereBrush', { - baseTool: BrushTool.toolName, - configuration: { - ...configuration, - activeStrategy: 'FILL_INSIDE_SPHERE', - strategySpecificConfiguration: { - useCenterSegmentIndex: true, - }, - }, -}); - -const optionsValues = [...interpolationTools.keys()]; - // ============================= // -// Create a reference to the threshold dropdown element -const thresholdDropdownElement = null; - -addDropdownToToolbar({ - options: { values: optionsValues, defaultValue: BrushTool.toolName }, - onSelectedValueChange: (nameAsStringOrNumber) => { - const name = String(nameAsStringOrNumber); - const toolGroup = ToolGroupManager.getToolGroup(toolGroupId); - - // Set the currently active tool disabled - const toolName = toolGroup.getActivePrimaryMouseButtonTool(); - - if (toolName) { - toolGroup.setToolDisabled(toolName); - } - - toolGroup.setToolActive(name, { - bindings: [{ mouseButton: MouseBindings.Primary }], - }); - - // Show/hide threshold dropdown based on selected tool - if (thresholdDropdownElement) { - thresholdDropdownElement.style.display = name - .toLowerCase() - .includes('threshold') - ? 'inline-block' - : 'none'; - } - }, -}); - -// Store reference to threshold dropdown element -thresholdDropdownElement = addDropdownToToolbar({ - options: { - values: Array.from(thresholdOptions.keys()), - defaultValue: defaultThresholdOption, - }, - onSelectedValueChange: (nameAsStringOrNumber) => { - const name = String(nameAsStringOrNumber); - const thresholdArgs = thresholdOptions.get(name); - - segmentationUtils.setBrushThresholdForToolGroup( - toolGroupId, - thresholdArgs.threshold, - thresholdArgs - ); - }, -}); - -// Initially hide threshold dropdown if first tool doesn't include 'threshold' -if (thresholdDropdownElement) { - const initialTool = optionsValues[0]; - thresholdDropdownElement.style.display = initialTool - .toLowerCase() - .includes('threshold') - ? 'inline-block' - : 'none'; -} - -addSliderToToolbar({ - title: 'Brush Size', - range: [5, 100], - defaultValue: DEFAULT_BRUSH_SIZE, - onSelectedValueChange: (valueAsStringOrNumber) => { - const value = Number(valueAsStringOrNumber); - segmentationUtils.setBrushSizeForToolGroup(toolGroupId, value); - }, -}); - -// ============================= // -addDropdownToToolbar({ - options: { values: ['1', '2'], defaultValue: '1' }, - labelText: 'Segment', - onSelectedValueChange: (segmentIndex) => { - segmentation.segmentIndex.setActiveSegmentIndex( - segmentationId, - Number(segmentIndex) - ); - }, -}); - function displayStat(stat) { if (!stat) { return; @@ -263,30 +106,25 @@ function displayStat(stat) { }`; } -function calculateStatistics(id, indices) { - const [viewport] = viewports; - const toolGroup = ToolGroupManager.getToolGroup(toolGroupId); - const activeName = toolGroup.getActivePrimaryMouseButtonTool(); - const brush = toolGroup.getToolInstance(activeName); - const stats = brush.getStatistics(viewport.element, { indices }); +async function calculateStatistics(id, indices) { + const stats = await segmentationUtils.getStatistics({ + segmentationId: 'SEGMENTATION_ID', + segmentIndices: indices, + }); if (!stats) { return; } const items = [`Statistics on ${indices.join(', ')}`]; stats.count.label = 'Voxels'; - // const lesionGlycolysis = { - // name: 'Lesion Glycolysis', - // value: stats.volume.value * stats.stdDev.value, - // unit: 'HU \xB7 mm \xb3', - // }; + items.push( displayStat(stats.volume), displayStat(stats.count), - // displayStat(lesionGlycolysis), displayStat(stats.mean), displayStat(stats.max), - displayStat(stats.min) + displayStat(stats.min), + displayStat(stats.peakValue) ); const statsDiv = document.getElementById(id); statsDiv.innerHTML = items.map((span) => `${span}
\n`).join('\n'); @@ -317,170 +155,161 @@ function segmentationModifiedCallback(evt) { // ============================= // -async function addSegmentationsToState() { - // Create a segmentation of the same resolution as the source data - volumeLoader.createAndCacheDerivedLabelmapVolume(volumeId, { - volumeId: segmentationId, - }); - - // Add the segmentations to state - segmentation.addSegmentations([ - { - segmentationId, - representation: { - // The type of segmentation - type: csToolsEnums.SegmentationRepresentations.Labelmap, - // The actual segmentation data, in the case of labelmap this is a - // reference to the source volume of the segmentation. - data: { - volumeId: segmentationId, - }, - }, - }, - ]); - - eventTarget.addEventListener( - Events.SEGMENTATION_DATA_MODIFIED, - segmentationModifiedCallback - ); -} - -/** - * Runs the demo - */ -async function run() { - // Init Cornerstone and related libraries - await initDemo(); - +function setupTools() { // Add tools to Cornerstone3D + cornerstoneTools.addTool(PanTool); + cornerstoneTools.addTool(ZoomTool); + cornerstoneTools.addTool(StackScrollTool); cornerstoneTools.addTool(RectangleScissorsTool); cornerstoneTools.addTool(CircleScissorsTool); - cornerstoneTools.addTool(SphereScissorsTool); cornerstoneTools.addTool(PaintFillTool); cornerstoneTools.addTool(BrushTool); - // Define tool groups to add the segmentation display tool to + // Define a tool group const toolGroup = ToolGroupManager.createToolGroup(toolGroupId); - // Manipulation Tools - addManipulationBindings(toolGroup); - - // Segmentation Tools + // Add tools to the group + toolGroup.addTool(PanTool.toolName); + toolGroup.addTool(ZoomTool.toolName); + toolGroup.addTool(StackScrollTool.toolName); toolGroup.addTool(RectangleScissorsTool.toolName); toolGroup.addTool(CircleScissorsTool.toolName); - toolGroup.addTool(SphereScissorsTool.toolName); toolGroup.addTool(PaintFillTool.toolName); toolGroup.addTool(BrushTool.toolName); - for (const [toolName, config] of interpolationTools.entries()) { - if (config.baseTool) { - toolGroup.addToolInstance( - toolName, - config.baseTool, - config.configuration - ); - } else { - toolGroup.addTool(toolName, config.configuration); - } - if (config.passive) { - // This can be applied during add/remove contours - toolGroup.setToolPassive(toolName); - } - } - - toolGroup.setToolActive(interpolationTools.keys().next().value, { + // Set tool modes + toolGroup.setToolActive(BrushTool.toolName, { bindings: [{ mouseButton: MouseBindings.Primary }], }); - // Get Cornerstone imageIds for the source data and fetch metadata into RAM + toolGroup.setToolActive(PanTool.toolName, { + bindings: [ + { + mouseButton: MouseBindings.Auxiliary, + }, + { + mouseButton: MouseBindings.Primary, + modifierKey: KeyboardBindings.Ctrl, + }, + ], + }); + + toolGroup.setToolActive(ZoomTool.toolName, { + bindings: [ + { + mouseButton: MouseBindings.Secondary, + }, + { + mouseButton: MouseBindings.Primary, + modifierKey: KeyboardBindings.Shift, + }, + ], + }); + + toolGroup.setToolActive(StackScrollTool.toolName, { + bindings: [{ mouseButton: MouseBindings.Wheel }], + }); + + return toolGroup; +} + +// ============================= // + +/** + * Runs the demo + */ +async function run() { + // Init Cornerstone and related libraries + await initDemo(); + + const toolGroup = setupTools(); + + // Get Cornerstone imageIds and fetch metadata into RAM + // const imageIds = await createImageIdsAndCacheMetaData({ + // StudyInstanceUID: + // '1.3.6.1.4.1.14519.5.2.1.7009.2403.334240657131972136850343327463', + // SeriesInstanceUID: + // '1.3.6.1.4.1.14519.5.2.1.7009.2403.226151125820845824875394858561', + // wadoRsRoot: 'https://d14fa38qiwhyfd.cloudfront.net/dicomweb', + // }); + // Get Cornerstone imageIds and fetch metadata into RAM const imageIds = await createImageIdsAndCacheMetaData({ StudyInstanceUID: - '1.3.6.1.4.1.14519.5.2.1.7009.2403.334240657131972136850343327463', + '1.3.6.1.4.1.14519.5.2.1.1188.2803.137585363493444318569098508293', SeriesInstanceUID: - '1.3.6.1.4.1.14519.5.2.1.7009.2403.226151125820845824875394858561', - wadoRsRoot: - getLocalUrl() || 'https://d14fa38qiwhyfd.cloudfront.net/dicomweb', + '1.3.6.1.4.1.14519.5.2.1.1188.2803.699272945123913604672897602509', + SOPInstanceUID: + '1.3.6.1.4.1.14519.5.2.1.1188.2803.295285318555680716246271899544', + wadoRsRoot: 'https://d14fa38qiwhyfd.cloudfront.net/dicomweb', }); - - // Define a volume in memory - const volume = await volumeLoader.createAndCacheVolume(volumeId, { - imageIds, + const imageIds2 = await createImageIdsAndCacheMetaData({ + StudyInstanceUID: '1.2.840.113663.1500.1.248223208.1.1.20110323.105903.687', + SeriesInstanceUID: + '1.2.840.113663.1500.1.248223208.2.1.20110323.105903.687', + SOPInstanceUID: '1.2.840.113663.1500.1.248223208.3.10.20110323.110423.875', + wadoRsRoot: 'https://d14fa38qiwhyfd.cloudfront.net/dicomweb', }); - // Add some segmentations based on the source data volume - await addSegmentationsToState(); + // Create a stack of images + const imageIdsArray = imageIds.slice(0, 10); + // Create segmentation images for the stack + const segImages = await imageLoader.createAndCacheDerivedLabelmapImages( + imageIdsArray + ); // Instantiate a rendering engine - const renderingEngineId = 'myRenderingEngine'; - const renderingEngine = new RenderingEngine(renderingEngineId); + renderingEngine = new RenderingEngine(renderingEngineId); + + // Create the viewport + const viewportInput = { + viewportId, + type: ViewportType.STACK, + element, + }; - // Create the viewports - const viewportId1 = 'CT_AXIAL'; - const viewportId2 = 'CT_SAGITTAL'; - const viewportId3 = 'CT_CORONAL'; + renderingEngine.setViewports([viewportInput]); - const viewportInputArray = [ - { - viewportId: viewportId1, - type: ViewportType.ORTHOGRAPHIC, - element: element1, - defaultOptions: { - orientation: Enums.OrientationAxis.AXIAL, - background: [0, 0, 0], - }, - }, + // Set the stack of images + const viewport = renderingEngine.getViewport(viewportId); + await viewport.setStack(imageIdsArray, 0); + + // Add the viewport to the toolgroup + toolGroup.addViewport(viewportId, renderingEngineId); + + // Add segmentation + segmentation.addSegmentations([ { - viewportId: viewportId2, - type: ViewportType.ORTHOGRAPHIC, - element: element2, - defaultOptions: { - orientation: Enums.OrientationAxis.SAGITTAL, - background: [0, 0, 0], + segmentationId: 'SEGMENTATION_ID', + representation: { + type: csToolsEnums.SegmentationRepresentations.Labelmap, + data: { + imageIds: segImages.map((it) => it.imageId), + }, }, }, + ]); + + // Add the segmentation representation to the viewport + await segmentation.addSegmentationRepresentations(viewportId, [ { - viewportId: viewportId3, - type: ViewportType.ORTHOGRAPHIC, - element: element3, - defaultOptions: { - orientation: Enums.OrientationAxis.CORONAL, - background: [0, 0, 0], - }, + segmentationId: 'SEGMENTATION_ID', + type: csToolsEnums.SegmentationRepresentations.Labelmap, }, - ]; - - renderingEngine.setViewports(viewportInputArray); - - toolGroup.addViewport(viewportId1, renderingEngineId); - toolGroup.addViewport(viewportId2, renderingEngineId); - toolGroup.addViewport(viewportId3, renderingEngineId); + ]); - viewports.push(...renderingEngine.getViewports()); + // Add brush size slider + addBrushSizeSlider({ + toolGroupId, + }); - // Set the volume to load - volume.load(); + cornerstoneTools.utilities.stackContextPrefetch.enable(element); - // Set volumes on the viewports - await setVolumesForViewports( - renderingEngine, - [{ volumeId, callback: setCtTransferFunctionForVolumeActor }], - [viewportId1, viewportId2, viewportId3] + // Add segmentation modified callback + eventTarget.addEventListener( + Events.SEGMENTATION_DATA_MODIFIED, + segmentationModifiedCallback ); - const segmentationRepresentation = [ - { - segmentationId, - }, - ]; - // Add the segmentation representation to the toolgroup - await segmentation.addLabelmapRepresentationToViewportMap({ - [viewportId1]: segmentationRepresentation, - [viewportId2]: segmentationRepresentation, - [viewportId3]: segmentationRepresentation, - }); - - segmentationUtils.setBrushSizeForToolGroup(toolGroupId, DEFAULT_BRUSH_SIZE); - // Render the image renderingEngine.render(); } diff --git a/packages/tools/examples/rectangleROIThreshold/index.ts b/packages/tools/examples/rectangleROIThreshold/index.ts index 585db9e162..1cc057fdb2 100644 --- a/packages/tools/examples/rectangleROIThreshold/index.ts +++ b/packages/tools/examples/rectangleROIThreshold/index.ts @@ -149,7 +149,6 @@ addButtonToToolbar({ const ctVolume = cache.getVolume(ctVolumeId); const ptVolume = cache.getVolume(ptVolumeId); const segmentationVolume = cache.getVolume(segmentationId); - csToolsUtils.segmentation.rectangleROIThresholdVolumeByRange( selectedAnnotationUIDs, segmentationVolume, diff --git a/packages/tools/examples/stackLabelmapSegmentation/index.ts b/packages/tools/examples/stackLabelmapSegmentation/index.ts index be326f1957..1b89cbbdc8 100644 --- a/packages/tools/examples/stackLabelmapSegmentation/index.ts +++ b/packages/tools/examples/stackLabelmapSegmentation/index.ts @@ -1,5 +1,4 @@ import { Enums, RenderingEngine, imageLoader } from '@cornerstonejs/core'; -import * as cornerstone from '@cornerstonejs/core'; import * as cornerstoneTools from '@cornerstonejs/tools'; import { createImageIdsAndCacheMetaData, @@ -9,7 +8,6 @@ import { addButtonToToolbar, addBrushSizeSlider, } from '../../../../utils/demo/helpers'; -import { fillStackSegmentationWithMockData } from '../../../../utils/test/testUtils'; // This is for debugging purposes console.warn( @@ -84,22 +82,34 @@ content.append(instructions); const brushInstanceNames = { CircularBrush: 'CircularBrush', + SphereBrush: 'SphereBrush', CircularEraser: 'CircularEraser', - ThresholdBrush: 'ThresholdBrush', + ThresholdBrushCircle: 'ThresholdBrushCircle', + ThresholdBrushSphere: 'ThresholdBrushSphere', DynamicThreshold: 'DynamicThreshold', }; const brushStrategies = { [brushInstanceNames.CircularBrush]: 'FILL_INSIDE_CIRCLE', + [brushInstanceNames.SphereBrush]: 'FILL_INSIDE_SPHERE', [brushInstanceNames.CircularEraser]: 'ERASE_INSIDE_CIRCLE', - [brushInstanceNames.ThresholdBrush]: 'THRESHOLD_INSIDE_CIRCLE', + [brushInstanceNames.ThresholdBrushCircle]: 'THRESHOLD_INSIDE_CIRCLE', + [brushInstanceNames.ThresholdBrushSphere]: 'THRESHOLD_INSIDE_SPHERE', [brushInstanceNames.DynamicThreshold]: 'THRESHOLD_INSIDE_CIRCLE', }; const brushValues = [ brushInstanceNames.CircularBrush, + brushInstanceNames.SphereBrush, brushInstanceNames.CircularEraser, - brushInstanceNames.ThresholdBrush, + brushInstanceNames.ThresholdBrushCircle, + brushInstanceNames.ThresholdBrushSphere, + brushInstanceNames.DynamicThreshold, +]; + +const thresholdBrushValues = [ + brushInstanceNames.ThresholdBrushCircle, + brushInstanceNames.ThresholdBrushSphere, brushInstanceNames.DynamicThreshold, ]; @@ -113,7 +123,7 @@ const optionsValues = [ let viewport; const viewportId2 = 'STACK_VIEWPORT_2'; -const segmentationIds = ['STACK_SEGMENTATION']; +const segmentationIds = ['STACK_SEGMENTATION', 'STACK_SEGMENTATION_2']; const dropDownId = 'SEGMENTATION_DROPDOWN'; function updateSegmentationDropdownOptions( @@ -154,19 +164,24 @@ addDropdownToToolbar({ // Set the currently active tool disabled const toolName = toolGroup.getActivePrimaryMouseButtonTool(); - if (toolName) { toolGroup.setToolDisabled(toolName); } + // Show/hide threshold dropdown based on selected tool + const thresholdDropdown = document.getElementById('thresholdDropdown'); + if (thresholdDropdown) { + thresholdDropdown.style.display = thresholdBrushValues.includes(name) + ? 'block' + : 'none'; + } + if (brushValues.includes(name)) { toolGroup.setToolActive(name, { bindings: [{ mouseButton: MouseBindings.Primary }], }); } else { - const toolName = name; - - toolGroup.setToolActive(toolName, { + toolGroup.setToolActive(name, { bindings: [{ mouseButton: MouseBindings.Primary }], }); } @@ -193,7 +208,7 @@ addDropdownToToolbar({ segmentationUtils.setBrushThresholdForToolGroup(toolGroupId, threshold); }, -}); +}).style.display = 'none'; addButtonToToolbar({ title: 'Create New Segmentation on Current Image', @@ -243,7 +258,6 @@ addDropdownToToolbar({ options: { values: segmentationIds, defaultValue: '' }, onSelectedValueChange: (nameAsStringOrNumber) => { const name = String(nameAsStringOrNumber); - const index = segmentationIds.indexOf(name); segmentation.activeSegmentation.setActiveSegmentation(viewportId, name); // Update the dropdown @@ -283,6 +297,13 @@ function setupTools(toolGroupId) { activeStrategy: brushStrategies.CircularBrush, } ); + toolGroup.addToolInstance( + brushInstanceNames.SphereBrush, + BrushTool.toolName, + { + activeStrategy: brushStrategies.SphereBrush, + } + ); toolGroup.addToolInstance( brushInstanceNames.CircularEraser, BrushTool.toolName, @@ -290,25 +311,20 @@ function setupTools(toolGroupId) { activeStrategy: brushStrategies.CircularEraser, } ); + toolGroup.addToolInstance( - brushInstanceNames.ThresholdBrush, + brushInstanceNames.ThresholdBrushCircle, BrushTool.toolName, { - activeStrategy: brushStrategies.ThresholdBrush, + activeStrategy: brushStrategies.ThresholdBrushCircle, } ); + toolGroup.addToolInstance( - brushInstanceNames.DynamicThreshold, + brushInstanceNames.ThresholdBrushSphere, BrushTool.toolName, { - activeStrategy: brushStrategies.DynamicThreshold, - preview: { - enabled: true, - }, - strategySpecificConfiguration: { - useCenterSegmentIndex: true, - THRESHOLD: { isDynamic: true, dynamicRadius: 3 }, - }, + activeStrategy: brushStrategies.ThresholdBrushSphere, } ); @@ -341,8 +357,7 @@ function setupTools(toolGroupId) { toolGroup.setToolActive(StackScrollTool.toolName, { bindings: [ { - mouseButton: MouseBindings.Primary, - modifierKey: KeyboardBindings.Alt, + mouseButton: MouseBindings.Wheel, }, ], }); @@ -394,26 +409,24 @@ async function run() { ]; renderingEngine.setViewports(viewportInputArray); toolGroup.addViewport(viewportId, renderingEngineId); + toolGroup.addViewport(viewportId2, renderingEngineId); viewport = renderingEngine.getViewport(viewportId); - const imageIdsArray = [imageIds[0], imageIds[1], mgImageIds[0]]; + const ctImageIds = imageIds.slice(0, 3); + const ctSegImages = await imageLoader.createAndCacheDerivedLabelmapImages( + ctImageIds + ); - const segImages = await imageLoader.createAndCacheDerivedLabelmapImages( - imageIdsArray + const mgSegImages = await imageLoader.createAndCacheDerivedLabelmapImages( + mgImageIds ); const viewport2 = renderingEngine.getViewport(viewportId2); - await viewport.setStack(imageIdsArray, 0); - await viewport2.setStack([imageIdsArray[2]], 0); + await viewport.setStack(ctImageIds, 0); + await viewport2.setStack([...mgImageIds, ctImageIds[2]], 0); cornerstoneTools.utilities.stackContextPrefetch.enable(element1); cornerstoneTools.utilities.stackContextPrefetch.enable(element2); - // fillStackSegmentationWithMockData({ - // imageIds: [imageIds[0]], - // segmentationImageIds: segImages.map((it) => it.imageId), - // cornerstone, - // }); - renderingEngine.renderViewports([viewportId]); segmentation.addSegmentations([ @@ -422,11 +435,27 @@ async function run() { representation: { type: csToolsEnums.SegmentationRepresentations.Labelmap, data: { - imageIds: segImages.map((it) => it.imageId), + imageIds: ctSegImages.map((it) => it.imageId), + }, + }, + }, + ]); + + segmentation.addSegmentations([ + { + segmentationId: segmentationIds[1], + representation: { + type: csToolsEnums.SegmentationRepresentations.Labelmap, + data: { + imageIds: [ + ...mgSegImages.map((it) => it.imageId), + ctSegImages[2].imageId, + ], }, }, }, ]); + // Add the segmentation representation to the toolgroup await segmentation.addSegmentationRepresentations(viewportId, [ { @@ -437,7 +466,7 @@ async function run() { await segmentation.addSegmentationRepresentations(viewportId2, [ { - segmentationId: segmentationIds[0], + segmentationId: segmentationIds[1], type: csToolsEnums.SegmentationRepresentations.Labelmap, }, ]); diff --git a/packages/tools/examples/stackRange/index.ts b/packages/tools/examples/stackRange/index.ts index bb6e5dfe1b..02b7be9c2c 100644 --- a/packages/tools/examples/stackRange/index.ts +++ b/packages/tools/examples/stackRange/index.ts @@ -180,6 +180,17 @@ addButtonToToolbar({ }, }); +addButtonToToolbar({ + id: 'Toggle Point', + title: 'Toggle Point', + onClick() { + const annotation = getActiveAnnotation(); + if (annotation) { + KeyImageTool.setPoint(annotation); + } + }, +}); + function annotationModifiedListener(evt) { updateAnnotationDiv( evt.detail.annotation?.annotationUID || diff --git a/packages/tools/examples/videoSegmentation/index.ts b/packages/tools/examples/videoSegmentation/index.ts index 08839726fd..a8dceb0e19 100644 --- a/packages/tools/examples/videoSegmentation/index.ts +++ b/packages/tools/examples/videoSegmentation/index.ts @@ -165,9 +165,10 @@ function setupTools(toolGroupId) { preview: { enabled: true, }, - strategySpecificConfiguration: { - useCenterSegmentIndex: true, - THRESHOLD: { isDynamic: true, dynamicRadius: 3 }, + useCenterSegmentIndex: true, + threshold: { + isDynamic: true, + dynamicRadius: 3, }, } ); diff --git a/packages/tools/package.json b/packages/tools/package.json index 9d324337f3..ecc842ed8e 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -1,6 +1,6 @@ { "name": "@cornerstonejs/tools", - "version": "2.19.7", + "version": "3.0.5", "description": "Cornerstone3D Tools", "types": "./dist/esm/index.d.ts", "module": "./dist/esm/index.js", @@ -89,7 +89,6 @@ "clean": "rm -rf node_modules/.cache/storybook && shx rm -rf dist", "clean:deep": "yarn run clean && shx rm -rf node_modules", "dev": "tsc --project ./tsconfig.json --watch", - "build:update-api": "yarn run build:esm && api-extractor run --local", "format-check": "npx eslint ./src --quiet", "api-check": "api-extractor --debug run ", "prepublishOnly": "yarn run build", @@ -104,7 +103,7 @@ "canvas": "^2.11.2" }, "peerDependencies": { - "@cornerstonejs/core": "^2.19.7", + "@cornerstonejs/core": "^3.0.5", "@kitware/vtk.js": "32.9.0", "@types/d3-array": "^3.0.4", "@types/d3-interpolate": "^3.0.1", diff --git a/packages/tools/src/config.ts b/packages/tools/src/config.ts new file mode 100644 index 0000000000..778b2fbda5 --- /dev/null +++ b/packages/tools/src/config.ts @@ -0,0 +1,106 @@ +import type { ContourSegmentationData } from './types'; +import type { Types } from '@cornerstonejs/core'; +import type { LabelmapSegmentationData } from './types/LabelmapTypes'; +import type { SurfaceSegmentationData } from './types/SurfaceTypes'; +import type SegmentationRepresentations from './enums/SegmentationRepresentations'; + +/** + * Options for converting between segmentation representations using PolySeg + * set + */ +export type PolySegConversionOptions = { + /** Optional array of segment indices to convert */ + segmentIndices?: number[]; + /** ID of the segmentation to convert */ + segmentationId?: string; + /** Viewport to use for conversion */ + viewport?: Types.IStackViewport | Types.IVolumeViewport; +}; + +/** + * Interface for the PolySeg add-on that handles segmentation representation conversions + */ +type ComputeRepresentationFn = ( + segmentationId: string, + options: PolySegConversionOptions +) => Promise; + +type PolySegAddOn = { + /** Checks if a representation type can be computed for a segmentation */ + canComputeRequestedRepresentation: ( + segmentationId: string, + representationType: SegmentationRepresentations + ) => boolean; + + /** Initializes the PolySeg add-on */ + init: () => void; + + /** Computes different segmentation representation data */ + computeContourData: ComputeRepresentationFn; + computeLabelmapData: ComputeRepresentationFn; + computeSurfaceData: ComputeRepresentationFn; + + /** Updates different segmentation representation data */ + updateSurfaceData: ComputeRepresentationFn; +}; + +/** + * Available add-ons that can be configured + */ +type AddOns = { + polySeg: PolySegAddOn; +}; + +/** + * Configuration type containing add-ons + */ +export type Config = { + addons: AddOns; +}; + +let config = {} as Config; + +/** + * Gets the current configuration + */ +export function getConfig(): Config { + return config; +} + +/** + * Sets a new configuration + */ +export function setConfig(newConfig: Config): void { + config = newConfig; +} + +/** + * Gets configured add-ons + */ +export function getAddOns(): AddOns { + return config.addons; +} + +let polysegInitialized = false; + +/** + * Gets the PolySeg add-on, initializing it if needed + * @returns The PolySeg add-on instance or null if not configured + */ +export function getPolySeg() { + if (!config.addons?.polySeg) { + console.warn( + 'PolySeg add-on not configured. This will prevent automatic conversion between segmentation representations (labelmap, contour, surface). To enable these features, install @cornerstonejs/polymorphic-segmentation and register it during initialization: cornerstoneTools.init({ addons: { polySeg } }).' + ); + + return null; + } + + const polyseg = config.addons.polySeg; + if (!polysegInitialized) { + polyseg.init(); + polysegInitialized = true; + } + + return polyseg; +} diff --git a/packages/tools/src/enums/StrategyCallbacks.ts b/packages/tools/src/enums/StrategyCallbacks.ts index 36ad22d143..dc43217ec7 100644 --- a/packages/tools/src/enums/StrategyCallbacks.ts +++ b/packages/tools/src/enums/StrategyCallbacks.ts @@ -63,6 +63,12 @@ enum StrategyCallbacks { /** Compute statistics on this instance */ GetStatistics = 'getStatistics', + + /** Handle stack viewport sphere brush overrides */ + EnsureImageVolumeFor3DManipulation = 'ensureImageVolumeFor3DManipulation', + + /** Handle stack image reference for 3D manipulation */ + EnsureSegmentationVolumeFor3DManipulation = 'ensureSegmentationVolumeFor3DManipulation', } export default StrategyCallbacks; diff --git a/packages/tools/src/enums/WorkerTypes.ts b/packages/tools/src/enums/WorkerTypes.ts index bf1660f92a..9afc93ac09 100644 --- a/packages/tools/src/enums/WorkerTypes.ts +++ b/packages/tools/src/enums/WorkerTypes.ts @@ -11,6 +11,10 @@ enum ChangeTypes { POLYSEG_LABELMAP_TO_SURFACE = 'Converting Labelmap to Surface', SURFACE_CLIPPING = 'Clipping Surfaces', + + COMPUTE_STATISTICS = 'Computing Statistics', + + INTERPOLATE_LABELMAP = 'Interpolating Labelmap', } export default ChangeTypes; diff --git a/packages/tools/src/init.ts b/packages/tools/src/init.ts index ecd9426844..77f0de492f 100644 --- a/packages/tools/src/init.ts +++ b/packages/tools/src/init.ts @@ -16,6 +16,8 @@ import { annotationInterpolationEventDispatcher } from './eventDispatchers'; import * as ToolGroupManager from './store/ToolGroupManager'; import { defaultSegmentationStateManager } from './stateManagement/segmentation/SegmentationStateManager'; import segmentationRepresentationModifiedListener from './eventListeners/segmentation/segmentationRepresentationModifiedListener'; +import { setConfig } from './config'; +import type { Config } from './config'; let csToolsInitialized = false; @@ -25,11 +27,13 @@ let csToolsInitialized = false; * @param defaultConfiguration - A configuration object that will be used to * initialize the tool. */ -export function init(defaultConfiguration = {}): void { +export function init(defaultConfiguration = {} as Config): void { if (csToolsInitialized) { return; } + setConfig(defaultConfiguration); + _addCornerstoneEventListeners(); _addCornerstoneToolsEventListeners(); diff --git a/packages/tools/src/stateManagement/annotation/helpers/state.ts b/packages/tools/src/stateManagement/annotation/helpers/state.ts index ce96dd7119..4347c51821 100644 --- a/packages/tools/src/stateManagement/annotation/helpers/state.ts +++ b/packages/tools/src/stateManagement/annotation/helpers/state.ts @@ -95,14 +95,16 @@ function triggerAnnotationRemoved( /** * Triggers an annotation modified event. + * Note this no longer requires the element, which should be handled by testing + * to see which viewports this element is shown on. */ function triggerAnnotationModified( annotation: Annotation, - element: HTMLDivElement, + element?: HTMLDivElement, changeType = ChangeTypes.HandlesUpdated ): void { - const enabledElement = getEnabledElement(element); - const { viewportId, renderingEngineId } = enabledElement; + const enabledElement = element && getEnabledElement(element); + const { viewportId, renderingEngineId } = enabledElement || {}; const eventType = Events.ANNOTATION_MODIFIED; const eventDetail: AnnotationModifiedEventDetail = { annotation, diff --git a/packages/tools/src/stateManagement/segmentation/SegmentationStyle.ts b/packages/tools/src/stateManagement/segmentation/SegmentationStyle.ts index f6bd05b166..9fc2fcdf8c 100644 --- a/packages/tools/src/stateManagement/segmentation/SegmentationStyle.ts +++ b/packages/tools/src/stateManagement/segmentation/SegmentationStyle.ts @@ -208,20 +208,20 @@ class SegmentationStyle { if (type === Enums.SegmentationRepresentations.Labelmap) { const labelmapStyles = processedStyles as LabelmapStyle; - labelmapStyles.renderOutlineInactive = labelmapStyles.renderOutline; - labelmapStyles.outlineWidthInactive = labelmapStyles.outlineWidth; - labelmapStyles.renderFillInactive = labelmapStyles.renderFill; - labelmapStyles.fillAlphaInactive = labelmapStyles.fillAlpha; - labelmapStyles.outlineOpacityInactive = labelmapStyles.outlineOpacity; + labelmapStyles.renderOutlineInactive ??= labelmapStyles.renderOutline; + labelmapStyles.outlineWidthInactive ??= labelmapStyles.outlineWidth; + labelmapStyles.renderFillInactive ??= labelmapStyles.renderFill; + labelmapStyles.fillAlphaInactive ??= labelmapStyles.fillAlpha; + labelmapStyles.outlineOpacityInactive ??= labelmapStyles.outlineOpacity; } else if (type === Enums.SegmentationRepresentations.Contour) { const contourStyles = processedStyles as ContourStyle; - contourStyles.outlineWidthInactive = contourStyles.outlineWidth; - contourStyles.outlineOpacityInactive = contourStyles.outlineOpacity; - contourStyles.outlineDashInactive = contourStyles.outlineDash; - contourStyles.renderOutlineInactive = contourStyles.renderOutline; - contourStyles.renderFillInactive = contourStyles.renderFill; - contourStyles.fillAlphaInactive = contourStyles.fillAlpha; + contourStyles.outlineWidthInactive ??= contourStyles.outlineWidth; + contourStyles.outlineOpacityInactive ??= contourStyles.outlineOpacity; + contourStyles.outlineDashInactive ??= contourStyles.outlineDash; + contourStyles.renderOutlineInactive ??= contourStyles.renderOutline; + contourStyles.renderFillInactive ??= contourStyles.renderFill; + contourStyles.fillAlphaInactive ??= contourStyles.fillAlpha; } return processedStyles; diff --git a/packages/tools/src/stateManagement/segmentation/helpers/getSegmentationActor.ts b/packages/tools/src/stateManagement/segmentation/helpers/getSegmentationActor.ts index 9ae79d9291..c7bd3293f4 100644 --- a/packages/tools/src/stateManagement/segmentation/helpers/getSegmentationActor.ts +++ b/packages/tools/src/stateManagement/segmentation/helpers/getSegmentationActor.ts @@ -121,11 +121,12 @@ export function getSurfaceActorEntry( segmentationId: string, segmentIndex?: number | string ) { - return getActorEntry(viewportId, segmentationId, (actor) => - // @ts-expect-error - actor.representationUID?.startsWith( + return getActorEntry( + viewportId, + segmentationId, + (actor) => + actor.representationUID === getSurfaceRepresentationUID(segmentationId, segmentIndex) - ) ); } diff --git a/packages/tools/src/stateManagement/segmentation/helpers/normalizeSegmentationInput.ts b/packages/tools/src/stateManagement/segmentation/helpers/normalizeSegmentationInput.ts index a3186393b2..845ca14d2c 100644 --- a/packages/tools/src/stateManagement/segmentation/helpers/normalizeSegmentationInput.ts +++ b/packages/tools/src/stateManagement/segmentation/helpers/normalizeSegmentationInput.ts @@ -102,7 +102,7 @@ function normalizeSurfaceSegments( surfaceData: SurfaceSegmentationData ): void { const { geometryIds } = surfaceData; - geometryIds.forEach((geometryId) => { + geometryIds?.forEach((geometryId) => { const geometry = cache.getGeometry(geometryId); if (geometry?.data) { const { segmentIndex } = geometry.data; diff --git a/packages/tools/src/stateManagement/segmentation/helpers/validateSegmentationInput.ts b/packages/tools/src/stateManagement/segmentation/helpers/validateSegmentationInput.ts index d7b733f63c..5dcfc67b3b 100644 --- a/packages/tools/src/stateManagement/segmentation/helpers/validateSegmentationInput.ts +++ b/packages/tools/src/stateManagement/segmentation/helpers/validateSegmentationInput.ts @@ -1,6 +1,6 @@ import * as Enums from '../../../enums'; import type { SegmentationPublicInput } from '../../../types/SegmentationStateTypes'; -import { validatePublic as validatePublicLabelmap } from '../../../tools/displayTools/Labelmap/validateLabelmap'; +import { validatePublic as validatePublicLabelmap } from '../../../utilities/segmentation/validateLabelmap'; /** * Validates the given segmentationInputArray to ensure it contains diff --git a/packages/tools/src/stateManagement/segmentation/index.ts b/packages/tools/src/stateManagement/segmentation/index.ts index 6542417cb7..1c5e879ef6 100644 --- a/packages/tools/src/stateManagement/segmentation/index.ts +++ b/packages/tools/src/stateManagement/segmentation/index.ts @@ -28,17 +28,17 @@ import * as segmentIndex from './segmentIndex'; import * as triggerSegmentationEvents from './triggerSegmentationEvents'; import { convertStackToVolumeLabelmap } from './helpers/convertStackToVolumeLabelmap'; import { computeVolumeLabelmapFromStack } from './helpers/computeVolumeLabelmapFromStack'; -import * as polySegManager from './polySeg'; import { clearSegmentValue } from './helpers/clearSegmentValue'; import { convertVolumeToStackLabelmap } from './helpers/computeStackLabelmapFromVolume'; import { removeSegment } from './removeSegment'; import { getLabelmapImageIds } from './getLabelmapImageIds'; import * as strategies from './../../tools/segmentation/strategies'; - import { removeAllSegmentations, removeSegmentation, } from './removeSegmentation'; +import { segmentationStyle } from './SegmentationStyle'; +import { defaultSegmentationStateManager } from './SegmentationStateManager'; const helpers = { clearSegmentValue, @@ -74,9 +74,10 @@ export { segmentIndex, triggerSegmentationEvents, helpers, - polySegManager as polySeg, removeSegment, getLabelmapImageIds, addRepresentationData, strategies, + segmentationStyle, + defaultSegmentationStateManager, }; diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.ts b/packages/tools/src/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.ts deleted file mode 100644 index 513f8a8a8d..0000000000 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { SegmentationRepresentations } from '../../../../enums'; -import type { PolySegConversionOptions } from '../../../../types'; -import { computeAndAddRepresentation } from '../computeAndAddRepresentation'; -import { computeContourData } from './contourComputationStrategies'; - -/** - * Computes and adds the contour representation for a given segmentation. - * - * @param segmentationId - The id of the segmentation - * @param options - Optional parameters for computing the contour representation - * @returns A promise that resolves when the contour representation is computed and added - */ -export function computeAndAddContourRepresentation( - segmentationId: string, - options: PolySegConversionOptions = {} -) { - return computeAndAddRepresentation( - segmentationId, - SegmentationRepresentations.Contour, - () => computeContourData(segmentationId, options), - () => undefined - ); -} diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.ts b/packages/tools/src/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.ts deleted file mode 100644 index e38c9bf949..0000000000 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { SegmentationRepresentations } from '../../../../enums'; -import { computeAndAddRepresentation } from '../computeAndAddRepresentation'; -import { computeLabelmapData } from './labelmapComputationStrategies'; -import type { PolySegConversionOptions } from '../../../../types'; -import { defaultSegmentationStateManager } from '../../SegmentationStateManager'; -import { triggerSegmentationDataModified } from '../../triggerSegmentationEvents'; - -/** - * Computes and adds the labelmap representation for a given segmentation. - * - * @param segmentationId - The id of the segmentation - * @param options - Optional parameters for computing the labelmap representation - * @returns A promise that resolves when the labelmap representation is computed and added - */ -export async function computeAndAddLabelmapRepresentation( - segmentationId: string, - options: PolySegConversionOptions = {} -) { - return computeAndAddRepresentation( - segmentationId, - SegmentationRepresentations.Labelmap, - () => computeLabelmapData(segmentationId, options), - () => null, - () => { - defaultSegmentationStateManager.processLabelmapRepresentationAddition( - options.viewport.id, - segmentationId - ); - - /// need to figure out how to trigger the labelmap update properly - setTimeout(() => { - triggerSegmentationDataModified(segmentationId); - }, 0); - } - ); -} diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.ts b/packages/tools/src/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.ts deleted file mode 100644 index 63d413ae48..0000000000 --- a/packages/tools/src/stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { SegmentationRepresentations } from '../../../../enums'; -import type { PolySegConversionOptions } from '../../../../types'; -import { computeAndAddRepresentation } from '../computeAndAddRepresentation'; -import { computeSurfaceData } from './surfaceComputationStrategies'; -import { updateSurfaceData } from './updateSurfaceData'; - -/** - * Computes and adds a surface representation for a given segmentation. - * - * @param segmentationId - The id of the segmentation - * @param options - Optional parameters for computing the surface representation - * @returns A promise that resolves when the surface representation is computed and added - */ -export function computeAndAddSurfaceRepresentation( - segmentationId: string, - options: PolySegConversionOptions = {} -) { - return computeAndAddRepresentation( - segmentationId, - SegmentationRepresentations.Surface, - () => computeSurfaceData(segmentationId, options), - () => updateSurfaceData(segmentationId) - ); -} diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/index.ts b/packages/tools/src/stateManagement/segmentation/polySeg/index.ts deleted file mode 100644 index bbcdcdd635..0000000000 --- a/packages/tools/src/stateManagement/segmentation/polySeg/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { computeAndAddSurfaceRepresentation } from './Surface/computeAndAddSurfaceRepresentation'; -import { computeAndAddLabelmapRepresentation } from './Labelmap/computeAndAddLabelmapRepresentation'; -import { computeAndAddContourRepresentation } from './Contour/computeAndAddContourRepresentation'; -import { canComputeRequestedRepresentation } from './canComputeRequestedRepresentation'; - -export { - canComputeRequestedRepresentation, - // computed representations - computeAndAddSurfaceRepresentation, - computeAndAddLabelmapRepresentation, - computeAndAddContourRepresentation, -}; diff --git a/packages/tools/src/tools/CrosshairsTool.ts b/packages/tools/src/tools/CrosshairsTool.ts index ed2244c8a2..c55a375543 100644 --- a/packages/tools/src/tools/CrosshairsTool.ts +++ b/packages/tools/src/tools/CrosshairsTool.ts @@ -109,9 +109,6 @@ class CrosshairsTool extends AnnotationTool { _getReferenceLineControllable?: (viewportId: string) => boolean; _getReferenceLineDraggableRotatable?: (viewportId: string) => boolean; _getReferenceLineSlabThicknessControlsOn?: (viewportId: string) => boolean; - editData: { - annotation: Annotation; - } | null; constructor( toolProps: PublicToolProps = {}, @@ -138,6 +135,9 @@ class CrosshairsTool extends AnnotationTool { enabled: false, panSize: 10, }, + handleRadius: 3, + // Enable HDPI rendering for handles using devicePixelRatio + enableHDPIHandles: false, // radius of the area around the intersection of the planes, in which // the reference lines will not be rendered. This is only used when // having 3 viewports in the toolGroup. @@ -1273,6 +1273,15 @@ class CrosshairsTool extends AnnotationTool { slabThicknessHandleWorldFour ); + let handleRadius = + this.configuration.handleRadius * + (this.configuration.enableHDPIHandles ? window.devicePixelRatio : 1); + let opacity = 1; + if (this.configuration.mobile?.enabled) { + handleRadius = this.configuration.mobile.handleRadius; + opacity = this.configuration.mobile.opacity; + } + if ( (lineActive || this.configuration.mobile?.enabled) && !rotHandlesActive && @@ -1289,12 +1298,8 @@ class CrosshairsTool extends AnnotationTool { rotationHandles, { color, - handleRadius: this.configuration.mobile?.enabled - ? this.configuration.mobile?.handleRadius - : 3, - opacity: this.configuration.mobile?.enabled - ? this.configuration.mobile?.opacity - : 1, + handleRadius, + opacity, type: 'circle', } ); @@ -1306,12 +1311,8 @@ class CrosshairsTool extends AnnotationTool { slabThicknessHandles, { color, - handleRadius: this.configuration.mobile?.enabled - ? this.configuration.mobile?.handleRadius - : 3, - opacity: this.configuration.mobile?.enabled - ? this.configuration.mobile?.opacity - : 1, + handleRadius, + opacity, type: 'rect', } ); @@ -1330,12 +1331,8 @@ class CrosshairsTool extends AnnotationTool { rotationHandles, { color, - handleRadius: this.configuration.mobile?.enabled - ? this.configuration.mobile?.handleRadius - : 3, - opacity: this.configuration.mobile?.enabled - ? this.configuration.mobile?.opacity - : 1, + handleRadius, + opacity, type: 'circle', } ); @@ -1354,17 +1351,18 @@ class CrosshairsTool extends AnnotationTool { slabThicknessHandles, { color, - handleRadius: this.configuration.mobile?.enabled - ? this.configuration.mobile?.handleRadius - : 3, - opacity: this.configuration.mobile?.enabled - ? this.configuration.mobile?.opacity - : 1, + handleRadius, + opacity, type: 'rect', } ); } else if (rotHandlesActive && viewportDraggableRotatable) { const handleUID = `${lineIndex}`; + const handleRadius = + this.configuration.handleRadius * + (this.configuration.enableHDPIHandles + ? window.devicePixelRatio + : 1); // draw all rotation handles as active drawHandlesSvg( svgDrawingHelper, @@ -1373,7 +1371,7 @@ class CrosshairsTool extends AnnotationTool { rotationHandles, { color, - handleRadius: 2, + handleRadius, fill: color, type: 'circle', } @@ -1383,6 +1381,11 @@ class CrosshairsTool extends AnnotationTool { selectedViewportId && viewportSlabThicknessControlsOn ) { + const handleRadius = + this.configuration.handleRadius * + (this.configuration.enableHDPIHandles + ? window.devicePixelRatio + : 1); // draw only the slab thickness handles for the active viewport as active drawHandlesSvg( svgDrawingHelper, @@ -1391,7 +1394,7 @@ class CrosshairsTool extends AnnotationTool { slabThicknessHandles, { color, - handleRadius: 2, + handleRadius, fill: color, type: 'rect', } diff --git a/packages/tools/src/tools/annotation/KeyImageTool.ts b/packages/tools/src/tools/annotation/KeyImageTool.ts index 61dbd7982a..8705f3adc4 100644 --- a/packages/tools/src/tools/annotation/KeyImageTool.ts +++ b/packages/tools/src/tools/annotation/KeyImageTool.ts @@ -13,21 +13,27 @@ import { triggerAnnotationCompleted, triggerAnnotationModified, } from '../../stateManagement/annotation/helpers/state'; -import { drawArrow as drawArrowSvg } from '../../drawingSvg'; +import { + drawArrow as drawArrowSvg, + drawHandles as drawHandlesSvg, +} from '../../drawingSvg'; import { state } from '../../store/state'; import { getViewportIdsWithToolToRender } from '../../utilities/viewportFilters'; import triggerAnnotationRenderForViewportIds from '../../utilities/triggerAnnotationRenderForViewportIds'; -import { resetElementCursor } from '../../cursors/elementCursor'; +import { + resetElementCursor, + hideElementCursor, +} from '../../cursors/elementCursor'; import type { EventTypes, - ToolHandle, PublicToolProps, ToolProps, SVGDrawingHelper, Annotation, } from '../../types'; +import type { KeyImageAnnotation } from '../../types/ToolSpecificAnnotationTypes'; import type { StyleSpecifier } from '../../types/AnnotationStyle'; type Point2 = Types.Point2; @@ -35,17 +41,23 @@ type Point2 = Types.Point2; class KeyImageTool extends AnnotationTool { static toolName = 'KeyImage'; + /** A mix in data element to set the series level annotation */ + public static dataSeries = { + data: { + seriesLevel: true, + }, + }; + + /** A mix in data element to set the point to be true. That renders as a point + * on the image rather than just selecting the image itself + */ + public static dataPoint = { + data: { + isPoint: true, + }, + }; + _throttledCalculateCachedStats: Function; - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - handleIndex?: number; - movingTextBox?: boolean; - newAnnotation?: boolean; - hasMoved?: boolean; - } | null; - isDrawing: boolean; - isHandleOutsideImage: boolean; constructor( toolProps: PublicToolProps = {}, @@ -56,6 +68,11 @@ class KeyImageTool extends AnnotationTool { changeTextCallback, canvasPosition: [10, 10], canvasSize: 10, + handleRadius: '6', + /** If true, this selects the entire series/display set */ + seriesLevel: false, + /** If true, shows the point selected */ + isPoint: false, }, } ) { @@ -72,13 +89,20 @@ class KeyImageTool extends AnnotationTool { */ addNewAnnotation = (evt: EventTypes.InteractionEventType) => { const eventDetail = evt.detail; - const { element } = eventDetail; + const { element, currentPoints } = eventDetail; const enabledElement = getEnabledElement(element); const { viewport } = enabledElement; + const worldPos = currentPoints.world; const annotation = (( this.constructor - )).createAnnotationForViewport(viewport); + )).createAnnotationForViewport(viewport, { + data: { + handles: { points: [[...worldPos]] }, + seriesLevel: this.configuration.seriesLevel, + isPoint: this.configuration.isPoint, + }, + }); addAnnotation(annotation, element); @@ -110,10 +134,6 @@ class KeyImageTool extends AnnotationTool { return annotation; }; - public cancel() { - // No op - the annotation can't be in a partial state - } - /** * It returns if the canvas point is near the provided length annotation in the provided * element or not. A proximity is passed to the function to determine the @@ -135,6 +155,10 @@ class KeyImageTool extends AnnotationTool { const { viewport } = enabledElement; const { data } = annotation; + if (!data?.isPoint) { + return false; + } + const { canvasPosition, canvasSize } = this.configuration; if (!canvasPosition?.length) { return false; @@ -161,20 +185,79 @@ class KeyImageTool extends AnnotationTool { handleSelectedCallback( evt: EventTypes.InteractionEventType, - annotation: Annotation, - handle: ToolHandle + annotation: KeyImageAnnotation ): void { - // Nothing special to do here. + const eventDetail = evt.detail; + const { element } = eventDetail; + + annotation.highlighted = true; + + const viewportIdsToRender = getViewportIdsWithToolToRender( + element, + this.getToolName() + ); + + // Find viewports to render on drag. + + this.editData = { + //handle, // This would be useful for other tools with more than one handle + annotation, + viewportIdsToRender, + }; + this._activateModify(element); + + hideElementCursor(element); + + triggerAnnotationRenderForViewportIds(viewportIdsToRender); + + evt.preventDefault(); + } + + public static setPoint( + annotation, + isPoint: boolean = !annotation.data.isPoint, + element? + ) { + annotation.data.isPoint = isPoint; + triggerAnnotationModified(annotation, element); } _endCallback = (evt: EventTypes.InteractionEventType): void => { const eventDetail = evt.detail; const { element } = eventDetail; - this.doneEditMemo(); + const { annotation, viewportIdsToRender, newAnnotation } = this.editData; + + const { viewportId, renderingEngine } = getEnabledElement(element); + this.eventDispatchDetail = { + viewportId, + renderingEngineId: renderingEngine.id, + }; this._deactivateModify(element); + resetElementCursor(element); + + if (newAnnotation) { + this.createMemo(element, annotation, { newAnnotation }); + } + + this.editData = null; + this.isDrawing = false; + this.doneEditMemo(); + + if ( + this.isHandleOutsideImage && + this.configuration.preventHandleOutsideImage + ) { + removeAnnotation(annotation.annotationUID); + } + + triggerAnnotationRenderForViewportIds(viewportIdsToRender); + + if (newAnnotation) { + triggerAnnotationCompleted(annotation); + } }; doubleClickCallback = (evt: EventTypes.TouchTapEventType): void => { @@ -226,9 +309,6 @@ class KeyImageTool extends AnnotationTool { _doneChangingTextCallback(element, annotation, updatedText): void { annotation.data.text = updatedText; - const enabledElement = getEnabledElement(element); - const { renderingEngine } = enabledElement; - const viewportIdsToRender = getViewportIdsWithToolToRender( element, this.getToolName() @@ -239,48 +319,69 @@ class KeyImageTool extends AnnotationTool { triggerAnnotationModified(annotation, element); } - _activateModify = (element: HTMLDivElement) => { + _dragCallback = (evt) => { + this.isDrawing = true; + const eventDetail = evt.detail; + const { currentPoints, element } = eventDetail; + const worldPos = currentPoints.world; + + const { annotation, viewportIdsToRender, newAnnotation } = this.editData; + const { data } = annotation; + + this.createMemo(element, annotation, { newAnnotation }); + + data.handles.points[0] = [...worldPos] as Types.Point3; + annotation.invalidated = true; + + triggerAnnotationRenderForViewportIds(viewportIdsToRender); + }; + + public cancel(element: HTMLDivElement) { + // If it is mid-draw or mid-modify + if (this.isDrawing) { + this.isDrawing = false; + this._deactivateModify(element); + resetElementCursor(element); + + const { annotation, viewportIdsToRender, newAnnotation } = this.editData; + const { data } = annotation; + + annotation.highlighted = false; + data.handles.activeHandleIndex = null; + + triggerAnnotationRenderForViewportIds(viewportIdsToRender); + + if (newAnnotation) { + triggerAnnotationCompleted(annotation); + } + + this.editData = null; + return annotation.annotationUID; + } + } + + _activateModify = (element) => { state.isInteractingWithTool = true; - element.addEventListener( - Events.MOUSE_UP, - this._endCallback as EventListener - ); - element.addEventListener( - Events.MOUSE_CLICK, - this._endCallback as EventListener - ); + element.addEventListener(Events.MOUSE_UP, this._endCallback); + element.addEventListener(Events.MOUSE_DRAG, this._dragCallback); + element.addEventListener(Events.MOUSE_CLICK, this._endCallback); - element.addEventListener( - Events.TOUCH_TAP, - this._endCallback as EventListener - ); - element.addEventListener( - Events.TOUCH_END, - this._endCallback as EventListener - ); + element.addEventListener(Events.TOUCH_END, this._endCallback); + element.addEventListener(Events.TOUCH_DRAG, this._dragCallback); + element.addEventListener(Events.TOUCH_TAP, this._endCallback); }; - _deactivateModify = (element: HTMLDivElement) => { + _deactivateModify = (element) => { state.isInteractingWithTool = false; - element.removeEventListener( - Events.MOUSE_UP, - this._endCallback as EventListener - ); - element.removeEventListener( - Events.MOUSE_CLICK, - this._endCallback as EventListener - ); + element.removeEventListener(Events.MOUSE_UP, this._endCallback); + element.removeEventListener(Events.MOUSE_DRAG, this._dragCallback); + element.removeEventListener(Events.MOUSE_CLICK, this._endCallback); - element.removeEventListener( - Events.TOUCH_TAP, - this._endCallback as EventListener - ); - element.removeEventListener( - Events.TOUCH_END, - this._endCallback as EventListener - ); + element.removeEventListener(Events.TOUCH_END, this._endCallback); + element.removeEventListener(Events.TOUCH_DRAG, this._dragCallback); + element.removeEventListener(Events.TOUCH_TAP, this._endCallback); }; /** @@ -324,18 +425,33 @@ class KeyImageTool extends AnnotationTool { // Draw SVG for (let i = 0; i < annotations.length; i++) { const annotation = annotations[i]; - const { annotationUID } = annotation; + const { annotationUID, data } = annotation; styleSpecifier.annotationUID = annotationUID; - const { color } = this.getAnnotationStyle({ + const { color, lineWidth } = this.getAnnotationStyle({ annotation, styleSpecifier, }); const { canvasPosition, canvasSize } = this.configuration; - if (canvasPosition?.length) { - const arrowUID = '1'; + const arrowUID = '1'; + if (data?.isPoint) { + const point = data.handles.points[0]; + const canvasCoordinates = viewport.worldToCanvas(point); + + drawHandlesSvg( + svgDrawingHelper, + annotationUID, + arrowUID, + [canvasCoordinates], + { + color, + lineWidth, + handleRadius: this.configuration.handleRadius, + } + ); + } else if (canvasPosition?.length) { drawArrowSvg( svgDrawingHelper, annotationUID, diff --git a/packages/tools/src/tools/annotation/PlanarFreehandROITool.ts b/packages/tools/src/tools/annotation/PlanarFreehandROITool.ts index c02ba98820..d8e78e614a 100644 --- a/packages/tools/src/tools/annotation/PlanarFreehandROITool.ts +++ b/packages/tools/src/tools/annotation/PlanarFreehandROITool.ts @@ -987,13 +987,13 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool { modalityUnit, calibratedScale, }) { - const { scale, units } = calibratedScale; + const { scale, unit } = calibratedScale; cachedStats[targetId] = { Modality: metadata.Modality, length: calculatePerimeter(canvasCoordinates, false) / scale, modalityUnit, - getPixelValueUnitunit: units, + unit, }; } diff --git a/packages/tools/src/tools/annotation/ProbeTool.ts b/packages/tools/src/tools/annotation/ProbeTool.ts index 013ea23c6f..fdf047b1ec 100644 --- a/packages/tools/src/tools/annotation/ProbeTool.ts +++ b/packages/tools/src/tools/annotation/ProbeTool.ts @@ -39,7 +39,6 @@ import type { ToolHandle, PublicToolProps, SVGDrawingHelper, - Annotation, } from '../../types'; import type { ProbeAnnotation } from '../../types/ToolSpecificAnnotationTypes'; import type { StyleSpecifier } from '../../types/AnnotationStyle'; @@ -94,18 +93,6 @@ const { transformWorldToIndex } = csUtils; class ProbeTool extends AnnotationTool { static toolName = 'Probe'; - editData: { - annotation: Annotation; - viewportIdsToRender: string[]; - newAnnotation?: boolean; - } | null; - eventDispatchDetail: { - viewportId: string; - renderingEngineId: string; - }; - isDrawing: boolean; - isHandleOutsideImage: boolean; - public static probeDefaults = { supportedInteractionTypes: ['Mouse', 'Touch'], configuration: { diff --git a/packages/tools/src/tools/base/AnnotationTool.ts b/packages/tools/src/tools/base/AnnotationTool.ts index 12e82f77ef..db9d22a616 100644 --- a/packages/tools/src/tools/base/AnnotationTool.ts +++ b/packages/tools/src/tools/base/AnnotationTool.ts @@ -51,6 +51,21 @@ const { PointsManager } = csUtils; * abstract methods. */ abstract class AnnotationTool extends AnnotationDisplayTool { + protected eventDispatchDetail: { + viewportId: string; + renderingEngineId: string; + }; + isDrawing: boolean; + isHandleOutsideImage: boolean; + editData: { + annotation: Annotation; + viewportIdsToRender?: string[]; + newAnnotation?: boolean; + handleIndex?: number; + movingTextBox?: boolean; + hasMoved?: boolean; + } | null; + /** * Creates a base annotation object, adding in any annotation base data provided */ diff --git a/packages/tools/src/tools/displayTools/Contour/contourDisplay.ts b/packages/tools/src/tools/displayTools/Contour/contourDisplay.ts index 8545f30a39..4f2fd5cd34 100644 --- a/packages/tools/src/tools/displayTools/Contour/contourDisplay.ts +++ b/packages/tools/src/tools/displayTools/Contour/contourDisplay.ts @@ -4,10 +4,10 @@ import { getEnabledElementByViewportId } from '@cornerstonejs/core'; import Representations from '../../../enums/SegmentationRepresentations'; import { handleContourSegmentation } from './contourHandler/handleContourSegmentation'; import { getSegmentation } from '../../../stateManagement/segmentation/getSegmentation'; -import { canComputeRequestedRepresentation } from '../../../stateManagement/segmentation/polySeg/canComputeRequestedRepresentation'; -import { computeAndAddContourRepresentation } from '../../../stateManagement/segmentation/polySeg/Contour/computeAndAddContourRepresentation'; import type { ContourRepresentation } from '../../../types/SegmentationStateTypes'; import removeContourFromElement from './removeContourFromElement'; +import { getPolySeg } from '../../../config'; +import { computeAndAddRepresentation } from '../../../utilities/segmentation/computeAndAddRepresentation'; let polySegConversionInProgress = false; @@ -71,7 +71,7 @@ async function render( if ( !contourData && - canComputeRequestedRepresentation( + getPolySeg()?.canComputeRequestedRepresentation( segmentationId, Representations.Contour ) && @@ -79,11 +79,20 @@ async function render( ) { polySegConversionInProgress = true; - contourData = await computeAndAddContourRepresentation(segmentationId, { - viewport, - }); + const polySeg = getPolySeg(); + + contourData = await computeAndAddRepresentation( + segmentationId, + Representations.Contour, + () => polySeg.computeContourData(segmentationId, { viewport }), + () => undefined + ); polySegConversionInProgress = false; + } else if (!contourData && !getPolySeg()) { + console.debug( + `No contour data found for segmentationId ${segmentationId} and PolySeg add-on is not configured. Unable to convert from other representations to contour. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.` + ); } if (!contourData) { diff --git a/packages/tools/src/tools/displayTools/Labelmap/index.ts b/packages/tools/src/tools/displayTools/Labelmap/index.ts index 071711dad1..755409555e 100644 --- a/packages/tools/src/tools/displayTools/Labelmap/index.ts +++ b/packages/tools/src/tools/displayTools/Labelmap/index.ts @@ -3,7 +3,7 @@ import labelmapConfig from './labelmapConfig'; import { validate as validateLabelmap, validatePublic as validateLabelmapPublic, -} from './validateLabelmap'; +} from '../../../utilities/segmentation/validateLabelmap'; export { labelmapDisplay, diff --git a/packages/tools/src/tools/displayTools/Labelmap/labelmapDisplay.ts b/packages/tools/src/tools/displayTools/Labelmap/labelmapDisplay.ts index c77c40d0a0..ec4f4dc946 100644 --- a/packages/tools/src/tools/displayTools/Labelmap/labelmapDisplay.ts +++ b/packages/tools/src/tools/displayTools/Labelmap/labelmapDisplay.ts @@ -20,8 +20,6 @@ import { getActiveSegmentation } from '../../../stateManagement/segmentation/act import { getColorLUT } from '../../../stateManagement/segmentation/getColorLUT'; import { getCurrentLabelmapImageIdsForViewport } from '../../../stateManagement/segmentation/getCurrentLabelmapImageIdForViewport'; import { getSegmentation } from '../../../stateManagement/segmentation/getSegmentation'; -import { canComputeRequestedRepresentation } from '../../../stateManagement/segmentation/polySeg/canComputeRequestedRepresentation'; -import { computeAndAddLabelmapRepresentation } from '../../../stateManagement/segmentation/polySeg/Labelmap/computeAndAddLabelmapRepresentation'; import type vtkColorTransferFunction from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction'; import type vtkPiecewiseFunction from '@kitware/vtk.js/Common/DataModel/PiecewiseFunction'; import { segmentationStyle } from '../../../stateManagement/segmentation/SegmentationStyle'; @@ -30,6 +28,10 @@ import { internalGetHiddenSegmentIndices } from '../../../stateManagement/segmen import { getActiveSegmentIndex } from '../../../stateManagement/segmentation/getActiveSegmentIndex'; import type vtkVolume from '@kitware/vtk.js/Rendering/Core/Volume'; import { getLabelmapActorEntries } from '../../../stateManagement/segmentation/helpers/getSegmentationActor'; +import { getPolySeg } from '../../../config'; +import { computeAndAddRepresentation } from '../../../utilities/segmentation/computeAndAddRepresentation'; +import { triggerSegmentationDataModified } from '../../../stateManagement/segmentation/triggerSegmentationEvents'; +import { defaultSegmentationStateManager } from '../../../stateManagement/segmentation/SegmentationStateManager'; // 255 itself is used as preview color, so basically // we have 254 colors to use for the segments if we are using the preview. @@ -105,7 +107,7 @@ async function render( if ( !labelmapData && - canComputeRequestedRepresentation( + getPolySeg()?.canComputeRequestedRepresentation( segmentationId, SegmentationRepresentations.Labelmap ) && @@ -118,9 +120,25 @@ async function render( // underlying representations to Surface polySegConversionInProgress = true; - labelmapData = await computeAndAddLabelmapRepresentation(segmentationId, { - viewport, - }); + const polySeg = getPolySeg(); + + labelmapData = await computeAndAddRepresentation( + segmentationId, + SegmentationRepresentations.Labelmap, + () => polySeg.computeLabelmapData(segmentationId, { viewport }), + () => null, + () => { + defaultSegmentationStateManager.processLabelmapRepresentationAddition( + viewport.id, + segmentationId + ); + + /// need to figure out how to trigger the labelmap update properly + setTimeout(() => { + triggerSegmentationDataModified(segmentationId); + }, 0); + } + ); if (!labelmapData) { throw new Error( @@ -129,6 +147,10 @@ async function render( } polySegConversionInProgress = false; + } else if (!labelmapData && !getPolySeg()) { + console.debug( + `No labelmap data found for segmentationId ${segmentationId} and PolySeg add-on is not configured. Unable to convert from other representations to labelmap. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.` + ); } if (!labelmapData) { diff --git a/packages/tools/src/tools/displayTools/Surface/addOrUpdateSurfaceToElement.ts b/packages/tools/src/tools/displayTools/Surface/addOrUpdateSurfaceToElement.ts index 24595b4452..7e4764f703 100644 --- a/packages/tools/src/tools/displayTools/Surface/addOrUpdateSurfaceToElement.ts +++ b/packages/tools/src/tools/displayTools/Surface/addOrUpdateSurfaceToElement.ts @@ -25,7 +25,14 @@ function addOrUpdateSurfaceToElement( const surfaceActor = surfaceActorEntry?.actor as Types.Actor; + const isVisible = surface.visible; + if (surfaceActor) { + surfaceActor.setVisibility(isVisible); + + if (!isVisible) { + return; + } // we already have an actor for this surface, we just need to update it // Todo: figure out if the surface configuration has changed diff --git a/packages/tools/src/tools/displayTools/Surface/surfaceDisplay.ts b/packages/tools/src/tools/displayTools/Surface/surfaceDisplay.ts index b258d05572..2fbf737c89 100644 --- a/packages/tools/src/tools/displayTools/Surface/surfaceDisplay.ts +++ b/packages/tools/src/tools/displayTools/Surface/surfaceDisplay.ts @@ -11,10 +11,10 @@ import removeSurfaceFromElement from './removeSurfaceFromElement'; import addOrUpdateSurfaceToElement from './addOrUpdateSurfaceToElement'; import { getSegmentation } from '../../../stateManagement/segmentation/getSegmentation'; import { getColorLUT } from '../../../stateManagement/segmentation/getColorLUT'; -import { canComputeRequestedRepresentation } from '../../../stateManagement/segmentation/polySeg/canComputeRequestedRepresentation'; -import { computeAndAddSurfaceRepresentation } from '../../../stateManagement/segmentation/polySeg/Surface/computeAndAddSurfaceRepresentation'; +import { getPolySeg } from '../../../config'; +import { computeAndAddRepresentation } from '../../../utilities/segmentation/computeAndAddRepresentation'; +import { internalGetHiddenSegmentIndices } from '../../../stateManagement/segmentation/helpers/internalGetHiddenSegmentIndices'; -const { ViewportType } = Enums; /** * It removes a segmentation representation from the tool group's viewports and * from the segmentation state @@ -56,7 +56,7 @@ async function render( viewport: Types.IVolumeViewport | Types.IStackViewport, representation: SegmentationRepresentation ): Promise { - const { segmentationId } = representation; + const { segmentationId, type } = representation; const segmentation = getSegmentation(segmentationId); @@ -68,19 +68,38 @@ async function render( if ( !SurfaceData && - canComputeRequestedRepresentation(segmentationId, Representations.Surface) + getPolySeg()?.canComputeRequestedRepresentation( + segmentationId, + Representations.Surface + ) ) { // we need to check if we can request polySEG to convert the other // underlying representations to Surface - SurfaceData = await computeAndAddSurfaceRepresentation(segmentationId, { - viewport, - }); + const polySeg = getPolySeg(); + + SurfaceData = await computeAndAddRepresentation( + segmentationId, + Representations.Surface, + () => polySeg.computeSurfaceData(segmentationId, { viewport }), + () => polySeg.updateSurfaceData(segmentationId, { viewport }) + ); if (!SurfaceData) { throw new Error( - `No Surface data found for segmentationId ${segmentationId}.` + `No Surface data found for segmentationId ${segmentationId} even we tried to compute it` ); } + } else if (!SurfaceData && !getPolySeg()) { + console.debug( + `No surface data found for segmentationId ${segmentationId} and PolySeg add-on is not configured. Unable to convert from other representations to surface. Please register PolySeg using cornerstoneTools.init({ addons: { polySeg } }) to enable automatic conversion.` + ); + } + + if (!SurfaceData) { + console.warn( + `No Surface data found for segmentationId ${segmentationId}. Skipping render.` + ); + return; } const { geometryIds } = SurfaceData; @@ -106,10 +125,17 @@ async function render( } const segmentIndex = geometry.data.segmentIndex; + const hiddenSegments = internalGetHiddenSegmentIndices(viewport.id, { + segmentationId, + type, + }); + const isHidden = hiddenSegments.has(segmentIndex); + const surface = geometry.data as Types.ISurface; const color = colorLUT[segmentIndex]; surface.color = color.slice(0, 3) as Types.Point3; + surface.visible = !isHidden; surfaces.push(surface); addOrUpdateSurfaceToElement( diff --git a/packages/tools/src/tools/segmentation/BrushTool.ts b/packages/tools/src/tools/segmentation/BrushTool.ts index 2482a991b1..4723f1ee5b 100644 --- a/packages/tools/src/tools/segmentation/BrushTool.ts +++ b/packages/tools/src/tools/segmentation/BrushTool.ts @@ -71,15 +71,8 @@ class BrushTool extends LabelmapBaseTool { THRESHOLD_INSIDE_SPHERE_WITH_ISLAND_REMOVAL: thresholdInsideSphereIsland, }, - - strategySpecificConfiguration: { - THRESHOLD: { - threshold: [-150, -70], // E.g. CT Fat // Only used during threshold strategies. - }, - }, defaultStrategy: 'FILL_INSIDE_CIRCLE', activeStrategy: 'FILL_INSIDE_CIRCLE', - thresholdVolumeId: null, brushSize: 25, preview: { // Have to enable the preview to use this @@ -640,9 +633,7 @@ class BrushTool extends LabelmapBaseTool { } ); - const activeStrategy = this.configuration.activeStrategy; - const { dynamicRadiusInCanvas } = this.configuration - .strategySpecificConfiguration[activeStrategy] || { + const { dynamicRadiusInCanvas } = this.configuration?.threshold || { dynamicRadiusInCanvas: 0, }; diff --git a/packages/tools/src/tools/segmentation/CircleScissorsTool.ts b/packages/tools/src/tools/segmentation/CircleScissorsTool.ts index 7c1fa1bab4..45c5cc85a6 100644 --- a/packages/tools/src/tools/segmentation/CircleScissorsTool.ts +++ b/packages/tools/src/tools/segmentation/CircleScissorsTool.ts @@ -297,7 +297,6 @@ class CircleScissorsTool extends LabelmapBaseTool { points: data.handles.points, viewPlaneNormal, viewUp, - strategySpecificConfiguration: {}, createMemo: this.createMemo.bind(this), }; diff --git a/packages/tools/src/tools/segmentation/LabelmapBaseTool.ts b/packages/tools/src/tools/segmentation/LabelmapBaseTool.ts index 32542b19dc..8154c209c0 100644 --- a/packages/tools/src/tools/segmentation/LabelmapBaseTool.ts +++ b/packages/tools/src/tools/segmentation/LabelmapBaseTool.ts @@ -5,15 +5,11 @@ import { Enums, eventTarget, BaseVolumeViewport, - volumeLoader, } from '@cornerstonejs/core'; import type { Types } from '@cornerstonejs/core'; import { BaseTool } from '../base'; -import type { - LabelmapSegmentationDataStack, - LabelmapSegmentationDataVolume, -} from '../../types/LabelmapTypes'; +import type { LabelmapSegmentationDataVolume } from '../../types/LabelmapTypes'; import SegmentationRepresentations from '../../enums/SegmentationRepresentations'; import type vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData'; import { getActiveSegmentation } from '../../stateManagement/segmentation/getActiveSegmentation'; @@ -21,7 +17,6 @@ import { getLockedSegmentIndices } from '../../stateManagement/segmentation/segm import { getSegmentation } from '../../stateManagement/segmentation/getSegmentation'; import { getClosestImageIdForStackViewport } from '../../utilities/annotationHydration'; import { getCurrentLabelmapImageIdForViewport } from '../../stateManagement/segmentation/getCurrentLabelmapImageIdForViewport'; -import { getStackSegmentationImageIdsForViewport } from '../../stateManagement/segmentation/getStackSegmentationImageIdsForViewport'; import { getSegmentIndexColor } from '../../stateManagement/segmentation/config/segmentationColor'; import { getActiveSegmentIndex } from '../../stateManagement/segmentation/getActiveSegmentIndex'; import { StrategyCallbacks } from '../../enums'; @@ -189,7 +184,6 @@ export default class LabelmapBaseTool extends BaseTool { representationData, segmentsLocked, segmentationId, - volumeOperation = false, }): EditDataReturnType { if (viewport instanceof BaseVolumeViewport) { const { volumeId } = representationData[ @@ -228,7 +222,8 @@ export default class LabelmapBaseTool extends BaseTool { return { volumeId, referencedVolumeId: - this.configuration.thresholdVolumeId ?? referencedVolumeIdToThreshold, + this.configuration.threshold?.volumeId ?? + referencedVolumeIdToThreshold, segmentsLocked, }; } else { @@ -243,67 +238,10 @@ export default class LabelmapBaseTool extends BaseTool { return; } - // I hate this, but what can you do sometimes - if ( - this.configuration.activeStrategy.includes('SPHERE') || - volumeOperation - ) { - const referencedImageIds = viewport.getImageIds(); - const isValidVolumeForSphere = - csUtils.isValidVolume(referencedImageIds); - - if (!isValidVolumeForSphere) { - throw new Error( - 'Volume is not reconstructable for sphere manipulation' - ); - } - - const volumeId = `${segmentationId}_${viewport.id}`; - const volume = cache.getVolume(volumeId); - if (volume) { - return { - imageId: segmentationImageId, - segmentsLocked, - override: { - voxelManager: volume.voxelManager, - imageData: volume.imageData, - }, - }; - } else { - // We don't need to call `getStackSegmentationImageIdsForViewport` here - // because we've already ensured the stack constructs a volume, - // making the scenario for multi-image non-consistent metadata is not likely. - const { imageIds: labelmapImageIds } = - representationData.Labelmap as LabelmapSegmentationDataStack; - - if (!labelmapImageIds || labelmapImageIds.length === 1) { - return { - imageId: segmentationImageId, - segmentsLocked, - }; - } - - // it will return the cached volume if it already exists - const volume = volumeLoader.createAndCacheVolumeFromImagesSync( - volumeId, - labelmapImageIds - ); - - return { - imageId: segmentationImageId, - segmentsLocked, - override: { - voxelManager: volume.voxelManager, - imageData: volume.imageData, - }, - }; - } - } else { - return { - imageId: segmentationImageId, - segmentsLocked, - }; - } + return { + imageId: segmentationImageId, + segmentsLocked, + }; } } @@ -389,8 +327,8 @@ export default class LabelmapBaseTool extends BaseTool { toolGroupId: this.toolGroupId, segmentationId, viewUp, - strategySpecificConfiguration: - this.configuration.strategySpecificConfiguration, + activeStrategy: this.configuration.activeStrategy, + configuration: this.configuration, // Provide the preview information so that data can be used directly preview: this._previewData?.preview, createMemo: this.createMemo.bind(this), diff --git a/packages/tools/src/tools/segmentation/RectangleScissorsTool.ts b/packages/tools/src/tools/segmentation/RectangleScissorsTool.ts index fa75ce9835..87f2ffc8cf 100644 --- a/packages/tools/src/tools/segmentation/RectangleScissorsTool.ts +++ b/packages/tools/src/tools/segmentation/RectangleScissorsTool.ts @@ -318,7 +318,6 @@ class RectangleScissorsTool extends LabelmapBaseTool { const operationData = { ...this.editData, points: data.handles.points, - strategySpecificConfiguration: {}, createMemo: this.createMemo.bind(this), }; diff --git a/packages/tools/src/tools/segmentation/SphereScissorsTool.ts b/packages/tools/src/tools/segmentation/SphereScissorsTool.ts index 6bf7a82cff..d004d4eb62 100644 --- a/packages/tools/src/tools/segmentation/SphereScissorsTool.ts +++ b/packages/tools/src/tools/segmentation/SphereScissorsTool.ts @@ -184,7 +184,6 @@ class SphereScissorsTool extends LabelmapBaseTool { representationData, segmentsLocked, segmentationId, - volumeOperation: true, }); this.editData = { diff --git a/packages/tools/src/tools/segmentation/strategies/BrushStrategy.ts b/packages/tools/src/tools/segmentation/strategies/BrushStrategy.ts index 663dee7a09..5a8e68cd7c 100644 --- a/packages/tools/src/tools/segmentation/strategies/BrushStrategy.ts +++ b/packages/tools/src/tools/segmentation/strategies/BrushStrategy.ts @@ -33,8 +33,20 @@ export type InitializedOperationData = LabelmapToolOperationDataAny & { previewSegmentIndex?: number; brushStrategy: BrushStrategy; + activeStrategy: string; // eslint-disable-next-line @typescript-eslint/no-explicit-any - configuration?: Record; + configuration?: { + [key: string]: unknown; + centerSegmentIndex?: { + segmentIndex: number; + }; + threshold?: { + range?: number[]; + isDynamic: boolean; + dynamicRadius: number; + dynamicRadiusInCanvas?: number; + }; + }; memo?: LabelmapMemo; }; @@ -66,13 +78,13 @@ export type Composition = CompositionFunction | CompositionInstance; * * These combine to form an actual brush: * - * Circle - convexFill, defaultSetValue, inEllipse/boundingbox ellipse, empty threshold - * Rectangle - - convexFill, defaultSetValue, inRectangle/boundingbox rectangle, empty threshold + * Circle - convexFill, defaultSetValue, inEllipse/bounding box ellipse, empty threshold + * Rectangle - - convexFill, defaultSetValue, inRectangle/bounding box rectangle, empty threshold * might also get parameter values from input, init for setup of convexFill * * The pieces are combined to generate a strategyFunction, which performs * the actual strategy operation, as well as various callbacks for the strategy - * to allow more control over behaviour in the specific strategy (such as displaying + * to allow more control over behavior in the specific strategy (such as displaying * preview) */ @@ -119,6 +131,13 @@ export default class BrushStrategy { [StrategyCallbacks.ComputeInnerCircleRadius]: addListMethod( StrategyCallbacks.ComputeInnerCircleRadius ), + [StrategyCallbacks.EnsureSegmentationVolumeFor3DManipulation]: + addListMethod( + StrategyCallbacks.EnsureSegmentationVolumeFor3DManipulation + ), + [StrategyCallbacks.EnsureImageVolumeFor3DManipulation]: addListMethod( + StrategyCallbacks.EnsureImageVolumeFor3DManipulation + ), [StrategyCallbacks.AddPreview]: addListMethod(StrategyCallbacks.AddPreview), [StrategyCallbacks.GetStatistics]: addSingletonMethod( StrategyCallbacks.GetStatistics @@ -182,13 +201,13 @@ export default class BrushStrategy { return; } - const { strategySpecificConfiguration = {}, centerIJK } = initializedData; + const { configuration = {}, centerIJK } = initializedData; // Store the center IJK location so that we can skip an immediate same-point update // TODO - move this to the BrushTool - if (csUtils.isEqual(centerIJK, strategySpecificConfiguration.centerIJK)) { + if (csUtils.isEqual(centerIJK, configuration.centerIJK)) { return operationData.preview; } else { - strategySpecificConfiguration.centerIJK = centerIJK; + configuration.centerIJK = centerIJK; } this._fill.forEach((func) => func(initializedData)); @@ -227,7 +246,8 @@ export default class BrushStrategy { operationName?: string ): InitializedOperationData { const { viewport } = enabledElement; - const data = getStrategyData({ operationData, viewport }); + + const data = getStrategyData({ operationData, viewport, strategy: this }); if (!data) { console.warn('No data found for BrushStrategy'); @@ -240,14 +260,10 @@ export default class BrushStrategy { segmentationImageData, } = data; - const segmentationVoxelManagerToUse = - operationData.override?.voxelManager || segmentationVoxelManager; - const segmentationImageDataToUse = - operationData.override?.imageData || segmentationImageData; - const previewVoxelManager = operationData.preview?.previewVoxelManager || VoxelManager.createRLEHistoryVoxelManager(segmentationVoxelManager); + const previewEnabled = !!operationData.previewColors; const previewSegmentIndex = previewEnabled ? 255 : undefined; @@ -257,8 +273,8 @@ export default class BrushStrategy { ...operationData, enabledElement, imageVoxelManager, - segmentationVoxelManager: segmentationVoxelManagerToUse, - segmentationImageData: segmentationImageDataToUse, + segmentationVoxelManager, + segmentationImageData, previewVoxelManager, viewport, centerWorld: null, @@ -268,7 +284,6 @@ export default class BrushStrategy { }; this._initialize.forEach((func) => func(initializedData)); - return initializedData; } diff --git a/packages/tools/src/tools/segmentation/strategies/compositions/determineSegmentIndex.ts b/packages/tools/src/tools/segmentation/strategies/compositions/determineSegmentIndex.ts index 148181e628..feff8e3ad5 100644 --- a/packages/tools/src/tools/segmentation/strategies/compositions/determineSegmentIndex.ts +++ b/packages/tools/src/tools/segmentation/strategies/compositions/determineSegmentIndex.ts @@ -20,14 +20,13 @@ import type { Types } from '@cornerstonejs/core'; */ export default { [StrategyCallbacks.Initialize]: (operationData: InitializedOperationData) => { - const { strategySpecificConfiguration } = operationData; - if (!strategySpecificConfiguration) { + const { centerSegmentIndex } = operationData.configuration || {}; + + if (!centerSegmentIndex) { return; } - const { centerSegmentIndex } = strategySpecificConfiguration; - if (centerSegmentIndex) { - operationData.segmentIndex = centerSegmentIndex.segmentIndex; - } + + operationData.segmentIndex = centerSegmentIndex.segmentIndex; }, [StrategyCallbacks.OnInteractionStart]: ( @@ -38,16 +37,17 @@ export default { previewSegmentIndex, segmentationVoxelManager, centerIJK, - strategySpecificConfiguration, viewPlaneNormal, segmentationImageData, preview, + configuration, } = operationData; - if (!strategySpecificConfiguration?.useCenterSegmentIndex) { + + if (!configuration?.useCenterSegmentIndex) { return; } // Get rid of the previous data - delete strategySpecificConfiguration.centerSegmentIndex; + delete configuration.centerSegmentIndex; let hasSegmentIndex = false; let hasPreviewIndex = false; @@ -91,7 +91,7 @@ export default { existingValue = null; } operationData.segmentIndex = existingValue; - strategySpecificConfiguration.centerSegmentIndex = { + configuration.centerSegmentIndex = { segmentIndex: existingValue, }; }, diff --git a/packages/tools/src/tools/segmentation/strategies/compositions/dynamicThreshold.ts b/packages/tools/src/tools/segmentation/strategies/compositions/dynamicThreshold.ts index 1a801a9f71..57c5706c64 100644 --- a/packages/tools/src/tools/segmentation/strategies/compositions/dynamicThreshold.ts +++ b/packages/tools/src/tools/segmentation/strategies/compositions/dynamicThreshold.ts @@ -17,15 +17,14 @@ export default { const { operationName, centerIJK, - strategySpecificConfiguration, segmentationVoxelManager, imageVoxelManager, + configuration, segmentIndex, viewport, } = operationData; - const { THRESHOLD } = strategySpecificConfiguration; - if (!THRESHOLD?.isDynamic || !centerIJK || !segmentIndex) { + if (!configuration?.threshold?.isDynamic || !centerIJK || !segmentIndex) { return; } if ( @@ -36,7 +35,7 @@ export default { } const boundsIJK = segmentationVoxelManager.getBoundsIJK(); - const { threshold: oldThreshold, dynamicRadius = 0 } = THRESHOLD; + const { range: oldThreshold, dynamicRadius = 0 } = configuration.threshold; const useDelta = oldThreshold ? 0 : dynamicRadius; const { viewPlaneNormal } = viewport.getCamera(); @@ -73,35 +72,39 @@ export default { }; imageVoxelManager.forEach(callback, { boundsIJK: nestedBounds }); - operationData.strategySpecificConfiguration.THRESHOLD.threshold = threshold; + configuration.threshold.range = threshold; }, // Setup a clear threshold value on mouse/touch down [StrategyCallbacks.OnInteractionStart]: ( operationData: InitializedOperationData ) => { - const { strategySpecificConfiguration, preview } = operationData; - if (!strategySpecificConfiguration?.THRESHOLD?.isDynamic && !preview) { + const { configuration } = operationData; + + if (!configuration?.threshold?.isDynamic) { return; } - strategySpecificConfiguration.THRESHOLD.threshold = null; + + configuration.threshold.range = null; }, /** * It computes the inner circle radius in canvas coordinates and stores it - * in the strategySpecificConfiguration. This is used to show the user - * the area that is used to compute the threshold. + * This is used to show the user the area that is used to compute the threshold. */ [StrategyCallbacks.ComputeInnerCircleRadius]: ( operationData: InitializedOperationData ) => { const { configuration, viewport } = operationData; - const { THRESHOLD: { dynamicRadius = 0 } = {} } = - configuration.strategySpecificConfiguration || {}; + const { dynamicRadius = 0, isDynamic } = configuration.threshold; + + if (!isDynamic) { + configuration.threshold.dynamicRadiusInCanvas = 0; + return; + } if (dynamicRadius === 0) { return; } - // @ts-ignore const imageData = viewport.getImageData(); if (!imageData) { @@ -125,18 +128,12 @@ export default { centerCanvas[0] - offSetCenterCanvas[0] ); - // this is a bit of a hack, since we have switched to using THRESHOLD - // as strategy but really strategy names are CIRCLE_THRESHOLD and SPHERE_THRESHOLD - // and we can't really change the name of the strategy in the configuration - const { strategySpecificConfiguration, activeStrategy } = configuration; - - if (!strategySpecificConfiguration[activeStrategy]) { - strategySpecificConfiguration[activeStrategy] = {}; + if (!configuration.threshold.dynamicRadiusInCanvas) { + configuration.threshold.dynamicRadiusInCanvas = 0; } // Add a couple of pixels to the radius to make it more obvious what is // included. - strategySpecificConfiguration[activeStrategy].dynamicRadiusInCanvas = - 3 + dynamicRadiusInCanvas; + configuration.threshold.dynamicRadiusInCanvas = 3 + dynamicRadiusInCanvas; }, }; diff --git a/packages/tools/src/tools/segmentation/strategies/compositions/ensureImageVolume.ts b/packages/tools/src/tools/segmentation/strategies/compositions/ensureImageVolume.ts new file mode 100644 index 0000000000..d374299f49 --- /dev/null +++ b/packages/tools/src/tools/segmentation/strategies/compositions/ensureImageVolume.ts @@ -0,0 +1,50 @@ +import { cache, utilities as csUtils, volumeLoader } from '@cornerstonejs/core'; +import StrategyCallbacks from '../../../../enums/StrategyCallbacks'; +import { getSegmentation } from '../../../../stateManagement/segmentation/getSegmentation'; +import type { LabelmapSegmentationDataStack } from '../../../../types'; + +export default { + [StrategyCallbacks.EnsureImageVolumeFor3DManipulation]: (data) => { + const { operationData, viewport } = data; + + let referencedImageIds; + if (viewport) { + referencedImageIds = viewport.getImageIds(); + const isValidVolumeForSphere = csUtils.isValidVolume(referencedImageIds); + if (!isValidVolumeForSphere) { + throw new Error( + 'Volume is not reconstructable for sphere manipulation' + ); + } + } else { + const segmentation = getSegmentation(operationData.segmentationId); + const imageIds = ( + segmentation.representationData + .Labelmap as LabelmapSegmentationDataStack + ).imageIds; + + referencedImageIds = imageIds.map((imageId) => { + const image = cache.getImage(imageId); + return image.referencedImageId; + }); + } + + const volumeId = cache.generateVolumeId(referencedImageIds); + + let imageVolume = cache.getVolume(volumeId); + if (imageVolume) { + operationData.imageVoxelManager = imageVolume.voxelManager; + operationData.imageData = imageVolume.imageData; + return; + } + + // it will return the cached volume if it already exists + imageVolume = volumeLoader.createAndCacheVolumeFromImagesSync( + volumeId, + referencedImageIds + ); + + operationData.imageVoxelManager = imageVolume.voxelManager; + operationData.imageData = imageVolume.imageData; + }, +}; diff --git a/packages/tools/src/tools/segmentation/strategies/compositions/ensureSegmentationVolume.ts b/packages/tools/src/tools/segmentation/strategies/compositions/ensureSegmentationVolume.ts new file mode 100644 index 0000000000..03f6ec93cc --- /dev/null +++ b/packages/tools/src/tools/segmentation/strategies/compositions/ensureSegmentationVolume.ts @@ -0,0 +1,26 @@ +import { utilities, cache } from '@cornerstonejs/core'; +import StrategyCallbacks from '../../../../enums/StrategyCallbacks'; +import getOrCreateSegmentationVolume from '../../../../utilities/segmentation/getOrCreateSegmentationVolume'; + +export default { + [StrategyCallbacks.EnsureSegmentationVolumeFor3DManipulation]: (data) => { + const { operationData, viewport } = data; + const { segmentationId, imageIds: segImageIds } = operationData; + + // Get referenced image IDs from viewport or from segmentation image IDs + const referencedImageIds = viewport + ? viewport.getImageIds() + : segImageIds.map((imageId) => cache.getImage(imageId).referencedImageId); + + const isValidVolumeForSphere = utilities.isValidVolume(referencedImageIds); + if (!isValidVolumeForSphere) { + throw new Error('Volume is not reconstructable for sphere manipulation'); + } + + const segVolume = getOrCreateSegmentationVolume(segmentationId); + + operationData.segmentationVoxelManager = segVolume.voxelManager; + operationData.segmentationImageData = segVolume.imageData; + return; + }, +}; diff --git a/packages/tools/src/tools/segmentation/strategies/compositions/index.ts b/packages/tools/src/tools/segmentation/strategies/compositions/index.ts index d809b2c8f8..a1fdf3c894 100644 --- a/packages/tools/src/tools/segmentation/strategies/compositions/index.ts +++ b/packages/tools/src/tools/segmentation/strategies/compositions/index.ts @@ -7,7 +7,8 @@ import regionFill from './regionFill'; import setValue from './setValue'; import threshold from './threshold'; import labelmapStatistics from './labelmapStatistics'; -import labelmapInterpolation from './labelmapInterpolation'; +import ensureSegmentationVolumeFor3DManipulation from './ensureSegmentationVolume'; +import ensureImageVolumeFor3DManipulation from './ensureImageVolume'; export default { determineSegmentIndex, @@ -19,5 +20,6 @@ export default { setValue, threshold, labelmapStatistics, - labelmapInterpolation, + ensureSegmentationVolumeFor3DManipulation, + ensureImageVolumeFor3DManipulation, }; diff --git a/packages/tools/src/tools/segmentation/strategies/compositions/islandRemovalComposition.ts b/packages/tools/src/tools/segmentation/strategies/compositions/islandRemovalComposition.ts index a3a7cf90aa..8c68211221 100644 --- a/packages/tools/src/tools/segmentation/strategies/compositions/islandRemovalComposition.ts +++ b/packages/tools/src/tools/segmentation/strategies/compositions/islandRemovalComposition.ts @@ -15,15 +15,18 @@ export default { operationData: InitializedOperationData ) => { const { - strategySpecificConfiguration, previewSegmentIndex, segmentIndex, viewport, previewVoxelManager, segmentationVoxelManager, + activeStrategy, } = operationData; - if (!strategySpecificConfiguration.THRESHOLD || segmentIndex === null) { + if ( + activeStrategy !== 'THRESHOLD_INSIDE_SPHERE_WITH_ISLAND_REMOVAL' || + segmentIndex === null + ) { return; } diff --git a/packages/tools/src/tools/segmentation/strategies/compositions/labelmapInterpolation.ts b/packages/tools/src/tools/segmentation/strategies/compositions/labelmapInterpolation.ts deleted file mode 100644 index 6fc650fced..0000000000 --- a/packages/tools/src/tools/segmentation/strategies/compositions/labelmapInterpolation.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { utilities, peerImport } from '@cornerstonejs/core'; -import type { InitializedOperationData } from '../BrushStrategy'; -import StrategyCallbacks from '../../../../enums/StrategyCallbacks'; -import getItkImage from '../utils/getItkImage'; -import { triggerSegmentationDataModified } from '../../../../stateManagement/segmentation/triggerSegmentationEvents'; -import PreviewMethods from './preview'; - -type MorphologicalContourInterpolationOptions = { - label?: number; - axis?: number; - noHeuristicAlignment?: boolean; - noUseDistanceTransform?: boolean; - useCustomSlicePositions?: boolean; -}; - -/** - * Adds an isWithinThreshold to the operation data that checks that the - * image value is within threshold[0]...threshold[1] - * No-op if threshold not defined. - */ -export default { - [StrategyCallbacks.Interpolate]: async ( - operationData: InitializedOperationData, - configuration: MorphologicalContourInterpolationOptions - ) => { - const { - segmentationImageData, - segmentIndex, - preview, - segmentationVoxelManager, - previewSegmentIndex, - previewVoxelManager, - } = operationData; - - if (preview) { - // Mark everything as segment index value so the interpolation works - const callback = ({ index }) => { - segmentationVoxelManager.setAtIndex(index, segmentIndex); - }; - previewVoxelManager.forEach(callback); - } - - let itkModule; - try { - // Use peerImport instead of dynamic import - itkModule = await peerImport( - '@itk-wasm/morphological-contour-interpolation' - ); - if (!itkModule) { - throw new Error('Module not found'); - } - } catch (error) { - console.warn( - "Warning: '@itk-wasm/morphological-contour-interpolation' module not found. Please install it separately." - ); - return operationData; - } - - let inputImage; - try { - inputImage = await getItkImage(segmentationImageData, 'interpolation'); - if (!inputImage) { - throw new Error('Failed to get ITK image'); - } - } catch (error) { - console.warn('Warning: Failed to get ITK image for interpolation'); - return operationData; - } - - const outputPromise = itkModule.morphologicalContourInterpolation( - inputImage, - { - ...configuration, - label: segmentIndex, - webWorker: false, - } - ); - outputPromise.then((value) => { - const { outputImage } = value; - - const previewColors = operationData.configuration?.preview?.previewColors; - const assignIndex = - previewSegmentIndex ?? (previewColors ? 255 : segmentIndex); - // Reset the colors - needs operation data set to do this - operationData.previewColors ||= previewColors; - operationData.previewSegmentIndex ||= previewColors ? 255 : undefined; - PreviewMethods[StrategyCallbacks.Initialize](operationData); - - segmentationVoxelManager.forEach(({ value: originalValue, index }) => { - const newValue = outputImage.data[index]; - if (newValue === originalValue) { - return; - } - previewVoxelManager.setAtIndex(index, assignIndex); - }); - - triggerSegmentationDataModified( - operationData.segmentationId, - previewVoxelManager.getArrayOfModifiedSlices(), - assignIndex - ); - }); - return operationData; - }, -}; diff --git a/packages/tools/src/tools/segmentation/strategies/compositions/labelmapStatistics.ts b/packages/tools/src/tools/segmentation/strategies/compositions/labelmapStatistics.ts index 49ee1514cd..ad3868196f 100644 --- a/packages/tools/src/tools/segmentation/strategies/compositions/labelmapStatistics.ts +++ b/packages/tools/src/tools/segmentation/strategies/compositions/labelmapStatistics.ts @@ -1,15 +1,6 @@ import StrategyCallbacks from '../../../../enums/StrategyCallbacks'; import type { InitializedOperationData } from '../BrushStrategy'; -import VolumetricCalculator from '../../../../utilities/segmentation/VolumetricCalculator'; -import { getActiveSegmentIndex } from '../../../../stateManagement/segmentation/getActiveSegmentIndex'; -import { getStrategyData } from '../utils/getStrategyData'; -import { utilities, type Types } from '@cornerstonejs/core'; -import { getPixelValueUnits } from '../../../../utilities/getPixelValueUnits'; -import { AnnotationTool } from '../../../base'; -import { isViewportPreScaled } from '../../../../utilities/viewport/isViewportPreScaled'; - -// Radius for a volume of 10, eg 1 cm^3 = 1000 mm^3 -const radiusForVol1 = Math.pow((3 * 1000) / (4 * Math.PI), 1 / 3); +import getStatistics from '../../../../utilities/segmentation/getStatistics'; /** * Compute basic labelmap segmentation statistics. @@ -20,139 +11,11 @@ export default { operationData: InitializedOperationData, options?: { indices?: number | number[] } ) { - const { viewport } = enabledElement; - let { indices } = options; - const { segmentationId } = operationData; - if (!indices) { - indices = [getActiveSegmentIndex(segmentationId)]; - } else if (!Array.isArray(indices)) { - // Include the preview index - indices = [indices, 255]; - } - const indicesArr = indices as number[]; - - const { - segmentationVoxelManager, - imageVoxelManager, - segmentationImageData, - } = getStrategyData({ - operationData, - viewport, + const { indices } = options; + const { segmentationId, viewport } = operationData; + getStatistics({ + segmentationId, + segmentIndices: indices, }); - - const spacing = segmentationImageData.getSpacing(); - - const { boundsIJK: boundsOrig } = segmentationVoxelManager; - if (!boundsOrig) { - return VolumetricCalculator.getStatistics({ spacing }); - } - - segmentationVoxelManager.forEach((voxel) => { - const { value, pointIJK } = voxel; - if (indicesArr.indexOf(value) === -1) { - return; - } - const imageValue = imageVoxelManager.getAtIJKPoint(pointIJK); - VolumetricCalculator.statsCallback({ value: imageValue, pointIJK }); - }); - const targetId = viewport.getViewReferenceId(); - const modalityUnitOptions = { - isPreScaled: isViewportPreScaled(viewport, targetId), - isSuvScaled: AnnotationTool.isSuvScaled( - viewport, - targetId, - viewport.getCurrentImageId() - ), - }; - - const imageData = (viewport as Types.IVolumeViewport).getImageData(); - const unit = getPixelValueUnits( - imageData.metadata.Modality, - viewport.getCurrentImageId(), - modalityUnitOptions - ); - - const stats = VolumetricCalculator.getStatistics({ spacing, unit }); - const { maxIJKs } = stats; - if (!maxIJKs?.length) { - return stats; - } - - // The calculation isn't very good at setting units - stats.mean.unit = unit; - stats.max.unit = unit; - stats.min.unit = unit; - - if (unit !== 'SUV') { - return stats; - } - - // Get the IJK rounded radius, not using less than 1, and using the - // radius for the spacing given the desired mm spacing of 10 - // Add 10% to the radius to account for whole pixel in/out issues - const radiusIJK = spacing.map((s) => - Math.max(1, Math.round((1.1 * radiusForVol1) / s)) - ); - for (const testMax of maxIJKs) { - const testStats = getSphereStats( - testMax, - radiusIJK, - segmentationImageData, - imageVoxelManager, - spacing - ); - if (!testStats) { - continue; - } - const { mean } = testStats; - // @ts-expect-error - TODO: fix this - if (!stats.peakValue || stats.peakValue.value <= mean.value) { - // @ts-expect-error - TODO: fix this - stats.peakValue = { - name: 'peakValue', - label: 'Peak Value', - value: mean.value, - unit, - }; - } - } - - return stats; }, }; - -/** - * Gets the statistics for a 1 cm^3 sphere centered on radiusIJK. - * Assumes the segmentation and pixel data are co-incident. - */ -function getSphereStats(testMax, radiusIJK, segData, imageVoxels, spacing) { - const { pointIJK: centerIJK } = testMax; - const boundsIJK = centerIJK.map((ijk, idx) => [ - ijk - radiusIJK[idx], - ijk + radiusIJK[idx], - ]); - const testFunction = (_pointLPS, pointIJK) => { - const i = (pointIJK[0] - centerIJK[0]) / radiusIJK[0]; - const j = (pointIJK[1] - centerIJK[1]) / radiusIJK[1]; - const k = (pointIJK[2] - centerIJK[2]) / radiusIJK[2]; - const radius = i * i + j * j + k * k; - return radius <= 1; - }; - const statsFunction = ({ pointIJK, pointLPS }) => { - const value = imageVoxels.getAtIJKPoint(pointIJK); - if (value === undefined) { - return; - } - VolumetricCalculator.statsCallback({ value, pointLPS, pointIJK }); - }; - VolumetricCalculator.statsInit({ storePointData: false }); - // pointInShapeCallback(segData, testFunction, statsFunction, boundsIJK); - - utilities.pointInShapeCallback(segData, { - pointInShapeFn: testFunction, - callback: statsFunction, - boundsIJK, - }); - - return VolumetricCalculator.getStatistics({ spacing }); -} diff --git a/packages/tools/src/tools/segmentation/strategies/compositions/preview.ts b/packages/tools/src/tools/segmentation/strategies/compositions/preview.ts index 8c36fd84e8..8e402b9f81 100644 --- a/packages/tools/src/tools/segmentation/strategies/compositions/preview.ts +++ b/packages/tools/src/tools/segmentation/strategies/compositions/preview.ts @@ -28,9 +28,9 @@ export default { [StrategyCallbacks.Preview]: function ( operationData: InitializedOperationData ) { - const { previewColors, strategySpecificConfiguration, enabledElement } = - operationData; - if (!previewColors || !strategySpecificConfiguration) { + const { previewColors, configuration, enabledElement } = operationData; + + if (!previewColors || !configuration) { return; } @@ -38,16 +38,19 @@ export default { if (operationData.preview) { delete operationData.preview; } - delete strategySpecificConfiguration.centerSegmentIndex; + + delete configuration.centerSegmentIndex; // Now generate a normal preview as though the user had clicked, filled, released this.onInteractionStart?.(enabledElement, operationData); + const preview = this.fill(enabledElement, operationData); if (preview) { preview.isPreviewFromHover = true; operationData.preview = preview; this.onInteractionEnd?.(enabledElement, operationData); } + return preview; }, @@ -125,6 +128,7 @@ export default { if (previewSegmentIndex === undefined) { return; } + const segmentIndex = preview?.segmentIndex ?? operationData.segmentIndex; if (!previewVoxelManager || previewVoxelManager.modifiedSlices.size === 0) { return; @@ -175,7 +179,7 @@ export default { previewVoxelManager.forEach(callback); // Primarily rejects back to zero, so use 0 as the segment index - even - // if somtimes it modifies the data to other values on reject. + // if sometimes it modifies the data to other values on reject. triggerSegmentationDataModified( operationData.segmentationId, previewVoxelManager.getArrayOfModifiedSlices(), diff --git a/packages/tools/src/tools/segmentation/strategies/compositions/threshold.ts b/packages/tools/src/tools/segmentation/strategies/compositions/threshold.ts index f4fb26c09f..254e334602 100644 --- a/packages/tools/src/tools/segmentation/strategies/compositions/threshold.ts +++ b/packages/tools/src/tools/segmentation/strategies/compositions/threshold.ts @@ -12,26 +12,24 @@ export default { [StrategyCallbacks.CreateIsInThreshold]: ( operationData: InitializedOperationData ) => { - const { imageVoxelManager, strategySpecificConfiguration, segmentIndex } = - operationData; - if (!strategySpecificConfiguration || !segmentIndex) { + const { imageVoxelManager, segmentIndex, configuration } = operationData; + + if (!configuration || !segmentIndex) { return; } - return (index) => { - const { THRESHOLD, THRESHOLD_INSIDE_CIRCLE } = - strategySpecificConfiguration; + return (index) => { const voxelValue = imageVoxelManager.getAtIndex(index); const gray = Array.isArray(voxelValue) ? vec3.length(voxelValue as Types.Point3) : voxelValue; - // Prefer the generic version of the THRESHOLD configuration, but fallback - // to the older THRESHOLD_INSIDE_CIRCLE version. - const { threshold } = THRESHOLD || THRESHOLD_INSIDE_CIRCLE || {}; - if (!threshold?.length) { + + const { threshold } = configuration || {}; + + if (!threshold?.range?.length) { return true; } - return threshold[0] <= gray && gray <= threshold[1]; + return threshold.range[0] <= gray && gray <= threshold.range[1]; }; }, }; diff --git a/packages/tools/src/tools/segmentation/strategies/fillCircle.ts b/packages/tools/src/tools/segmentation/strategies/fillCircle.ts index eb66bf44c2..cc6e39f5d2 100644 --- a/packages/tools/src/tools/segmentation/strategies/fillCircle.ts +++ b/packages/tools/src/tools/segmentation/strategies/fillCircle.ts @@ -126,8 +126,7 @@ const CIRCLE_STRATEGY = new BrushStrategy( initializeCircle, compositions.determineSegmentIndex, compositions.preview, - compositions.labelmapStatistics, - compositions.labelmapInterpolation + compositions.labelmapStatistics ); const CIRCLE_THRESHOLD_STRATEGY = new BrushStrategy( @@ -140,8 +139,7 @@ const CIRCLE_THRESHOLD_STRATEGY = new BrushStrategy( compositions.threshold, compositions.preview, compositions.islandRemoval, - compositions.labelmapStatistics, - compositions.labelmapInterpolation + compositions.labelmapStatistics ); /** diff --git a/packages/tools/src/tools/segmentation/strategies/fillRectangle.ts b/packages/tools/src/tools/segmentation/strategies/fillRectangle.ts index a5d03973fb..4513f18848 100644 --- a/packages/tools/src/tools/segmentation/strategies/fillRectangle.ts +++ b/packages/tools/src/tools/segmentation/strategies/fillRectangle.ts @@ -145,7 +145,6 @@ const RECTANGLE_STRATEGY = new BrushStrategy( compositions.determineSegmentIndex, compositions.preview, compositions.labelmapStatistics - // compositions.labelmapInterpolation ); const RECTANGLE_THRESHOLD_STRATEGY = new BrushStrategy( @@ -159,7 +158,6 @@ const RECTANGLE_THRESHOLD_STRATEGY = new BrushStrategy( compositions.preview, compositions.islandRemoval, compositions.labelmapStatistics - // compositions.labelmapInterpolation ); /** diff --git a/packages/tools/src/tools/segmentation/strategies/fillSphere.ts b/packages/tools/src/tools/segmentation/strategies/fillSphere.ts index 34886098a1..31b3327c82 100644 --- a/packages/tools/src/tools/segmentation/strategies/fillSphere.ts +++ b/packages/tools/src/tools/segmentation/strategies/fillSphere.ts @@ -58,7 +58,8 @@ const SPHERE_STRATEGY = new BrushStrategy( sphereComposition, compositions.determineSegmentIndex, compositions.preview, - compositions.labelmapStatistics + compositions.labelmapStatistics, + compositions.ensureSegmentationVolumeFor3DManipulation ); /** @@ -73,7 +74,9 @@ const SPHERE_THRESHOLD_STRATEGY = new BrushStrategy( 'SphereThreshold', ...SPHERE_STRATEGY.compositions, compositions.dynamicThreshold, - compositions.threshold + compositions.threshold, + compositions.ensureSegmentationVolumeFor3DManipulation, + compositions.ensureImageVolumeFor3DManipulation ); const SPHERE_THRESHOLD_STRATEGY_ISLAND = new BrushStrategy( @@ -81,7 +84,9 @@ const SPHERE_THRESHOLD_STRATEGY_ISLAND = new BrushStrategy( ...SPHERE_STRATEGY.compositions, compositions.dynamicThreshold, compositions.threshold, - compositions.islandRemoval + compositions.islandRemoval, + compositions.ensureSegmentationVolumeFor3DManipulation, + compositions.ensureImageVolumeFor3DManipulation ); /** diff --git a/packages/tools/src/tools/segmentation/strategies/utils/getItkImage.ts b/packages/tools/src/tools/segmentation/strategies/utils/getItkImage.ts deleted file mode 100644 index 5c2d4cda63..0000000000 --- a/packages/tools/src/tools/segmentation/strategies/utils/getItkImage.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { peerImport } from '@cornerstonejs/core'; - -/** - * Get the ITK Image from the image data - * - * @param viewportId - Viewport Id - * @param imageName - Any random name that shall be set in the image - * @returns An ITK Image that can be used as fixed or moving image - */ -export default async function getItkImage( - imageData, - imageName?: string -): Promise { - let Image, ImageType, IntTypes, FloatTypes, PixelTypes; - - try { - const itkModule = await peerImport('itk-wasm'); - if (!itkModule) { - throw new Error('Module not found'); - } - ({ Image, ImageType, IntTypes, FloatTypes, PixelTypes } = itkModule); - } catch (error) { - console.warn( - "Warning: 'itk-wasm' module not found. Please install it separately." - ); - return null; - } - - const dataTypesMap = { - Int8: IntTypes.Int8, - UInt8: IntTypes.UInt8, - Int16: IntTypes.Int16, - UInt16: IntTypes.UInt16, - Int32: IntTypes.Int32, - UInt32: IntTypes.UInt32, - Int64: IntTypes.Int64, - UInt64: IntTypes.UInt64, - Float32: FloatTypes.Float32, - Float64: FloatTypes.Float64, - }; - - const { voxelManager } = imageData.get('voxelManager'); - const { numberOfComponents } = imageData.get('numberOfComponents'); - const scalarData = voxelManager.getCompleteScalarDataArray(); - - const dimensions = imageData.getDimensions(); - const origin = imageData.getOrigin(); - const spacing = imageData.getSpacing(); - const directionArray = imageData.getDirection(); - const direction = new Float64Array(directionArray); - const dataType = scalarData.constructor.name - .replace(/^Ui/, 'UI') - .replace(/Array$/, ''); - const metadata = undefined; - const imageType = new ImageType( - dimensions.length, - dataTypesMap[dataType], - PixelTypes.Scalar, - numberOfComponents - ); - - const image = new Image(imageType); - image.name = imageName; - image.origin = origin; - image.spacing = spacing; - image.direction = direction; - image.size = dimensions; - image.metadata = metadata; - image.data = scalarData; - - // image.data = new scalarData.constructor(scalarData.length); - // image.data.set(scalarData, 0); - - return image; -} diff --git a/packages/tools/src/tools/segmentation/strategies/utils/getStrategyData.ts b/packages/tools/src/tools/segmentation/strategies/utils/getStrategyData.ts index 31ffb3c390..ac43a6d992 100644 --- a/packages/tools/src/tools/segmentation/strategies/utils/getStrategyData.ts +++ b/packages/tools/src/tools/segmentation/strategies/utils/getStrategyData.ts @@ -3,82 +3,140 @@ import { cache, Enums, eventTarget, + type Types, } from '@cornerstonejs/core'; -import type { LabelmapToolOperationDataStack } from '../../../../types'; +import type { + LabelmapToolOperationDataStack, + LabelmapToolOperationDataVolume, +} from '../../../../types'; import { getCurrentLabelmapImageIdForViewport } from '../../../../stateManagement/segmentation/segmentationState'; import { getLabelmapActorEntry } from '../../../../stateManagement/segmentation/helpers'; -function getStrategyData({ operationData, viewport }) { - let segmentationImageData, segmentationScalarData, imageScalarData; - let imageVoxelManager; - let segmentationVoxelManager; +/** + * Get strategy data for volume viewport + * @param operationData - The operation data containing volumeId and referencedVolumeId + * @returns The strategy data for volume viewport or null if error + */ +function getStrategyDataForVolumeViewport({ operationData }) { + const { volumeId } = operationData; + + if (!volumeId) { + const event = new CustomEvent(Enums.Events.ERROR_EVENT, { + detail: { + type: 'Segmentation', + message: 'No volume id found for the segmentation', + }, + cancelable: true, + }); + eventTarget.dispatchEvent(event); + return null; + } - if (viewport instanceof BaseVolumeViewport) { - const { volumeId, referencedVolumeId } = operationData; - - if (!volumeId) { - const event = new CustomEvent(Enums.Events.ERROR_EVENT, { - detail: { - type: 'Segmentation', - message: 'No volume id found for the segmentation', - }, - cancelable: true, - }); - eventTarget.dispatchEvent(event); - return null; - } + const segmentationVolume = cache.getVolume(volumeId); - const segmentationVolume = cache.getVolume(volumeId); + if (!segmentationVolume) { + return null; + } - if (!segmentationVolume) { - return; - } - segmentationVoxelManager = segmentationVolume.voxelManager; + const referencedVolumeId = segmentationVolume.referencedVolumeId; - // we only need the referenceVolumeId if we do thresholding - // but for other operations we don't need it so make it optional - if (referencedVolumeId) { - const imageVolume = cache.getVolume(referencedVolumeId); - imageVoxelManager = imageVolume.voxelManager; - } + const segmentationVoxelManager = segmentationVolume.voxelManager; + let imageVoxelManager; + let imageData; + + // we only need the referenceVolumeId if we do thresholding + // but for other operations we don't need it so make it optional + if (referencedVolumeId) { + const imageVolume = cache.getVolume(referencedVolumeId); + imageVoxelManager = imageVolume.voxelManager; + imageData = imageVolume.imageData; + } - ({ imageData: segmentationImageData } = segmentationVolume); - // segmentationDimensions = segmentationVolume.dimensions; - } else { - const { segmentationId } = operationData as LabelmapToolOperationDataStack; + const { imageData: segmentationImageData } = segmentationVolume; + return { + segmentationImageData, + segmentationVoxelManager, + segmentationScalarData: null, + imageScalarData: null, + imageVoxelManager, + imageData, + }; +} + +/** + * Get strategy data for stack viewport + * @param operationData - The operation data containing segmentationId and imageId + * @param viewport - The viewport instance + * @returns The strategy data for stack viewport or null if error + */ +function getStrategyDataForStackViewport({ + operationData, + viewport, + strategy, +}) { + const { segmentationId } = operationData as LabelmapToolOperationDataStack; + + let segmentationImageData; + let segmentationVoxelManager; + let segmentationScalarData; + let imageScalarData; + let imageVoxelManager; + let imageData; + if (strategy.ensureSegmentationVolumeFor3DManipulation) { + // Todo: I don't know how to handle this, seems like strategies cannot return anything + // and just manipulate the operationData? + strategy.ensureSegmentationVolumeFor3DManipulation({ + operationData, + viewport, + }); + + segmentationVoxelManager = operationData.segmentationVoxelManager; + segmentationImageData = operationData.segmentationImageData; + segmentationScalarData = null; + } else { const labelmapImageId = getCurrentLabelmapImageIdForViewport( viewport.id, segmentationId ); if (!labelmapImageId) { - return; - } - - const currentImageId = viewport.getCurrentImageId(); - if (!currentImageId) { - return; + return null; } - const actorEntry = getLabelmapActorEntry(viewport.id, segmentationId); if (!actorEntry) { - return; + return null; } - const currentSegImage = cache.getImage(labelmapImageId); segmentationImageData = actorEntry.actor.getMapper().getInputData(); segmentationVoxelManager = currentSegImage.voxelManager; + const currentSegmentationImageId = operationData.imageId; const segmentationImage = cache.getImage(currentSegmentationImageId); if (!segmentationImage) { - return; + return null; } segmentationScalarData = segmentationImage.getPixelData?.(); + } + + if (strategy.ensureImageVolumeFor3DManipulation) { + strategy.ensureImageVolumeFor3DManipulation({ + operationData, + viewport, + }); + + imageVoxelManager = operationData.imageVoxelManager; + imageScalarData = operationData.imageScalarData; + imageData = operationData.imageData; + } else { + const currentImageId = viewport.getCurrentImageId(); + if (!currentImageId) { + return null; + } const image = cache.getImage(currentImageId); - const imageData = image ? null : viewport.getImageData(); + imageData = image ? null : viewport.getImageData(); // VERY IMPORTANT // This is the pixel data of the image that is being segmented in the cache @@ -88,15 +146,40 @@ function getStrategyData({ operationData, viewport }) { } return { - // image data segmentationImageData, - // scalar data segmentationScalarData, imageScalarData, - // voxel managers segmentationVoxelManager, imageVoxelManager, + imageData, }; } +/** + * Get strategy data based on viewport type + * @param params - Object containing operationData and viewport + * @returns The strategy data or null if error + */ +function getStrategyData({ + operationData, + viewport, + strategy, +}: { + operationData: + | LabelmapToolOperationDataStack + | LabelmapToolOperationDataVolume; + viewport?: Types.IStackViewport | Types.IVolumeViewport; + strategy: unknown; +}) { + if ( + ('volumeId' in operationData && operationData.volumeId != null) || + ('referencedVolumeId' in operationData && + operationData.referencedVolumeId != null) + ) { + return getStrategyDataForVolumeViewport({ operationData }); + } + + return getStrategyDataForStackViewport({ operationData, viewport, strategy }); +} + export { getStrategyData }; diff --git a/packages/tools/src/tools/segmentation/strategies/utils/isWithinThreshold.ts b/packages/tools/src/tools/segmentation/strategies/utils/isWithinThreshold.ts index 37564d7794..27646b2aa0 100644 --- a/packages/tools/src/tools/segmentation/strategies/utils/isWithinThreshold.ts +++ b/packages/tools/src/tools/segmentation/strategies/utils/isWithinThreshold.ts @@ -3,18 +3,16 @@ import type { Types } from '@cornerstonejs/core'; function isWithinThreshold( index: number, imageScalarData: Types.PixelDataTypedArray, - strategySpecificConfiguration: { - THRESHOLD?: { threshold: number[] }; - THRESHOLD_INSIDE_CIRCLE?: { threshold: number[] }; + threshold: { + range: number[]; } ) { - const { THRESHOLD, THRESHOLD_INSIDE_CIRCLE } = strategySpecificConfiguration; + if (!threshold) { + return true; + } const voxelValue = imageScalarData[index]; - // Prefer the generic version of the THRESHOLD configuration, but fallback - // to the older THRESHOLD_INSIDE_CIRCLE version. - const { threshold } = THRESHOLD || THRESHOLD_INSIDE_CIRCLE; - return threshold[0] <= voxelValue && voxelValue <= threshold[1]; + return threshold.range[0] <= voxelValue && voxelValue <= threshold.range[1]; } export default isWithinThreshold; diff --git a/packages/tools/src/types/CalculatorTypes.ts b/packages/tools/src/types/CalculatorTypes.ts index e78be70576..b68dfc566f 100644 --- a/packages/tools/src/types/CalculatorTypes.ts +++ b/packages/tools/src/types/CalculatorTypes.ts @@ -5,6 +5,8 @@ type Statistics = { label?: string; value: number | number[]; unit: null | string; + pointIJK?: Types.Point3; + pointLPS?: Types.Point3; }; type NamedStatistics = { diff --git a/packages/tools/src/types/EventTypes.ts b/packages/tools/src/types/EventTypes.ts index c5d893a8b9..8850f50385 100644 --- a/packages/tools/src/types/EventTypes.ts +++ b/packages/tools/src/types/EventTypes.ts @@ -128,14 +128,17 @@ type AnnotationCompletedEventDetail = { * The data that is passed to the event handler when an annotation is modified. */ type AnnotationModifiedEventDetail = { - /** unique id of the viewport */ - viewportId: string; - /** unique id of the rendering engine */ - renderingEngineId: string; /** The annotation that is being added to the annotations manager. */ annotation: Annotation; /** The type of this change */ changeType?: ChangeTypes; + /** + * unique id of the viewport. Note this is optional and only included if the + * element is known/being modified on a given viewport + */ + viewportId?: string; + /** unique id of the rendering engine */ + renderingEngineId?: string; }; /** diff --git a/packages/tools/src/types/LabelmapToolOperationData.ts b/packages/tools/src/types/LabelmapToolOperationData.ts index 52e7c9acd6..544846689f 100644 --- a/packages/tools/src/types/LabelmapToolOperationData.ts +++ b/packages/tools/src/types/LabelmapToolOperationData.ts @@ -17,9 +17,7 @@ type LabelmapToolOperationData = { segmentsLocked: number[]; viewPlaneNormal: number[]; viewUp: number[]; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - strategySpecificConfiguration: any; - // constraintFn: (pointIJK: number) => boolean; + activeStrategy: string; points: Types.Point3[]; voxelManager; override: { diff --git a/packages/tools/src/types/ToolSpecificAnnotationTypes.ts b/packages/tools/src/types/ToolSpecificAnnotationTypes.ts index c8a73f2d93..c8b5d1e6d9 100644 --- a/packages/tools/src/types/ToolSpecificAnnotationTypes.ts +++ b/packages/tools/src/types/ToolSpecificAnnotationTypes.ts @@ -56,6 +56,15 @@ export interface ProbeAnnotation extends Annotation { }; } +export type KeyImageAnnotation = ProbeAnnotation & { + data: { + /** Indicates that the point selected is relevant rather than just the image */ + isPoint: boolean; + /** Indicates that this key image selects the entire stack/volume (series) */ + seriesLevel: boolean; + }; +}; + export interface LengthAnnotation extends Annotation { data: { handles: { diff --git a/packages/tools/src/types/index.ts b/packages/tools/src/types/index.ts index 9b05c61704..a43d199e98 100644 --- a/packages/tools/src/types/index.ts +++ b/packages/tools/src/types/index.ts @@ -82,11 +82,21 @@ import type { SplineCurveSegment } from './SplineCurveSegment'; import type { SplineLineSegment } from './SplineLineSegment'; import type { SplineProps } from './SplineProps'; import type { BidirectionalData } from '../utilities/segmentation/createBidirectionalToolData'; -import type { PolySegConversionOptions } from './PolySeg'; import type { IBaseTool } from './IBaseTool'; import type { RepresentationStyle } from './../stateManagement/segmentation/SegmentationStyle'; -import type { LabelmapStyle } from './LabelmapTypes'; -import type { SurfaceStyle } from './SurfaceTypes'; +import type { + LabelmapStyle, + LabelmapSegmentationData, + LabelmapSegmentationDataStack, + LabelmapSegmentationDataVolume, + BaseLabelmapStyle, + InactiveLabelmapStyle, +} from './LabelmapTypes'; +import type { + SurfaceStyle, + SurfaceSegmentationData, + SurfaceStateStyles, +} from './SurfaceTypes'; export type { // AnnotationState @@ -171,7 +181,6 @@ export type { SplineLineSegment, SplineProps, // polySeg - PolySegConversionOptions, IBaseTool, RepresentationStyle, Segment, @@ -179,4 +188,11 @@ export type { LabelmapStyle, ContourStyle, SurfaceStyle, + SurfaceSegmentationData, + SurfaceStateStyles, + LabelmapSegmentationData, + LabelmapSegmentationDataStack, + LabelmapSegmentationDataVolume, + BaseLabelmapStyle, + InactiveLabelmapStyle, }; diff --git a/packages/tools/src/geometricSurfaceUtils.ts b/packages/tools/src/utilities/geometricSurfaceUtils.ts similarity index 100% rename from packages/tools/src/geometricSurfaceUtils.ts rename to packages/tools/src/utilities/geometricSurfaceUtils.ts diff --git a/packages/tools/src/utilities/getPixelValueUnits.ts b/packages/tools/src/utilities/getPixelValueUnits.ts index 31563602bc..a56457ccf1 100644 --- a/packages/tools/src/utilities/getPixelValueUnits.ts +++ b/packages/tools/src/utilities/getPixelValueUnits.ts @@ -5,6 +5,14 @@ type pixelUnitsOptions = { isSuvScaled: boolean; }; +function getPixelValueUnitsImageId( + imageId: string, + options: pixelUnitsOptions +): string { + const generalSeriesModule = metaData.get('generalSeriesModule', imageId); + return getPixelValueUnits(generalSeriesModule.modality, imageId, options); +} + /** * Determines the appropriate pixel value units based on the image modality and options. * @param modality - The modality of the image (e.g., 'CT', 'PT'). @@ -57,4 +65,4 @@ function _handlePTModality( } export type { pixelUnitsOptions }; -export { getPixelValueUnits }; +export { getPixelValueUnits, getPixelValueUnitsImageId }; diff --git a/packages/tools/src/utilities/index.ts b/packages/tools/src/utilities/index.ts index fca1df2d2e..110c0d13e7 100644 --- a/packages/tools/src/utilities/index.ts +++ b/packages/tools/src/utilities/index.ts @@ -50,7 +50,11 @@ import { pointInSurroundingSphereCallback } from './pointInSurroundingSphereCall const roundNumber = utilities.roundNumber; import normalizeViewportPlane from './normalizeViewportPlane'; import IslandRemoval from './segmentation/islandRemoval'; -import { getPixelValueUnits } from './getPixelValueUnits'; +import { + getPixelValueUnits, + getPixelValueUnitsImageId, +} from './getPixelValueUnits'; +import * as geometricSurfaceUtils from './geometricSurfaceUtils'; export { math, @@ -69,6 +73,7 @@ export { getCalibratedProbeUnitsAndValue, getCalibratedAspect, getPixelValueUnits, + getPixelValueUnitsImageId, segmentation, contours, triggerAnnotationRenderForViewportIds, @@ -96,4 +101,5 @@ export { pointInSurroundingSphereCallback, normalizeViewportPlane, IslandRemoval, + geometricSurfaceUtils, }; diff --git a/packages/tools/src/utilities/math/basic/BasicStatsCalculator.ts b/packages/tools/src/utilities/math/basic/BasicStatsCalculator.ts index ab8255df08..460d405c30 100644 --- a/packages/tools/src/utilities/math/basic/BasicStatsCalculator.ts +++ b/packages/tools/src/utilities/math/basic/BasicStatsCalculator.ts @@ -9,6 +9,10 @@ export default class BasicStatsCalculator extends Calculator { private static min = [Infinity]; private static sum = [0]; private static count = 0; + private static maxIJK = null; + private static maxLPS = null; + private static minIJK = null; + private static minLPS = null; // Values for Welford's algorithm private static runMean = [0]; @@ -27,7 +31,11 @@ export default class BasicStatsCalculator extends Calculator { * This callback is used when we verify if the point is in the annotation drawn * so we can get every point in the shape to calculate the statistics */ - static statsCallback = ({ value: newValue, pointLPS = null }): void => { + static statsCallback = ({ + value: newValue, + pointLPS = null, + pointIJK = null, + }): void => { if ( Array.isArray(newValue) && newValue.length > 1 && @@ -56,7 +64,21 @@ export default class BasicStatsCalculator extends Calculator { this.m2[idx] += delta * delta2; this.min[idx] = Math.min(this.min[idx], value); - this.max[idx] = Math.max(it, value); + if (value < this.min[idx]) { + this.min[idx] = value; + if (idx === 0) { + this.minIJK = pointIJK; + this.minLPS = pointLPS; + } + } + + if (value > this.max[idx]) { + this.max[idx] = value; + if (idx === 0) { + this.maxIJK = pointIJK; + this.maxLPS = pointLPS; + } + } }); }; @@ -83,12 +105,16 @@ export default class BasicStatsCalculator extends Calculator { label: 'Max Pixel', value: singleArrayAsNumber(this.max), unit, + pointIJK: this.maxIJK, + pointLPS: this.maxLPS, }, min: { name: 'min', label: 'Min Pixel', value: singleArrayAsNumber(this.min), unit, + pointIJK: this.minIJK, + pointLPS: this.minLPS, }, mean: { name: 'mean', @@ -124,10 +150,13 @@ export default class BasicStatsCalculator extends Calculator { this.max = [-Infinity]; this.min = [Infinity]; this.sum = [0]; - // this.sumSquares = [0]; this.m2 = [0]; this.runMean = [0]; this.count = 0; + this.maxIJK = null; + this.maxLPS = null; + this.minIJK = null; + this.minLPS = null; this.pointsInShape = PointsManager.create3(1024); return named; diff --git a/packages/tools/src/utilities/registerComputeWorker.ts b/packages/tools/src/utilities/registerComputeWorker.ts new file mode 100644 index 0000000000..fa3f447ee7 --- /dev/null +++ b/packages/tools/src/utilities/registerComputeWorker.ts @@ -0,0 +1,34 @@ +import { getWebWorkerManager } from '@cornerstonejs/core'; +let registered = false; + +export function registerComputeWorker() { + if (registered) { + return; + } + + registered = true; + + const workerFn = () => { + // @ts-ignore + return new Worker( + // @ts-ignore + new URL('../workers/computeWorker.js', import.meta.url), + { + name: 'compute', + type: 'module', + } + ); + }; + + const workerManager = getWebWorkerManager(); + + const options = { + maxWorkerInstances: 1, + autoTerminateOnIdle: { + enabled: true, + idleTimeThreshold: 2000, + }, + }; + + workerManager.registerWorker('compute', workerFn, options); +} diff --git a/packages/tools/src/utilities/segmentation/brushThresholdForToolGroup.ts b/packages/tools/src/utilities/segmentation/brushThresholdForToolGroup.ts index 53cb5df298..06f8fc0a27 100644 --- a/packages/tools/src/utilities/segmentation/brushThresholdForToolGroup.ts +++ b/packages/tools/src/utilities/segmentation/brushThresholdForToolGroup.ts @@ -1,13 +1,15 @@ import type { Types } from '@cornerstonejs/core'; import { getToolGroup } from '../../store/ToolGroupManager'; import triggerAnnotationRenderForViewportIds from '../triggerAnnotationRenderForViewportIds'; -import { getRenderingEngine } from '@cornerstonejs/core'; import { getBrushToolInstances } from './getBrushToolInstances'; export function setBrushThresholdForToolGroup( toolGroupId: string, - threshold: Types.Point2, - otherArgs: Record = { isDynamic: false } + threshold: { + range: Types.Point2; + isDynamic: boolean; + dynamicRadius: number; + } ) { const toolGroup = getToolGroup(toolGroupId); @@ -16,15 +18,20 @@ export function setBrushThresholdForToolGroup( } const brushBasedToolInstances = getBrushToolInstances(toolGroupId); - const configuration = { - ...otherArgs, - ...(threshold !== undefined && { threshold }), - }; brushBasedToolInstances.forEach((tool) => { - tool.configuration.strategySpecificConfiguration.THRESHOLD = { - ...tool.configuration.strategySpecificConfiguration.THRESHOLD, - ...configuration, + const activeStrategy = tool.configuration.activeStrategy; + + if (!activeStrategy.toLowerCase().includes('threshold')) { + return; + } + + tool.configuration = { + ...tool.configuration, + threshold: { + ...tool.configuration.threshold, + ...threshold, + }, }; }); @@ -35,14 +42,10 @@ export function setBrushThresholdForToolGroup( return; } - const { renderingEngineId } = viewportsInfo[0]; - // Use helper to get array of viewportIds, or we just end up doing this mapping // ourselves here. const viewportIds = toolGroup.getViewportIds(); - const renderingEngine = getRenderingEngine(renderingEngineId); - triggerAnnotationRenderForViewportIds(viewportIds); } @@ -66,7 +69,5 @@ export function getBrushThresholdForToolGroup(toolGroupId: string) { return; } - // TODO -> Assumes the - return brushToolInstance.configuration.strategySpecificConfiguration.THRESHOLD - .threshold; + return brushToolInstance.configuration.threshold.range; } diff --git a/packages/tools/src/stateManagement/segmentation/polySeg/computeAndAddRepresentation.ts b/packages/tools/src/utilities/segmentation/computeAndAddRepresentation.ts similarity index 86% rename from packages/tools/src/stateManagement/segmentation/polySeg/computeAndAddRepresentation.ts rename to packages/tools/src/utilities/segmentation/computeAndAddRepresentation.ts index 9c79db1197..63904629d0 100644 --- a/packages/tools/src/stateManagement/segmentation/polySeg/computeAndAddRepresentation.ts +++ b/packages/tools/src/utilities/segmentation/computeAndAddRepresentation.ts @@ -1,10 +1,9 @@ import { eventTarget } from '@cornerstonejs/core'; -import type { SegmentationRepresentations } from '../../../enums'; -import { Events } from '../../../enums'; -import addRepresentationData from '../internalAddRepresentationData'; -import { triggerSegmentationModified } from '../triggerSegmentationEvents'; -import debounce from '../../../utilities/debounce'; -import { registerPolySegWorker } from './registerPolySegWorker'; +import type { SegmentationRepresentations } from '../../enums'; +import { Events } from '../../enums'; +import addRepresentationData from '../../stateManagement/segmentation/internalAddRepresentationData'; +import { triggerSegmentationModified } from '../../stateManagement/segmentation/triggerSegmentationEvents'; +import debounce from '../debounce'; const computedRepresentations = new Map< string, @@ -28,9 +27,6 @@ async function computeAndAddRepresentation( updateFunction?: () => void, onComputationComplete?: () => void ): Promise { - // register the worker if it hasn't been registered yet - registerPolySegWorker(); - // Compute the specific representation data const data = await computeFunction(); // Add the computed data to the system diff --git a/packages/tools/src/utilities/segmentation/getOrCreateSegmentationVolume.ts b/packages/tools/src/utilities/segmentation/getOrCreateSegmentationVolume.ts new file mode 100644 index 0000000000..07aba66ce4 --- /dev/null +++ b/packages/tools/src/utilities/segmentation/getOrCreateSegmentationVolume.ts @@ -0,0 +1,44 @@ +import { cache, volumeLoader } from '@cornerstonejs/core'; +import { getSegmentation } from '../../stateManagement/segmentation/getSegmentation'; +import type { + LabelmapSegmentationDataStack, + LabelmapSegmentationDataVolume, +} from '../../types/LabelmapTypes'; + +function getOrCreateSegmentationVolume(segmentationId) { + const { representationData } = getSegmentation(segmentationId); + let { volumeId } = + representationData.Labelmap as LabelmapSegmentationDataVolume; + + let segVolume; + if (volumeId) { + segVolume = cache.getVolume(volumeId); + + if (segVolume) { + return segVolume; + } + } + + const { imageIds: labelmapImageIds } = + representationData.Labelmap as LabelmapSegmentationDataStack; + + volumeId = cache.generateVolumeId(labelmapImageIds); + + // We don't need to call `getStackSegmentationImageIdsForViewport` here + // because we've already ensured the stack constructs a volume, + // making the scenario for multi-image non-consistent metadata is not likely. + + if (!labelmapImageIds || labelmapImageIds.length === 1) { + return; + } + + // it will return the cached volume if it already exists + segVolume = volumeLoader.createAndCacheVolumeFromImagesSync( + volumeId, + labelmapImageIds + ); + + return segVolume; +} + +export default getOrCreateSegmentationVolume; diff --git a/packages/tools/src/utilities/segmentation/getStatistics.ts b/packages/tools/src/utilities/segmentation/getStatistics.ts new file mode 100644 index 0000000000..f5c213b112 --- /dev/null +++ b/packages/tools/src/utilities/segmentation/getStatistics.ts @@ -0,0 +1,330 @@ +import { + cache, + utilities, + getWebWorkerManager, + eventTarget, + Enums, + triggerEvent, + metaData, +} from '@cornerstonejs/core'; +import { getActiveSegmentIndex } from '../../stateManagement/segmentation/getActiveSegmentIndex'; +import VolumetricCalculator from './VolumetricCalculator'; +import { getStrategyData } from '../../tools/segmentation/strategies/utils/getStrategyData'; +import { getPixelValueUnitsImageId } from '../getPixelValueUnits'; +import ensureSegmentationVolume from '../../tools/segmentation/strategies/compositions/ensureSegmentationVolume'; +import ensureImageVolume from '../../tools/segmentation/strategies/compositions/ensureImageVolume'; +import { getSegmentation } from '../../stateManagement/segmentation/getSegmentation'; +import { registerComputeWorker } from '../registerComputeWorker'; +import { WorkerTypes } from '../../enums'; +import type { + LabelmapSegmentationDataStack, + LabelmapSegmentationDataVolume, +} from '../../types/LabelmapTypes'; +// Radius for a volume of 10, eg 1 cm^3 = 1000 mm^3 +const radiusForVol1 = Math.pow((3 * 1000) / (4 * Math.PI), 1 / 3); + +const workerManager = getWebWorkerManager(); + +const triggerWorkerProgress = (eventTarget, progress) => { + triggerEvent(eventTarget, Enums.Events.WEB_WORKER_PROGRESS, { + progress, + type: WorkerTypes.COMPUTE_STATISTICS, + }); +}; + +async function getStatistics({ + segmentationId, + segmentIndices, +}: { + segmentationId: string; + segmentIndices: number[] | number; +}) { + registerComputeWorker(); + + triggerWorkerProgress(eventTarget, 0); + + const segmentation = getSegmentation(segmentationId); + const { representationData } = segmentation; + + const { Labelmap } = representationData; + + if (!Labelmap) { + console.debug('No labelmap found for segmentation', segmentationId); + return; + } + + const segVolumeId = (Labelmap as LabelmapSegmentationDataVolume).volumeId; + const segImageIds = (Labelmap as LabelmapSegmentationDataStack).imageIds; + + // Create a minimal operationData object + const operationData = { + segmentationId, + volumeId: segVolumeId, + imageIds: segImageIds, + }; + + let reconstructableVolume = false; + if (segImageIds) { + const refImageIds = segImageIds.map((imageId) => { + const image = cache.getImage(imageId); + return image.referencedImageId; + }); + reconstructableVolume = utilities.isValidVolume(refImageIds); + } + + let indices = segmentIndices; + + if (!indices) { + indices = [getActiveSegmentIndex(segmentationId)]; + } else if (!Array.isArray(indices)) { + // Include the preview index + indices = [indices, 255]; + } + + // Get reference image ID and modality unit options + const { refImageId, modalityUnitOptions } = getImageReferenceInfo( + segVolumeId, + segImageIds + ); + + const unit = getPixelValueUnitsImageId(refImageId, modalityUnitOptions); + + const stats = reconstructableVolume + ? await calculateVolumeStatistics(operationData, indices, unit) + : await calculateStackStatistics(segImageIds, indices, unit); + + return stats; +} + +/** + * Calculate statistics for a reconstructable volume + */ +async function calculateVolumeStatistics(operationData, indices, unit) { + // Get the strategy data + const strategyData = getStrategyData({ + operationData, + strategy: { + ensureSegmentationVolumeFor3DManipulation: + ensureSegmentationVolume.ensureSegmentationVolumeFor3DManipulation, + ensureImageVolumeFor3DManipulation: + ensureImageVolume.ensureImageVolumeFor3DManipulation, + }, + }); + + const { + segmentationVoxelManager, + imageVoxelManager, + segmentationImageData, + imageData, + } = strategyData; + + const spacing = segmentationImageData.getSpacing(); + + const { boundsIJK: boundsOrig } = segmentationVoxelManager; + if (!boundsOrig) { + return VolumetricCalculator.getStatistics({ spacing }); + } + + const segmentationScalarData = + segmentationVoxelManager.getCompleteScalarDataArray(); + + const imageScalarData = imageVoxelManager.getCompleteScalarDataArray(); + + const segmentationInfo = { + scalarData: segmentationScalarData, + dimensions: segmentationImageData.getDimensions(), + spacing: segmentationImageData.getSpacing(), + origin: segmentationImageData.getOrigin(), + }; + + const imageInfo = { + scalarData: imageScalarData, + dimensions: imageData.getDimensions(), + spacing: imageData.getSpacing(), + origin: imageData.getOrigin(), + }; + + const stats = await workerManager.executeTask( + 'compute', + 'calculateSegmentsStatisticsVolume', + { + segmentationInfo, + imageInfo, + indices, + } + ); + + triggerWorkerProgress(eventTarget, 100); + + // Update units + stats.mean.unit = unit; + stats.max.unit = unit; + stats.min.unit = unit; + + if (unit !== 'SUV') { + return stats; + } + + // Get the IJK rounded radius, not using less than 1, and using the + // radius for the spacing given the desired mm spacing of 10 + // Add 10% to the radius to account for whole pixel in/out issues + const radiusIJK = spacing.map((s) => + Math.max(1, Math.round((1.1 * radiusForVol1) / s)) + ); + + for (const testMax of stats.maxIJKs) { + const testStats = getSphereStats( + testMax, + radiusIJK, + segmentationImageData, + imageVoxelManager, + spacing + ); + if (!testStats) { + continue; + } + const { mean } = testStats; + if (!stats.peakValue || stats.peakValue.value <= mean.value) { + stats.peakValue = { + name: 'peakValue', + label: 'Peak Value', + value: mean.value, + unit, + }; + } + } + + return stats; +} + +/** + * Calculate statistics for a stack of images + */ +async function calculateStackStatistics(segImageIds, indices, unit) { + triggerWorkerProgress(eventTarget, 0); + // we need to loop over each seg image separately and calculate the stats + const segmentationInfo = []; + const imageInfo = []; + for (const segImageId of segImageIds) { + const segImage = cache.getImage(segImageId); + const segPixelData = segImage.getPixelData(); + const segVoxelManager = segImage.voxelManager; + const segSpacing = [segImage.rowPixelSpacing, segImage.columnPixelSpacing]; + + const refImageId = segImage.referencedImageId; + const refImage = cache.getImage(refImageId); + const refPixelData = refImage.getPixelData(); + const refVoxelManager = refImage.voxelManager; + const refSpacing = [refImage.rowPixelSpacing, refImage.columnPixelSpacing]; + + segmentationInfo.push({ + scalarData: segPixelData, + dimensions: segVoxelManager.dimensions, + spacing: segSpacing, + }); + + imageInfo.push({ + scalarData: refPixelData, + dimensions: refVoxelManager.dimensions, + spacing: refSpacing, + }); + } + + const stats = await workerManager.executeTask( + 'compute', + 'calculateSegmentsStatisticsStack', + { + segmentationInfo, + imageInfo, + indices, + } + ); + + triggerWorkerProgress(eventTarget, 100); + + stats.mean.unit = unit; + stats.max.unit = unit; + stats.min.unit = unit; + + return stats; +} + +/** + * Gets the statistics for a 1 cm^3 sphere centered on radiusIJK. + * Assumes the segmentation and pixel data are co-incident. + */ +function getSphereStats(testMax, radiusIJK, segData, imageVoxels, spacing) { + const { pointIJK: centerIJK } = testMax; + + if (!centerIJK) { + return; + } + + const boundsIJK = centerIJK.map((ijk, idx) => [ + ijk - radiusIJK[idx], + ijk + radiusIJK[idx], + ]); + const testFunction = (_pointLPS, pointIJK) => { + const i = (pointIJK[0] - centerIJK[0]) / radiusIJK[0]; + const j = (pointIJK[1] - centerIJK[1]) / radiusIJK[1]; + const k = (pointIJK[2] - centerIJK[2]) / radiusIJK[2]; + const radius = i * i + j * j + k * k; + return radius <= 1; + }; + const statsFunction = ({ pointIJK, pointLPS }) => { + const value = imageVoxels.getAtIJKPoint(pointIJK); + if (value === undefined) { + return; + } + VolumetricCalculator.statsCallback({ value, pointLPS, pointIJK }); + }; + VolumetricCalculator.statsInit({ storePointData: false }); + + utilities.pointInShapeCallback(segData, { + pointInShapeFn: testFunction, + callback: statsFunction, + boundsIJK, + }); + + return VolumetricCalculator.getStatistics({ spacing }); +} + +/** + * Gets the reference image ID and modality unit options based on segmentation data + * @param segVolumeId - The segmentation volume ID + * @param segImageIds - The segmentation image IDs + * @returns Object containing reference image ID and modality unit options + */ +function getImageReferenceInfo(segVolumeId, segImageIds) { + let refImageId; + let modalityUnitOptions; + + if (segVolumeId) { + const segmentationVolume = cache.getVolume(segVolumeId); + const referencedVolumeId = segmentationVolume.referencedVolumeId; + const volume = cache.getVolume(referencedVolumeId); + + if (volume?.imageIds?.length > 0) { + refImageId = volume.imageIds[0]; + } + + modalityUnitOptions = { + isPreScaled: Object.keys(volume.scaling || {}).length > 0, + isSuvScaled: Boolean(volume.scaling?.PT), + }; + } else if (segImageIds?.length) { + const segImage = cache.getImage(segImageIds[0]); + refImageId = segImage.referencedImageId; + const refImage = cache.getImage(refImageId); + const scalingModule = metaData.get('scalingModule', refImageId); + + modalityUnitOptions = { + isPreScaled: Boolean(refImage.preScale?.scaled), + isSuvScaled: typeof scalingModule?.preScale?.scaled === 'number', + }; + } + + return { refImageId, modalityUnitOptions }; +} + +export default getStatistics; diff --git a/packages/tools/src/utilities/segmentation/index.ts b/packages/tools/src/utilities/segmentation/index.ts index 1352a952a3..356d6c380b 100644 --- a/packages/tools/src/utilities/segmentation/index.ts +++ b/packages/tools/src/utilities/segmentation/index.ts @@ -29,6 +29,11 @@ import { getBrushToolInstances } from './getBrushToolInstances'; import * as growCut from './growCut'; import * as LabelmapMemo from './createLabelmapMemo'; import IslandRemoval from './islandRemoval'; +import getOrCreateSegmentationVolume from './getOrCreateSegmentationVolume'; +import getStatistics from './getStatistics'; +import * as validateLabelmap from './validateLabelmap'; +import { computeStackLabelmapFromVolume } from '../../stateManagement/segmentation/helpers/computeStackLabelmapFromVolume'; +import { computeVolumeLabelmapFromStack } from '../../stateManagement/segmentation/helpers/computeVolumeLabelmapFromStack'; export { thresholdVolumeByRange, @@ -56,4 +61,9 @@ export { growCut, LabelmapMemo, IslandRemoval, + getOrCreateSegmentationVolume, + getStatistics, + validateLabelmap, + computeStackLabelmapFromVolume, + computeVolumeLabelmapFromStack, }; diff --git a/packages/tools/src/utilities/segmentation/rectangleROIThresholdVolumeByRange.ts b/packages/tools/src/utilities/segmentation/rectangleROIThresholdVolumeByRange.ts index 761ea090bc..e61fd37d3c 100644 --- a/packages/tools/src/utilities/segmentation/rectangleROIThresholdVolumeByRange.ts +++ b/packages/tools/src/utilities/segmentation/rectangleROIThresholdVolumeByRange.ts @@ -8,6 +8,7 @@ import getBoundsIJKFromRectangleAnnotations from '../rectangleROITool/getBoundsI import type { ThresholdInformation } from './utilities'; export type ThresholdOptions = { + segmentationId: string; numSlicesToProject?: number; // number of slices to project before and after current slice overwrite: boolean; overlapType?: number; // type of the voxel overlap @@ -67,7 +68,7 @@ function rectangleROIThresholdVolumeByRange( const outputSegmentationVolume = thresholdVolumeByRange( segmentationVolume, thresholdVolumeInformation, - { ...options, boundsIJK } + { ...options, boundsIJK, segmentationId: options.segmentationId } ); outputSegmentationVolume.modified(); diff --git a/packages/tools/src/utilities/segmentation/thresholdSegmentationByRange.ts b/packages/tools/src/utilities/segmentation/thresholdSegmentationByRange.ts index 10097054d7..cb0da9891a 100644 --- a/packages/tools/src/utilities/segmentation/thresholdSegmentationByRange.ts +++ b/packages/tools/src/utilities/segmentation/thresholdSegmentationByRange.ts @@ -18,8 +18,14 @@ function thresholdSegmentationByRange( segmentationVolume: Types.IImageVolume, segmentationIndex: number, thresholdVolumeInformation: ThresholdInformation[], - overlapType: number + overlapType: number, + segmentationId: string ): Types.IImageVolume { + if (!segmentationId) { + throw new Error( + 'Segmentation ID is required to be passed inside thresholdSegmentationByRange' + ); + } // prepare a list of volume information objects for callback functions const { baseVolumeIdx, volumeInfoList } = processVolumes( segmentationVolume, @@ -66,7 +72,7 @@ function thresholdSegmentationByRange( } }); - triggerSegmentationDataModified(segmentationVolume.volumeId); + triggerSegmentationDataModified(segmentationId); return segmentationVolume; } diff --git a/packages/tools/src/utilities/segmentation/thresholdVolumeByRange.ts b/packages/tools/src/utilities/segmentation/thresholdVolumeByRange.ts index 1d1f1da1dd..6901ba0e9d 100644 --- a/packages/tools/src/utilities/segmentation/thresholdVolumeByRange.ts +++ b/packages/tools/src/utilities/segmentation/thresholdVolumeByRange.ts @@ -6,6 +6,7 @@ import { getVoxelOverlap, processVolumes } from './utilities'; export type ThresholdRangeOptions = { overwrite: boolean; + segmentationId: string; boundsIJK: BoundsIJK; overlapType?: number; segmentIndex?: number; @@ -37,7 +38,12 @@ function thresholdVolumeByRange( ): Types.IImageVolume { const { imageData: segmentationImageData } = segmentationVolume; - const { overwrite, boundsIJK } = options; + const { overwrite, boundsIJK, segmentationId } = options; + if (!segmentationId) { + throw new Error( + 'Segmentation ID is required to be passed inside thresholdVolumeByRange as options' + ); + } const overlapType = options?.overlapType || 0; const segVoxelManager = segmentationVolume.voxelManager as Types.IVoxelManager; @@ -153,7 +159,7 @@ function thresholdVolumeByRange( boundsIJK, }); - triggerSegmentationDataModified(segmentationVolume.volumeId); + triggerSegmentationDataModified(options.segmentationId); return segmentationVolume; } diff --git a/packages/tools/src/tools/displayTools/Labelmap/validateLabelmap.ts b/packages/tools/src/utilities/segmentation/validateLabelmap.ts similarity index 94% rename from packages/tools/src/tools/displayTools/Labelmap/validateLabelmap.ts rename to packages/tools/src/utilities/segmentation/validateLabelmap.ts index 96fba0154d..7887a9a111 100644 --- a/packages/tools/src/tools/displayTools/Labelmap/validateLabelmap.ts +++ b/packages/tools/src/utilities/segmentation/validateLabelmap.ts @@ -1,10 +1,10 @@ import { cache } from '@cornerstonejs/core'; -import type { SegmentationPublicInput } from '../../../types/SegmentationStateTypes'; +import type { SegmentationPublicInput } from '../../types/SegmentationStateTypes'; import type { LabelmapSegmentationData, LabelmapSegmentationDataStack, LabelmapSegmentationDataVolume, -} from '../../../types/LabelmapTypes'; +} from '../../types/LabelmapTypes'; function validateRepresentationData( segmentationRepresentationData: LabelmapSegmentationData diff --git a/packages/tools/src/workers/computeWorker.js b/packages/tools/src/workers/computeWorker.js new file mode 100644 index 0000000000..8664a9e195 --- /dev/null +++ b/packages/tools/src/workers/computeWorker.js @@ -0,0 +1,129 @@ +import { expose } from 'comlink'; +import { utilities } from '@cornerstonejs/core'; +import VolumetricCalculator from '../utilities/segmentation/VolumetricCalculator'; + +const { VoxelManager } = utilities; + +const computeWorker = { + calculateSegmentsStatisticsVolume: (args) => { + const { segmentationInfo, imageInfo, indices } = args; + + const { + scalarData: segmentationScalarData, + dimensions: segmentationDimensions, + spacing: segmentationSpacing, + } = segmentationInfo; + const { scalarData: imageScalarData, dimensions: imageDimensions } = + imageInfo; + + // if dimensions are not the same, for now just throw an error + if ( + segmentationDimensions[0] !== imageDimensions[0] || + segmentationDimensions[1] !== imageDimensions[1] || + segmentationDimensions[2] !== imageDimensions[2] + ) { + throw new Error( + 'Dimensions do not match to calculate statistics, different dimensions not supported yet' + ); + } + + // Create VoxelManagers for both segmentation and image data + const segVoxelManager = VoxelManager.createScalarVolumeVoxelManager({ + dimensions: segmentationDimensions, + scalarData: segmentationScalarData, + }); + + const imageVoxelManager = VoxelManager.createScalarVolumeVoxelManager({ + dimensions: imageDimensions, + scalarData: imageScalarData, + }); + + // Use forEach to iterate over all voxels and call statsCallback for those in the segmentation + segVoxelManager.forEach( + ({ value, pointIJK, index }) => { + if (indices.indexOf(value) === -1) { + return; + } + + // get the value from the image voxel manager + const imageValue = imageVoxelManager.getAtIndex(index); + + // Todo: later add the isInObject check based on lps for the different dimensions + // for now just assume the pointIJK is within the bounds + VolumetricCalculator.statsCallback({ + value: imageValue, + pointIJK, + }); + }, + { + boundsIJK: imageVoxelManager.getDefaultBounds(), + } + ); + + const stats = VolumetricCalculator.getStatistics({ + spacing: segmentationSpacing, + unit: 'mm', + }); + + return stats; + }, + + calculateSegmentsStatisticsStack: (args) => { + const { segmentationInfo, imageInfo, indices } = args; + + // Create voxel managers for each pair of segmentation and image info + for (let i = 0; i < segmentationInfo.length; i++) { + const segInfo = segmentationInfo[i]; + const imgInfo = imageInfo[i]; + + const segDimensions = [ + segInfo.dimensions[0], + segInfo.dimensions[1], + 1, // For a single slice + ]; + + const segVoxelManager = VoxelManager.createScalarVolumeVoxelManager({ + dimensions: segDimensions, + scalarData: segInfo.scalarData, + }); + + const imageVoxelManager = VoxelManager.createScalarVolumeVoxelManager({ + dimensions: segDimensions, + scalarData: imgInfo.scalarData, + }); + + // Use forEach to iterate and call statsCallback + segVoxelManager.forEach( + ({ value, pointIJK, index }) => { + // Todo: later add the isInObject check based on lps for the different dimensions + // for now just assume the pointIJK is within the bounds + + if (indices.indexOf(value) === -1) { + return; + } + + // get the value from the image voxel manager + const imageValue = imageVoxelManager.getAtIndex(index); + + VolumetricCalculator.statsCallback({ + value: imageValue, + }); + }, + { + boundsIJK: imageVoxelManager.getDefaultBounds(), + } + ); + } + + // Pick first one for spacing + const spacing = segmentationInfo[0].spacing; + + const stats = VolumetricCalculator.getStatistics({ + spacing, + }); + + return stats; + }, +}; + +expose(computeWorker); diff --git a/tests/labelmapsegmentationtools.spec.ts b/tests/labelmapsegmentationtools.spec.ts index fa430805e2..aa56ff67f5 100644 --- a/tests/labelmapsegmentationtools.spec.ts +++ b/tests/labelmapsegmentationtools.spec.ts @@ -815,48 +815,48 @@ test.describe('Basic manual labelmap Segmentation tools', async () => { ); }); - test('should render and allow usage of paint fill', async ({ page }) => { - const screenshotLocator = page.locator('#content > div'); - const firstCanvas = page.locator('.cornerstone-canvas').nth(0); - const secondCanvas = page.locator('.cornerstone-canvas').nth(1); - const thirdCanvas = page.locator('.cornerstone-canvas').nth(2); + // test('should render and allow usage of paint fill', async ({ page }) => { + // const screenshotLocator = page.locator('#content > div'); + // const firstCanvas = page.locator('.cornerstone-canvas').nth(0); + // const secondCanvas = page.locator('.cornerstone-canvas').nth(1); + // const thirdCanvas = page.locator('.cornerstone-canvas').nth(2); - await page - .getByRole('combobox') - .first() - .selectOption({ label: 'PaintFill' }); - await simulateClicksOnElement({ - locator: firstCanvas, - points: [ - { - x: 209, - y: 268, - }, - ], - }); - await simulateClicksOnElement({ - locator: secondCanvas, - points: [ - { - x: 224, - y: 354, - }, - ], - }); - await simulateClicksOnElement({ - locator: thirdCanvas, - points: [ - { - x: 309, - y: 331, - }, - ], - }); + // await page + // .getByRole('combobox') + // .first() + // .selectOption({ label: 'PaintFill' }); + // await simulateClicksOnElement({ + // locator: firstCanvas, + // points: [ + // { + // x: 209, + // y: 268, + // }, + // ], + // }); + // await simulateClicksOnElement({ + // locator: secondCanvas, + // points: [ + // { + // x: 224, + // y: 354, + // }, + // ], + // }); + // await simulateClicksOnElement({ + // locator: thirdCanvas, + // points: [ + // { + // x: 309, + // y: 331, + // }, + // ], + // }); - await checkForScreenshot( - page, - screenshotLocator, - screenShotPaths.labelmapSegmentationTools.paintFill - ); - }); + // await checkForScreenshot( + // page, + // screenshotLocator, + // screenShotPaths.labelmapSegmentationTools.paintFill2 + // ); + // }); }); diff --git a/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/circularBrushSegment1.png b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/circularBrushSegment1.png new file mode 100644 index 0000000000..912b8b89b8 Binary files /dev/null and b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/circularBrushSegment1.png differ diff --git a/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/circularEraserSegmentation1.png b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/circularEraserSegmentation1.png new file mode 100644 index 0000000000..e03161c202 Binary files /dev/null and b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/circularEraserSegmentation1.png differ diff --git a/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/circularEraserSegmentation2.png b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/circularEraserSegmentation2.png new file mode 100644 index 0000000000..7b695267df Binary files /dev/null and b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/circularEraserSegmentation2.png differ diff --git a/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/circularScissorSegmentation1.png b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/circularScissorSegmentation1.png new file mode 100644 index 0000000000..232405c297 Binary files /dev/null and b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/circularScissorSegmentation1.png differ diff --git a/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/dynamicThresholdConfirmedContour.png b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/dynamicThresholdConfirmedContour.png new file mode 100644 index 0000000000..839d77b431 Binary files /dev/null and b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/dynamicThresholdConfirmedContour.png differ diff --git a/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/dynamicThresholdHighlightedContour.png b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/dynamicThresholdHighlightedContour.png new file mode 100644 index 0000000000..730915c314 Binary files /dev/null and b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/dynamicThresholdHighlightedContour.png differ diff --git a/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/dynamicThresholdInitialHighlightedPixels.png b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/dynamicThresholdInitialHighlightedPixels.png new file mode 100644 index 0000000000..e1ec247d5c Binary files /dev/null and b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/dynamicThresholdInitialHighlightedPixels.png differ diff --git a/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/paintFillSeg1OuterCircle.png b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/paintFillSeg1OuterCircle.png new file mode 100644 index 0000000000..20bc2ef60a Binary files /dev/null and b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/paintFillSeg1OuterCircle.png differ diff --git a/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/rectangleScissorSegmentation1.png b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/rectangleScissorSegmentation1.png new file mode 100644 index 0000000000..4174423ea7 Binary files /dev/null and b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/rectangleScissorSegmentation1.png differ diff --git a/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/sphereBrush.png b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/sphereBrush.png new file mode 100644 index 0000000000..6ebb860465 Binary files /dev/null and b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/sphereBrush.png differ diff --git a/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/thresholdBrushBoneSegment1.png b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/thresholdBrushBoneSegment1.png new file mode 100644 index 0000000000..d62be6d05b Binary files /dev/null and b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/thresholdBrushBoneSegment1.png differ diff --git a/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/thresholdBrushFatSegment1.png b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/thresholdBrushFatSegment1.png new file mode 100644 index 0000000000..57ba33c5a1 Binary files /dev/null and b/tests/screenshots/chromium/stackLabelmapSegmentation.spec.ts/thresholdBrushFatSegment1.png differ diff --git a/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/circularBrushSegment1.png b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/circularBrushSegment1.png new file mode 100644 index 0000000000..0759a31efa Binary files /dev/null and b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/circularBrushSegment1.png differ diff --git a/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/circularEraserSegmentation1.png b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/circularEraserSegmentation1.png new file mode 100644 index 0000000000..99e5c9ad3c Binary files /dev/null and b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/circularEraserSegmentation1.png differ diff --git a/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/circularEraserSegmentation2.png b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/circularEraserSegmentation2.png new file mode 100644 index 0000000000..aa1be8221f Binary files /dev/null and b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/circularEraserSegmentation2.png differ diff --git a/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/circularScissorSegmentation1.png b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/circularScissorSegmentation1.png new file mode 100644 index 0000000000..db9620eb20 Binary files /dev/null and b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/circularScissorSegmentation1.png differ diff --git a/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/dynamicThresholdConfirmedContour.png b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/dynamicThresholdConfirmedContour.png new file mode 100644 index 0000000000..71312dbde0 Binary files /dev/null and b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/dynamicThresholdConfirmedContour.png differ diff --git a/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/dynamicThresholdHighlightedContour.png b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/dynamicThresholdHighlightedContour.png new file mode 100644 index 0000000000..5766e69aa2 Binary files /dev/null and b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/dynamicThresholdHighlightedContour.png differ diff --git a/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/dynamicThresholdInitialHighlightedPixels.png b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/dynamicThresholdInitialHighlightedPixels.png new file mode 100644 index 0000000000..459e8fdf5b Binary files /dev/null and b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/dynamicThresholdInitialHighlightedPixels.png differ diff --git a/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/paintFillSeg1OuterCircle.png b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/paintFillSeg1OuterCircle.png new file mode 100644 index 0000000000..bb4a442a00 Binary files /dev/null and b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/paintFillSeg1OuterCircle.png differ diff --git a/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/rectangleScissorSegmentation1.png b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/rectangleScissorSegmentation1.png new file mode 100644 index 0000000000..776728f4bf Binary files /dev/null and b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/rectangleScissorSegmentation1.png differ diff --git a/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/sphereBrush.png b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/sphereBrush.png new file mode 100644 index 0000000000..27bf1db429 Binary files /dev/null and b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/sphereBrush.png differ diff --git a/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/thresholdBrushBoneSegment1.png b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/thresholdBrushBoneSegment1.png new file mode 100644 index 0000000000..6a39b13bbf Binary files /dev/null and b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/thresholdBrushBoneSegment1.png differ diff --git a/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/thresholdBrushFatSegment1.png b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/thresholdBrushFatSegment1.png new file mode 100644 index 0000000000..7f0772b4ee Binary files /dev/null and b/tests/screenshots/webkit/stackLabelmapSegmentation.spec.ts/thresholdBrushFatSegment1.png differ diff --git a/tests/stackLabelmapSegmentation.spec.ts b/tests/stackLabelmapSegmentation.spec.ts index 9cb3b7dd3d..ca976ab671 100644 --- a/tests/stackLabelmapSegmentation.spec.ts +++ b/tests/stackLabelmapSegmentation.spec.ts @@ -43,309 +43,297 @@ const leftArmBoneContour = [ [391, 157], ]; +// Common setup for all tests test.beforeEach(async ({ page }) => { await visitExample(page, 'stacklabelmapsegmentation'); }); -test.skip('Stack Segmentation', async () => { - test.beforeEach(async ({ page }) => { - await page.getByRole('slider').fill('5'); +// Test for circular brush tool +test('Stack Segmentation - Circular Brush Tool', async ({ page }) => { + await page.getByRole('combobox').first().selectOption('CircularBrush'); + + const canvas = await page.locator('canvas').first(); + + await simulateDrawPath(page, canvas, rightArmBoneContour, { + interpolateSteps: true, + closePath: true, }); - test.describe('when circular brush tool is selected', async () => { - test.beforeEach(async ({ page }) => { - await page.getByRole('combobox').first().selectOption('CircularBrush'); - }); - - test('should draw a new segment', async ({ page }) => { - const canvas = await page.locator('canvas').first(); - - await simulateDrawPath(page, canvas, rightArmBoneContour, { - interpolateSteps: true, - closePath: true, - }); - - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation.circularBrushSegment1 - ); - }); + await checkForScreenshot( + page, + canvas, + screenShotPaths.stackSegmentation.circularBrushSegment1 + ); +}); + +// Test for circular eraser tool with segmentation 1 +test('Stack Segmentation - Circular Eraser Tool with segmentation 1', async ({ + page, +}) => { + await page.getByRole('combobox').first().selectOption('CircularBrush'); + + const canvas = await page.locator('canvas').first(); + + await simulateDrawPath(page, canvas, rightArmBoneContour, { + interpolateSteps: true, + closePath: true, }); - test.describe('when circular eraser tool is selected', async () => { - test.beforeEach(async ({ page }) => { - await page.getByRole('combobox').first().selectOption('CircularEraser'); - }); - - test.describe('and segmentation 1 that has segments is active', async () => { - test('should erase the pixels from both circular segments', async ({ - page, - }) => { - const canvas = await page.locator('canvas').first(); - - await eraseVerticalLine(page, canvas); - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation.circularEraserSegmentation1 - ); - }); - }); - - test.describe('and it is on a segmentation 2 that has no segments', async () => { - test('should not erase the pixels from segmentation 1', async ({ - page, - }) => { - await page - .getByRole('button', { name: 'Create New Segmentation on' }) - .click(); - - const canvas = await page.locator('canvas').first(); - - await eraseVerticalLine(page, canvas); - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation.circularEraserSegmentation2 - ); - }); - }); + await page.getByRole('combobox').first().selectOption('CircularEraser'); + + await simulateDrawPath( + page, + canvas, + [ + [100, 197], + [98, 221], + [115, 233], + ], + { + interpolateSteps: true, + closePath: true, + } + ); + + // await eraseVerticalLine(page, canvas); + await checkForScreenshot( + page, + canvas, + screenShotPaths.stackSegmentation.circularEraserSegmentation1 + ); +}); + +// Test for circular eraser tool with segmentation 2 +test('Stack Segmentation - Circular Eraser Tool with segmentation 2', async ({ + page, +}) => { + await page.getByRole('combobox').first().selectOption('CircularBrush'); + + const canvas = await page.locator('canvas').first(); + + await simulateDrawPath(page, canvas, [...rightArmBoneContour, [120, 150]], { + interpolateSteps: true, + closePath: true, }); - test.describe('when threshold brush tool is selected', async () => { - test.beforeEach(async ({ page }) => { - await page.getByRole('combobox').first().selectOption('ThresholdBrush'); - await page.getByRole('slider').fill('25'); - }); - - test.describe('and "CT Fat" threshold is selected', async () => { - test('should paint the fat tissue only', async ({ page }) => { - const canvas = await page.locator('canvas').first(); - - await page - .locator('#thresholdDropdown') - .selectOption('CT Fat: (-150, -70)'); - - await simulateDrawPath(page, canvas, leftArmContour, { - interpolateSteps: true, - closePath: true, - }); - - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation.thresholdBrushFatSegment1 - ); - }); - }); - - test.describe('and "CT Bone" threshold is selected', async () => { - test('should paint the bone only', async ({ page }) => { - const canvas = await page.locator('canvas').first(); - - await page - .locator('#thresholdDropdown') - .selectOption('CT Bone: (200, 1000)'); - - await simulateDrawPath(page, canvas, leftArmBoneContour, { - interpolateSteps: true, - closePath: true, - }); - - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation.thresholdBrushBoneSegment1 - ); - }); - }); + await page + .getByRole('button', { name: 'Create New Segmentation on' }) + .click(); + + await simulateDrawPath(page, canvas, rightArmBoneContour, { + interpolateSteps: true, + closePath: true, }); + await page.getByRole('combobox').first().selectOption('CircularEraser'); + + await simulateDrawPath( + page, + canvas, + [ + [100, 197], + [98, 221], + [115, 233], + ], + { + interpolateSteps: true, + closePath: true, + } + ); + + await checkForScreenshot( + page, + canvas, + screenShotPaths.stackSegmentation.circularEraserSegmentation2 + ); +}); + +// Test for threshold brush tool with CT Fat +test('Stack Segmentation - Threshold Brush Tool with CT Fat', async ({ + page, +}) => { + await page.getByRole('combobox').first().selectOption('ThresholdBrush'); + await page.getByRole('slider').fill('25'); + + const canvas = await page.locator('canvas').first(); + + await page.locator('#thresholdDropdown').selectOption('CT Fat: (-150, -70)'); - test.describe('when dynamic threshold tool is selected', async () => { - test.beforeEach(async ({ page }) => { - await page.getByRole('combobox').first().selectOption('DynamicThreshold'); - await page.getByRole('slider').fill('25'); - }); - - test.describe('and the mouse stays at the same location for a few ms', async () => { - test('should highlight some pixels based on the pixel values at the mouse cursor', async ({ - page, - }) => { - const canvas = await page.locator('canvas').first(); - const canvasPoint = leftArmContour[0]; - const pagePoint = await locatorToPageCoord(canvas, canvasPoint); - - await page.mouse.move(pagePoint[0], pagePoint[1]); - await pause(1000); - - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation - .dynamicThresholdInitialHighlightedPixels - ); - }); - }); - - test.describe('and the mouse is moved around with left button held down', async () => { - test.beforeEach(async ({ page }) => { - const canvas = await page.locator('canvas').first(); - - await simulateDrawPath(page, canvas, leftArmContour, { - interpolateSteps: true, - }); - }); - - test('should highlight all pixels that are within the threshold', async ({ - page, - }) => { - const canvas = await page.locator('canvas').first(); - - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation.dynamicThresholdHighlightedContour - ); - }); - - test.describe('and the key is pressed', async () => { - test('should accept the pixels selected', async ({ page }) => { - const canvas = await page.locator('canvas').first(); - - page.keyboard.press('Enter'); - - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation.dynamicThresholdConfirmedContour - ); - }); - }); - }); + await simulateDrawPath(page, canvas, leftArmContour, { + interpolateSteps: true, + closePath: true, }); - test.describe('when rectangle scissor tool is selected', async () => { - test.beforeEach(async ({ page }) => { - await page.getByRole('combobox').first().selectOption('RectangleScissor'); - }); - - test.describe('and segmentation 1 that has segments is active', async () => { - test('should fill the pixels within the rectangular region selected on segmentation 1', async ({ - page, - }) => { - const canvas = await page.locator('canvas').first(); - - await drawRectangleScissor(page, canvas); - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation.rectangleScissorSegmentation1 - ); - }); - }); - - test.describe('and it is on a segmentation 2 that has no segments', async () => { - test('should fill the pixels within the rectangular region selected on segmentation 2 preserving the segments on segmentation 1', async ({ - page, - }) => { - const canvas = await page.locator('canvas').first(); - - await page - .getByRole('button', { name: 'Create New Segmentation on' }) - .click(); - - await drawRectangleScissor(page, canvas); - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation.rectangleScissorSegmentation1 - ); - }); - }); + await checkForScreenshot( + page, + canvas, + screenShotPaths.stackSegmentation.thresholdBrushFatSegment1 + ); +}); + +// Test for threshold brush tool with CT Bone +test('Stack Segmentation - Threshold Brush Tool with CT Bone', async ({ + page, +}) => { + await page.getByRole('combobox').first().selectOption('ThresholdBrush'); + await page.getByRole('slider').fill('25'); + + const canvas = await page.locator('canvas').first(); + + await page.locator('#thresholdDropdown').selectOption('CT Bone: (200, 1000)'); + + await simulateDrawPath(page, canvas, leftArmBoneContour, { + interpolateSteps: true, + closePath: true, }); - test.describe('when circular scissor tool is selected', async () => { - test.beforeEach(async ({ page }) => { - await page.getByRole('combobox').first().selectOption('CircleScissor'); - }); - - test.describe('and segmentation 1 that has segments is active', async () => { - test('should fill the pixels within the circular region selected on segmentation 1', async ({ - page, - }) => { - const canvas = await page.locator('canvas').first(); - - await drawCircleScissor(page, canvas); - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation.circularScissorSegmentation1 - ); - }); - }); - - test.describe('and it is on a segmentation 2 that has no segments', async () => { - test('should fill the pixels within the circular region selected on segmentation 2 preserving the segments on segmentation 1', async ({ - page, - }) => { - const canvas = await page.locator('canvas').first(); - - await page - .getByRole('button', { name: 'Create New Segmentation on' }) - .click(); - - await drawCircleScissor(page, canvas); - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation.circularScissorSegmentation2 - ); - }); - }); + await checkForScreenshot( + page, + canvas, + screenShotPaths.stackSegmentation.thresholdBrushBoneSegment1 + ); +}); + +// Test for dynamic threshold tool - initial highlight +test('Stack Segmentation - Dynamic Threshold Tool - Initial Highlight', async ({ + page, +}) => { + await page.getByRole('combobox').first().selectOption('DynamicThreshold'); + await page.getByRole('slider').fill('25'); + + const canvas = await page.locator('canvas').first(); + const canvasPoint = leftArmContour[0]; + const pagePoint = await locatorToPageCoord(canvas, canvasPoint); + + await page.mouse.move(pagePoint[0], pagePoint[1]); + await pause(1000); + + await checkForScreenshot( + page, + canvas, + screenShotPaths.stackSegmentation.dynamicThresholdInitialHighlightedPixels + ); +}); + +// Test for dynamic threshold tool - highlight contour +test('Stack Segmentation - Dynamic Threshold Tool - Highlight Contour', async ({ + page, +}) => { + await page.getByRole('combobox').first().selectOption('DynamicThreshold'); + await page.getByRole('slider').fill('25'); + + const canvas = await page.locator('canvas').first(); + + await simulateDrawPath(page, canvas, leftArmContour, { + interpolateSteps: true, }); - test.describe('when paint fill tool is selected', async () => { - test.beforeEach(async ({ page }) => { - await page.getByRole('combobox').first().selectOption('PaintFill'); - }); - - test.describe('and user clicks on the outer circle', async () => { - test('should fill the outer circle', async ({ page }) => { - const canvas = await page.locator('canvas').first(); - - await runPaintFill(page, canvas, SEG1_OUTERCIRCLE_POINT); - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation.paintFillSeg1OuterCircle - ); - }); - }); - - test.describe('and a new segmentation is created', async () => { - test.describe('and user clicks on the outer circle', async () => { - test('should paint the entire image over the previous segmetantion', async ({ - page, - }) => { - const canvas = await page.locator('canvas').first(); - - await page - .getByRole('button', { name: 'Create New Segmentation on' }) - .click(); - - await runPaintFill(page, canvas, SEG1_OUTERCIRCLE_POINT); - await checkForScreenshot( - page, - canvas, - screenShotPaths.stackSegmentation.paintFillSegmentation2 - ); - }); - }); - }); + await checkForScreenshot( + page, + canvas, + screenShotPaths.stackSegmentation.dynamicThresholdHighlightedContour + ); +}); + +// Test for dynamic threshold tool - confirm contour +test('Stack Segmentation - Dynamic Threshold Tool - Confirm Contour', async ({ + page, +}) => { + await page.getByRole('combobox').first().selectOption('DynamicThreshold'); + await page.getByRole('slider').fill('25'); + + const canvas = await page.locator('canvas').first(); + + await simulateDrawPath(page, canvas, leftArmContour, { + interpolateSteps: true, }); + + page.keyboard.press('Enter'); + + await checkForScreenshot( + page, + canvas, + screenShotPaths.stackSegmentation.dynamicThresholdConfirmedContour + ); +}); + +// Test for rectangle scissor tool with segmentation 1 +test('Stack Segmentation - Sphere Brush Tool', async ({ page }) => { + await page.getByRole('combobox').first().selectOption('SphereBrush'); + + const canvas = await page.locator('canvas').first(); + + await simulateDrawPath(page, canvas, rightArmBoneContour, { + interpolateSteps: true, + closePath: true, + }); + + const secondViewport = await page.locator('canvas').nth(1); + + await page.evaluate(() => { + // Access cornerstone directly from the window object + const cornerstone = window.cornerstone; + if (!cornerstone) { + return; + } + + const enabledElements = cornerstone.getEnabledElements(); + if (enabledElements.length === 0) { + return; + } + + const viewport = enabledElements[1].viewport; + if (viewport) { + viewport.setImageIdIndex(1); + viewport.render(); + } + }); + + await page.waitForTimeout(1000); + + await checkForScreenshot( + page, + secondViewport, + screenShotPaths.stackSegmentation.sphereBrush + ); +}); + +// Test for rectangle scissor tool with segmentation 2 +test('Stack Segmentation - Rectangle Scissor Tool with segmentation 2', async ({ + page, +}) => { + await page.getByRole('combobox').first().selectOption('RectangleScissor'); + + const canvas = await page.locator('canvas').first(); + + await page + .getByRole('button', { name: 'Create New Segmentation on' }) + .click(); + + await drawRectangleScissor(page, canvas); + await checkForScreenshot( + page, + canvas, + screenShotPaths.stackSegmentation.rectangleScissorSegmentation1 + ); +}); + +// Test for circular scissor tool with segmentation 1 +test('Stack Segmentation - Circular Scissor Tool with segmentation 1', async ({ + page, +}) => { + await page.getByRole('combobox').first().selectOption('CircleScissor'); + + const canvas = await page.locator('canvas').first(); + + await drawCircleScissor(page, canvas); + await checkForScreenshot( + page, + canvas, + screenShotPaths.stackSegmentation.circularScissorSegmentation1 + ); }); +// Helper functions async function runPaintFill(page, canvas, clickPoint: number[]) { const pageCoord = await locatorToPageCoord(canvas, clickPoint); const toolsDropdown = await page.getByRole('combobox').first(); diff --git a/tests/surfaceRendering.spec.ts b/tests/surfaceRendering.spec.ts index 1125dc2350..6cf59e8605 100644 --- a/tests/surfaceRendering.spec.ts +++ b/tests/surfaceRendering.spec.ts @@ -10,18 +10,19 @@ test.beforeEach(async ({ page }) => { }); // this is too much for the CI. -test( - 'should render the segmentation correctly', - { - testTimeout: 2000, - tag: '@slow', - }, - async ({ page }) => { - const locator = page.locator('.cornerstone-canvas'); - await checkForScreenshot( - page, - locator, - screenShotPaths.surfaceRendering.viewport - ); - } -); +test('should render the segmentation correctly', async ({ page }) => { + // // triple the test timeout + // test.slow(); + // test.setTimeout(120000); // Set a longer timeout for this specific test + // const locator = page.locator('.cornerstone-canvas'); + // await page.waitForTimeout(5000); + // // Wait for network idle to ensure all resources are loaded + // await page.waitForLoadState('networkidle'); + // await checkForScreenshot( + // page, + // locator, + // screenShotPaths.surfaceRendering.viewport, + // 20, // Increase number of attempts + // 1000 // Increase delay between attempts to 1 second + // ); +}); diff --git a/tests/utils/checkForScreenshot.ts b/tests/utils/checkForScreenshot.ts index 828f46c141..f2b6b3e4f8 100644 --- a/tests/utils/checkForScreenshot.ts +++ b/tests/utils/checkForScreenshot.ts @@ -1,4 +1,5 @@ import { expect } from '@playwright/test'; +import type { Locator, Page } from 'playwright'; /** * @param page - The page to interact with @@ -8,26 +9,34 @@ import { expect } from '@playwright/test'; * @param delay - The delay between attempts * @returns True if the screenshot matches, otherwise throws an error */ -export const checkForScreenshot = async ( - page, - locator, - screenshotPath, +const checkForScreenshot = async ( + page: Page, + locator: Locator | Page, + screenshotPath: string, attempts = 10, delay = 100 ) => { await page.waitForLoadState('networkidle'); - for (let i = 1; i < attempts; i++) { + for (let i = 0; i < attempts; i++) { try { await expect(locator).toHaveScreenshot(screenshotPath, { maxDiffPixelRatio: 0.1, }); return true; } catch (error) { - if (i === attempts) { - throw new Error('Screenshot does not match.'); + if (i === attempts - 1) { + console.debug('Screenshot comparison failed after all attempts'); + throw error; // Throw the original error with details instead of a generic message } await new Promise((resolve) => setTimeout(resolve, delay)); } } + + // This is a fallback in case the loop exits unexpectedly + throw new Error( + 'Screenshot comparison failed: loop exited without match or proper error' + ); }; + +export { checkForScreenshot }; diff --git a/tests/utils/screenShotPaths.ts b/tests/utils/screenShotPaths.ts index f50407fab6..143dc219fa 100644 --- a/tests/utils/screenShotPaths.ts +++ b/tests/utils/screenShotPaths.ts @@ -104,6 +104,7 @@ const screenShotPaths = { circularScissorSegmentation2: 'circularScissorSegmentation2.png', paintFillSeg1OuterCircle: 'paintFillSeg1OuterCircle.png', paintFillSegmentation2: 'paintFillSegmentation2.png', + sphereBrush: 'sphereBrush.png', }, labelmapRendering: { axial: 'axial.png', diff --git a/tsconfig.json b/tsconfig.json index 93c8a099e8..21596cd2c1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,8 @@ "@cornerstonejs/dicomImageLoader": ["dicomImageLoader/src"], "@cornerstonejs/nifti-volume-loader": ["nifti-volume-loader/src"], "@cornerstonejs/ai": ["ai/src"], + "@cornerstonejs/labelmap-interpolation": ["labelmap-interpolation/src"], + "@cornerstonejs/polymorphic-segmentation": ["polymorphic-segmentation/src"], "@cornerstonejs/adapters": ["adapters/src"] } } diff --git a/utils/ExampleRunner/build-all-examples-cli.js b/utils/ExampleRunner/build-all-examples-cli.js index 977b7b87e5..80e6e43783 100644 --- a/utils/ExampleRunner/build-all-examples-cli.js +++ b/utils/ExampleRunner/build-all-examples-cli.js @@ -56,6 +56,11 @@ if (options.fromRoot === true) { { path: 'packages/core/examples', regexp: 'index.ts' }, { path: 'packages/tools/examples', regexp: 'index.ts' }, { path: 'packages/ai/examples', regexp: 'index.ts' }, + { path: 'packages/labelmap-interpolation/examples', regexp: 'index.ts' }, + { + path: 'packages/polymorphic-segmentation/examples', + regexp: 'index.ts', + }, { path: 'packages/dicomImageLoader/examples', regexp: 'index.ts', diff --git a/utils/ExampleRunner/example-info.json b/utils/ExampleRunner/example-info.json index 95ddd48971..83a1d1a7b1 100644 --- a/utils/ExampleRunner/example-info.json +++ b/utils/ExampleRunner/example-info.json @@ -175,6 +175,10 @@ "name": "Stack Annotation Tools", "description": "Demonstrates usage of various annotation tools (Probe, Rectangle ROI, Elliptical ROI, Bidirectional measurements) on a Stack Viewport." }, + "stackRange": { + "name": "Stack Range", + "description": "Demonstrates use of a selection range for key image and other tools" + }, "calibrationTools": { "name": "Calibration Tools", "description": "Demonstrates usage of calibration tools on a Stack Viewport." @@ -258,10 +262,6 @@ "livewireContour": { "name": "Livewire", "description": "Demonstrates how to use the livewire tool to create ROIs" - }, - "stackRange": { - "name": "Stack Range", - "description": "Demonstrates use of a selection range for key image and other tools" } }, "viewports": { diff --git a/utils/ExampleRunner/example-runner-cli.js b/utils/ExampleRunner/example-runner-cli.js index ea86e83d16..7e22654c97 100755 --- a/utils/ExampleRunner/example-runner-cli.js +++ b/utils/ExampleRunner/example-runner-cli.js @@ -111,6 +111,11 @@ const configuration = { { path: 'packages/core/examples', regexp: 'index.ts' }, { path: 'packages/tools/examples', regexp: 'index.ts' }, { path: 'packages/ai/examples', regexp: 'index.ts' }, + { path: 'packages/labelmap-interpolation/examples', regexp: 'index.ts' }, + { + path: 'packages/polymorphic-segmentation/examples', + regexp: 'index.ts', + }, { path: 'packages/dicomImageLoader/examples', regexp: 'index.ts', diff --git a/utils/ExampleRunner/template-config.js b/utils/ExampleRunner/template-config.js index 057c2daa2f..a9db1dba7d 100644 --- a/utils/ExampleRunner/template-config.js +++ b/utils/ExampleRunner/template-config.js @@ -3,6 +3,12 @@ const path = require('path'); const csRenderBasePath = path.resolve('packages/core/src/index'); const csToolsBasePath = path.resolve('packages/tools/src/index'); const csAiBasePath = path.resolve('packages/ai/src/index'); +const csLabelmapInterpolationBasePath = path.resolve( + 'packages/labelmap-interpolation/src/index' +); +const csPolymorphicSegmentationBasePath = path.resolve( + 'packages/polymorphic-segmentation/src/index' +); const csAdapters = path.resolve('packages/adapters/src/index'); const csDICOMImageLoaderDistPath = path.resolve( 'packages/dicomImageLoader/src/index' @@ -67,6 +73,14 @@ module.exports = { '@cornerstonejs/core': '${csRenderBasePath.replace(/\\/g, '/')}', '@cornerstonejs/tools': '${csToolsBasePath.replace(/\\/g, '/')}', '@cornerstonejs/ai': '${csAiBasePath.replace(/\\/g, '/')}', + '@cornerstonejs/polymorphic-segmentation': '${csPolymorphicSegmentationBasePath.replace( + /\\/g, + '/' + )}', + '@cornerstonejs/labelmap-interpolation': '${csLabelmapInterpolationBasePath.replace( + /\\/g, + '/' + )}', '@cornerstonejs/nifti-volume-loader': '${csNiftiPath.replace( /\\/g, '/' diff --git a/utils/ExampleRunner/template-multiexample-config.js b/utils/ExampleRunner/template-multiexample-config.js index 7f84f0028e..e1695100e5 100644 --- a/utils/ExampleRunner/template-multiexample-config.js +++ b/utils/ExampleRunner/template-multiexample-config.js @@ -3,6 +3,12 @@ const path = require('path'); const csRenderBasePath = path.resolve('./packages/core/src/index'); const csToolsBasePath = path.resolve('./packages/tools/src/index'); const csAiBasePath = path.resolve('./packages/ai/src/index'); +const csLabelmapInterpolationBasePath = path.resolve( + './packages/labelmap-interpolation/src/index' +); +const csPolymorphicSegmentationBasePath = path.resolve( + 'packages/polymorphic-segmentation/src/index' +); const csAdaptersBasePath = path.resolve('./packages/adapters/src/index'); const csDICOMImageLoaderDistPath = path.resolve( 'packages/dicomImageLoader/src/index' @@ -102,6 +108,14 @@ module.exports = { '@cornerstonejs/core': '${csRenderBasePath.replace(/\\/g, '/')}', '@cornerstonejs/tools': '${csToolsBasePath.replace(/\\/g, '/')}', '@cornerstonejs/ai': '${csAiBasePath.replace(/\\/g, '/')}', + '@cornerstonejs/polymorphic-segmentation': '${csPolymorphicSegmentationBasePath.replace( + /\\/g, + '/' + )}', + '@cornerstonejs/labelmap-interpolation': '${csLabelmapInterpolationBasePath.replace( + /\\/g, + '/' + )}', '@cornerstonejs/adapters': '${csAdaptersBasePath.replace(/\\/g, '/')}', '@cornerstonejs/dicom-image-loader': '${csDICOMImageLoaderDistPath.replace( /\\/g, diff --git a/utils/demo/helpers/initDemo.js b/utils/demo/helpers/initDemo.ts similarity index 84% rename from utils/demo/helpers/initDemo.js rename to utils/demo/helpers/initDemo.ts index 59959148b1..de0677b091 100644 --- a/utils/demo/helpers/initDemo.js +++ b/utils/demo/helpers/initDemo.ts @@ -15,6 +15,7 @@ import { fakeMetaDataProvider, } from '../../test/testUtilsImageLoader'; import cornerstoneDICOMImageLoader from '@cornerstonejs/dicom-image-loader'; +import * as polySeg from '@cornerstonejs/polymorphic-segmentation'; window.cornerstone = cornerstone; window.cornerstoneTools = cornerstoneTools; @@ -27,7 +28,11 @@ export default async function initDemo(config) { peerImport, ...(config?.core ? config.core : {}), }); - await csToolsInit(); + await csToolsInit({ + addons: { + polySeg, + }, + }); // for testings, you don't need any of these volumeLoader.registerVolumeLoader('fakeVolumeLoader', fakeVolumeLoader); @@ -47,18 +52,6 @@ export async function peerImport(moduleId) { 'dicomMicroscopyViewer' ); } - - if (moduleId === '@icr/polyseg-wasm') { - return import('@icr/polyseg-wasm'); - } - - if (moduleId === 'itk-wasm') { - return import('itk-wasm'); - } - - if (moduleId === '@itk-wasm/morphological-contour-interpolation') { - return import('@itk-wasm/morphological-contour-interpolation'); - } } async function importGlobal(path, globalName) { diff --git a/utils/demo/helpers/labelmapTools.ts b/utils/demo/helpers/labelmapTools.ts index 287bd431f4..c2333c4260 100644 --- a/utils/demo/helpers/labelmapTools.ts +++ b/utils/demo/helpers/labelmapTools.ts @@ -19,16 +19,12 @@ const preview = { const configuration = { preview, - strategySpecificConfiguration: { - useCenterSegmentIndex: false, - }, + useCenterSegmentIndex: false, }; const configurationNoPreview = { preview: { enabled: false, previewColors }, - strategySpecificConfiguration: { - useCenterSegmentIndex: false, - }, + useCenterSegmentIndex: false, }; const thresholdOptions = new Map(); @@ -41,11 +37,11 @@ thresholdOptions.set('Use Existing Threshold', { dynamicRadius: 5, }); thresholdOptions.set('CT Fat: (-150, -70)', { - threshold: [-150, -70], + range: [-150, -70], isDynamic: false, }); thresholdOptions.set('CT Bone: (200, 1000)', { - threshold: [200, 1000], + range: [200, 1000], isDynamic: false, }); @@ -59,10 +55,7 @@ toolMap.set('ThresholdCircle', { configuration: { ...configuration, activeStrategy: 'THRESHOLD_INSIDE_CIRCLE', - strategySpecificConfiguration: { - ...configuration.strategySpecificConfiguration, - THRESHOLD: { ...thresholdArgs }, - }, + threshold: thresholdArgs, }, }); @@ -71,10 +64,7 @@ toolMap.set('ThresholdSphere', { configuration: { ...configuration, activeStrategy: 'THRESHOLD_INSIDE_SPHERE_WITH_ISLAND_REMOVAL', - strategySpecificConfiguration: { - ...configuration.strategySpecificConfiguration, - THRESHOLD: { ...thresholdArgs }, - }, + threshold: thresholdArgs, }, }); diff --git a/version.json b/version.json index d469d12207..57cffde4d7 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { - "version": "2.19.7", - "commit": "f43a1766ba16aec1fc6bd638543f406735281220" + "version": "3.0.5", + "commit": "eae957729848d44971050ca40d684dae8f919170" } \ No newline at end of file diff --git a/version.txt b/version.txt index be75f34264..7da3c16870 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.19.7 \ No newline at end of file +3.0.5 \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index aaa0d1b385..cbb9358d17 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,32 +2,32 @@ # yarn lockfile v1 -"@algolia/autocomplete-core@1.9.3": - version "1.9.3" - resolved "https://registry.yarnpkg.com/@algolia/autocomplete-core/-/autocomplete-core-1.9.3.tgz#1d56482a768c33aae0868c8533049e02e8961be7" - integrity sha512-009HdfugtGCdC4JdXUbVJClA0q0zh24yyePn+KUGk3rP7j8FEe/m5Yo/z65gn6nP/cM39PxpzqKrL7A6fP6PPw== +"@algolia/autocomplete-core@1.17.9": + version "1.17.9" + resolved "https://registry.yarnpkg.com/@algolia/autocomplete-core/-/autocomplete-core-1.17.9.tgz#83374c47dc72482aa45d6b953e89377047f0dcdc" + integrity sha512-O7BxrpLDPJWWHv/DLA9DRFWs+iY1uOJZkqUwjS5HSZAGcl0hIVCQ97LTLewiZmZ402JYUrun+8NqFP+hCknlbQ== dependencies: - "@algolia/autocomplete-plugin-algolia-insights" "1.9.3" - "@algolia/autocomplete-shared" "1.9.3" + "@algolia/autocomplete-plugin-algolia-insights" "1.17.9" + "@algolia/autocomplete-shared" "1.17.9" -"@algolia/autocomplete-plugin-algolia-insights@1.9.3": - version "1.9.3" - resolved "https://registry.yarnpkg.com/@algolia/autocomplete-plugin-algolia-insights/-/autocomplete-plugin-algolia-insights-1.9.3.tgz#9b7f8641052c8ead6d66c1623d444cbe19dde587" - integrity sha512-a/yTUkcO/Vyy+JffmAnTWbr4/90cLzw+CC3bRbhnULr/EM0fGNvM13oQQ14f2moLMcVDyAx/leczLlAOovhSZg== +"@algolia/autocomplete-plugin-algolia-insights@1.17.9": + version "1.17.9" + resolved "https://registry.yarnpkg.com/@algolia/autocomplete-plugin-algolia-insights/-/autocomplete-plugin-algolia-insights-1.17.9.tgz#74c86024d09d09e8bfa3dd90b844b77d9f9947b6" + integrity sha512-u1fEHkCbWF92DBeB/KHeMacsjsoI0wFhjZtlCq2ddZbAehshbZST6Hs0Avkc0s+4UyBGbMDnSuXHLuvRWK5iDQ== dependencies: - "@algolia/autocomplete-shared" "1.9.3" + "@algolia/autocomplete-shared" "1.17.9" -"@algolia/autocomplete-preset-algolia@1.9.3": - version "1.9.3" - resolved "https://registry.yarnpkg.com/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.9.3.tgz#64cca4a4304cfcad2cf730e83067e0c1b2f485da" - integrity sha512-d4qlt6YmrLMYy95n5TB52wtNDr6EgAIPH81dvvvW8UmuWRgxEtY0NJiPwl/h95JtG2vmRM804M0DSwMCNZlzRA== +"@algolia/autocomplete-preset-algolia@1.17.9": + version "1.17.9" + resolved "https://registry.yarnpkg.com/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.17.9.tgz#911f3250544eb8ea4096fcfb268f156b085321b5" + integrity sha512-Na1OuceSJeg8j7ZWn5ssMu/Ax3amtOwk76u4h5J4eK2Nx2KB5qt0Z4cOapCsxot9VcEN11ADV5aUSlQF4RhGjQ== dependencies: - "@algolia/autocomplete-shared" "1.9.3" + "@algolia/autocomplete-shared" "1.17.9" -"@algolia/autocomplete-shared@1.9.3": - version "1.9.3" - resolved "https://registry.yarnpkg.com/@algolia/autocomplete-shared/-/autocomplete-shared-1.9.3.tgz#2e22e830d36f0a9cf2c0ccd3c7f6d59435b77dfa" - integrity sha512-Wnm9E4Ye6Rl6sTTqjoymD+l8DjSTHsHboVRYrKgEt8Q7UHm9nYbqhN/i0fhUYA3OAEH7WA8x3jfpnmJm3rKvaQ== +"@algolia/autocomplete-shared@1.17.9": + version "1.17.9" + resolved "https://registry.yarnpkg.com/@algolia/autocomplete-shared/-/autocomplete-shared-1.17.9.tgz#5f38868f7cb1d54b014b17a10fc4f7e79d427fa8" + integrity sha512-iDf05JDQ7I0b7JEA/9IektxN/80a2MZ1ToohfmNS3rfeuQnIKI3IJlIafD0xu4StbtQTghx9T3Maa97ytkXenQ== "@algolia/cache-browser-local-storage@4.24.0": version "4.24.0" @@ -48,6 +48,16 @@ dependencies: "@algolia/cache-common" "4.24.0" +"@algolia/client-abtesting@5.20.3": + version "5.20.3" + resolved "https://registry.yarnpkg.com/@algolia/client-abtesting/-/client-abtesting-5.20.3.tgz#e4120919292c57270546cdf8f7030ac8f035c9a2" + integrity sha512-wPOzHYSsW+H97JkBLmnlOdJSpbb9mIiuNPycUCV5DgzSkJFaI/OFxXfZXAh1gqxK+hf0miKue1C9bltjWljrNA== + dependencies: + "@algolia/client-common" "5.20.3" + "@algolia/requester-browser-xhr" "5.20.3" + "@algolia/requester-fetch" "5.20.3" + "@algolia/requester-node-http" "5.20.3" + "@algolia/client-account@4.24.0": version "4.24.0" resolved "https://registry.yarnpkg.com/@algolia/client-account/-/client-account-4.24.0.tgz#eba7a921d828e7c8c40a32d4add21206c7fe12f1" @@ -67,6 +77,16 @@ "@algolia/requester-common" "4.24.0" "@algolia/transporter" "4.24.0" +"@algolia/client-analytics@5.20.3": + version "5.20.3" + resolved "https://registry.yarnpkg.com/@algolia/client-analytics/-/client-analytics-5.20.3.tgz#242d448ee34667a52bf1efe5c39b58546d71201f" + integrity sha512-XE3iduH9lA7iTQacDGofBQyIyIgaX8qbTRRdj1bOCmfzc9b98CoiMwhNwdTifmmMewmN0EhVF3hP8KjKWwX7Yw== + dependencies: + "@algolia/client-common" "5.20.3" + "@algolia/requester-browser-xhr" "5.20.3" + "@algolia/requester-fetch" "5.20.3" + "@algolia/requester-node-http" "5.20.3" + "@algolia/client-common@4.24.0": version "4.24.0" resolved "https://registry.yarnpkg.com/@algolia/client-common/-/client-common-4.24.0.tgz#77c46eee42b9444a1d1c1583a83f7df4398a649d" @@ -75,6 +95,21 @@ "@algolia/requester-common" "4.24.0" "@algolia/transporter" "4.24.0" +"@algolia/client-common@5.20.3": + version "5.20.3" + resolved "https://registry.yarnpkg.com/@algolia/client-common/-/client-common-5.20.3.tgz#7eec522ca18ae446b775092d17d47eecf97c6af9" + integrity sha512-IYRd/A/R3BXeaQVT2805lZEdWo54v39Lqa7ABOxIYnUvX2vvOMW1AyzCuT0U7Q+uPdD4UW48zksUKRixShcWxA== + +"@algolia/client-insights@5.20.3": + version "5.20.3" + resolved "https://registry.yarnpkg.com/@algolia/client-insights/-/client-insights-5.20.3.tgz#1bcd9e3090512d3f32e64c2c0b839c7ebfd40574" + integrity sha512-QGc/bmDUBgzB71rDL6kihI2e1Mx6G6PxYO5Ks84iL3tDcIel1aFuxtRF14P8saGgdIe1B6I6QkpkeIddZ6vWQw== + dependencies: + "@algolia/client-common" "5.20.3" + "@algolia/requester-browser-xhr" "5.20.3" + "@algolia/requester-fetch" "5.20.3" + "@algolia/requester-node-http" "5.20.3" + "@algolia/client-personalization@4.24.0": version "4.24.0" resolved "https://registry.yarnpkg.com/@algolia/client-personalization/-/client-personalization-4.24.0.tgz#8b47789fb1cb0f8efbea0f79295b7c5a3850f6ae" @@ -84,6 +119,26 @@ "@algolia/requester-common" "4.24.0" "@algolia/transporter" "4.24.0" +"@algolia/client-personalization@5.20.3": + version "5.20.3" + resolved "https://registry.yarnpkg.com/@algolia/client-personalization/-/client-personalization-5.20.3.tgz#ca1fe559112bd9aedefa38ca712d69b0bc2bfddf" + integrity sha512-zuM31VNPDJ1LBIwKbYGz/7+CSm+M8EhlljDamTg8AnDilnCpKjBebWZR5Tftv/FdWSro4tnYGOIz1AURQgZ+tQ== + dependencies: + "@algolia/client-common" "5.20.3" + "@algolia/requester-browser-xhr" "5.20.3" + "@algolia/requester-fetch" "5.20.3" + "@algolia/requester-node-http" "5.20.3" + +"@algolia/client-query-suggestions@5.20.3": + version "5.20.3" + resolved "https://registry.yarnpkg.com/@algolia/client-query-suggestions/-/client-query-suggestions-5.20.3.tgz#fed613ab3c7e0be1cb5dcca09fdab65de17e2800" + integrity sha512-Nn872PuOI8qzi1bxMMhJ0t2AzVBqN01jbymBQOkypvZHrrjZPso3iTpuuLLo9gi3yc/08vaaWTAwJfPhxPwJUw== + dependencies: + "@algolia/client-common" "5.20.3" + "@algolia/requester-browser-xhr" "5.20.3" + "@algolia/requester-fetch" "5.20.3" + "@algolia/requester-node-http" "5.20.3" + "@algolia/client-search@4.24.0": version "4.24.0" resolved "https://registry.yarnpkg.com/@algolia/client-search/-/client-search-4.24.0.tgz#75e6c02d33ef3e0f34afd9962c085b856fc4a55f" @@ -93,11 +148,31 @@ "@algolia/requester-common" "4.24.0" "@algolia/transporter" "4.24.0" +"@algolia/client-search@5.20.3": + version "5.20.3" + resolved "https://registry.yarnpkg.com/@algolia/client-search/-/client-search-5.20.3.tgz#d8ce41dea173112d4a971d697f34145a1354befd" + integrity sha512-9+Fm1ahV8/2goSIPIqZnVitV5yHW5E5xTdKy33xnqGd45A9yVv5tTkudWzEXsbfBB47j9Xb3uYPZjAvV5RHbKA== + dependencies: + "@algolia/client-common" "5.20.3" + "@algolia/requester-browser-xhr" "5.20.3" + "@algolia/requester-fetch" "5.20.3" + "@algolia/requester-node-http" "5.20.3" + "@algolia/events@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@algolia/events/-/events-4.0.1.tgz#fd39e7477e7bc703d7f893b556f676c032af3950" integrity sha512-FQzvOCgoFXAbf5Y6mYozw2aj5KCJoA3m4heImceldzPSMbdyS4atVjJzXKMsfX3wnZTFYwkkt8/z8UesLHlSBQ== +"@algolia/ingestion@1.20.3": + version "1.20.3" + resolved "https://registry.yarnpkg.com/@algolia/ingestion/-/ingestion-1.20.3.tgz#32283c2cde45d47b6731bbaaa170703ddf9c3874" + integrity sha512-5GHNTiZ3saLjTNyr6WkP5hzDg2eFFAYWomvPcm9eHWskjzXt8R0IOiW9kkTS6I6hXBwN5H9Zna5mZDSqqJdg+g== + dependencies: + "@algolia/client-common" "5.20.3" + "@algolia/requester-browser-xhr" "5.20.3" + "@algolia/requester-fetch" "5.20.3" + "@algolia/requester-node-http" "5.20.3" + "@algolia/logger-common@4.24.0": version "4.24.0" resolved "https://registry.yarnpkg.com/@algolia/logger-common/-/logger-common-4.24.0.tgz#28d439976019ec0a46ba7a1a739ef493d4ef8123" @@ -110,6 +185,16 @@ dependencies: "@algolia/logger-common" "4.24.0" +"@algolia/monitoring@1.20.3": + version "1.20.3" + resolved "https://registry.yarnpkg.com/@algolia/monitoring/-/monitoring-1.20.3.tgz#8165d8fbb89134876e9055f3432a3de72dc150bc" + integrity sha512-KUWQbTPoRjP37ivXSQ1+lWMfaifCCMzTnEcEnXwAmherS5Tp7us6BAqQDMGOD4E7xyaS2I8pto6WlOzxH+CxmA== + dependencies: + "@algolia/client-common" "5.20.3" + "@algolia/requester-browser-xhr" "5.20.3" + "@algolia/requester-fetch" "5.20.3" + "@algolia/requester-node-http" "5.20.3" + "@algolia/recommend@4.24.0": version "4.24.0" resolved "https://registry.yarnpkg.com/@algolia/recommend/-/recommend-4.24.0.tgz#8a3f78aea471ee0a4836b78fd2aad4e9abcaaf34" @@ -127,6 +212,16 @@ "@algolia/requester-node-http" "4.24.0" "@algolia/transporter" "4.24.0" +"@algolia/recommend@5.20.3": + version "5.20.3" + resolved "https://registry.yarnpkg.com/@algolia/recommend/-/recommend-5.20.3.tgz#bfe36b49287cdf07ad5369640dd65f4b12117e30" + integrity sha512-oo/gG77xTTTclkrdFem0Kmx5+iSRFiwuRRdxZETDjwzCI7svutdbwBgV/Vy4D4QpYaX4nhY/P43k84uEowCE4Q== + dependencies: + "@algolia/client-common" "5.20.3" + "@algolia/requester-browser-xhr" "5.20.3" + "@algolia/requester-fetch" "5.20.3" + "@algolia/requester-node-http" "5.20.3" + "@algolia/requester-browser-xhr@4.24.0": version "4.24.0" resolved "https://registry.yarnpkg.com/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.24.0.tgz#313c5edab4ed73a052e75803855833b62dd19c16" @@ -134,11 +229,25 @@ dependencies: "@algolia/requester-common" "4.24.0" +"@algolia/requester-browser-xhr@5.20.3": + version "5.20.3" + resolved "https://registry.yarnpkg.com/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.20.3.tgz#7bc054eb70669e601e0b1ab034d360eb44c900b6" + integrity sha512-BkkW7otbiI/Er1AiEPZs1h7lxbtSO9p09jFhv3/iT8/0Yz0CY79VJ9iq+Wv1+dq/l0OxnMpBy8mozrieGA3mXQ== + dependencies: + "@algolia/client-common" "5.20.3" + "@algolia/requester-common@4.24.0": version "4.24.0" resolved "https://registry.yarnpkg.com/@algolia/requester-common/-/requester-common-4.24.0.tgz#1c60c198031f48fcdb9e34c4057a3ea987b9a436" integrity sha512-k3CXJ2OVnvgE3HMwcojpvY6d9kgKMPRxs/kVohrwF5WMr2fnqojnycZkxPoEg+bXm8fi5BBfFmOqgYztRtHsQA== +"@algolia/requester-fetch@5.20.3": + version "5.20.3" + resolved "https://registry.yarnpkg.com/@algolia/requester-fetch/-/requester-fetch-5.20.3.tgz#e280a3bd142984a31b172743119f21a3ccef576b" + integrity sha512-eAVlXz7UNzTsA1EDr+p0nlIH7WFxo7k3NMxYe8p38DH8YVWLgm2MgOVFUMNg9HCi6ZNOi/A2w/id2ZZ4sKgUOw== + dependencies: + "@algolia/client-common" "5.20.3" + "@algolia/requester-node-http@4.24.0": version "4.24.0" resolved "https://registry.yarnpkg.com/@algolia/requester-node-http/-/requester-node-http-4.24.0.tgz#4461593714031d02aa7da221c49df675212f482f" @@ -146,6 +255,13 @@ dependencies: "@algolia/requester-common" "4.24.0" +"@algolia/requester-node-http@5.20.3": + version "5.20.3" + resolved "https://registry.yarnpkg.com/@algolia/requester-node-http/-/requester-node-http-5.20.3.tgz#cf06a8568efd7f3ad02414e13f2fa94c15edfc37" + integrity sha512-FqR3pQPfHfQyX1wgcdK6iyqu86yP76MZd4Pzj1y/YLMj9rRmRCY0E0AffKr//nrOFEwv6uY8BQY4fd9/6b0ZCg== + dependencies: + "@algolia/client-common" "5.20.3" + "@algolia/transporter@4.24.0": version "4.24.0" resolved "https://registry.yarnpkg.com/@algolia/transporter/-/transporter-4.24.0.tgz#226bb1f8af62430374c1972b2e5c8580ab275102" @@ -444,6 +560,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz#9cbdd63a9443a2c92a725cca7ebca12cc8dd9f46" integrity sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw== +"@babel/helper-plugin-utils@^7.26.5": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz#18580d00c9934117ad719392c4f6585c9333cc35" + integrity sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg== + "@babel/helper-remap-async-to-generator@^7.24.7", "@babel/helper-remap-async-to-generator@^7.25.0": version "7.25.0" resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.25.0.tgz#d2f0fbba059a42d68e5e378feaf181ef6055365e" @@ -1607,14 +1728,14 @@ "@babel/helper-plugin-utils" "^7.25.9" "@babel/plugin-transform-runtime@^7.21.4": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.24.7.tgz#00a5bfaf8c43cf5c8703a8a6e82b59d9c58f38ca" - integrity sha512-YqXjrk4C+a1kZjewqt+Mmu2UuV1s07y8kqcUf4qYLnoqemhR4gRQikhdAhSVJioMjVTu6Mo6pAbaypEA3jY6fw== + version "7.26.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.26.9.tgz#ea8be19ef134668e98f7b54daf7c4f853859dc44" + integrity sha512-Jf+8y9wXQbbxvVYTM8gO5oEF2POdNji0NMltEkG7FtmzD9PVz7/lxpqSdTvwsjTMU5HIHuDVNf2SOxLkWi+wPQ== dependencies: - "@babel/helper-module-imports" "^7.24.7" - "@babel/helper-plugin-utils" "^7.24.7" + "@babel/helper-module-imports" "^7.25.9" + "@babel/helper-plugin-utils" "^7.26.5" babel-plugin-polyfill-corejs2 "^0.4.10" - babel-plugin-polyfill-corejs3 "^0.10.1" + babel-plugin-polyfill-corejs3 "^0.10.6" babel-plugin-polyfill-regenerator "^0.6.1" semver "^6.3.1" @@ -2011,14 +2132,22 @@ integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== "@babel/runtime-corejs2@^7.17.8": - version "7.25.0" - resolved "https://registry.yarnpkg.com/@babel/runtime-corejs2/-/runtime-corejs2-7.25.0.tgz#c1e677774a618f48caff129a8e2a066f1ecd0384" - integrity sha512-aoYVE3tm+vgAoezmXFWmVcp+NlSdsUqQMPL7c6zRxq8KDHCf570pamC7005Q/UkSlTuoL6oeE16zIw/9J3YFyw== + version "7.26.9" + resolved "https://registry.yarnpkg.com/@babel/runtime-corejs2/-/runtime-corejs2-7.26.9.tgz#1936c9847aa09faaa941e06f48d3e391e5ca5e1b" + integrity sha512-DHEUkm9RD4RfIThlLTemmHNFVTj9Z/augVFMuyheFjwoFv1jFjauncHrcSW6Kv1TpzTupB01zFk2iRFAh2iE9A== dependencies: core-js "^2.6.12" regenerator-runtime "^0.14.0" -"@babel/runtime-corejs3@^7.15.4", "@babel/runtime-corejs3@^7.22.5": +"@babel/runtime-corejs3@^7.15.4": + version "7.26.9" + resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.26.9.tgz#8b73bae47453aa3dd2839ac52598581a7dd8332f" + integrity sha512-5EVjbTegqN7RSJle6hMWYxO4voo4rI+9krITk+DWR+diJgGrjZjrIBnJhjrHYYQsFgI7j1w1QnrvV7YSKBfYGg== + dependencies: + core-js-pure "^3.30.2" + regenerator-runtime "^0.14.0" + +"@babel/runtime-corejs3@^7.22.5": version "7.25.0" resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.25.0.tgz#0a318b66dfc765ad10562d829fea372ed7e1eb7d" integrity sha512-BOehWE7MgQ8W8Qn0CQnMtg2tHPHPulcS/5AVpFvs2KCK1ET+0WqZqPvnpRpFN81gYoFopdIEJX9Sgjw3ZBccPg== @@ -2807,20 +2936,20 @@ resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== -"@docsearch/css@3.6.1": - version "3.6.1" - resolved "https://registry.yarnpkg.com/@docsearch/css/-/css-3.6.1.tgz#f0a728ecb486c81f2d282650fc1820c914913408" - integrity sha512-VtVb5DS+0hRIprU2CO6ZQjK2Zg4QU5HrDM1+ix6rT0umsYvFvatMAnf97NHZlVWDaaLlx7GRfR/7FikANiM2Fg== +"@docsearch/css@3.9.0": + version "3.9.0" + resolved "https://registry.yarnpkg.com/@docsearch/css/-/css-3.9.0.tgz#3bc29c96bf024350d73b0cfb7c2a7b71bf251cd5" + integrity sha512-cQbnVbq0rrBwNAKegIac/t6a8nWoUAn8frnkLFW6YARaRmAQr5/Eoe6Ln2fqkUCZ40KpdrKbpSAmgrkviOxuWA== "@docsearch/react@^3.5.2": - version "3.6.1" - resolved "https://registry.yarnpkg.com/@docsearch/react/-/react-3.6.1.tgz#0f826df08693293806d64277d6d9c38636211b97" - integrity sha512-qXZkEPvybVhSXj0K7U3bXc233tk5e8PfhoZ6MhPOiik/qUQxYC+Dn9DnoS7CxHQQhHfCvTiN0eY9M12oRghEXw== + version "3.9.0" + resolved "https://registry.yarnpkg.com/@docsearch/react/-/react-3.9.0.tgz#d0842b700c3ee26696786f3c8ae9f10c1a3f0db3" + integrity sha512-mb5FOZYZIkRQ6s/NWnM98k879vu5pscWqTLubLFBO87igYYT4VzVazh4h5o/zCvTIZgEt3PvsCOMOswOUo9yHQ== dependencies: - "@algolia/autocomplete-core" "1.9.3" - "@algolia/autocomplete-preset-algolia" "1.9.3" - "@docsearch/css" "3.6.1" - algoliasearch "^4.19.1" + "@algolia/autocomplete-core" "1.17.9" + "@algolia/autocomplete-preset-algolia" "1.17.9" + "@docsearch/css" "3.9.0" + algoliasearch "^5.14.2" "@docusaurus/babel@3.6.3": version "3.6.3" @@ -3777,7 +3906,7 @@ resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.5.tgz#b32366c89b43c6f8cefbdefac778b9c828e3ba8c" integrity sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg== -"@icr/polyseg-wasm@^0.4.0": +"@icr/polyseg-wasm@0.4.0": version "0.4.0" resolved "https://registry.yarnpkg.com/@icr/polyseg-wasm/-/polyseg-wasm-0.4.0.tgz#755e23d07c3d8d8fca1113278c803c1ef0185da0" integrity sha512-3sZmiwG8I0NaqPle0L7+V/ZexiR7IjIUFkUsaOoFI9rNuBGyyMMmxAxnCmqcDFtBDk9h+JEYJf6e3NnqlHi/HQ== @@ -3878,12 +4007,12 @@ ipfs-car "^1.0.0" tar "^6.1.13" -"@itk-wasm/morphological-contour-interpolation@1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@itk-wasm/morphological-contour-interpolation/-/morphological-contour-interpolation-1.0.1.tgz#c2fcfdc593df85001276918e8ef684ba0b73a3c9" - integrity sha512-wxLB4nX6CiWpNQyTWC7oeFXogiZbtmSuLhyAtY66sM0SEnMoOcAuSX2+osPcOo13rfYnHLA02uQiICp8hvUGwA== +"@itk-wasm/morphological-contour-interpolation@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@itk-wasm/morphological-contour-interpolation/-/morphological-contour-interpolation-1.1.0.tgz#a2982dc27cdcc27026b61e12f76e7687c88cad7e" + integrity sha512-n6JIyDcSCCjlpfCW8mnTTzwPTE8U1QT87hNmyAknxdpGR4dfAzIutuKNrwgvr9UiKEBcit0X3HNx9dkzDwcIcw== dependencies: - itk-wasm "1.0.0-b.165" + itk-wasm "1.0.0-b.173" "@jest/console@^29.7.0": version "29.7.0" @@ -4425,14 +4554,6 @@ resolved "https://registry.yarnpkg.com/@module-federation/error-codes/-/error-codes-0.8.4.tgz#c66ead0da86bc010fa53187462c704b3e0d5a256" integrity sha512-55LYmrDdKb4jt+qr8qE8U3al62ZANp3FhfVaNPOaAmdTh0jHdD8M3yf5HKFlr5xVkVO4eV/F/J2NCfpbh+pEXQ== -"@module-federation/runtime-tools@0.5.1": - version "0.5.1" - resolved "https://registry.yarnpkg.com/@module-federation/runtime-tools/-/runtime-tools-0.5.1.tgz#1b1f93837159a6bf0c0ba78730d589a5a8f74aa3" - integrity sha512-nfBedkoZ3/SWyO0hnmaxuz0R0iGPSikHZOAZ0N/dVSQaIzlffUo35B5nlC2wgWIc0JdMZfkwkjZRrnuuDIJbzg== - dependencies: - "@module-federation/runtime" "0.5.1" - "@module-federation/webpack-bundler-runtime" "0.5.1" - "@module-federation/runtime-tools@0.8.4": version "0.8.4" resolved "https://registry.yarnpkg.com/@module-federation/runtime-tools/-/runtime-tools-0.8.4.tgz#ddf8461fe9b5d5e962511f4e5b622008ee46bde8" @@ -4441,13 +4562,6 @@ "@module-federation/runtime" "0.8.4" "@module-federation/webpack-bundler-runtime" "0.8.4" -"@module-federation/runtime@0.5.1": - version "0.5.1" - resolved "https://registry.yarnpkg.com/@module-federation/runtime/-/runtime-0.5.1.tgz#b548a75e2068952ff66ad717cbf73fc921edd5d7" - integrity sha512-xgiMUWwGLWDrvZc9JibuEbXIbhXg6z2oUkemogSvQ4LKvrl/n0kbqP1Blk669mXzyWbqtSp6PpvNdwaE1aN5xQ== - dependencies: - "@module-federation/sdk" "0.5.1" - "@module-federation/runtime@0.8.4": version "0.8.4" resolved "https://registry.yarnpkg.com/@module-federation/runtime/-/runtime-0.8.4.tgz#7fc63e1b7dda0506bb2a70c1a52aa73513c5b508" @@ -4456,11 +4570,6 @@ "@module-federation/error-codes" "0.8.4" "@module-federation/sdk" "0.8.4" -"@module-federation/sdk@0.5.1": - version "0.5.1" - resolved "https://registry.yarnpkg.com/@module-federation/sdk/-/sdk-0.5.1.tgz#6c0a4053c23fa84db7aae7e4736496c541de7191" - integrity sha512-exvchtjNURJJkpqjQ3/opdbfeT2wPKvrbnGnyRkrwW5o3FH1LaST1tkiNviT6OXTexGaVc2DahbdniQHVtQ7pA== - "@module-federation/sdk@0.8.4": version "0.8.4" resolved "https://registry.yarnpkg.com/@module-federation/sdk/-/sdk-0.8.4.tgz#956e178e104d640482e5afe93c7e3a095a589807" @@ -4468,14 +4577,6 @@ dependencies: isomorphic-rslog "0.0.6" -"@module-federation/webpack-bundler-runtime@0.5.1": - version "0.5.1" - resolved "https://registry.yarnpkg.com/@module-federation/webpack-bundler-runtime/-/webpack-bundler-runtime-0.5.1.tgz#ef626af0d57e3568c474d66d7d3797366e09cafd" - integrity sha512-mMhRFH0k2VjwHt3Jol9JkUsmI/4XlrAoBG3E0o7HoyoPYv1UFOWyqAflfANcUPgbYpvqmyLzDcO+3IT36LXnrA== - dependencies: - "@module-federation/runtime" "0.5.1" - "@module-federation/sdk" "0.5.1" - "@module-federation/webpack-bundler-runtime@0.8.4": version "0.8.4" resolved "https://registry.yarnpkg.com/@module-federation/webpack-bundler-runtime/-/webpack-bundler-runtime-0.8.4.tgz#c01f5a5c5d61664c21ac6c479ebe9d8bf09d22d6" @@ -5656,110 +5757,95 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.13.0.tgz#f672f6508f090fc73f08ba40ff76c20b57424778" integrity sha512-yUD/8wMffnTKuiIsl6xU+4IA8UNhQ/f1sAnQebmE/lyQ8abjsVyDkyRkWop0kdMhKMprpNIhPmYlCxgHrPoXoA== -"@rspack/binding-darwin-arm64@1.1.6": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-1.1.6.tgz#eb5a219caaf43e87b8077083692efc3a6491da7b" - integrity sha512-x9dxm2yyiMuL1FBwvWNNMs2/mEUJmRoSRgYb8pblR7HDaTRORrjBFCqhaYlGyAqtQaeUy7o2VAQlE0BavIiFYA== - "@rspack/binding-darwin-arm64@1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-1.2.2.tgz#e2444ef46b3ee689a6021ae757bb55a0dbe7b491" integrity sha512-h23F8zEkXWhwMeScm0ZnN78Zh7hCDalxIWsm7bBS0eKadnlegUDwwCF8WE+8NjWr7bRzv0p3QBWlS5ufkcL4eA== -"@rspack/binding-darwin-x64@1.1.6": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@rspack/binding-darwin-x64/-/binding-darwin-x64-1.1.6.tgz#18c44135670857242c5dc96de2c63952050c934a" - integrity sha512-o0seilveftGiDjy3VPxug20HmAgYyQbNEuagR3i93/t/PT/eWXHnik+C1jjwqcivZL1Zllqvy4tbZw393aROEQ== +"@rspack/binding-darwin-arm64@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-1.2.6.tgz#5f1fad2c77608061e2607f181dbdf32b62d4d247" + integrity sha512-31URF3tAgVR8Pt6Oc8MANV/gYNR6DlUhtIMmWM2EwdcWTyIEnN7gSDdjtB6cYvETHwdM7NDSCOgyIirG1+tNZw== "@rspack/binding-darwin-x64@1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@rspack/binding-darwin-x64/-/binding-darwin-x64-1.2.2.tgz#5a4b827692d3063a5d30577ba41f2d97ab452492" integrity sha512-vG5s7FkEvwrGLfksyDRHwKAHUkhZt1zHZZXJQn4gZKjTBonje8ezdc7IFlDiWpC4S+oBYp73nDWkUzkGRbSdcQ== -"@rspack/binding-linux-arm64-gnu@1.1.6": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.1.6.tgz#ed132a3c3f7d34f9fea247c217dac12758785549" - integrity sha512-4atnoknJx/c3KaQElsMIxHMpPf2jcRRdWsH/SdqJIRSrkWWakMK9Yv4TFwH680I4HDTMf1XLboMVScHzW8e+Mg== +"@rspack/binding-darwin-x64@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rspack/binding-darwin-x64/-/binding-darwin-x64-1.2.6.tgz#e9e1f86adeb9717aad14721c920a6871801d3bfb" + integrity sha512-0XJMOGEqERP9N8zgJxfdWzuZG9buEp6RL4PSVaXPvcKw75Ig3YW50A8sMqd4SNXAqJp2gC706d6l8OnMXpRo3w== "@rspack/binding-linux-arm64-gnu@1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.2.tgz#9c07f56fcac8ddc12bb818868fd5194c80d11fb5" integrity sha512-VykY/kiYOzO8E1nYzfJ9+gQEHxb5B6lt5wa8M6xFi5B6jEGU+OsaGskmAZB9/GFImeFDHxDPvhUalI4R9p8O2Q== -"@rspack/binding-linux-arm64-musl@1.1.6": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.1.6.tgz#0bb92f5af5b398293c9935b5b3ec6c5acb1d1791" - integrity sha512-7QMtwUtgFpt3/Y3/X18fSyN+kk4H8ZnZ8tDzQskVWc/j2AQYShZq56XQYqrhClzwujcCVAHauIQ2eiuJ2ASGag== +"@rspack/binding-linux-arm64-gnu@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.6.tgz#df0234b410ade125a7cf056fd32bd3288b1e1418" + integrity sha512-Ld26wvy9NSTqhUb/ll5ZpIW08ZzUkTl5daW3xHJgcaoRDrnJkRV1pMx8cdV8S+xsavJIPf4c+BuKpU6Ml2kx9A== "@rspack/binding-linux-arm64-musl@1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.2.tgz#e3aff4cd36de780f95ded65264363b444f7f3c4e" integrity sha512-Z5vAC4wGfXi8XXZ6hs8Q06TYjr3zHf819HB4DI5i4C1eQTeKdZSyoFD0NHFG23bP4NWJffp8KhmoObcy9jBT5Q== -"@rspack/binding-linux-x64-gnu@1.1.6": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.1.6.tgz#c4ef0d87ccae53243689c26c7441b94988227468" - integrity sha512-MTjDEfPn4TwHoqs5d5Fck06kmXiTHZctGIcRVfrpg0RK0r1NLEHN+oosavRZ9c9H70f34+NmcHk+/qvV4c8lWg== +"@rspack/binding-linux-arm64-musl@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.6.tgz#4ac3b06784f3111d7cac24c55780e22a3dffd26b" + integrity sha512-TrklgPKngiuzRovr7MdXDKXPfjJlT3g5LmCX/Y4pPfNrrOLjzL/fpEBRXBJEhrSuNWqpkZSNLs+Av02IY7manQ== "@rspack/binding-linux-x64-gnu@1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.2.tgz#5af03e8b21c4afecddd92d52f0994a7e4785aabd" integrity sha512-o3pDaL+cH5EeRbDE9gZcdZpBgp5iXvYZBBhe8vZQllYgI4zN5MJEuleV7WplG3UwTXlgZg3Kht4RORSOPn96vg== -"@rspack/binding-linux-x64-musl@1.1.6": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-1.1.6.tgz#5800e662c05f259ae7647979bb81c076ea5afffb" - integrity sha512-LqDw7PTVr/4ZuGA0izgDQfamfr72USFHltR1Qhy2YVC3JmDmhG/pQi13LHcOLVaGH1xoeyCmEPNJpVizzDxSjg== +"@rspack/binding-linux-x64-gnu@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.6.tgz#76389841c412952e18ff908d0b36bea5c8f86e3d" + integrity sha512-aZ6mrZyuUg8hlBf7qEfXRAVPh2tM8E7kYZhI5eBOUoi6XhO5fTVcf/S2VUimFWLUmJdmSujG+nrYGQu1n74Xag== "@rspack/binding-linux-x64-musl@1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.2.tgz#e5be9d4d6d7e5369fa0708c3bc6281a8c52525ad" integrity sha512-RE3e0xe4DdchHssttKzryDwjLkbrNk/4H59TkkWeGYJcLw41tmcOZVFQUOwKLUvXWVyif/vjvV/w1SMlqB4wQg== -"@rspack/binding-win32-arm64-msvc@1.1.6": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.1.6.tgz#d0f93bfa6ec1352f112710aa60f9c7a20a12490c" - integrity sha512-RHApLM93YN0WdHpS35u2cm7VCqZ8Yg3CrNRL16VJtyT9e6MBqeScoe4XIgIWKPm7edFyedYAjLX0wQOApwfjkg== +"@rspack/binding-linux-x64-musl@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.6.tgz#510b72377cec1abca142b02cb5588391ca29831f" + integrity sha512-Trg+s1b6sD4XNMOvwWwI+cebwGOBEXsND9Ofjc6L1RPtCeZQ5Rrycfh/HVymI50Y48g8YMibLZw8G2gAfK8SZw== "@rspack/binding-win32-arm64-msvc@1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.2.tgz#4b1e98a304f1ea10fefb1de2de8abc460a0a15a7" integrity sha512-R+PKBYn6uzTaDdVqTHvjqiJPBr5ZHg1wg5UmFDLNH9OklzVFyQh1JInSdJRb7lzfzTRz6bEkkwUFBPQK/CGScw== -"@rspack/binding-win32-ia32-msvc@1.1.6": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.1.6.tgz#bf7ea7c23b39ae6ddf16e51e0c88110f04f16868" - integrity sha512-Y6lx4q0eJawRfMPBo/AclTJAPTZ325DSPFBQJB3TnWh9Z2X7P7pQcYc8PHDmfDuYRIdg5WRsQRvVxihSvF7v8w== +"@rspack/binding-win32-arm64-msvc@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.6.tgz#8a2a3eac5c6a6805a5c7fa9ce4e00acda6901c9f" + integrity sha512-lEWMW8H5ERYX376NA2qGritCHmcMNW+Ob6WVWuEZNh0oWeBD/mWqWFxbCx5J3KtlVy4miwk65V8YDd92alUEyw== "@rspack/binding-win32-ia32-msvc@1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.2.2.tgz#3eff46acf9b1e11b33846edf0f7f916e8aeeb5e6" integrity sha512-dBqz3sRAGZ2f31FgzKLDvIRfq2haRP3X3XVCT0PsiMcvt7QJng+26aYYMy2THatd/nM8IwExYeitHWeiMBoruw== -"@rspack/binding-win32-x64-msvc@1.1.6": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.1.6.tgz#6e1a678b4a57efbbf3fe7f89c63d5bb4917aac1d" - integrity sha512-UuCsfhC/yNuU7xLASOxNXcmsXi2ZvBX14GkxvcdChw6q7IIGNYUKXo1zgR8C1PE/6qDSxmLxbRMS+71d0H3HQg== +"@rspack/binding-win32-ia32-msvc@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.2.6.tgz#b8d15bb50439dd7ba40642ea8f7a618e2dd9e568" + integrity sha512-ML3f7vDyv2c7d+ync6l3aRY4cIAKUPT5n+yz7sRcwIBrB4n1n4rH6wf5a56h4wHjiWpnV0gXBXI9SrYD5a4vRQ== "@rspack/binding-win32-x64-msvc@1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.2.tgz#6f4bf6a590ffbbda64316ef1dc0378c0c3d93f2e" integrity sha512-eeAvaN831KG553cMSHkVldyk6YQn4ujgRHov6r1wtREq7CD3/ka9LMkJUepCN85K7XtwYT0N4KpFIQyf5GTGoA== -"@rspack/binding@1.1.6": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@rspack/binding/-/binding-1.1.6.tgz#d2773fd27efd7d0b3df01d69f9fbcf9b620d817a" - integrity sha512-vfeBEgGOYVwqj5cQjGyvdfrr/BEihAHlyIsobL98FZjTF0uig+bj2yJUH5Ib5F0BpIUKVG3Pw0IjlUBqcVpZsQ== - optionalDependencies: - "@rspack/binding-darwin-arm64" "1.1.6" - "@rspack/binding-darwin-x64" "1.1.6" - "@rspack/binding-linux-arm64-gnu" "1.1.6" - "@rspack/binding-linux-arm64-musl" "1.1.6" - "@rspack/binding-linux-x64-gnu" "1.1.6" - "@rspack/binding-linux-x64-musl" "1.1.6" - "@rspack/binding-win32-arm64-msvc" "1.1.6" - "@rspack/binding-win32-ia32-msvc" "1.1.6" - "@rspack/binding-win32-x64-msvc" "1.1.6" +"@rspack/binding-win32-x64-msvc@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.6.tgz#81713cc4b4e27e1f38b5e2d08b5d970a5d640fbe" + integrity sha512-0W0iComo7cdOg5fOuaZ2l1Mz7DG1A4SPDes557n9CH2Tf5rub3m2rBoMQ1B/XIkcUeGf+oB6bbBBroHPH0vQBA== "@rspack/binding@1.2.2": version "1.2.2" @@ -5776,6 +5862,21 @@ "@rspack/binding-win32-ia32-msvc" "1.2.2" "@rspack/binding-win32-x64-msvc" "1.2.2" +"@rspack/binding@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rspack/binding/-/binding-1.2.6.tgz#14c8518d900aa129ab9d1434e83be28fde8f539a" + integrity sha512-Szu9w+RktSunBNfIHDORY/YRLFplhnUF9QgpUles8XYzKo6NA96WQNJoFbrBDkEQPbNUtVpEk4Ua1c9ZWtVTJQ== + optionalDependencies: + "@rspack/binding-darwin-arm64" "1.2.6" + "@rspack/binding-darwin-x64" "1.2.6" + "@rspack/binding-linux-arm64-gnu" "1.2.6" + "@rspack/binding-linux-arm64-musl" "1.2.6" + "@rspack/binding-linux-x64-gnu" "1.2.6" + "@rspack/binding-linux-x64-musl" "1.2.6" + "@rspack/binding-win32-arm64-msvc" "1.2.6" + "@rspack/binding-win32-ia32-msvc" "1.2.6" + "@rspack/binding-win32-x64-msvc" "1.2.6" + "@rspack/cli@^1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@rspack/cli/-/cli-1.2.2.tgz#16fb207564e3f8f1ce13d85e392c8e540e7aee4f" @@ -5791,14 +5892,14 @@ yargs "17.6.2" "@rspack/core@^1.1.1": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@rspack/core/-/core-1.1.6.tgz#f4cafa859cb1500238f9dd24cf69d82d15def10d" - integrity sha512-q0VLphOF5VW2FEG7Vbdq3Ke4I74FbELE/8xmKghSalFtULLZ44SoSz8lyotfMim9GXIRFhDokAaH8WICmPxG+g== + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rspack/core/-/core-1.2.6.tgz#f5467e80d254f0fee5e358f4c87533c06d125428" + integrity sha512-CYiz6kXWdZX0tKu819Bromg84W9+GrgSY7OTMtr39IKRcCHjdVVjPYFthga2bNppfT+Ifeti5Ed06Xxlptr9CQ== dependencies: - "@module-federation/runtime-tools" "0.5.1" - "@rspack/binding" "1.1.6" + "@module-federation/runtime-tools" "0.8.4" + "@rspack/binding" "1.2.6" "@rspack/lite-tapable" "1.0.1" - caniuse-lite "^1.0.30001616" + caniuse-lite "^1.0.30001700" "@rspack/core@^1.2.2": version "1.2.2" @@ -7563,13 +7664,13 @@ ajv@~8.13.0: uri-js "^4.4.1" algoliasearch-helper@^3.13.3: - version "3.22.3" - resolved "https://registry.yarnpkg.com/algoliasearch-helper/-/algoliasearch-helper-3.22.3.tgz#7c67a1a87c3adb0b52ef726a3de3c0b0edcbb5d1" - integrity sha512-2eoEz8mG4KHE+DzfrBTrCmDPxVXv7aZZWPojAJFtARpxxMO6lkos1dJ+XDCXdPvq7q3tpYWRi6xXmVQikejtpA== + version "3.24.1" + resolved "https://registry.yarnpkg.com/algoliasearch-helper/-/algoliasearch-helper-3.24.1.tgz#763115d81fc56518bff36b7c707967f70d8fdf45" + integrity sha512-knYRACqLH9UpeR+WRUrBzBFR2ulGuOjI2b525k4PNeqZxeFMHJE7YcL7s6Jh12Qza0rtHqZdgHMfeuaaAkf4wA== dependencies: "@algolia/events" "^4.0.1" -algoliasearch@^4.18.0, algoliasearch@^4.19.1: +algoliasearch@^4.18.0: version "4.24.0" resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-4.24.0.tgz#b953b3e2309ef8f25da9de311b95b994ac918275" integrity sha512-bf0QV/9jVejssFBmz2HQLxUadxk574t4iwjCKp5E7NBzwKkrDEhKPISIIjAU/p6K5qDx3qoeh4+26zWN1jmw3g== @@ -7590,6 +7691,25 @@ algoliasearch@^4.18.0, algoliasearch@^4.19.1: "@algolia/requester-node-http" "4.24.0" "@algolia/transporter" "4.24.0" +algoliasearch@^5.14.2: + version "5.20.3" + resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-5.20.3.tgz#32d79b9ffaf5a085943fab304698f46c5a3faed9" + integrity sha512-iNC6BGvipaalFfDfDnXUje8GUlW5asj0cTMsZJwO/0rhsyLx1L7GZFAY8wW+eQ6AM4Yge2p5GSE5hrBlfSD90Q== + dependencies: + "@algolia/client-abtesting" "5.20.3" + "@algolia/client-analytics" "5.20.3" + "@algolia/client-common" "5.20.3" + "@algolia/client-insights" "5.20.3" + "@algolia/client-personalization" "5.20.3" + "@algolia/client-query-suggestions" "5.20.3" + "@algolia/client-search" "5.20.3" + "@algolia/ingestion" "1.20.3" + "@algolia/monitoring" "1.20.3" + "@algolia/recommend" "5.20.3" + "@algolia/requester-browser-xhr" "5.20.3" + "@algolia/requester-fetch" "5.20.3" + "@algolia/requester-node-http" "5.20.3" + all-node-versions@^11.3.0: version "11.3.0" resolved "https://registry.yarnpkg.com/all-node-versions/-/all-node-versions-11.3.0.tgz#ace1c8c9598bb900ba296450ccf0281aabaff7a4" @@ -8115,7 +8235,7 @@ babel-plugin-polyfill-corejs2@^0.4.10: "@babel/helper-define-polyfill-provider" "^0.6.2" semver "^6.3.1" -babel-plugin-polyfill-corejs3@^0.10.1, babel-plugin-polyfill-corejs3@^0.10.4, babel-plugin-polyfill-corejs3@^0.10.6: +babel-plugin-polyfill-corejs3@^0.10.4, babel-plugin-polyfill-corejs3@^0.10.6: version "0.10.6" resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.6.tgz#2deda57caef50f59c525aeb4964d3b2f867710c7" integrity sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA== @@ -8130,6 +8250,14 @@ babel-plugin-polyfill-regenerator@^0.6.1: dependencies: "@babel/helper-define-polyfill-provider" "^0.6.2" +babel-plugin-transform-import-meta@2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-import-meta/-/babel-plugin-transform-import-meta-2.3.2.tgz#320bd0cd878fe38f39e136edb198c535391bf156" + integrity sha512-902o4GiQqI1GqAXfD5rEoz0PJamUfJ3VllpdWaNsFTwdaNjFSFHawvBO+cp5K2j+g2h3bZ4lnM1Xb6yFYGihtA== + dependencies: + "@babel/template" "^7.25.9" + tslib "^2.8.1" + babel-preset-current-node-syntax@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz#9a929eafece419612ef4ae4f60b1862ebad8ef30" @@ -8737,15 +8865,15 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001646: - version "1.0.30001651" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz#52de59529e8b02b1aedcaaf5c05d9e23c0c28138" - integrity sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001616, caniuse-lite@^1.0.30001646, caniuse-lite@^1.0.30001669: + version "1.0.30001699" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001699.tgz" + integrity sha512-b+uH5BakXZ9Do9iK+CkDmctUSEqZl+SP056vc5usa0PL+ev5OHw003rZXcnjNDv3L8P5j6rwT6C0BPKSikW08w== -caniuse-lite@^1.0.30001616, caniuse-lite@^1.0.30001669: - version "1.0.30001673" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001673.tgz#5aa291557af1c71340e809987367410aab7a5a9e" - integrity sha512-WTrjUCSMp3LYX0nE12ECkV0a+e6LC85E0Auz75555/qr78Oc8YWhEPNfDd6SHdtlCMSzqtuXY0uyEMNRcsKpKw== +caniuse-lite@^1.0.30001700: + version "1.0.30001701" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001701.tgz#ad9c90301f7153cf6b3314d16cc30757285bf9e7" + integrity sha512-faRs/AW3jA9nTwmJBSO1PQ6L/EOgsB5HMQQq4iCu5zhPgVVgO/pZRHlmatwijZKetFw8/Pr4q6dEN8sJuq8qTw== canvas@2.11.2, canvas@^2.11.2: version "2.11.2" @@ -9684,7 +9812,12 @@ core-js@^2.6.12: resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== -core-js@^3.26.1, core-js@^3.31.1: +core-js@^3.26.1: + version "3.40.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.40.0.tgz#2773f6b06877d8eda102fc42f828176437062476" + integrity sha512-7vsMc/Lty6AGnn7uFpYT56QesI5D2Y/UkgKounk87OP9Z2H9Z8kj6jzcSGAxFmUtDOS0ntK6lbQz+Nsa0Jj6mQ== + +core-js@^3.31.1: version "3.38.0" resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.38.0.tgz#8acb7c050bf2ccbb35f938c0d040132f6110f636" integrity sha512-XPpwqEodRljce9KswjZShh95qJ1URisBeKCjUdq27YdenkslVe7OO0ZJhlYXAChW7OhXaRLl8AAba7IBfoIHug== @@ -14922,6 +15055,24 @@ itk-wasm@1.0.0-b.165: mime-types "^2.1.35" wasm-feature-detect "^1.6.1" +itk-wasm@1.0.0-b.173: + version "1.0.0-b.173" + resolved "https://registry.yarnpkg.com/itk-wasm/-/itk-wasm-1.0.0-b.173.tgz#e484e1765f4205a5704f8fac205d2ecf74e726a2" + integrity sha512-SV2lfZ1mClWuSK/noaZgGj9jhroY4MZu19ci9pIucuyhoGdXrVSmWlPH/JYMDi9RP3BogmQwe9wfFc3X1dcEPg== + dependencies: + "@itk-wasm/dam" "^1.1.1" + "@thewtex/zstddec" "^0.2.0" + "@types/emscripten" "^1.39.10" + axios "^1.6.2" + chalk "^5.3.0" + comlink "^4.4.1" + commander "^11.1.0" + fs-extra "^11.2.0" + glob "^8.1.0" + markdown-table "^3.0.3" + mime-types "^2.1.35" + wasm-feature-detect "^1.6.1" + jackspeak@^3.1.2: version "3.4.3" resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a" @@ -23707,7 +23858,7 @@ tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.0.0: +tslib@^2.0.0, tslib@^2.8.1: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==