Compare commits

..
123 changed files with 4355 additions and 1768 deletions

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
timeout-minutes: 60
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.50.0-noble
image: mcr.microsoft.com/playwright:v1.51.1-noble
strategy:
fail-fast: false
matrix:
+38
View File
@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
### Bug Fixes
* **seg:** Enhance segmentation tools and UI, refactor code, and update dependencies ([#4915](https://github.com/OHIF/Viewers/issues/4915)) ([8432d5f](https://github.com/OHIF/Viewers/commit/8432d5f6330b300ac6760b32372be382210ed05b))
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
### Features
* **segmentation:** Enhance Segmentation with New AI and Once Click Tools ([#4910](https://github.com/OHIF/Viewers/issues/4910)) ([c75a3f3](https://github.com/OHIF/Viewers/commit/c75a3f3af58c4cd29c349338e4065269d8d9f387))
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package ohif-monorepo-root
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package ohif-monorepo-root
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
-1
View File
@@ -1,5 +1,4 @@
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<div align="center">
<h1>OHIF Medical Imaging Viewer</h1>
<p><strong>The OHIF Viewer</strong> is a zero-footprint medical image viewer
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @externals/devDependencies
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @externals/devDependencies
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @externals/devDependencies
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @externals/devDependencies
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @externals/devDependencies
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@externals/devDependencies",
"description": "External dev dependencies - put dev build dependencies here",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"license": "MIT",
"private": true,
"engines": {
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @externals/dicom-microscopy-viewer
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @externals/dicom-microscopy-viewer
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @externals/dicom-microscopy-viewer
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @externals/dicom-microscopy-viewer
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @externals/dicom-microscopy-viewer
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@externals/dicom-microscopy-viewer",
"description": "External reference to dicom-microscopy-viewer",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"license": "MIT",
"dependencies": {
"dicom-microscopy-viewer": "^0.46.1"
+407 -467
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -1 +1 @@
d7bd36544a039deae30e179404452cde738b8b03
8432d5f6330b300ac6760b32372be382210ed05b
@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
### Bug Fixes
* **seg:** Enhance segmentation tools and UI, refactor code, and update dependencies ([#4915](https://github.com/OHIF/Viewers/issues/4915)) ([8432d5f](https://github.com/OHIF/Viewers/commit/8432d5f6330b300ac6760b32372be382210ed05b))
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
### Features
* **segmentation:** Enhance Segmentation with New AI and Once Click Tools ([#4910](https://github.com/OHIF/Viewers/issues/4910)) ([c75a3f3](https://github.com/OHIF/Viewers/commit/c75a3f3af58c4cd29c349338e4065269d8d9f387))
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-cornerstone-dicom-pmap
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/extension-cornerstone-dicom-pmap
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dicom-pmap",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "DICOM Parametric Map read workflow",
"author": "OHIF",
"license": "MIT",
@@ -33,10 +33,10 @@
"start": "yarn run dev"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-cornerstone": "3.10.0-beta.141",
"@ohif/extension-default": "3.10.0-beta.141",
"@ohif/i18n": "3.10.0-beta.141",
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-cornerstone": "3.10.0-beta.145",
"@ohif/extension-default": "3.10.0-beta.145",
"@ohif/i18n": "3.10.0-beta.145",
"prop-types": "^15.6.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
@@ -46,8 +46,8 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^3.7.17",
"@cornerstonejs/core": "^3.7.17",
"@cornerstonejs/adapters": "^3.8.4",
"@cornerstonejs/core": "^3.8.4",
"@kitware/vtk.js": "32.12.0",
"react-color": "^2.19.3"
}
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @ohif/extension-cornerstone-dicom-rt
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-cornerstone-dicom-rt
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-cornerstone-dicom-rt
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/extension-cornerstone-dicom-rt
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/extension-cornerstone-dicom-rt
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dicom-rt",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "DICOM RT read workflow",
"author": "OHIF",
"license": "MIT",
@@ -33,10 +33,10 @@
"start": "yarn run dev"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-cornerstone": "3.10.0-beta.141",
"@ohif/extension-default": "3.10.0-beta.141",
"@ohif/i18n": "3.10.0-beta.141",
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-cornerstone": "3.10.0-beta.145",
"@ohif/extension-default": "3.10.0-beta.145",
"@ohif/i18n": "3.10.0-beta.145",
"prop-types": "^15.6.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
### Bug Fixes
* **seg:** Enhance segmentation tools and UI, refactor code, and update dependencies ([#4915](https://github.com/OHIF/Viewers/issues/4915)) ([8432d5f](https://github.com/OHIF/Viewers/commit/8432d5f6330b300ac6760b32372be382210ed05b))
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
### Features
* **segmentation:** Enhance Segmentation with New AI and Once Click Tools ([#4910](https://github.com/OHIF/Viewers/issues/4910)) ([c75a3f3](https://github.com/OHIF/Viewers/commit/c75a3f3af58c4cd29c349338e4065269d8d9f387))
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-cornerstone-dicom-seg
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/extension-cornerstone-dicom-seg
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dicom-seg",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "DICOM SEG read workflow",
"author": "OHIF",
"license": "MIT",
@@ -33,10 +33,10 @@
"start": "yarn run dev"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-cornerstone": "3.10.0-beta.141",
"@ohif/extension-default": "3.10.0-beta.141",
"@ohif/i18n": "3.10.0-beta.141",
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-cornerstone": "3.10.0-beta.145",
"@ohif/extension-default": "3.10.0-beta.145",
"@ohif/i18n": "3.10.0-beta.145",
"prop-types": "^15.6.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
@@ -46,8 +46,8 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^3.7.17",
"@cornerstonejs/core": "^3.7.17",
"@cornerstonejs/adapters": "^3.8.4",
"@cornerstonejs/core": "^3.8.4",
"@kitware/vtk.js": "32.12.0",
"react-color": "^2.19.3"
}
@@ -1,22 +1,13 @@
import dcmjs from 'dcmjs';
import { Types } from '@ohif/core';
import { classes, Types } from '@ohif/core';
import { cache, metaData } from '@cornerstonejs/core';
import {
segmentation as cornerstoneToolsSegmentation,
Enums as cornerstoneToolsEnums,
utilities,
} from '@cornerstonejs/tools';
import { segmentation as cornerstoneToolsSegmentation } from '@cornerstonejs/tools';
import { adaptersRT, helpers, adaptersSEG } from '@cornerstonejs/adapters';
import { createReportDialogPrompt } from '@ohif/extension-default';
import { classes, DicomMetadataStore } from '@ohif/core';
import { DicomMetadataStore } from '@ohif/core';
import vtkImageMarchingSquares from '@kitware/vtk.js/Filters/General/ImageMarchingSquares';
import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray';
import vtkImageData from '@kitware/vtk.js/Common/DataModel/ImageData';
import PROMPT_RESPONSES from '../../default/src/utils/_shared/PROMPT_RESPONSES';
const { segmentation: segmentationUtils } = utilities;
const { datasetToBlob } = dcmjs.data;
const getTargetViewport = ({ viewportId, viewportGridService }) => {
@@ -46,14 +37,8 @@ const commandsModule = ({
servicesManager,
extensionManager,
}: Types.Extensions.ExtensionParams): Types.Extensions.CommandsModule => {
const {
segmentationService,
uiDialogService,
displaySetService,
viewportGridService,
toolGroupService,
customizationService,
} = servicesManager.services as AppTypes.Services;
const { segmentationService, displaySetService, viewportGridService, toolGroupService } =
servicesManager.services as AppTypes.Services;
const actions = {
/**
@@ -287,21 +272,24 @@ const commandsModule = ({
* converts dataset to downloadable blob.
*
*/
downloadRTSS: ({ segmentationId }) => {
downloadRTSS: async ({ segmentationId }) => {
const segmentations = segmentationService.getSegmentation(segmentationId);
const vtkUtils = {
vtkImageMarchingSquares,
vtkDataArray,
vtkImageData,
};
const RTSS = generateRTSSFromSegmentations(
// inject colors to the segmentIndex
const firstRepresentation =
segmentationService.getRepresentationsForSegmentation(segmentationId)[0];
Object.entries(segmentations.segments).forEach(([segmentIndex, segment]) => {
segment.color = segmentationService.getSegmentColor(
firstRepresentation.viewportId,
segmentationId,
segmentIndex
);
});
const RTSS = await generateRTSSFromSegmentations(
segmentations,
classes.MetadataProvider,
DicomMetadataStore,
cache,
cornerstoneToolsEnums,
vtkUtils
DicomMetadataStore
);
try {
@@ -314,56 +302,12 @@ const commandsModule = ({
console.warn(e);
}
},
setBrushSize: ({ value, toolNames }) => {
const brushSize = Number(value);
toolGroupService.getToolGroupIds()?.forEach(toolGroupId => {
if (toolNames?.length === 0) {
segmentationUtils.setBrushSizeForToolGroup(toolGroupId, brushSize);
} else {
toolNames?.forEach(toolName => {
segmentationUtils.setBrushSizeForToolGroup(toolGroupId, brushSize, toolName);
});
}
});
},
setThresholdRange: ({
value,
toolNames = [
'ThresholdCircularBrush',
'ThresholdSphereBrush',
'ThresholdCircularBrushDynamic',
'ThresholdSphereBrushDynamic',
],
}) => {
const toolGroupIds = toolGroupService.getToolGroupIds();
if (!toolGroupIds?.length) {
return;
}
for (const toolGroupId of toolGroupIds) {
const toolGroup = toolGroupService.getToolGroup(toolGroupId);
toolNames?.forEach(toolName => {
toolGroup.setToolConfiguration(toolName, {
threshold: {
range: value,
},
});
});
}
},
};
const definitions = {
/**
* Obsolete?
*/
loadSegmentationDisplaySetsForViewport: {
commandFn: actions.loadSegmentationDisplaySetsForViewport,
},
/**
* Obsolete?
*/
loadSegmentationsForViewport: {
commandFn: actions.loadSegmentationsForViewport,
},
@@ -380,12 +324,6 @@ const commandsModule = ({
downloadRTSS: {
commandFn: actions.downloadRTSS,
},
setBrushSize: {
commandFn: actions.setBrushSize,
},
setThresholdRange: {
commandFn: actions.setThresholdRange,
},
};
return {
@@ -45,7 +45,7 @@ export function getToolbarModule({ servicesManager }: withAppTypes) {
if (!toolNames) {
return {
disabled: false,
// isActive: true,
// isActive: false,
};
}
@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
### Bug Fixes
* **seg:** Enhance segmentation tools and UI, refactor code, and update dependencies ([#4915](https://github.com/OHIF/Viewers/issues/4915)) ([8432d5f](https://github.com/OHIF/Viewers/commit/8432d5f6330b300ac6760b32372be382210ed05b))
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
### Features
* **segmentation:** Enhance Segmentation with New AI and Once Click Tools ([#4910](https://github.com/OHIF/Viewers/issues/4910)) ([c75a3f3](https://github.com/OHIF/Viewers/commit/c75a3f3af58c4cd29c349338e4065269d8d9f387))
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-cornerstone-dicom-sr
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/extension-cornerstone-dicom-sr
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dicom-sr",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "OHIF extension for an SR Cornerstone Viewport",
"author": "OHIF",
"license": "MIT",
@@ -34,10 +34,10 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-cornerstone": "3.10.0-beta.141",
"@ohif/extension-measurement-tracking": "3.10.0-beta.141",
"@ohif/ui": "3.10.0-beta.141",
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-cornerstone": "3.10.0-beta.145",
"@ohif/extension-measurement-tracking": "3.10.0-beta.145",
"@ohif/ui": "3.10.0-beta.145",
"dcmjs": "*",
"dicom-parser": "^1.8.9",
"hammerjs": "^2.0.8",
@@ -46,9 +46,9 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^3.7.17",
"@cornerstonejs/core": "^3.7.17",
"@cornerstonejs/tools": "^3.7.17",
"@cornerstonejs/adapters": "^3.8.4",
"@cornerstonejs/core": "^3.8.4",
"@cornerstonejs/tools": "^3.8.4",
"classnames": "^2.3.2"
}
}
@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
### Bug Fixes
* **seg:** Enhance segmentation tools and UI, refactor code, and update dependencies ([#4915](https://github.com/OHIF/Viewers/issues/4915)) ([8432d5f](https://github.com/OHIF/Viewers/commit/8432d5f6330b300ac6760b32372be382210ed05b))
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
### Features
* **segmentation:** Enhance Segmentation with New AI and Once Click Tools ([#4910](https://github.com/OHIF/Viewers/issues/4910)) ([c75a3f3](https://github.com/OHIF/Viewers/commit/c75a3f3af58c4cd29c349338e4065269d8d9f387))
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-cornerstone-dynamic-volume
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/extension-cornerstone-dynamic-volume
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dynamic-volume",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "OHIF extension for 4D volumes data",
"author": "OHIF",
"license": "MIT",
@@ -29,11 +29,11 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-cornerstone": "3.10.0-beta.141",
"@ohif/extension-default": "3.10.0-beta.141",
"@ohif/i18n": "3.10.0-beta.141",
"@ohif/ui": "3.10.0-beta.141",
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-cornerstone": "3.10.0-beta.145",
"@ohif/extension-default": "3.10.0-beta.145",
"@ohif/i18n": "3.10.0-beta.145",
"@ohif/ui": "3.10.0-beta.145",
"dcmjs": "*",
"dicom-parser": "^1.8.21",
"hammerjs": "^2.0.8",
@@ -42,8 +42,8 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/core": "^3.7.17",
"@cornerstonejs/tools": "^3.7.17",
"@cornerstonejs/core": "^3.8.4",
"@cornerstonejs/tools": "^3.8.4",
"classnames": "^2.3.2"
}
}
@@ -1,12 +1,24 @@
import React, { useState } from 'react';
import { Button, PanelSection, ButtonGroup, IconButton, InputNumber } from '@ohif/ui';
import { Icons, Tooltip, TooltipTrigger, TooltipContent, Numeric } from '@ohif/ui-next';
import {
Tabs,
TabsList,
TabsTrigger,
Button,
PanelSection,
Icons,
Tooltip,
TooltipTrigger,
TooltipContent,
Numeric,
} from '@ohif/ui-next';
import { Enums } from '@cornerstonejs/core';
const controlClassNames = {
sizeClassName: 'w-[58px] h-[28px]',
arrowsDirection: 'horizontal',
labelPosition: 'bottom',
// Helper function to safely convert any value to uppercase string
const toUpperCaseString = value => {
if (value === null || value === undefined) {
return '';
}
return String(value).toUpperCase();
};
const Header = ({ title, tooltip }) => (
@@ -16,18 +28,18 @@ const Header = ({ title, tooltip }) => (
<span>
<Icons.ByName
name="info-link"
className="text-primary-active h-[14px] w-[14px]"
className="text-primary h-3 w-3"
/>
</span>
</TooltipTrigger>
<TooltipContent
sideOffset={4}
className="bg-primary-dark max-w-xs p-2 text-white"
className="max-w-xs"
>
<div>{tooltip}</div>
</TooltipContent>
</Tooltip>
<span className="text-aqua-pale text-[11px] uppercase">{title}</span>
<span className="text-muted-foreground text-xs uppercase tracking-wide">{title}</span>
</div>
);
@@ -51,112 +63,138 @@ const DynamicVolumeControls = ({
const [computedView, setComputedView] = useState(false);
const [computeViewMode, setComputeViewMode] = useState(Enums.DynamicOperatorType.SUM);
// Wrapper for onGenerate to handle potential errors
const handleGenerate = () => {
try {
if (typeof onGenerate === 'function') {
onGenerate(computeViewMode);
} else {
console.error('onGenerate is not a function', onGenerate);
}
} catch (error) {
console.error('Error in onGenerate:', error);
}
};
return (
<div className="flex select-none flex-col">
<PanelSection
title="Controls"
childrenClassName="space-y-4 pb-5 px-5"
>
<div className="mt-2">
<Header
title="View"
tooltip={
'Select the view mode, 4D to view the dynamic volume or Computed to view the computed volume'
}
/>
<ButtonGroup className="mt-2 w-full">
<button
className="w-1/2"
onClick={() => {
setComputedView(false);
onDynamicClick?.();
<PanelSection defaultOpen={true}>
<PanelSection.Header>Controls</PanelSection.Header>
<PanelSection.Content className="bg-muted space-y-4 px-5 pt-2 pb-4">
<div className="mb-4">
<Header
title="View"
tooltip={
'Select the view mode, 4D to view the dynamic volume or Computed to view the computed volume'
}
/>
<Tabs
value={computedView ? 'computed' : '4d'}
onValueChange={value => {
const isComputed = value === 'computed';
setComputedView(isComputed);
if (!isComputed && typeof onDynamicClick === 'function') {
onDynamicClick();
}
}}
className="my-2 w-full"
>
4D
</button>
<button
className="w-1/2"
onClick={() => {
setComputedView(true);
}}
>
Computed
</button>
</ButtonGroup>
</div>
<div>
<DimensionGroupControls
onPlayPauseChange={onPlayPauseChange}
isPlaying={isPlaying}
computedView={computedView}
// fps
fps={fps}
onFpsChange={onFpsChange}
minFps={minFps}
maxFps={maxFps}
//
numDimensionGroups={numDimensionGroups}
onDimensionGroupChange={onDimensionGroupChange}
currentDimensionGroupNumber={currentDimensionGroupNumber}
/>
</div>
<div className={`mt-6 flex flex-col ${computedView ? '' : 'ohif-disabled'}`}>
<Header
title="Computed Operation"
tooltip={
<div>
Operation Buttons (SUM, AVERAGE, SUBTRACT): Select the mathematical operation to be
applied to the data set.
<br /> Range Slider: Choose the numeric range of dimension groups within which the
operation will be performed.
<br />
Generate Button: Execute the chosen operation on the specified range of data.
</div>
}
/>
<ButtonGroup
className="mt-2 w-full"
separated={true}
>
<button
className="w-1/2"
onClick={() => setComputeViewMode(Enums.DynamicOperatorType.SUM)}
>
{Enums.DynamicOperatorType.SUM.toString().toUpperCase()}
</button>
<button
className="w-1/2"
onClick={() => setComputeViewMode(Enums.DynamicOperatorType.AVERAGE)}
>
{Enums.DynamicOperatorType.AVERAGE.toString().toUpperCase()}
</button>
<button
className="w-1/2"
onClick={() => setComputeViewMode(Enums.DynamicOperatorType.SUBTRACT)}
>
{Enums.DynamicOperatorType.SUBTRACT.toString().toUpperCase()}
</button>
</ButtonGroup>
<div className="mt-2 w-full">
<Numeric.Container
mode="doubleRange"
min={1}
max={numDimensionGroups}
values={rangeValues}
onChange={onDoubleRangeChange}
>
<Numeric.DoubleRange showNumberInputs />
</Numeric.Container>
<TabsList className="w-full">
<TabsTrigger
value="4d"
className="w-1/2"
>
4D
</TabsTrigger>
<TabsTrigger
value="computed"
className="w-1/2"
>
Computed
</TabsTrigger>
</TabsList>
</Tabs>
</div>
<Button
className="mt-2 !h-[26px] !w-[115px] self-start !p-0"
onClick={() => {
onGenerate(computeViewMode);
}}
>
Generate
</Button>
</div>
<div>
<DimensionGroupControls
onPlayPauseChange={onPlayPauseChange}
isPlaying={isPlaying}
computedView={computedView}
// fps
fps={fps}
onFpsChange={onFpsChange}
minFps={minFps}
maxFps={maxFps}
//
numDimensionGroups={numDimensionGroups}
onDimensionGroupChange={onDimensionGroupChange}
currentDimensionGroupNumber={currentDimensionGroupNumber}
/>
</div>
<div className={`mt-3 flex flex-col ${computedView ? '' : 'ohif-disabled'}`}>
<Header
title="Computed Operation"
tooltip={
<div>
Operation Buttons (SUM, AVERAGE, SUBTRACT): Select the mathematical operation to
be applied to the data set.
<br /> Range Slider: Choose the numeric range of dimension groups within which the
operation will be performed.
<br />
Generate Button: Execute the chosen operation on the specified range of data.
</div>
}
/>
<Tabs
value={String(computeViewMode)}
onValueChange={value => {
setComputeViewMode(value);
}}
className="mt-2 w-full"
>
<TabsList className="w-full gap-1">
{' '}
<TabsTrigger
value={String(Enums.DynamicOperatorType.SUM)}
className="w-1/3"
>
{toUpperCaseString(Enums.DynamicOperatorType.SUM)}
</TabsTrigger>
<TabsTrigger
value={String(Enums.DynamicOperatorType.AVERAGE)}
className="w-1/3"
>
{toUpperCaseString(Enums.DynamicOperatorType.AVERAGE)}
</TabsTrigger>
<TabsTrigger
value={String(Enums.DynamicOperatorType.SUBTRACT)}
className="w-1/3"
>
{toUpperCaseString(Enums.DynamicOperatorType.SUBTRACT)}
</TabsTrigger>
</TabsList>
</Tabs>
<div className="mt-2 w-full">
<Numeric.Container
mode="doubleRange"
min={1}
max={numDimensionGroups || 1}
values={rangeValues || [1, numDimensionGroups || 1]}
onChange={onDoubleRangeChange || (() => {})}
>
<Numeric.DoubleRange showNumberInputs />
</Numeric.Container>
</div>
<Button
variant="default"
size="sm"
className="mt-2 h-[26px] w-[115px] self-start p-0"
onClick={handleGenerate}
>
Generate
</Button>
</div>
</PanelSection.Content>
</PanelSection>
</div>
);
@@ -179,7 +217,7 @@ function DimensionGroupControls({
const getPlayPauseIconName = () => (isPlaying ? 'icon-pause' : 'icon-play');
return (
<div className={computedView && 'ohif-disabled'}>
<div className={computedView ? 'ohif-disabled' : ''}>
<Header
title="4D Controls"
tooltip={
@@ -192,32 +230,56 @@ function DimensionGroupControls({
}
/>
<div className="mt-3 flex justify-between">
<IconButton
<Button
id="play-pause-button"
className="bg-customblue-30 h-[26px] w-[58px] rounded-[4px]"
onClick={() => onPlayPauseChange(!isPlaying)}
variant="secondary"
size="default"
className="w-[58px]"
onClick={() => {
if (typeof onPlayPauseChange === 'function') {
onPlayPauseChange(!isPlaying);
}
}}
>
<Icons.ByName
name={getPlayPauseIconName()}
className="active:text-primary-light hover:bg-customblue-300 h-[24px] w-[24px] cursor-pointer text-white"
className="text-foreground h-[24px] w-[24px]"
/>
</IconButton>
<InputNumber
value={currentDimensionGroupNumber}
onChange={onDimensionGroupChange}
minValue={1}
maxValue={numDimensionGroups}
label="Group"
{...controlClassNames}
/>
<InputNumber
value={fps}
onChange={onFpsChange}
minValue={minFps}
maxValue={maxFps}
{...controlClassNames}
label="FPS"
/>
</Button>
<Numeric.Container
mode="stepper"
value={currentDimensionGroupNumber || 1}
onChange={onDimensionGroupChange || (() => {})}
min={1}
max={numDimensionGroups || 1}
step={1}
>
<div className="flex flex-col items-center">
<Numeric.NumberStepper
className="h-[28px] w-[58px]"
direction="horizontal"
/>
<Numeric.Label className="text-muted-foreground mt-1 text-sm">Frame</Numeric.Label>
</div>
</Numeric.Container>
<Numeric.Container
mode="stepper"
value={fps || 1}
onChange={onFpsChange || (() => {})}
min={minFps || 1}
max={maxFps || 30}
step={1}
>
<div className="flex flex-col items-center">
<Numeric.NumberStepper
className="h-[28px] w-[58px]"
direction="horizontal"
/>
<Numeric.Label className="text-muted-foreground mt-1 text-sm">FPS</Numeric.Label>
</div>
</Numeric.Container>
</div>
</div>
);
+38
View File
@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
### Bug Fixes
* **seg:** Enhance segmentation tools and UI, refactor code, and update dependencies ([#4915](https://github.com/OHIF/Viewers/issues/4915)) ([8432d5f](https://github.com/OHIF/Viewers/commit/8432d5f6330b300ac6760b32372be382210ed05b))
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
### Features
* **segmentation:** Enhance Segmentation with New AI and Once Click Tools ([#4910](https://github.com/OHIF/Viewers/issues/4910)) ([c75a3f3](https://github.com/OHIF/Viewers/commit/c75a3f3af58c4cd29c349338e4065269d8d9f387))
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-cornerstone
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/extension-cornerstone
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
+10 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "OHIF extension for Cornerstone",
"author": "OHIF",
"license": "MIT",
@@ -38,9 +38,9 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.4",
"@cornerstonejs/codec-openjph": "^2.4.5",
"@cornerstonejs/dicom-image-loader": "^3.7.17",
"@ohif/core": "3.10.0-beta.141",
"@ohif/ui": "3.10.0-beta.141",
"@cornerstonejs/dicom-image-loader": "^3.8.4",
"@ohif/core": "3.10.0-beta.145",
"@ohif/ui": "3.10.0-beta.145",
"dcmjs": "*",
"dicom-parser": "^1.8.21",
"hammerjs": "^2.0.8",
@@ -51,11 +51,12 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@cornerstonejs/adapters": "^3.7.17",
"@cornerstonejs/core": "^3.7.17",
"@cornerstonejs/labelmap-interpolation": "^3.7.17",
"@cornerstonejs/polymorphic-segmentation": "^3.7.17",
"@cornerstonejs/tools": "^3.7.17",
"@cornerstonejs/adapters": "^3.8.4",
"@cornerstonejs/ai": "^3.8.4",
"@cornerstonejs/core": "^3.8.4",
"@cornerstonejs/labelmap-interpolation": "^3.8.4",
"@cornerstonejs/polymorphic-segmentation": "^3.8.4",
"@cornerstonejs/tools": "^3.8.4",
"@itk-wasm/morphological-contour-interpolation": "1.1.0",
"@kitware/vtk.js": "32.12.0",
"html2canvas": "^1.4.1",
+189 -10
View File
@@ -10,12 +10,12 @@ import {
ToolGroupManager,
Enums,
utilities as cstUtils,
ReferenceLinesTool,
annotation,
Types as ToolTypes,
} from '@cornerstonejs/tools';
import * as cornerstoneTools from '@cornerstonejs/tools';
import * as labelmapInterpolation from '@cornerstonejs/labelmap-interpolation';
import { ONNXSegmentationController } from '@cornerstonejs/ai';
import { Types as OhifTypes, utils } from '@ohif/core';
import i18n from '@ohif/i18n';
@@ -42,6 +42,8 @@ const toggleSyncFunctions = {
voi: toggleVOISliceSync,
};
const { segmentation: segmentationUtils } = cstUtils;
const getLabelmapTools = ({ toolGroupService }) => {
const labelmapTools = [];
const toolGroupIds = toolGroupService.getToolGroupIds();
@@ -59,6 +61,28 @@ const getLabelmapTools = ({ toolGroupService }) => {
return labelmapTools;
};
const segmentAI = new ONNXSegmentationController({
autoSegmentMode: true,
models: {
sam_b: [
{
name: 'sam-b-encoder',
url: 'https://huggingface.co/schmuell/sam-b-fp16/resolve/main/sam_vit_b_01ec64.encoder-fp16.onnx',
size: 180,
key: 'encoder',
},
{
name: 'sam-b-decoder',
url: 'https://huggingface.co/schmuell/sam-b-fp16/resolve/main/sam_vit_b_01ec64.decoder.onnx',
size: 17,
key: 'decoder',
},
],
},
modelName: 'sam_b',
});
let segmentAIEnabled = false;
function commandsModule({
servicesManager,
commandsManager,
@@ -132,6 +156,8 @@ function commandsModule({
}
);
measurement.annotationUID = annotation.annotationUID;
// Update segmentation stats
const updatedSegmentation = updateSegmentBidirectionalStats({
segmentationId: targetId,
@@ -149,6 +175,14 @@ function commandsModule({
});
}
});
// get the active segmentIndex bidirectional annotation and jump to it
const activeBidirectional = bidirectionalData.find(
measurement => measurement.segmentIndex === targetIndex
);
commandsManager.run('jumpToMeasurement', {
uid: activeBidirectional.annotationUID,
});
},
interpolateLabelmap: () => {
const { segmentationId, segmentIndex } = _getActiveSegmentationInfo();
@@ -979,7 +1013,7 @@ function commandsModule({
});
}
},
setSourceViewportForReferenceLinesTool: ({ viewportId }) => {
setViewportForToolConfiguration: ({ viewportId, toolName }) => {
if (!viewportId) {
const { activeViewportId } = viewportGridService.getState();
viewportId = activeViewportId ?? 'default';
@@ -987,9 +1021,11 @@ function commandsModule({
const toolGroup = toolGroupService.getToolGroupForViewport(viewportId);
const prevConfig = toolGroup?.getToolConfiguration(toolName);
toolGroup?.setToolConfiguration(
ReferenceLinesTool.toolName,
toolName,
{
...prevConfig,
sourceViewportId: viewportId,
},
true // overwrite
@@ -1525,17 +1561,151 @@ function commandsModule({
}
});
},
acceptPreview: () => {
toggleUseCenterSegmentIndex: ({ toggle }) => {
const labelmapTools = getLabelmapTools({ toolGroupService });
labelmapTools.forEach(tool => {
tool.acceptPreview();
tool.configuration = {
...tool.configuration,
useCenterSegmentIndex: toggle,
};
});
},
rejectPreview: () => {
_handlePreviewAction: action => {
const labelmapTools = getLabelmapTools({ toolGroupService });
labelmapTools.forEach(tool => {
tool.rejectPreview();
const { viewport } = _getActiveViewportEnabledElement();
const activeTools = labelmapTools.filter(
tool => tool.mode === 'Active' || tool.mode === 'Enabled'
);
activeTools.forEach(tool => {
tool[`${action}Preview`]();
});
if (segmentAI.enabled) {
segmentAI[`${action}Preview`](viewport.element);
}
},
acceptPreview: () => {
actions._handlePreviewAction('accept');
},
rejectPreview: () => {
actions._handlePreviewAction('reject');
},
clearMarkersForMarkerLabelmap: () => {
const { viewport } = _getActiveViewportEnabledElement();
const toolGroup = cornerstoneTools.ToolGroupManager.getToolGroupForViewport(viewport.id);
const toolInstance = toolGroup.getToolInstance('MarkerLabelmap');
if (!toolInstance) {
return;
}
toolInstance.clearMarkers(viewport);
},
interpolateScrollForMarkerLabelmap: () => {
const { viewport } = _getActiveViewportEnabledElement();
const toolGroup = cornerstoneTools.ToolGroupManager.getToolGroupForViewport(viewport.id);
const toolInstance = toolGroup.getToolInstance('MarkerLabelmap');
if (!toolInstance) {
return;
}
toolInstance.interpolateScroll(viewport, 1);
},
toggleLabelmapAssist: async () => {
const { viewport } = _getActiveViewportEnabledElement();
const newState = !segmentAI.enabled;
segmentAI.enabled = newState;
if (!segmentAIEnabled) {
await segmentAI.initModel();
segmentAIEnabled = true;
}
// set the brush tool to active
const toolGroupIds = toolGroupService.getToolGroupIds();
if (newState) {
actions.setToolActiveToolbar({
toolName: 'CircularBrushForAutoSegmentAI',
toolGroupIds: toolGroupIds,
});
} else {
toolGroupIds.forEach(toolGroupId => {
const toolGroup = cornerstoneTools.ToolGroupManager.getToolGroup(toolGroupId);
toolGroup.setToolPassive('CircularBrushForAutoSegmentAI');
});
}
if (segmentAI.enabled) {
segmentAI.initViewport(viewport);
}
},
setBrushSize: ({ value, toolNames }) => {
const brushSize = Number(value);
toolGroupService.getToolGroupIds()?.forEach(toolGroupId => {
if (toolNames?.length === 0) {
segmentationUtils.setBrushSizeForToolGroup(toolGroupId, brushSize);
} else {
toolNames?.forEach(toolName => {
segmentationUtils.setBrushSizeForToolGroup(toolGroupId, brushSize, toolName);
});
}
});
},
setThresholdRange: ({
value,
toolNames = [
'ThresholdCircularBrush',
'ThresholdSphereBrush',
'ThresholdCircularBrushDynamic',
'ThresholdSphereBrushDynamic',
],
}) => {
const toolGroupIds = toolGroupService.getToolGroupIds();
if (!toolGroupIds?.length) {
return;
}
for (const toolGroupId of toolGroupIds) {
const toolGroup = toolGroupService.getToolGroup(toolGroupId);
toolNames?.forEach(toolName => {
toolGroup.setToolConfiguration(toolName, {
threshold: {
range: value,
},
});
});
}
},
increaseBrushSize: () => {
const toolGroupIds = toolGroupService.getToolGroupIds();
if (!toolGroupIds?.length) {
return;
}
for (const toolGroupId of toolGroupIds) {
const brushSize = segmentationUtils.getBrushSizeForToolGroup(toolGroupId);
segmentationUtils.setBrushSizeForToolGroup(toolGroupId, brushSize + 3);
}
},
decreaseBrushSize: () => {
const toolGroupIds = toolGroupService.getToolGroupIds();
if (!toolGroupIds?.length) {
return;
}
for (const toolGroupId of toolGroupIds) {
const brushSize = segmentationUtils.getBrushSizeForToolGroup(toolGroupId);
segmentationUtils.setBrushSizeForToolGroup(toolGroupId, brushSize - 3);
}
},
addNewSegment: () => {
const { segmentationService } = servicesManager.services;
const { activeViewportId } = viewportGridService.getState();
const activeSegmentation = segmentationService.getActiveSegmentation(activeViewportId);
segmentationService.addSegment(activeSegmentation.segmentationId);
},
};
@@ -1680,8 +1850,8 @@ function commandsModule({
setViewportColormap: {
commandFn: actions.setViewportColormap,
},
setSourceViewportForReferenceLinesTool: {
commandFn: actions.setSourceViewportForReferenceLinesTool,
setViewportForToolConfiguration: {
commandFn: actions.setViewportForToolConfiguration,
},
storePresentation: {
commandFn: actions.storePresentation,
@@ -1806,6 +1976,15 @@ function commandsModule({
toggleSegmentSelect: actions.toggleSegmentSelect,
acceptPreview: actions.acceptPreview,
rejectPreview: actions.rejectPreview,
toggleUseCenterSegmentIndex: actions.toggleUseCenterSegmentIndex,
toggleLabelmapAssist: actions.toggleLabelmapAssist,
interpolateScrollForMarkerLabelmap: actions.interpolateScrollForMarkerLabelmap,
clearMarkersForMarkerLabelmap: actions.clearMarkersForMarkerLabelmap,
setBrushSize: actions.setBrushSize,
setThresholdRange: actions.setThresholdRange,
increaseBrushSize: actions.increaseBrushSize,
decreaseBrushSize: actions.decreaseBrushSize,
addNewSegment: actions.addNewSegment,
};
return {
@@ -1,7 +1,7 @@
import React, { useEffect, useCallback, useState, ReactElement, useMemo } from 'react';
import PropTypes from 'prop-types';
import debounce from 'lodash.debounce';
import { PanelSection, WindowLevel } from '@ohif/ui';
import { PanelSection, WindowLevel } from '@ohif/ui-next';
import { Enums, eventTarget } from '@cornerstonejs/core';
import { useActiveViewportDisplaySets } from '@ohif/core';
import {
@@ -20,7 +20,7 @@ const ViewportWindowLevel = ({
viewportId: string;
}>): ReactElement => {
const { cornerstoneViewportService } = servicesManager.services;
const [windowLevels, setWindowLevels] = useState([]);
const [windowLevels, setWindowLevels] = useState<any[]>([]);
const [isLoading, setIsLoading] = useState(true);
const displaySets = useActiveViewportDisplaySets({ servicesManager });
@@ -200,29 +200,41 @@ const ViewportWindowLevel = ({
}, [viewportId, cornerstoneViewportService, updateViewportHistograms, displaySetIds, isLoading]);
return (
<PanelSection title="Window Level">
{windowLevels.map((windowLevel, i) => {
if (!windowLevel.histogram) {
return null;
}
<PanelSection defaultOpen={true}>
<PanelSection.Header>Window Level</PanelSection.Header>
<PanelSection.Content className="bg-muted py-1">
{windowLevels.map((windowLevel, i) => {
if (!windowLevel.histogram) {
return null;
}
return (
<WindowLevel
key={windowLevel.volumeId}
title={`${windowLevel.modality}`}
histogram={windowLevel.histogram}
voi={windowLevel.voi}
step={windowLevel.step}
showOpacitySlider={windowLevel.showOpacitySlider}
colormap={windowLevel.colormap}
onVOIChange={voi => handleVOIChange(windowLevel.volumeId, voi)}
opacity={windowLevel.opacity}
onOpacityChange={opacity =>
handleOpacityChange(windowLevel.viewportId, i, windowLevel.volumeId, opacity)
}
/>
);
})}
return (
<WindowLevel
key={windowLevel.volumeId}
histogram={windowLevel.histogram}
voi={windowLevel.voi}
step={windowLevel.step}
showOpacitySlider={windowLevel.showOpacitySlider}
colormap={windowLevel.colormap}
onVOIChange={voi => handleVOIChange(windowLevel.volumeId, voi)}
opacity={windowLevel.opacity}
onOpacityChange={opacity =>
handleOpacityChange(windowLevel.viewportId, i, windowLevel.volumeId, opacity)
}
/>
);
})}
{windowLevels.length === 0 && !isLoading && (
<div className="text-muted-foreground py-2 text-center text-sm">
No window level data available
</div>
)}
{isLoading && (
<div className="text-muted-foreground py-2 text-center text-sm">
Loading window level data...
</div>
)}
</PanelSection.Content>
</PanelSection>
);
};
@@ -95,24 +95,53 @@ export const CustomDropdownMenuContent = () => {
<DropdownMenuSub>
<DropdownMenuSubTrigger className="pl-1">
<Icons.Export className="text-foreground" />
<span className="pl-2">{t('Export & Download')}</span>
<span className="pl-2">{t('Download & Export')}</span>
</DropdownMenuSubTrigger>
<DropdownMenuPortal>
<DropdownMenuSubContent>
<DropdownMenuItem onClick={() => actions.downloadCSVSegmentationReport(segmentationId)}>
{t('Download CSV Report')}
<DropdownMenuLabel className="flex items-center pl-0">
<Icons.Download className="h-5 w-5" />
<span className="pl-1">{t('Download')}</span>
</DropdownMenuLabel>
<DropdownMenuItem
onClick={e => {
e.preventDefault();
actions.downloadCSVSegmentationReport(segmentationId);
}}
>
{t('CSV Report')}
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => actions.storeSegmentation(segmentationId)}
onClick={e => {
e.preventDefault();
actions.onSegmentationDownload(segmentationId);
}}
disabled={!allowExport}
>
{t('Export DICOM SEG')}
{t('DICOM SEG')}
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => actions.onSegmentationDownload(segmentationId)}
onClick={e => {
e.preventDefault();
actions.onSegmentationDownloadRTSS(segmentationId);
}}
disabled={!allowExport}
>
{t('Download DICOM SEG')}
{t('DICOM RTSS')}
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuLabel className="flex items-center pl-0">
<Icons.Export className="h-5 w-5" />
<span className="pl-1 pt-1">{t('Export')}</span>
</DropdownMenuLabel>
<DropdownMenuItem
onClick={e => {
e.preventDefault();
actions.storeSegmentation(segmentationId);
}}
disabled={!allowExport}
>
{t('DICOM SEG')}
</DropdownMenuItem>
</DropdownMenuSubContent>
</DropdownMenuPortal>
@@ -36,7 +36,7 @@ export default function getSegmentationPanelCustomization({ commandsManager, ser
// Get initial states based on current configuration
const [previewEdits, setPreviewEdits] = useState(false);
const [toggleSegmentEnabled, setToggleSegmentEnabled] = useState(false);
const [useCenterAsSegmentIndex, setUseCenterAsSegmentIndex] = useState(false);
const handlePreviewEditsChange = checked => {
setPreviewEdits(checked);
commandsManager.run('toggleSegmentPreviewEdit', { toggle: checked });
@@ -47,6 +47,11 @@ export default function getSegmentationPanelCustomization({ commandsManager, ser
commandsManager.run('toggleSegmentSelect', { toggle: checked });
};
const handleUseCenterAsSegmentIndexChange = checked => {
setUseCenterAsSegmentIndex(checked);
commandsManager.run('toggleUseCenterSegmentIndex', { toggle: checked });
};
return (
<div className="bg-muted flex flex-col gap-4 border-b border-b-[2px] border-black px-2 py-3">
<div className="flex items-center gap-2">
@@ -57,12 +62,20 @@ export default function getSegmentationPanelCustomization({ commandsManager, ser
<span className="text-base text-white">Preview edits before creating</span>
</div>
<div className="flex items-center gap-2">
<Switch
checked={useCenterAsSegmentIndex}
onCheckedChange={handleUseCenterAsSegmentIndexChange}
/>
<span className="text-base text-white">Use Center as Segment Index</span>
</div>
<div className="flex items-center gap-2">
<Switch
checked={toggleSegmentEnabled}
onCheckedChange={handleToggleSegmentEnabledChange}
/>
<span className="text-base text-white">Highlight segments to select</span>
<span className="text-base text-white">Hover on segment border to activate</span>
</div>
</div>
);
+13 -38
View File
@@ -39,7 +39,10 @@ import { useLutPresentationStore } from './stores/useLutPresentationStore';
import { usePositionPresentationStore } from './stores/usePositionPresentationStore';
import { useSegmentationPresentationStore } from './stores/useSegmentationPresentationStore';
import { imageRetrieveMetadataProvider } from '@cornerstonejs/core/utilities';
import { updateSegmentationStats } from './utils/updateSegmentationStats';
import {
setupSegmentationDataModifiedHandler,
setupSegmentationModifiedHandler,
} from './utils/segmentationHandlers';
const { registerColormap } = csUtilities.colormap;
@@ -189,44 +192,16 @@ export default async function init({
});
});
segmentationService.subscribeDebounced(
segmentationService.EVENTS.SEGMENTATION_DATA_MODIFIED,
async ({ segmentationId }) => {
const segmentation = segmentationService.getSegmentation(segmentationId);
const readableText = customizationService.getCustomization('panelSegmentation.readableText');
const updatedSegmentation = await updateSegmentationStats({
segmentation,
segmentationId,
readableText,
});
// Setup segmentation event handlers
setupSegmentationDataModifiedHandler({
segmentationService,
customizationService,
commandsManager,
});
if (updatedSegmentation) {
segmentationService.addOrUpdateSegmentation({
segmentationId,
segments: updatedSegmentation.segments,
});
}
// Check for segments with bidirectional measurements and update them
if (segmentation) {
const segmentIndices = Object.keys(segmentation.segments)
.map(index => parseInt(index))
.filter(index => index > 0);
for (const segmentIndex of segmentIndices) {
const segment = segmentation.segments[segmentIndex];
if (segment?.cachedStats?.namedStats?.bidirectional) {
// Run the command to update the bidirectional measurement
commandsManager.runCommand('runSegmentBidirectional', {
segmentationId,
segmentIndex,
});
}
}
}
},
1000
);
setupSegmentationModifiedHandler({
segmentationService,
});
// When a custom image load is performed, update the relevant viewports
hangingProtocolService.subscribe(
@@ -38,7 +38,9 @@ import {
OrientationMarkerTool,
WindowLevelRegionTool,
SegmentSelectTool,
RegionSegmentPlusTool,
} from '@cornerstonejs/tools';
import { LabelmapSlicePropagationTool, MarkerLabelmapTool } from '@cornerstonejs/ai';
import * as polySeg from '@cornerstonejs/polymorphic-segmentation';
import CalibrationLineTool from './tools/CalibrationLineTool';
@@ -98,6 +100,9 @@ export default function initCornerstoneTools(configuration = {}) {
addTool(WindowLevelRegionTool);
addTool(PlanarFreehandContourSegmentationTool);
addTool(SegmentSelectTool);
addTool(LabelmapSlicePropagationTool);
addTool(MarkerLabelmapTool);
addTool(RegionSegmentPlusTool);
// Modify annotation tools to use dashed lines on SR
const annotationStyle = {
textBoxFontSize: '15px',
@@ -152,6 +157,9 @@ const toolNames = {
PlanarFreehandContourSegmentation: PlanarFreehandContourSegmentationTool.toolName,
SegmentBidirectional: SegmentBidirectionalTool.toolName,
SegmentSelect: SegmentSelectTool.toolName,
LabelmapSlicePropagation: LabelmapSlicePropagationTool.toolName,
MarkerLabelmap: MarkerLabelmapTool.toolName,
RegionSegmentPlus: RegionSegmentPlusTool.toolName,
};
export { toolNames };
@@ -360,7 +360,7 @@ class SegmentationService extends PubSubService {
type: LABELMAP,
data: {
imageIds: segImageIds,
referencedVolumeId: this._getVolumeIdForDisplaySet(displaySet),
// referencedVolumeId: this._getVolumeIdForDisplaySet(displaySet),
referencedImageIds: referenceImageIds,
},
},
@@ -602,10 +602,16 @@ class SegmentationService extends PubSubService {
const segments: { [segmentIndex: string]: cstTypes.Segment } = {};
let segmentsCachedStats = {};
// Create colorLUT array for RT structures
const colorLUT = [[0, 0, 0, 0]]; // First entry is transparent for index 0
// Process each segment similarly to the SEG function
for (const rtStructData of allRTStructData) {
const { data, id, color, segmentIndex, geometryId } = rtStructData;
// Add the color to the colorLUT array
colorLUT.push(color);
try {
const geometry = await geometryLoader.createAndCacheGeometry(geometryId, {
geometryData: {
@@ -647,6 +653,11 @@ class SegmentationService extends PubSubService {
}
}
// Create and register the colorLUT
const colorLUTIndex = getNextColorLUTIndex();
addColorLUT(colorLUT, colorLUTIndex);
this._segmentationIdToColorLUTIndexMap.set(segmentationId, colorLUTIndex);
// Assign processed segments to segmentation config
segmentation.config.segments = segments;
@@ -53,7 +53,6 @@ const segmentationRepresentationModifiedCallback = async (
const targetFrameOfReferenceUID = viewport.getFrameOfReferenceUID();
if (!targetFrameOfReferenceUID) {
console.debug('No frame of reference UID found for the target viewport');
return;
}
@@ -846,13 +846,17 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
if (addOverlayFn) {
addOverlayFn();
}
viewport.render();
volumesProperties.forEach(({ properties, volumeId }) => {
viewport.setProperties(properties, volumeId);
setTimeout(() => {
// seems like a hack but we need the actor to be ready first before
// we set the properties
viewport.setProperties(properties, volumeId);
viewport.render();
}, 0);
});
viewport.render();
this.setPresentations(viewport.id, presentations, viewportInfo);
if (!presentations.positionPresentation) {
@@ -865,8 +869,6 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
}
}
viewport.render();
this._broadcastEvent(this.EVENTS.VIEWPORT_VOLUMES_CHANGED, {
viewportInfo,
});
@@ -2,7 +2,6 @@ const colormaps = [
{
ColorSpace: 'RGB',
Name: 'Grayscale',
name: 'Grayscale',
NanColor: [1, 0, 0],
RGBPoints: [0, 0, 0, 0, 1, 1, 1, 1],
description: 'Grayscale',
@@ -10,7 +9,6 @@ const colormaps = [
{
ColorSpace: 'RGB',
Name: 'X Ray',
name: 'X Ray',
NanColor: [1, 0, 0],
RGBPoints: [0, 1, 1, 1, 1, 0, 0, 0],
description: 'X Ray',
@@ -18,7 +16,6 @@ const colormaps = [
{
ColorSpace: 'RGB',
Name: 'hsv',
name: 'hsv',
RGBPoints: [
-1, 1, 0, 0, -0.666666, 1, 0, 1, -0.333333, 0, 0, 1, 0, 0, 1, 1, 0.33333, 0, 1, 0, 0.66666, 1,
1, 0, 1, 1, 0, 0,
@@ -28,7 +25,6 @@ const colormaps = [
{
ColorSpace: 'RGB',
Name: 'hot_iron',
name: 'hot_iron',
RGBPoints: [
0.0, 0.0039215686, 0.0039215686, 0.0156862745, 0.00392156862745098, 0.0039215686,
0.0039215686, 0.0156862745, 0.00784313725490196, 0.0039215686, 0.0039215686, 0.031372549,
@@ -224,7 +220,6 @@ const colormaps = [
{
ColorSpace: 'RGB',
Name: 'red_hot',
name: 'red_hot',
RGBPoints: [
0.0, 0.0, 0.0, 0.0, 0.00392156862745098, 0.0, 0.0, 0.0, 0.00784313725490196, 0.0, 0.0, 0.0,
0.011764705882352941, 0.0, 0.0, 0.0, 0.01568627450980392, 0.0039215686, 0.0039215686,
@@ -359,7 +354,6 @@ const colormaps = [
{
ColorSpace: 'RGB',
Name: 's_pet',
name: 's_pet',
RGBPoints: [
0.0, 0.0156862745, 0.0039215686, 0.0156862745, 0.00392156862745098, 0.0156862745,
0.0039215686, 0.0156862745, 0.00784313725490196, 0.0274509804, 0.0039215686, 0.031372549,
@@ -553,7 +547,6 @@ const colormaps = [
{
ColorSpace: 'RGB',
Name: 'perfusion',
name: 'perfusion',
RGBPoints: [
0.0, 0.0, 0.0, 0.0, 0.00392156862745098, 0.0078431373, 0.0235294118, 0.0235294118,
0.00784313725490196, 0.0078431373, 0.031372549, 0.0470588235, 0.011764705882352941,
@@ -733,7 +726,6 @@ const colormaps = [
{
ColorSpace: 'RGB',
Name: 'rainbow_2',
name: 'rainbow_2',
RGBPoints: [
0.0, 0.0, 0.0, 0.0, 0.00392156862745098, 0.0156862745, 0.0, 0.0117647059, 0.00784313725490196,
0.0352941176, 0.0, 0.0274509804, 0.011764705882352941, 0.0509803922, 0.0, 0.0392156863,
@@ -872,7 +864,6 @@ const colormaps = [
{
ColorSpace: 'RGB',
Name: 'suv',
name: 'suv',
RGBPoints: [
0.0, 1.0, 1.0, 1.0, 0.00392156862745098, 1.0, 1.0, 1.0, 0.00784313725490196, 1.0, 1.0, 1.0,
0.011764705882352941, 1.0, 1.0, 1.0, 0.01568627450980392, 1.0, 1.0, 1.0, 0.0196078431372549,
@@ -1019,7 +1010,6 @@ const colormaps = [
{
ColorSpace: 'RGB',
Name: 'ge_256',
name: 'ge_256',
RGBPoints: [
0.0, 0.0039215686, 0.0078431373, 0.0078431373, 0.00392156862745098, 0.0039215686,
0.0078431373, 0.0078431373, 0.00784313725490196, 0.0039215686, 0.0078431373, 0.0117647059,
@@ -1211,7 +1201,6 @@ const colormaps = [
{
ColorSpace: 'RGB',
Name: 'ge',
name: 'ge',
RGBPoints: [
0.0, 0.0078431373, 0.0078431373, 0.0078431373, 0.00392156862745098, 0.0078431373,
0.0078431373, 0.0078431373, 0.00784313725490196, 0.0078431373, 0.0078431373, 0.0078431373,
@@ -1404,7 +1393,6 @@ const colormaps = [
{
ColorSpace: 'RGB',
Name: 'siemens',
name: 'siemens',
RGBPoints: [
0.0, 0.0078431373, 0.0039215686, 0.1254901961, 0.00392156862745098, 0.0078431373,
0.0039215686, 0.1254901961, 0.00784313725490196, 0.0078431373, 0.0039215686, 0.1882352941,
@@ -1,9 +1,15 @@
import { handleSegmentChange } from './segmentUtils';
import { isReferenceViewable } from './isReferenceViewable';
import {
setupSegmentationDataModifiedHandler,
setupSegmentationModifiedHandler,
} from './segmentationHandlers';
const utils = {
handleSegmentChange,
isReferenceViewable,
setupSegmentationDataModifiedHandler,
setupSegmentationModifiedHandler,
};
export default utils;
@@ -84,7 +84,7 @@ const Bidirectional = {
function getMappedAnnotations(annotation, displaySetService) {
const { metadata, data } = annotation;
const { cachedStats } = data;
const { referencedImageId, referencedSeriesInstanceUID } = metadata;
const { referencedImageId } = metadata;
const targets = Object.keys(cachedStats);
if (!targets.length) {
@@ -93,6 +93,7 @@ function getMappedAnnotations(annotation, displaySetService) {
}
const annotations = [];
const addedModalities = new Set();
Object.keys(cachedStats).forEach(targetId => {
const targetStats = cachedStats[targetId];
@@ -108,6 +109,12 @@ function getMappedAnnotations(annotation, displaySetService) {
const { mean, stdDev, max, area, Modality, areaUnit, modalityUnit, perimeter, radiusUnit } =
targetStats;
if (Modality && addedModalities.has(Modality)) {
return;
}
addedModalities.add(Modality);
annotations.push({
SeriesInstanceUID,
SOPInstanceUID,
@@ -93,6 +93,8 @@ function getMappedAnnotations(annotation, displaySetService) {
}
const annotations = [];
const addedModalities = new Set();
Object.keys(cachedStats).forEach(targetId => {
const targetStats = cachedStats[targetId];
@@ -107,6 +109,16 @@ function getMappedAnnotations(annotation, displaySetService) {
const { SeriesNumber } = displaySet;
const { mean, stdDev, max, area, Modality, areaUnit, modalityUnit } = targetStats;
// Skip if we've already added this modality
if (Modality && addedModalities.has(Modality)) {
return;
}
// Add modality to the set if it exists
if (Modality) {
addedModalities.add(Modality);
}
annotations.push({
SeriesInstanceUID,
SOPInstanceUID,
@@ -92,6 +92,8 @@ function getMappedAnnotations(annotation, displaySetService) {
}
const annotations = [];
const addedModalities = new Set();
Object.keys(cachedStats).forEach(targetId => {
const targetStats = cachedStats[targetId];
@@ -106,6 +108,16 @@ function getMappedAnnotations(annotation, displaySetService) {
const { SeriesNumber } = displaySet;
const { mean, stdDev, max, area, Modality, modalityUnit, areaUnit } = targetStats;
// Skip if we've already added this modality
if (Modality && addedModalities.has(Modality)) {
return;
}
// Add modality to the set if it exists
if (Modality) {
addedModalities.add(Modality);
}
annotations.push({
SeriesInstanceUID,
SOPInstanceUID,
@@ -0,0 +1,93 @@
import * as cornerstoneTools from '@cornerstonejs/tools';
import { updateSegmentationStats } from './updateSegmentationStats';
/**
* Sets up the handler for segmentation data modification events
*/
export function setupSegmentationDataModifiedHandler({
segmentationService,
customizationService,
commandsManager,
}) {
segmentationService.subscribeDebounced(
segmentationService.EVENTS.SEGMENTATION_DATA_MODIFIED,
async ({ segmentationId }) => {
const segmentation = segmentationService.getSegmentation(segmentationId);
const readableText = customizationService.getCustomization('panelSegmentation.readableText');
// Check for segments with bidirectional measurements and update them
const segmentIndices = Object.keys(segmentation.segments)
.map(index => parseInt(index))
.filter(index => index > 0);
for (const segmentIndex of segmentIndices) {
const segment = segmentation.segments[segmentIndex];
if (segment?.cachedStats?.namedStats?.bidirectional) {
// Run the command to update the bidirectional measurement
commandsManager.runCommand('runSegmentBidirectional', {
segmentationId,
segmentIndex,
});
}
}
const updatedSegmentation = await updateSegmentationStats({
segmentation,
segmentationId,
readableText,
});
if (updatedSegmentation) {
segmentationService.addOrUpdateSegmentation({
segmentationId,
segments: updatedSegmentation.segments,
});
}
},
1000
);
}
/**
* Sets up the handler for segmentation modification events
*/
export function setupSegmentationModifiedHandler({ segmentationService }) {
segmentationService.subscribe(
segmentationService.EVENTS.SEGMENTATION_MODIFIED,
async ({ segmentationId }) => {
const segmentation = segmentationService.getSegmentation(segmentationId);
const annotationState = cornerstoneTools.annotation.state.getAllAnnotations();
const bidirectionalAnnotations = annotationState.filter(
annotation =>
annotation.metadata.toolName === cornerstoneTools.SegmentBidirectionalTool.toolName
);
let toRemoveUIDs = [];
if (!segmentation) {
toRemoveUIDs = bidirectionalAnnotations.map(
annotation => annotation.metadata.segmentationId === segmentationId
);
return;
} else {
const segmentIndices = Object.keys(segmentation.segments)
.map(index => parseInt(index))
.filter(index => index > 0);
// check if there is a bidirectional data that exists but the segment
// does not exists anymore we need to remove the bidirectional data
const bidirectionalAnnotationsToRemove = bidirectionalAnnotations.filter(
annotation =>
annotation.metadata.segmentationId === segmentationId &&
!segmentIndices.includes(annotation.metadata.segmentIndex)
);
toRemoveUIDs = bidirectionalAnnotationsToRemove.map(annotation => annotation.annotationUID);
}
toRemoveUIDs.forEach(uid => {
cornerstoneTools.annotation.state.removeAnnotation(uid);
});
}
);
}
+38
View File
@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
### Bug Fixes
* **seg:** Enhance segmentation tools and UI, refactor code, and update dependencies ([#4915](https://github.com/OHIF/Viewers/issues/4915)) ([8432d5f](https://github.com/OHIF/Viewers/commit/8432d5f6330b300ac6760b32372be382210ed05b))
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
### Features
* **segmentation:** Enhance Segmentation with New AI and Once Click Tools ([#4910](https://github.com/OHIF/Viewers/issues/4910)) ([c75a3f3](https://github.com/OHIF/Viewers/commit/c75a3f3af58c4cd29c349338e4065269d8d9f387))
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-default
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/extension-default
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-default",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "Common/default features and functionality for basic image viewing",
"author": "OHIF Core Team",
"license": "MIT",
@@ -32,8 +32,8 @@
"start": "yarn run dev"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/i18n": "3.10.0-beta.141",
"@ohif/core": "3.10.0-beta.145",
"@ohif/i18n": "3.10.0-beta.145",
"dcmjs": "*",
"dicomweb-client": "^0.10.4",
"prop-types": "^15.6.2",
@@ -12,33 +12,48 @@ import { CallbackCustomization } from 'platform/core/src/types';
const { sortStudyInstances, formatDate, createStudyBrowserTabs } = utils;
const thumbnailNoImageModalities = [
'SR',
'SEG',
'SM',
'RTSTRUCT',
'RTPLAN',
'RTDOSE',
'DOC',
'OT',
'PMAP',
];
/**
*
* @param {*} param0
* Study Browser component that displays and manages studies and their display sets
*/
function PanelStudyBrowser({
getImageSrc,
getStudiesForPatientByMRN,
requestDisplaySetCreationForStudy,
dataSource,
customMapDisplaySets,
onClickUntrack,
}) {
const { servicesManager, commandsManager } = useSystem();
const { displaySetService, customizationService } = servicesManager.services;
const navigate = useNavigate();
const studyMode = customizationService.getCustomization('studyBrowser.studyMode') || 'all';
const internalImageViewer = useImageViewer();
const StudyInstanceUIDs = internalImageViewer.StudyInstanceUIDs;
// Normally you nest the components so the tree isn't so deep, and the data
// doesn't have to have such an intense shape. This works well enough for now.
// Tabs --> Studies --> DisplaySets --> Thumbnails
const { StudyInstanceUIDs } = useImageViewer();
const [{ activeViewportId, viewports, isHangingProtocolLayout }] = useViewportGrid();
const [activeTabName, setActiveTabName] = useState('all');
const [activeTabName, setActiveTabName] = useState(studyMode);
const [expandedStudyInstanceUIDs, setExpandedStudyInstanceUIDs] = useState([
...StudyInstanceUIDs,
]);
const [hasLoadedViewports, setHasLoadedViewports] = useState(false);
const [studyDisplayList, setStudyDisplayList] = useState([]);
const [displaySets, setDisplaySets] = useState([]);
const [displaySetsLoadingState, setDisplaySetsLoadingState] = useState({});
const [thumbnailImageSrcMap, setThumbnailImageSrcMap] = useState({});
const [jumpToDisplaySet, setJumpToDisplaySet] = useState(null);
const [viewPresets, setViewPresets] = useState(
customizationService.getCustomization('studyBrowser.viewPresets')
@@ -65,6 +80,8 @@ function PanelStudyBrowser({
setViewPresets(newViewPresets);
};
const mapDisplaySetsWithState = customMapDisplaySets || _mapDisplaySets;
const onDoubleClickThumbnailHandler = useCallback(
async displaySetInstanceUID => {
const customHandler = customizationService.getCustomization(
@@ -121,7 +138,7 @@ function PanelStudyBrowser({
const actuallyMappedStudies = mappedStudies.map(qidoStudy => {
return {
studyInstanceUid: qidoStudy.StudyInstanceUID,
date: formatDate(qidoStudy.StudyDate),
date: formatDate(qidoStudy.StudyDate) || '',
description: qidoStudy.StudyDescription,
modalities: qidoStudy.ModalitiesInStudy,
numInstances: Number(qidoStudy.NumInstances),
@@ -142,7 +159,7 @@ function PanelStudyBrowser({
StudyInstanceUIDs.forEach(sid => fetchStudiesForPatient(sid));
}, [StudyInstanceUIDs, dataSource, getStudiesForPatientByMRN, navigate]);
// // ~~ Initial Thumbnails
// ~~ Initial Thumbnails
useEffect(() => {
if (!hasLoadedViewports) {
if (activeViewportId) {
@@ -150,19 +167,35 @@ function PanelStudyBrowser({
// so wait a bit of time to allow the viewports preferential loading
// which improves user experience of responsiveness significantly on slower
// systems.
window.setTimeout(() => setHasLoadedViewports(true), 250);
const delayMs = 250 + displaySetService.getActiveDisplaySets().length * 10;
window.setTimeout(() => setHasLoadedViewports(true), delayMs);
}
return;
}
const currentDisplaySets = displaySetService.activeDisplaySets;
let currentDisplaySets = displaySetService.activeDisplaySets;
// filter non based on the list of modalities that are supported by cornerstone
currentDisplaySets = currentDisplaySets.filter(
ds => !thumbnailNoImageModalities.includes(ds.Modality)
);
if (!currentDisplaySets.length) {
return;
}
currentDisplaySets.forEach(async dSet => {
const newImageSrcEntry = {};
const displaySet = displaySetService.getDisplaySetByUID(dSet.displaySetInstanceUID);
const imageIds = dataSource.getImageIdsForDisplaySet(displaySet);
const imageId = imageIds[Math.floor(imageIds.length / 2)];
const imageId = getImageIdForThumbnail(displaySet, imageIds);
// TODO: Is it okay that imageIds are not returned here for SR displaySets?
if (!imageId || displaySet?.unsupported) {
return;
}
// When the image arrives, render it and store the result in the thumbnailImgSrcMap
let { thumbnailSrc } = displaySet;
if (!thumbnailSrc && displaySet.getThumbnailSrc) {
thumbnailSrc = await displaySet.getThumbnailSrc();
@@ -172,39 +205,40 @@ function PanelStudyBrowser({
displaySet.thumbnailSrc = thumbnailSrc;
}
newImageSrcEntry[dSet.displaySetInstanceUID] = thumbnailSrc;
// TODO: Is it okay that imageIds are not returned here for SR displaySets?
if (!imageId || displaySet?.unsupported) {
return;
}
// When the image arrives, render it and store the result in the thumbnailImgSrcMap
try {
newImageSrcEntry[dSet.displaySetInstanceUID] = await getImageSrc(imageId);
} catch (e) {
// This can happen for thumbnails and generate huge log sets if logged.
return;
}
setThumbnailImageSrcMap(prevState => {
return { ...prevState, ...newImageSrcEntry };
});
});
}, [
StudyInstanceUIDs,
dataSource,
displaySetService,
getImageSrc,
hasLoadedViewports,
activeViewportId,
]);
}, [displaySetService, dataSource, getImageSrc, activeViewportId, hasLoadedViewports]);
// ~~ displaySets
useEffect(() => {
// TODO: Are we sure `activeDisplaySets` will always be accurate?
const currentDisplaySets = displaySetService.activeDisplaySets;
const mappedDisplaySets = _mapDisplaySets(currentDisplaySets, thumbnailImageSrcMap);
sortStudyInstances(mappedDisplaySets);
if (!currentDisplaySets.length) {
return;
}
const mappedDisplaySets = mapDisplaySetsWithState(
currentDisplaySets,
displaySetsLoadingState,
thumbnailImageSrcMap,
viewports
);
if (!customMapDisplaySets) {
sortStudyInstances(mappedDisplaySets);
}
setDisplaySets(mappedDisplaySets);
}, [StudyInstanceUIDs, thumbnailImageSrcMap, displaySetService]);
}, [
displaySetService.activeDisplaySets,
displaySetsLoadingState,
viewports,
thumbnailImageSrcMap,
customMapDisplaySets,
]);
// ~~ subscriptions --> displaySets
useEffect(() => {
@@ -212,30 +246,41 @@ function PanelStudyBrowser({
const SubscriptionDisplaySetsAdded = displaySetService.subscribe(
displaySetService.EVENTS.DISPLAY_SETS_ADDED,
data => {
// for some reason this breaks thumbnail loading
// if (!hasLoadedViewports) {
// return;
// }
const { displaySetsAdded } = data;
if (!hasLoadedViewports) {
return;
}
const { displaySetsAdded, options } = data;
displaySetsAdded.forEach(async dSet => {
const displaySetInstanceUID = dSet.displaySetInstanceUID;
const newImageSrcEntry = {};
const displaySet = displaySetService.getDisplaySetByUID(dSet.displaySetInstanceUID);
const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
if (displaySet?.unsupported) {
return;
}
if (options?.madeInClient) {
setJumpToDisplaySet(displaySetInstanceUID);
}
const imageIds = dataSource.getImageIdsForDisplaySet(displaySet);
const imageId = imageIds[Math.floor(imageIds.length / 2)];
const imageId = getImageIdForThumbnail(displaySet, imageIds);
// TODO: Is it okay that imageIds are not returned here for SR displaysets?
if (!imageId) {
return;
}
// When the image arrives, render it and store the result in the thumbnailImgSrcMap
newImageSrcEntry[dSet.displaySetInstanceUID] = await getImageSrc(
imageId,
dSet.initialViewport
);
let { thumbnailSrc } = displaySet;
if (!thumbnailSrc && displaySet.getThumbnailSrc) {
thumbnailSrc = await displaySet.getThumbnailSrc();
}
if (!thumbnailSrc) {
thumbnailSrc = await getImageSrc(imageId);
displaySet.thumbnailSrc = thumbnailSrc;
}
newImageSrcEntry[displaySetInstanceUID] = thumbnailSrc;
setThumbnailImageSrcMap(prevState => {
return { ...prevState, ...newImageSrcEntry };
@@ -247,7 +292,7 @@ function PanelStudyBrowser({
return () => {
SubscriptionDisplaySetsAdded.unsubscribe();
};
}, [getImageSrc, dataSource, displaySetService]);
}, [displaySetService, dataSource, getImageSrc, hasLoadedViewports]);
useEffect(() => {
// TODO: Will this always hold _all_ the displaySets we care about?
@@ -255,7 +300,17 @@ function PanelStudyBrowser({
const SubscriptionDisplaySetsChanged = displaySetService.subscribe(
displaySetService.EVENTS.DISPLAY_SETS_CHANGED,
changedDisplaySets => {
const mappedDisplaySets = _mapDisplaySets(changedDisplaySets, thumbnailImageSrcMap);
const mappedDisplaySets = mapDisplaySetsWithState(
changedDisplaySets,
displaySetsLoadingState,
thumbnailImageSrcMap,
viewports
);
if (!customMapDisplaySets) {
sortStudyInstances(mappedDisplaySets);
}
setDisplaySets(mappedDisplaySets);
}
);
@@ -263,11 +318,17 @@ function PanelStudyBrowser({
const SubscriptionDisplaySetMetaDataInvalidated = displaySetService.subscribe(
displaySetService.EVENTS.DISPLAY_SET_SERIES_METADATA_INVALIDATED,
() => {
const mappedDisplaySets = _mapDisplaySets(
const mappedDisplaySets = mapDisplaySetsWithState(
displaySetService.getActiveDisplaySets(),
thumbnailImageSrcMap
displaySetsLoadingState,
thumbnailImageSrcMap,
viewports
);
if (!customMapDisplaySets) {
sortStudyInstances(mappedDisplaySets);
}
setDisplaySets(mappedDisplaySets);
}
);
@@ -276,7 +337,13 @@ function PanelStudyBrowser({
SubscriptionDisplaySetsChanged.unsubscribe();
SubscriptionDisplaySetMetaDataInvalidated.unsubscribe();
};
}, [StudyInstanceUIDs, thumbnailImageSrcMap, displaySetService]);
}, [
displaySetsLoadingState,
thumbnailImageSrcMap,
viewports,
displaySetService,
customMapDisplaySets,
]);
const tabs = createStudyBrowserTabs(StudyInstanceUIDs, studyDisplayList, displaySets);
@@ -284,8 +351,7 @@ function PanelStudyBrowser({
function _handleStudyClick(StudyInstanceUID) {
const shouldCollapseStudy = expandedStudyInstanceUIDs.includes(StudyInstanceUID);
const updatedExpandedStudyInstanceUIDs = shouldCollapseStudy
? // eslint-disable-next-line prettier/prettier
[...expandedStudyInstanceUIDs.filter(stdyUid => stdyUid !== StudyInstanceUID)]
? [...expandedStudyInstanceUIDs.filter(stdyUid => stdyUid !== StudyInstanceUID)]
: [...expandedStudyInstanceUIDs, StudyInstanceUID];
setExpandedStudyInstanceUIDs(updatedExpandedStudyInstanceUIDs);
@@ -296,6 +362,43 @@ function PanelStudyBrowser({
}
}
useEffect(() => {
if (jumpToDisplaySet) {
// Get element by displaySetInstanceUID
const displaySetInstanceUID = jumpToDisplaySet;
const element = document.getElementById(`thumbnail-${displaySetInstanceUID}`);
if (element && typeof element.scrollIntoView === 'function') {
// TODO: Any way to support IE here?
element.scrollIntoView({ behavior: 'smooth' });
setJumpToDisplaySet(null);
}
}
}, [jumpToDisplaySet, expandedStudyInstanceUIDs, activeTabName]);
useEffect(() => {
if (!jumpToDisplaySet) {
return;
}
const displaySetInstanceUID = jumpToDisplaySet;
// Set the activeTabName and expand the study
const thumbnailLocation = _findTabAndStudyOfDisplaySet(displaySetInstanceUID, tabs);
if (!thumbnailLocation) {
console.warn('jumpToThumbnail: displaySet thumbnail not found.');
return;
}
const { tabName, StudyInstanceUID } = thumbnailLocation;
setActiveTabName(tabName);
const studyExpanded = expandedStudyInstanceUIDs.includes(StudyInstanceUID);
if (!studyExpanded) {
const updatedExpandedStudyInstanceUIDs = [...expandedStudyInstanceUIDs, StudyInstanceUID];
setExpandedStudyInstanceUIDs(updatedExpandedStudyInstanceUIDs);
}
}, [expandedStudyInstanceUIDs, jumpToDisplaySet, tabs]);
const activeDisplaySetInstanceUIDs = viewports.get(activeViewportId)?.displaySetInstanceUIDs;
return (
@@ -323,10 +426,11 @@ function PanelStudyBrowser({
onClickTab={clickedTabName => {
setActiveTabName(clickedTabName);
}}
onClickUntrack={onClickUntrack}
onClickThumbnail={() => {}}
onDoubleClickThumbnail={onDoubleClickThumbnailHandler}
activeDisplaySetInstanceUIDs={activeDisplaySetInstanceUIDs}
showSettings={actionIcons.find(icon => icon.id === 'settings').value}
showSettings={actionIcons.find(icon => icon.id === 'settings')?.value}
viewPresets={viewPresets}
ThumbnailMenuItems={MoreDropdownMenu({
commandsManager,
@@ -367,35 +471,36 @@ function _mapDataSourceStudies(studies) {
});
}
function _mapDisplaySets(displaySets, thumbnailImageSrcMap) {
function _mapDisplaySets(displaySets, displaySetLoadingState, thumbnailImageSrcMap, viewports) {
const thumbnailDisplaySets = [];
const thumbnailNoImageDisplaySets = [];
displaySets
.filter(ds => !ds.excludeFromThumbnailBrowser)
.forEach(ds => {
const { thumbnailSrc, displaySetInstanceUID } = ds; // thumbnailImageSrcMap[ds.displaySetInstanceUID];
const { thumbnailSrc, displaySetInstanceUID } = ds;
const componentType = _getComponentType(ds);
const array =
componentType === 'thumbnail' ? thumbnailDisplaySets : thumbnailNoImageDisplaySets;
const loadingProgress = displaySetLoadingState?.[displaySetInstanceUID];
array.push({
displaySetInstanceUID: ds.displaySetInstanceUID,
displaySetInstanceUID,
description: ds.SeriesDescription || '',
seriesNumber: ds.SeriesNumber,
modality: ds.Modality,
seriesDate: ds.SeriesDate,
seriesTime: ds.SeriesTime,
numInstances: parseInt(ds.numImageFrames),
seriesDate: formatDate(ds.SeriesDate),
numInstances: ds.numImageFrames,
loadingProgress,
countIcon: ds.countIcon,
StudyInstanceUID: ds.StudyInstanceUID,
messages: ds.messages,
StudyInstanceUID: ds.StudyInstanceUID,
componentType,
imageSrc: thumbnailSrc || thumbnailImageSrcMap[displaySetInstanceUID],
dragData: {
type: 'displayset',
displaySetInstanceUID: ds.displaySetInstanceUID,
displaySetInstanceUID,
// .. Any other data to pass
},
isHydratedForDerivedDisplaySet: ds.isHydrated,
@@ -405,13 +510,44 @@ function _mapDisplaySets(displaySets, thumbnailImageSrcMap) {
return [...thumbnailDisplaySets, ...thumbnailNoImageDisplaySets];
}
const thumbnailNoImageModalities = ['SR', 'SEG', 'SM', 'RTSTRUCT', 'RTPLAN', 'RTDOSE'];
function _getComponentType(ds) {
if (thumbnailNoImageModalities.includes(ds.Modality) || ds?.unsupported) {
// TODO probably others.
return 'thumbnailNoImage';
}
return 'thumbnail';
}
function getImageIdForThumbnail(displaySet, imageIds) {
let imageId;
if (displaySet.isDynamicVolume) {
const timePoints = displaySet.dynamicVolumeInfo.timePoints;
const middleIndex = Math.floor(timePoints.length / 2);
const middleTimePointImageIds = timePoints[middleIndex];
imageId = middleTimePointImageIds[Math.floor(middleTimePointImageIds.length / 2)];
} else {
imageId = imageIds[Math.floor(imageIds.length / 2)];
}
return imageId;
}
function _findTabAndStudyOfDisplaySet(displaySetInstanceUID, tabs) {
for (let t = 0; t < tabs.length; t++) {
const { studies } = tabs[t];
for (let s = 0; s < studies.length; s++) {
const { displaySets } = studies[s];
for (let d = 0; d < displaySets.length; d++) {
const displaySet = displaySets[d];
if (displaySet.displaySetInstanceUID === displaySetInstanceUID) {
return {
tabName: tabs[t].name,
StudyInstanceUID: studies[s].studyInstanceUid,
};
}
}
}
}
}
@@ -1,12 +1,19 @@
async function getStudiesForPatientByMRN(dataSource, qidoForStudyUID) {
if (qidoForStudyUID && qidoForStudyUID.length && qidoForStudyUID[0].mrn) {
return dataSource.query.studies.search({
patientId: qidoForStudyUID[0].mrn,
disableWildcard: true,
});
if (!qidoForStudyUID?.length) {
return [];
}
console.log('No mrn found for', qidoForStudyUID);
return qidoForStudyUID;
const mrn = qidoForStudyUID[0].mrn;
// if not defined or empty, return the original qidoForStudyUID
if (!mrn) {
return qidoForStudyUID;
}
return dataSource.query.studies.search({
patientId: mrn,
disableWildcard: true,
});
}
export default getStudiesForPatientByMRN;
@@ -42,14 +42,14 @@ export function ToolBoxButtonGroupWrapper({ groupId, buttonSection, ...props })
);
}
export function ToolBoxButtonWrapper({ onInteraction, options, ...props }) {
export function ToolBoxButtonWrapper({ onInteraction, className, options, ...props }) {
return (
<div className="bg-popover flex flex-row rounded-md px-0 py-0">
<ToolButton
{...props}
id={props.id}
size="small"
className={classNames(props.disabled && 'text-foreground/70')}
className={classNames(props.disabled && 'text-foreground/70', className)}
onInteraction={event => {
onInteraction?.({
event,
+10 -3
View File
@@ -1,4 +1,4 @@
import React, { useEffect, useState, useCallback } from 'react';
import React, { useEffect, useState, useCallback, useRef } from 'react';
import PropTypes from 'prop-types';
import { InvestigationalUseDialog } from '@ohif/ui';
@@ -55,6 +55,10 @@ function ViewerLayout({
setRightPanelClosed
);
const handleMouseEnter = () => {
(document.activeElement as HTMLElement)?.blur();
};
const LoadingIndicatorProgress = customizationService.getCustomization(
'ui.loadingIndicatorProgress'
);
@@ -67,6 +71,7 @@ function ViewerLayout({
useEffect(() => {
document.body.classList.add('bg-black');
document.body.classList.add('overflow-hidden');
return () => {
document.body.classList.remove('bg-black');
document.body.classList.remove('overflow-hidden');
@@ -150,7 +155,6 @@ function ViewerLayout({
{showLoadingIndicator && <LoadingIndicatorProgress className="h-full w-full bg-black" />}
<ResizablePanelGroup {...resizablePanelGroupProps}>
{/* LEFT SIDEPANELS */}
{hasLeftPanels ? (
<>
<ResizablePanel {...resizableLeftPanelProps}>
@@ -171,7 +175,10 @@ function ViewerLayout({
{/* TOOLBAR + GRID */}
<ResizablePanel {...resizableViewportGridPanelProps}>
<div className="flex h-full flex-1 flex-col">
<div className="relative flex h-full flex-1 items-center justify-center overflow-hidden bg-black">
<div
className="relative flex h-full flex-1 items-center justify-center overflow-hidden bg-black"
onMouseEnter={handleMouseEnter}
>
<ViewportGridComp
servicesManager={servicesManager}
viewportComponents={viewportComponents}
+2 -2
View File
@@ -95,7 +95,7 @@ export function Toolbox({ buttonSectionId, title }: { buttonSectionId: string; t
)}
</PanelSection.Header>
<PanelSection.Content className="flex-shrink-0 border-none">
<PanelSection.Content className="bg-muted flex-shrink-0 border-none">
{showConfig && <CustomConfigComponent />}
{toolboxSections.map(section => {
const sectionId = section.componentProps.buttonSection;
@@ -131,7 +131,7 @@ export function Toolbox({ buttonSectionId, title }: { buttonSectionId: string; t
);
})}
{activeToolOptions && (
<div className="bg-primary-dark h-auto px-2">
<div className="bg-primary-dark mt-1 h-auto px-2">
<ToolSettings options={activeToolOptions} />
</div>
)}
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @ohif/extension-dicom-microscopy
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-dicom-microscopy
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-dicom-microscopy
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/extension-dicom-microscopy
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/extension-dicom-microscopy
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-dicom-microscopy",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "OHIF extension for DICOM microscopy",
"author": "Bill Wallace, md-prog",
"license": "MIT",
@@ -30,10 +30,10 @@
"start": "yarn run dev"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-default": "3.10.0-beta.141",
"@ohif/i18n": "3.10.0-beta.141",
"@ohif/ui": "3.10.0-beta.141",
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-default": "3.10.0-beta.145",
"@ohif/i18n": "3.10.0-beta.145",
"@ohif/ui": "3.10.0-beta.145",
"prop-types": "^15.6.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @ohif/extension-dicom-pdf
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-dicom-pdf
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-dicom-pdf
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/extension-dicom-pdf
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/extension-dicom-pdf
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-dicom-pdf",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "OHIF extension for PDF display",
"author": "OHIF",
"license": "MIT",
@@ -30,8 +30,8 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/ui": "3.10.0-beta.141",
"@ohif/core": "3.10.0-beta.145",
"@ohif/ui": "3.10.0-beta.145",
"dcmjs": "*",
"dicom-parser": "^1.8.9",
"hammerjs": "^2.0.8",
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @ohif/extension-dicom-video
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-dicom-video
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-dicom-video
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/extension-dicom-video
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/extension-dicom-video
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-dicom-video",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "OHIF extension for video display",
"author": "OHIF",
"license": "MIT",
@@ -30,8 +30,8 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/ui": "3.10.0-beta.141",
"@ohif/core": "3.10.0-beta.145",
"@ohif/ui": "3.10.0-beta.145",
"dcmjs": "*",
"dicom-parser": "^1.8.9",
"hammerjs": "^2.0.8",
@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
### Bug Fixes
* **seg:** Enhance segmentation tools and UI, refactor code, and update dependencies ([#4915](https://github.com/OHIF/Viewers/issues/4915)) ([8432d5f](https://github.com/OHIF/Viewers/commit/8432d5f6330b300ac6760b32372be382210ed05b))
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
### Features
* **segmentation:** Enhance Segmentation with New AI and Once Click Tools ([#4910](https://github.com/OHIF/Viewers/issues/4910)) ([c75a3f3](https://github.com/OHIF/Viewers/commit/c75a3f3af58c4cd29c349338e4065269d8d9f387))
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-measurement-tracking
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/extension-measurement-tracking
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-measurement-tracking",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "Tracking features and functionality for basic image viewing",
"author": "OHIF Core Team",
"license": "MIT",
@@ -32,12 +32,12 @@
"start": "yarn run dev"
},
"peerDependencies": {
"@cornerstonejs/core": "^3.7.17",
"@cornerstonejs/tools": "^3.7.17",
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.141",
"@ohif/extension-default": "3.10.0-beta.141",
"@ohif/ui": "3.10.0-beta.141",
"@cornerstonejs/core": "^3.8.4",
"@cornerstonejs/tools": "^3.8.4",
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.145",
"@ohif/extension-default": "3.10.0-beta.145",
"@ohif/ui": "3.10.0-beta.145",
"classnames": "^2.3.2",
"dcmjs": "*",
"lodash.debounce": "^4.0.8",
@@ -49,7 +49,7 @@
},
"dependencies": {
"@babel/runtime": "^7.20.13",
"@ohif/ui": "3.10.0-beta.141",
"@ohif/ui": "3.10.0-beta.145",
"@xstate/react": "^3.2.2",
"xstate": "^4.10.0"
}
@@ -1,23 +1,9 @@
import React, { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import React from 'react';
import PropTypes from 'prop-types';
import { useSystem, utils } from '@ohif/core';
import { useImageViewer, Dialog, ButtonEnums } from '@ohif/ui';
import { useViewportGrid } from '@ohif/ui-next';
import { StudyBrowser } from '@ohif/ui-next';
import { useTrackedMeasurements } from '../../getContextModule';
import { Separator } from '@ohif/ui-next';
import { MoreDropdownMenu, PanelStudyBrowserHeader } from '@ohif/extension-default';
import { defaultActionIcons } from './constants';
import { useSystem } from '@ohif/core';
import PanelStudyBrowser from '@ohif/extension-default/src/Panels/StudyBrowser/PanelStudyBrowser';
import { UntrackSeriesModal } from './untrackSeriesModal';
const { formatDate, createStudyBrowserTabs } = utils;
const DIALOG_ID = {
UNTRACK_SERIES: 'untrack-series',
REJECT_REPORT: 'ds-reject-sr',
};
import { useTrackedMeasurements } from '../../getContextModule';
const thumbnailNoImageModalities = [
'SR',
@@ -32,8 +18,7 @@ const thumbnailNoImageModalities = [
];
/**
*
* @param {*} param0
* Panel component for the Study Browser with tracking capabilities
*/
export default function PanelStudyBrowserTracking({
getImageSrc,
@@ -41,404 +26,11 @@ export default function PanelStudyBrowserTracking({
requestDisplaySetCreationForStudy,
dataSource,
}) {
const { servicesManager, commandsManager } = useSystem();
const {
displaySetService,
uiDialogService,
hangingProtocolService,
uiNotificationService,
measurementService,
studyPrefetcherService,
customizationService,
uiModalService,
} = servicesManager.services;
const navigate = useNavigate();
const studyMode = customizationService.getCustomization('studyBrowser.studyMode');
const { t } = useTranslation('Common');
// Normally you nest the components so the tree isn't so deep, and the data
// doesn't have to have such an intense shape. This works well enough for now.
// Tabs --> Studies --> DisplaySets --> Thumbnails
const { StudyInstanceUIDs } = useImageViewer();
const [{ activeViewportId, viewports, isHangingProtocolLayout }, viewportGridService] =
useViewportGrid();
const { servicesManager } = useSystem();
const { displaySetService, uiModalService, measurementService } = servicesManager.services;
const [trackedMeasurements, sendTrackedMeasurementsEvent] = useTrackedMeasurements();
const [activeTabName, setActiveTabName] = useState(studyMode);
const [expandedStudyInstanceUIDs, setExpandedStudyInstanceUIDs] = useState([
...StudyInstanceUIDs,
]);
const [studyDisplayList, setStudyDisplayList] = useState([]);
const [hasLoadedViewports, setHasLoadedViewports] = useState(false);
const [displaySets, setDisplaySets] = useState([]);
const [displaySetsLoadingState, setDisplaySetsLoadingState] = useState({});
const [thumbnailImageSrcMap, setThumbnailImageSrcMap] = useState({});
const [jumpToDisplaySet, setJumpToDisplaySet] = useState(null);
const [viewPresets, setViewPresets] = useState(
customizationService.getCustomization('studyBrowser.viewPresets')
);
const [actionIcons, setActionIcons] = useState(defaultActionIcons);
const updateActionIconValue = actionIcon => {
actionIcon.value = !actionIcon.value;
const newActionIcons = [...actionIcons];
setActionIcons(newActionIcons);
};
const updateViewPresetValue = viewPreset => {
if (!viewPreset) {
return;
}
const newViewPresets = viewPresets.map(preset => {
preset.selected = preset.id === viewPreset.id;
return preset;
});
setViewPresets(newViewPresets);
};
const onDoubleClickThumbnailHandler = displaySetInstanceUID => {
let updatedViewports = [];
const viewportId = activeViewportId;
try {
updatedViewports = hangingProtocolService.getViewportsRequireUpdate(
viewportId,
displaySetInstanceUID,
isHangingProtocolLayout
);
} catch (error) {
console.warn(error);
uiNotificationService.show({
title: 'Thumbnail Double Click',
message:
'The selected display sets could not be added to the viewport due to a mismatch in the Hanging Protocol rules.',
type: 'error',
duration: 3000,
});
}
viewportGridService.setDisplaySetsForViewports(updatedViewports);
};
const activeViewportDisplaySetInstanceUIDs =
viewports.get(activeViewportId)?.displaySetInstanceUIDs;
const { trackedSeries } = trackedMeasurements.context;
useEffect(() => {
setActiveTabName(studyMode);
}, [studyMode]);
// ~~ studyDisplayList
useEffect(() => {
// Fetch all studies for the patient in each primary study
async function fetchStudiesForPatient(StudyInstanceUID) {
// current study qido
const qidoForStudyUID = await dataSource.query.studies.search({
studyInstanceUid: StudyInstanceUID,
});
if (!qidoForStudyUID?.length) {
navigate('/notfoundstudy', '_self');
throw new Error('Invalid study URL');
}
let qidoStudiesForPatient = qidoForStudyUID;
// try to fetch the prior studies based on the patientID if the
// server can respond.
try {
qidoStudiesForPatient = await getStudiesForPatientByMRN(qidoForStudyUID);
} catch (error) {
console.warn(error);
}
const mappedStudies = _mapDataSourceStudies(qidoStudiesForPatient);
const actuallyMappedStudies = mappedStudies.map(qidoStudy => {
return {
studyInstanceUid: qidoStudy.StudyInstanceUID,
date: formatDate(qidoStudy.StudyDate) || t('NoStudyDate'),
description: qidoStudy.StudyDescription,
modalities: qidoStudy.ModalitiesInStudy,
numInstances: qidoStudy.NumInstances,
};
});
setStudyDisplayList(prevArray => {
const ret = [...prevArray];
for (const study of actuallyMappedStudies) {
if (!prevArray.find(it => it.studyInstanceUid === study.studyInstanceUid)) {
ret.push(study);
}
}
return ret;
});
}
StudyInstanceUIDs.forEach(sid => fetchStudiesForPatient(sid));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [StudyInstanceUIDs, getStudiesForPatientByMRN]);
// ~~ Initial Thumbnails
useEffect(() => {
if (!hasLoadedViewports) {
if (activeViewportId) {
// Once there is an active viewport id, it means the layout is ready
// so wait a bit of time to allow the viewports preferential loading
// which improves user experience of responsiveness significantly on slower
// systems.
const delayMs = 250 + displaySetService.getActiveDisplaySets().length * 10;
window.setTimeout(() => setHasLoadedViewports(true), delayMs);
}
return;
}
let currentDisplaySets = displaySetService.activeDisplaySets;
// filter non based on the list of modalities that are supported by cornerstone
currentDisplaySets = currentDisplaySets.filter(
ds => !thumbnailNoImageModalities.includes(ds.Modality)
);
if (!currentDisplaySets.length) {
return;
}
currentDisplaySets.forEach(async dSet => {
const newImageSrcEntry = {};
const displaySet = displaySetService.getDisplaySetByUID(dSet.displaySetInstanceUID);
const imageIds = dataSource.getImageIdsForDisplaySet(displaySet);
const imageId = getImageIdForThumbnail(displaySet, imageIds);
// TODO: Is it okay that imageIds are not returned here for SR displaySets?
if (!imageId || displaySet?.unsupported) {
return;
}
// When the image arrives, render it and store the result in the thumbnailImgSrcMap
let { thumbnailSrc } = displaySet;
if (!thumbnailSrc && displaySet.getThumbnailSrc) {
thumbnailSrc = await displaySet.getThumbnailSrc();
}
if (!thumbnailSrc) {
const thumbnailSrc = await getImageSrc(imageId);
displaySet.thumbnailSrc = thumbnailSrc;
}
newImageSrcEntry[dSet.displaySetInstanceUID] = thumbnailSrc;
setThumbnailImageSrcMap(prevState => {
return { ...prevState, ...newImageSrcEntry };
});
});
}, [displaySetService, dataSource, getImageSrc, activeViewportId, hasLoadedViewports]);
// ~~ displaySets
useEffect(() => {
const currentDisplaySets = displaySetService.activeDisplaySets;
if (!currentDisplaySets.length) {
return;
}
const mappedDisplaySets = _mapDisplaySets(
currentDisplaySets,
displaySetsLoadingState,
thumbnailImageSrcMap,
trackedSeries,
viewports,
viewportGridService,
dataSource,
displaySetService,
uiDialogService,
uiNotificationService
);
setDisplaySets(mappedDisplaySets);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
displaySetService.activeDisplaySets,
displaySetsLoadingState,
trackedSeries,
viewports,
dataSource,
thumbnailImageSrcMap,
]);
// -- displaySetsLoadingState
useEffect(() => {
const { unsubscribe } = studyPrefetcherService.subscribe(
studyPrefetcherService.EVENTS.DISPLAYSET_LOAD_PROGRESS,
updatedDisplaySetLoadingState => {
const { displaySetInstanceUID, loadingProgress } = updatedDisplaySetLoadingState;
setDisplaySetsLoadingState(prevState => ({
...prevState,
[displaySetInstanceUID]: loadingProgress,
}));
}
);
return () => unsubscribe();
}, [studyPrefetcherService]);
// ~~ subscriptions --> displaySets
useEffect(() => {
// DISPLAY_SETS_ADDED returns an array of DisplaySets that were added
const SubscriptionDisplaySetsAdded = displaySetService.subscribe(
displaySetService.EVENTS.DISPLAY_SETS_ADDED,
data => {
if (!hasLoadedViewports) {
return;
}
const { displaySetsAdded, options } = data;
displaySetsAdded.forEach(async dSet => {
const displaySetInstanceUID = dSet.displaySetInstanceUID;
const newImageSrcEntry = {};
const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
if (displaySet?.unsupported) {
return;
}
if (options.madeInClient) {
setJumpToDisplaySet(displaySetInstanceUID);
}
const imageIds = dataSource.getImageIdsForDisplaySet(displaySet);
const imageId = getImageIdForThumbnail(displaySet, imageIds);
// TODO: Is it okay that imageIds are not returned here for SR displaysets?
if (!imageId) {
return;
}
// When the image arrives, render it and store the result in the thumbnailImgSrcMap
newImageSrcEntry[displaySetInstanceUID] = await getImageSrc(imageId);
setThumbnailImageSrcMap(prevState => {
return { ...prevState, ...newImageSrcEntry };
});
});
}
);
return () => {
SubscriptionDisplaySetsAdded.unsubscribe();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [displaySetService, dataSource, getImageSrc, thumbnailImageSrcMap, trackedSeries, viewports]);
useEffect(() => {
// TODO: Will this always hold _all_ the displaySets we care about?
// DISPLAY_SETS_CHANGED returns `DisplaySerService.activeDisplaySets`
const SubscriptionDisplaySetsChanged = displaySetService.subscribe(
displaySetService.EVENTS.DISPLAY_SETS_CHANGED,
changedDisplaySets => {
const mappedDisplaySets = _mapDisplaySets(
changedDisplaySets,
displaySetsLoadingState,
thumbnailImageSrcMap,
trackedSeries,
viewports,
viewportGridService,
dataSource,
displaySetService,
uiDialogService,
uiNotificationService
);
setDisplaySets(mappedDisplaySets);
}
);
const SubscriptionDisplaySetMetaDataInvalidated = displaySetService.subscribe(
displaySetService.EVENTS.DISPLAY_SET_SERIES_METADATA_INVALIDATED,
() => {
const mappedDisplaySets = _mapDisplaySets(
displaySetService.getActiveDisplaySets(),
displaySetsLoadingState,
thumbnailImageSrcMap,
trackedSeries,
viewports,
viewportGridService,
dataSource,
displaySetService,
uiDialogService,
uiNotificationService
);
setDisplaySets(mappedDisplaySets);
}
);
return () => {
SubscriptionDisplaySetsChanged.unsubscribe();
SubscriptionDisplaySetMetaDataInvalidated.unsubscribe();
};
}, [
displaySetsLoadingState,
thumbnailImageSrcMap,
trackedSeries,
viewports,
dataSource,
displaySetService,
]);
const tabs = createStudyBrowserTabs(StudyInstanceUIDs, studyDisplayList, displaySets);
// TODO: Should not fire this on "close"
function _handleStudyClick(StudyInstanceUID) {
const shouldCollapseStudy = expandedStudyInstanceUIDs.includes(StudyInstanceUID);
const updatedExpandedStudyInstanceUIDs = shouldCollapseStudy
? [...expandedStudyInstanceUIDs.filter(stdyUid => stdyUid !== StudyInstanceUID)]
: [...expandedStudyInstanceUIDs, StudyInstanceUID];
setExpandedStudyInstanceUIDs(updatedExpandedStudyInstanceUIDs);
if (!shouldCollapseStudy) {
const madeInClient = true;
requestDisplaySetCreationForStudy(displaySetService, StudyInstanceUID, madeInClient);
}
}
useEffect(() => {
if (jumpToDisplaySet) {
// Get element by displaySetInstanceUID
const displaySetInstanceUID = jumpToDisplaySet;
const element = document.getElementById(`thumbnail-${displaySetInstanceUID}`);
if (element && typeof element.scrollIntoView === 'function') {
// TODO: Any way to support IE here?
element.scrollIntoView({ behavior: 'smooth' });
setJumpToDisplaySet(null);
}
}
}, [jumpToDisplaySet, expandedStudyInstanceUIDs, activeTabName]);
useEffect(() => {
if (!jumpToDisplaySet) {
return;
}
const displaySetInstanceUID = jumpToDisplaySet;
// Set the activeTabName and expand the study
const thumbnailLocation = _findTabAndStudyOfDisplaySet(displaySetInstanceUID, tabs);
if (!thumbnailLocation) {
console.warn('jumpToThumbnail: displaySet thumbnail not found.');
return;
}
const { tabName, StudyInstanceUID } = thumbnailLocation;
setActiveTabName(tabName);
const studyExpanded = expandedStudyInstanceUIDs.includes(StudyInstanceUID);
if (!studyExpanded) {
const updatedExpandedStudyInstanceUIDs = [...expandedStudyInstanceUIDs, StudyInstanceUID];
setExpandedStudyInstanceUIDs(updatedExpandedStudyInstanceUIDs);
}
}, [expandedStudyInstanceUIDs, jumpToDisplaySet, tabs]);
const onClickUntrack = displaySetInstanceUID => {
const onConfirm = () => {
const displaySet = displaySetService.getDisplaySetByUID(displaySetInstanceUID);
@@ -462,51 +54,68 @@ export default function PanelStudyBrowserTracking({
});
};
return (
<>
<>
<PanelStudyBrowserHeader
viewPresets={viewPresets}
updateViewPresetValue={updateViewPresetValue}
actionIcons={actionIcons}
updateActionIconValue={updateActionIconValue}
/>
<Separator
orientation="horizontal"
className="bg-black"
thickness="2px"
/>
</>
// Custom mapping function to add tracking data to display sets
const mapDisplaySetsWithTracking = (
displaySets,
displaySetLoadingState,
thumbnailImageSrcMap,
viewports
) => {
const thumbnailDisplaySets = [];
const thumbnailNoImageDisplaySets = [];
displaySets
.filter(ds => !ds.excludeFromThumbnailBrowser)
.forEach(ds => {
const { thumbnailSrc, displaySetInstanceUID } = ds;
const componentType = getComponentType(ds);
<StudyBrowser
tabs={tabs}
servicesManager={servicesManager}
activeTabName={activeTabName}
expandedStudyInstanceUIDs={expandedStudyInstanceUIDs}
onClickStudy={_handleStudyClick}
onClickTab={clickedTabName => {
setActiveTabName(clickedTabName);
}}
onClickUntrack={displaySetInstanceUID => {
onClickUntrack(displaySetInstanceUID);
}}
onClickThumbnail={() => {}}
onDoubleClickThumbnail={onDoubleClickThumbnailHandler}
activeDisplaySetInstanceUIDs={activeViewportDisplaySetInstanceUIDs}
showSettings={actionIcons.find(icon => icon.id === 'settings').value}
viewPresets={viewPresets}
ThumbnailMenuItems={MoreDropdownMenu({
commandsManager,
servicesManager,
menuItemsKey: 'studyBrowser.thumbnailMenuItems',
})}
StudyMenuItems={MoreDropdownMenu({
commandsManager,
servicesManager,
menuItemsKey: 'studyBrowser.studyMenuItems',
})}
/>
</>
const array =
componentType === 'thumbnailTracked' ? thumbnailDisplaySets : thumbnailNoImageDisplaySets;
const loadingProgress = displaySetLoadingState?.[displaySetInstanceUID];
array.push({
displaySetInstanceUID,
description: ds.SeriesDescription || '',
seriesNumber: ds.SeriesNumber,
modality: ds.Modality,
seriesDate: ds.SeriesDate ? new Date(ds.SeriesDate).toLocaleDateString() : '',
numInstances: ds.numImageFrames,
loadingProgress,
countIcon: ds.countIcon,
messages: ds.messages,
StudyInstanceUID: ds.StudyInstanceUID,
componentType,
imageSrc: thumbnailSrc || thumbnailImageSrcMap[displaySetInstanceUID],
dragData: {
type: 'displayset',
displaySetInstanceUID,
},
isTracked: trackedSeries.includes(ds.SeriesInstanceUID),
isHydratedForDerivedDisplaySet: ds.isHydrated,
});
});
return [...thumbnailDisplaySets, ...thumbnailNoImageDisplaySets];
};
// Override component type to use tracking specific components
const getComponentType = ds => {
if (thumbnailNoImageModalities.includes(ds.Modality) || ds?.unsupported) {
return 'thumbnailNoImage';
}
return 'thumbnailTracked';
};
return (
<PanelStudyBrowser
getImageSrc={getImageSrc}
getStudiesForPatientByMRN={getStudiesForPatientByMRN}
requestDisplaySetCreationForStudy={requestDisplaySetCreationForStudy}
dataSource={dataSource}
customMapDisplaySets={mapDisplaySetsWithTracking}
onClickUntrack={onClickUntrack}
/>
);
}
@@ -518,120 +127,3 @@ PanelStudyBrowserTracking.propTypes = {
getStudiesForPatientByMRN: PropTypes.func.isRequired,
requestDisplaySetCreationForStudy: PropTypes.func.isRequired,
};
function getImageIdForThumbnail(displaySet: any, imageIds: any) {
let imageId;
if (displaySet.isDynamicVolume) {
const timePoints = displaySet.dynamicVolumeInfo.timePoints;
const middleIndex = Math.floor(timePoints.length / 2);
const middleTimePointImageIds = timePoints[middleIndex];
imageId = middleTimePointImageIds[Math.floor(middleTimePointImageIds.length / 2)];
} else {
imageId = imageIds[Math.floor(imageIds.length / 2)];
}
return imageId;
}
/**
* Maps from the DataSource's format to a naturalized object
*
* @param {*} studies
*/
function _mapDataSourceStudies(studies) {
return studies.map(study => {
// TODO: Why does the data source return in this format?
return {
AccessionNumber: study.accession,
StudyDate: study.date,
StudyDescription: study.description,
NumInstances: study.instances,
ModalitiesInStudy: study.modalities,
PatientID: study.mrn,
PatientName: study.patientName,
StudyInstanceUID: study.studyInstanceUid,
StudyTime: study.time,
};
});
}
function _mapDisplaySets(
displaySets,
displaySetLoadingState,
thumbnailImageSrcMap,
trackedSeriesInstanceUIDs,
viewports, // TODO: make array of `displaySetInstanceUIDs`?
viewportGridService,
dataSource,
displaySetService,
uiDialogService,
uiNotificationService
) {
const thumbnailDisplaySets = [];
const thumbnailNoImageDisplaySets = [];
displaySets
.filter(ds => !ds.excludeFromThumbnailBrowser)
.forEach(ds => {
const { thumbnailSrc, displaySetInstanceUID } = ds; // thumbnailImageSrcMap[ds.displaySetInstanceUID];
const componentType = _getComponentType(ds);
const array =
componentType === 'thumbnailTracked' ? thumbnailDisplaySets : thumbnailNoImageDisplaySets;
const loadingProgress = displaySetLoadingState?.[displaySetInstanceUID];
const thumbnailProps = {
displaySetInstanceUID,
description: ds.SeriesDescription,
seriesNumber: ds.SeriesNumber,
modality: ds.Modality,
seriesDate: formatDate(ds.SeriesDate),
numInstances: ds.numImageFrames,
loadingProgress,
countIcon: ds.countIcon,
messages: ds.messages,
StudyInstanceUID: ds.StudyInstanceUID,
componentType,
imageSrc: thumbnailSrc || thumbnailImageSrcMap[displaySetInstanceUID],
dragData: {
type: 'displayset',
displaySetInstanceUID,
// .. Any other data to pass
},
isTracked: trackedSeriesInstanceUIDs.includes(ds.SeriesInstanceUID),
isHydratedForDerivedDisplaySet: ds.isHydrated,
};
array.push(thumbnailProps);
});
return [...thumbnailDisplaySets, ...thumbnailNoImageDisplaySets];
}
function _getComponentType(ds) {
if (thumbnailNoImageModalities.includes(ds.Modality) || ds?.unsupported) {
return 'thumbnailNoImage';
}
return 'thumbnailTracked';
}
function _findTabAndStudyOfDisplaySet(displaySetInstanceUID, tabs) {
for (let t = 0; t < tabs.length; t++) {
const { studies } = tabs[t];
for (let s = 0; s < studies.length; s++) {
const { displaySets } = studies[s];
for (let d = 0; d < displaySets.length; d++) {
const displaySet = displaySets[d];
if (displaySet.displaySetInstanceUID === displaySetInstanceUID) {
return {
tabName: tabs[t].name,
StudyInstanceUID: studies[s].studyInstanceUid,
};
}
}
}
}
}
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @ohif/extension-test
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-test
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-test
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/extension-test
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/extension-test
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-test",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "OHIF extension used inside e2e testing",
"author": "OHIF",
"license": "MIT",
@@ -30,8 +30,8 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/ui": "3.10.0-beta.141",
"@ohif/core": "3.10.0-beta.145",
"@ohif/ui": "3.10.0-beta.145",
"dcmjs": "0.38.0",
"dicom-parser": "^1.8.9",
"hammerjs": "^2.0.8",
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @ohif/extension-tmtv
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-tmtv
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/extension-tmtv
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/extension-tmtv
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/extension-tmtv
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-tmtv",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "OHIF extension for Total Metabolic Tumor Volume",
"author": "OHIF",
"license": "MIT",
@@ -30,8 +30,8 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/ui": "3.10.0-beta.141",
"@ohif/core": "3.10.0-beta.145",
"@ohif/ui": "3.10.0-beta.145",
"dcmjs": "*",
"dicom-parser": "^1.8.9",
"hammerjs": "^2.0.8",
+1 -1
View File
@@ -1,5 +1,5 @@
{
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"packages": ["extensions/*", "platform/*", "modes/*", "addOns/externals/*"],
"npmClient": "yarn"
}
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @ohif/mode-basic-dev-mode
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @ohif/mode-basic-dev-mode
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/mode-basic-dev-mode
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/mode-basic-dev-mode
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/mode-basic-dev-mode
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-basic-dev-mode",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "Basic OHIF Viewer Using Cornerstone",
"author": "OHIF",
"license": "MIT",
@@ -31,12 +31,12 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-cornerstone": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.141",
"@ohif/extension-default": "3.10.0-beta.141",
"@ohif/extension-dicom-pdf": "3.10.0-beta.141",
"@ohif/extension-dicom-video": "3.10.0-beta.141"
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-cornerstone": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.145",
"@ohif/extension-default": "3.10.0-beta.145",
"@ohif/extension-dicom-pdf": "3.10.0-beta.145",
"@ohif/extension-dicom-video": "3.10.0-beta.145"
},
"dependencies": {
"@babel/runtime": "^7.20.13",
+35
View File
@@ -3,6 +3,41 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @ohif/mode-test
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
### Features
* **segmentation:** Enhance Segmentation with New AI and Once Click Tools ([#4910](https://github.com/OHIF/Viewers/issues/4910)) ([c75a3f3](https://github.com/OHIF/Viewers/commit/c75a3f3af58c4cd29c349338e4065269d8d9f387))
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/mode-test
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/mode-test
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/mode-test
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-test",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "Basic mode for testing",
"author": "OHIF",
"license": "MIT",
@@ -34,14 +34,14 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-cornerstone": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.141",
"@ohif/extension-default": "3.10.0-beta.141",
"@ohif/extension-dicom-pdf": "3.10.0-beta.141",
"@ohif/extension-dicom-video": "3.10.0-beta.141",
"@ohif/extension-measurement-tracking": "3.10.0-beta.141",
"@ohif/extension-test": "3.10.0-beta.141"
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-cornerstone": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.145",
"@ohif/extension-default": "3.10.0-beta.145",
"@ohif/extension-dicom-pdf": "3.10.0-beta.145",
"@ohif/extension-dicom-video": "3.10.0-beta.145",
"@ohif/extension-measurement-tracking": "3.10.0-beta.145",
"@ohif/extension-test": "3.10.0-beta.145"
},
"dependencies": {
"@babel/runtime": "^7.20.13",
+4 -2
View File
@@ -42,8 +42,10 @@ export const setToolActiveToolbar = {
const ReferenceLinesListeners = [
{
commandName: 'setSourceViewportForReferenceLinesTool',
context: 'CORNERSTONE',
commandName: 'setViewportForToolConfiguration',
commandOptions: {
toolName: 'ReferenceLines',
},
},
];
+35
View File
@@ -3,6 +3,41 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
### Bug Fixes
* **seg:** Enhance segmentation tools and UI, refactor code, and update dependencies ([#4915](https://github.com/OHIF/Viewers/issues/4915)) ([8432d5f](https://github.com/OHIF/Viewers/commit/8432d5f6330b300ac6760b32372be382210ed05b))
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @ohif/mode-longitudinal
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/mode-longitudinal
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/mode-longitudinal
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/mode-longitudinal
+10 -10
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-longitudinal",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "Longitudinal Workflow",
"author": "OHIF",
"license": "MIT",
@@ -34,15 +34,15 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-cornerstone": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-rt": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-seg": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.141",
"@ohif/extension-default": "3.10.0-beta.141",
"@ohif/extension-dicom-pdf": "3.10.0-beta.141",
"@ohif/extension-dicom-video": "3.10.0-beta.141",
"@ohif/extension-measurement-tracking": "3.10.0-beta.141"
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-cornerstone": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-rt": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-seg": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.145",
"@ohif/extension-default": "3.10.0-beta.145",
"@ohif/extension-dicom-pdf": "3.10.0-beta.145",
"@ohif/extension-dicom-video": "3.10.0-beta.145",
"@ohif/extension-measurement-tracking": "3.10.0-beta.145"
},
"dependencies": {
"@babel/runtime": "^7.20.13",
+8 -1
View File
@@ -82,7 +82,8 @@ function modeFactory({ modeConfiguration }) {
* Lifecycle hooks
*/
onModeEnter: function ({ servicesManager, extensionManager, commandsManager }: withAppTypes) {
const { measurementService, toolbarService, toolGroupService } = servicesManager.services;
const { measurementService, toolbarService, toolGroupService, customizationService } =
servicesManager.services;
measurementService.clearMeasurements();
@@ -135,6 +136,12 @@ function modeFactory({ modeConfiguration }) {
'WindowLevelRegion',
]);
customizationService.setCustomizations({
'panelSegmentation.disableEditing': {
$set: true,
},
});
// // ActivatePanel event trigger for when a segmentation or measurement is added.
// // Do not force activation so as to respect the state the user may have left the UI in.
// _activatePanelTriggersSubscriptions = [
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @ohif/mode-microscopy
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @ohif/mode-microscopy
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/mode-microscopy
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/mode-microscopy
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/mode-microscopy
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-microscopy",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "OHIF mode for DICOM microscopy",
"author": "OHIF",
"license": "MIT",
@@ -35,8 +35,8 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-dicom-microscopy": "3.10.0-beta.141"
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-dicom-microscopy": "3.10.0-beta.145"
},
"dependencies": {
"@babel/runtime": "^7.20.13",
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @ohif/mode-preclinical-4d
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @ohif/mode-preclinical-4d
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/mode-preclinical-4d
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/mode-preclinical-4d
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/mode-preclinical-4d
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-preclinical-4d",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "4D Workflow",
"author": "OHIF",
"license": "MIT",
@@ -33,12 +33,12 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-cornerstone": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-seg": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dynamic-volume": "3.10.0-beta.141",
"@ohif/extension-default": "3.10.0-beta.141",
"@ohif/extension-tmtv": "3.10.0-beta.141"
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-cornerstone": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-seg": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dynamic-volume": "3.10.0-beta.145",
"@ohif/extension-default": "3.10.0-beta.145",
"@ohif/extension-tmtv": "3.10.0-beta.145"
},
"dependencies": {
"@babel/runtime": "^7.20.13"
+38
View File
@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
### Bug Fixes
* **seg:** Enhance segmentation tools and UI, refactor code, and update dependencies ([#4915](https://github.com/OHIF/Viewers/issues/4915)) ([8432d5f](https://github.com/OHIF/Viewers/commit/8432d5f6330b300ac6760b32372be382210ed05b))
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
### Features
* **segmentation:** Enhance Segmentation with New AI and Once Click Tools ([#4910](https://github.com/OHIF/Viewers/issues/4910)) ([c75a3f3](https://github.com/OHIF/Viewers/commit/c75a3f3af58c4cd29c349338e4065269d8d9f387))
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/mode-segmentation
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/mode-segmentation
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/mode-segmentation
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-segmentation",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "OHIF segmentation mode which enables labelmap segmentation read/edit/export",
"author": "@ohif",
"license": "MIT",
@@ -35,14 +35,14 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-cornerstone": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-rt": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-seg": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.141",
"@ohif/extension-default": "3.10.0-beta.141",
"@ohif/extension-dicom-pdf": "3.10.0-beta.141",
"@ohif/extension-dicom-video": "3.10.0-beta.141"
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-cornerstone": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-rt": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-seg": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.145",
"@ohif/extension-default": "3.10.0-beta.145",
"@ohif/extension-dicom-pdf": "3.10.0-beta.145",
"@ohif/extension-dicom-video": "3.10.0-beta.145"
},
"dependencies": {
"@babel/runtime": "^7.20.13",
+4 -1
View File
@@ -92,11 +92,14 @@ function modeFactory({ modeConfiguration }) {
'SegmentationTools',
]);
toolbarService.createButtonSection('segmentationToolboxUtilitySection', [
'LabelmapSlicePropagation',
'InterpolateLabelmap',
'SegmentBidirectional',
]);
toolbarService.createButtonSection('segmentationToolboxToolsSection', [
'BrushTools',
'MarkerLabelmap',
'RegionSegmentPlus',
'Shapes',
]);
toolbarService.createButtonSection('brushToolsSection', ['Brush', 'Eraser', 'Threshold']);
@@ -189,7 +192,7 @@ function modeFactory({ modeConfiguration }) {
/** HangingProtocol used by the mode */
// Commented out to just use the most applicable registered hanging protocol
// The example is used for a grid layout to specify that as a preferred layout
// hangingProtocol: ['@ohif/mnGrid'],
hangingProtocol: ['@ohif/mnGrid'],
/** SopClassHandlers used by the mode */
sopClassHandlers: [ohif.sopClassHandler, segmentation.sopClassHandler, dicomRT.sopClassHandler],
};
+9
View File
@@ -27,6 +27,15 @@ function createTools(utilityModule) {
activeStrategy: 'FILL_INSIDE_CIRCLE',
},
},
{
toolName: toolNames.LabelmapSlicePropagation,
},
{
toolName: toolNames.MarkerLabelmap,
},
{
toolName: toolNames.RegionSegmentPlus,
},
{
toolName: 'CircularEraser',
parentTool: 'Brush',
+98
View File
@@ -1,4 +1,5 @@
import type { Button } from '@ohif/core/types';
import { ViewportGridService } from '@ohif/core';
const setToolActiveToolbar = {
commandName: 'setToolActiveToolbar',
@@ -7,6 +8,15 @@ const setToolActiveToolbar = {
},
};
const callbacks = (toolName: string) => [
{
commandName: 'setViewportForToolConfiguration',
commandOptions: {
toolName,
},
},
];
const toolbarButtons: Button[] = [
// sections
{
@@ -322,6 +332,94 @@ const toolbarButtons: Button[] = [
commands: 'runSegmentBidirectional',
},
},
{
id: 'RegionSegmentPlus',
uiType: 'ohif.toolBoxButton',
props: {
icon: 'icon-tool-click-segment',
label: 'One Click Segment',
tooltip: 'One Click Segment',
evaluate: {
name: 'evaluate.cornerstone.segmentation',
toolNames: ['RegionSegmentPlus'],
disabledText: 'Create new segmentation to enable this tool.',
},
commands: 'setToolActiveToolbar',
},
},
{
id: 'LabelmapSlicePropagation',
uiType: 'ohif.toolBoxButton',
props: {
icon: 'icon-labelmap-slice-propagation',
label: 'Labelmap Assist',
tooltip: 'Labelmap Assist Based on Previous / Next Slice Data',
evaluate: [
'evaluate.cornerstoneTool.toggle',
{
name: 'evaluate.cornerstone.hasSegmentation',
},
],
listeners: {
[ViewportGridService.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED]: callbacks(
'LabelmapSlicePropagation'
),
[ViewportGridService.EVENTS.VIEWPORTS_READY]: callbacks('LabelmapSlicePropagation'),
},
commands: 'toggleEnabledDisabledToolbar',
},
},
{
id: 'MarkerLabelmap',
uiType: 'ohif.toolBoxButton',
props: {
icon: 'icon-marker-labelmap',
label: 'Marker Guided Labelmap',
tooltip:
'Use Positive and Negative Points to Guide Labelmap Creation, hit N to move to next slice',
evaluate: [
{
name: 'evaluate.cornerstone.segmentation',
toolNames: ['MarkerLabelmap', 'MarkerInclude', 'MarkerExclude'],
},
],
commands: 'setToolActiveToolbar',
listeners: {
[ViewportGridService.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED]: callbacks('MarkerLabelmap'),
[ViewportGridService.EVENTS.VIEWPORTS_READY]: callbacks('MarkerLabelmap'),
},
options: [
{
name: 'Clear Markers',
type: 'button',
id: 'clear-markers',
commands: 'clearMarkersForMarkerLabelmap',
},
{
name: 'Marker Mode',
type: 'radio',
id: 'marker-mode',
value: 'markerInclude',
values: [
{ value: 'markerInclude', label: 'Include' },
{ value: 'markerExclude', label: 'Exclude' },
],
commands: ({ commandsManager, options }) => {
const markerModeOption = options.find(option => option.id === 'marker-mode');
if (markerModeOption.value === 'markerInclude') {
commandsManager.run('setToolActive', {
toolName: 'MarkerInclude',
});
} else {
commandsManager.run('setToolActive', {
toolName: 'MarkerExclude',
});
}
},
},
],
},
},
{
id: 'Eraser',
uiType: 'ohif.toolBoxButton',
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @ohif/mode-tmtv
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @ohif/mode-tmtv
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/mode-tmtv
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/mode-tmtv
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/mode-tmtv
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-tmtv",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "Total Metabolic Tumor Volume Workflow",
"author": "OHIF",
"license": "MIT",
@@ -34,13 +34,13 @@
"test:unit:ci": "jest --ci --runInBand --collectCoverage --passWithNoTests"
},
"peerDependencies": {
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-cornerstone": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.141",
"@ohif/extension-default": "3.10.0-beta.141",
"@ohif/extension-dicom-pdf": "3.10.0-beta.141",
"@ohif/extension-dicom-video": "3.10.0-beta.141",
"@ohif/extension-measurement-tracking": "3.10.0-beta.141"
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-cornerstone": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.145",
"@ohif/extension-default": "3.10.0-beta.145",
"@ohif/extension-dicom-pdf": "3.10.0-beta.145",
"@ohif/extension-dicom-video": "3.10.0-beta.145",
"@ohif/extension-measurement-tracking": "3.10.0-beta.145"
},
"dependencies": {
"@babel/runtime": "^7.20.13",
+4
View File
@@ -100,6 +100,10 @@ module.exports = (env, argv) => {
ignore: ['**/config/**', '**/html-templates/**', '.DS_Store'],
},
},
{
from: '../../../node_modules/onnxruntime-web/dist',
to: `${DIST_DIR}/ort`,
},
// Short term solution to make sure GCloud config is available in output
// for our docker implementation
{
+38
View File
@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
### Bug Fixes
* **seg:** Enhance segmentation tools and UI, refactor code, and update dependencies ([#4915](https://github.com/OHIF/Viewers/issues/4915)) ([8432d5f](https://github.com/OHIF/Viewers/commit/8432d5f6330b300ac6760b32372be382210ed05b))
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
### Features
* **segmentation:** Enhance Segmentation with New AI and Once Click Tools ([#4910](https://github.com/OHIF/Viewers/issues/4910)) ([c75a3f3](https://github.com/OHIF/Viewers/commit/c75a3f3af58c4cd29c349338e4065269d8d9f387))
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/app
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/app
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
+19 -19
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/app",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"productVersion": "3.4.0",
"description": "OHIF Viewer",
"author": "OHIF Contributors",
@@ -54,25 +54,25 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.4",
"@cornerstonejs/codec-openjph": "^2.4.5",
"@cornerstonejs/dicom-image-loader": "^3.7.17",
"@cornerstonejs/dicom-image-loader": "^3.8.4",
"@emotion/serialize": "^1.1.3",
"@ohif/core": "3.10.0-beta.141",
"@ohif/extension-cornerstone": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-rt": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-seg": "3.10.0-beta.141",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.141",
"@ohif/extension-default": "3.10.0-beta.141",
"@ohif/extension-dicom-microscopy": "3.10.0-beta.141",
"@ohif/extension-dicom-pdf": "3.10.0-beta.141",
"@ohif/extension-dicom-video": "3.10.0-beta.141",
"@ohif/extension-test": "3.10.0-beta.141",
"@ohif/i18n": "3.10.0-beta.141",
"@ohif/mode-basic-dev-mode": "3.10.0-beta.141",
"@ohif/mode-longitudinal": "3.10.0-beta.141",
"@ohif/mode-microscopy": "3.10.0-beta.141",
"@ohif/mode-test": "3.10.0-beta.141",
"@ohif/ui": "3.10.0-beta.141",
"@ohif/ui-next": "3.10.0-beta.141",
"@ohif/core": "3.10.0-beta.145",
"@ohif/extension-cornerstone": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-rt": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-seg": "3.10.0-beta.145",
"@ohif/extension-cornerstone-dicom-sr": "3.10.0-beta.145",
"@ohif/extension-default": "3.10.0-beta.145",
"@ohif/extension-dicom-microscopy": "3.10.0-beta.145",
"@ohif/extension-dicom-pdf": "3.10.0-beta.145",
"@ohif/extension-dicom-video": "3.10.0-beta.145",
"@ohif/extension-test": "3.10.0-beta.145",
"@ohif/i18n": "3.10.0-beta.145",
"@ohif/mode-basic-dev-mode": "3.10.0-beta.145",
"@ohif/mode-longitudinal": "3.10.0-beta.145",
"@ohif/mode-microscopy": "3.10.0-beta.145",
"@ohif/mode-test": "3.10.0-beta.145",
"@ohif/ui": "3.10.0-beta.145",
"@ohif/ui-next": "3.10.0-beta.145",
"@svgr/webpack": "^8.1.0",
"@types/react": "^18.3.3",
"classnames": "^2.3.2",
+17 -3
View File
@@ -275,6 +275,20 @@ function ViewerViewportGrid(props: withAppTypes) {
// Store previous isReferenceViewable values to avoid infinite loops
const prevReferenceViewableMap = useRef(new Map());
// Track viewports that need isReferenceViewable updates
const viewportsToUpdate = useRef(new Map());
// Apply isReferenceViewable updates in an effect, not during render
useEffect(() => {
const updates = viewportsToUpdate.current;
if (updates.size > 0) {
updates.forEach((isReferenceViewable, viewportId) => {
viewportGridService.setIsReferenceViewable(viewportId, isReferenceViewable);
prevReferenceViewableMap.current.set(viewportId, isReferenceViewable);
});
viewportsToUpdate.current.clear();
}
});
const getViewportPanes = useCallback(() => {
const viewportPanes = [];
@@ -313,7 +327,7 @@ function ViewerViewportGrid(props: withAppTypes) {
uiNotificationService
);
// Only update isReferenceViewable if it's changed to avoid render loops
// Only queue isReferenceViewable updates if it's changed to avoid render loops
// We need to handle both function and non-function values
if (viewportId) {
const prevValue = prevReferenceViewableMap.current.get(viewportId);
@@ -323,8 +337,8 @@ function ViewerViewportGrid(props: withAppTypes) {
// For non-functions, compare directly. For functions, we treat them as always different
// (this is conservative but safe)
if (!isSameFunction && prevValue !== isReferenceViewable) {
viewportGridService.setIsReferenceViewable(viewportId, isReferenceViewable);
prevReferenceViewableMap.current.set(viewportId, isReferenceViewable);
// Queue the update instead of doing it during render
viewportsToUpdate.current.set(viewportId, isReferenceViewable);
}
}
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @ohif/cli
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @ohif/cli
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/cli
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/cli
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/cli
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/cli",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "A CLI to bootstrap new OHIF extension or mode",
"type": "module",
"main": "src/index.js",
+38
View File
@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
### Bug Fixes
* **seg:** Enhance segmentation tools and UI, refactor code, and update dependencies ([#4915](https://github.com/OHIF/Viewers/issues/4915)) ([8432d5f](https://github.com/OHIF/Viewers/commit/8432d5f6330b300ac6760b32372be382210ed05b))
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
### Features
* **segmentation:** Enhance Segmentation with New AI and Once Click Tools ([#4910](https://github.com/OHIF/Viewers/issues/4910)) ([c75a3f3](https://github.com/OHIF/Viewers/commit/c75a3f3af58c4cd29c349338e4065269d8d9f387))
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/core
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/core
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/core",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "Generic business logic for web-based medical imaging applications",
"author": "OHIF Core Team",
"license": "MIT",
@@ -37,8 +37,8 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.4",
"@cornerstonejs/codec-openjph": "^2.4.5",
"@cornerstonejs/dicom-image-loader": "^3.7.17",
"@ohif/ui": "3.10.0-beta.141",
"@cornerstonejs/dicom-image-loader": "^3.8.4",
"@ohif/ui": "3.10.0-beta.145",
"cornerstone-math": "0.1.9",
"dicom-parser": "^1.8.21"
},
+50 -13
View File
@@ -177,19 +177,56 @@ const bindings = [
label: 'Reject Preview',
keys: ['esc'],
},
// after we have the ui for undo/redo, we can add these back in
// {
// commandName: 'undo',
// label: 'Undo',
// keys: ['ctrl+z'],
// isEditable: true,
// },
// {
// commandName: 'redo',
// label: 'Redo',
// keys: ['ctrl+y'],
// isEditable: true,
// },
{
commandName: 'undo',
label: 'Undo',
keys: ['ctrl+z'],
isEditable: true,
},
{
commandName: 'redo',
label: 'Redo',
keys: ['ctrl+y'],
isEditable: true,
},
{
commandName: 'interpolateScrollForMarkerLabelmap',
label: 'Interpolate Scroll',
keys: ['n'],
isEditable: true,
},
{
commandName: 'increaseBrushSize',
label: 'Increase Brush Size',
keys: [']'],
isEditable: true,
},
{
commandName: 'decreaseBrushSize',
label: 'Decrease Brush Size',
keys: ['['],
isEditable: true,
},
{
commandName: 'setToolActive',
commandOptions: { toolName: 'CircularEraser' },
label: 'Eraser',
keys: ['e'],
isEditable: true,
},
{
commandName: 'setToolActive',
commandOptions: { toolName: 'CircularBrush' },
label: 'Brush',
keys: ['b'],
isEditable: true,
},
{
commandName: 'addNewSegment',
label: 'Add New Segment',
keys: ['a'],
isEditable: true,
},
];
export default bindings;
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package ohif-docs
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package ohif-docs
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package ohif-docs
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package ohif-docs
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package ohif-docs
+2 -1
View File
@@ -1,6 +1,6 @@
{
"name": "ohif-docs",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
@@ -48,6 +48,7 @@
"@radix-ui/react-checkbox": "^1.1.1",
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-hover-card": "^1.1.6",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.0.7",
@@ -9,6 +9,7 @@ import ShowcaseRow from './ShowcaseRow';
export default function NumericShowcase() {
const [controlledValue, setControlledValue] = useState(0);
const [controlledValues, setControlledValues] = useState([0, 100] as [number, number]);
const [dimensionGroupNumber, setDimensionGroupNumber] = useState(1);
return (
<div className="space-y-8">
@@ -87,6 +88,108 @@ export default function NumericShowcase() {
</div>
</ShowcaseRow>
{/* Stepper Controls */}
<ShowcaseRow
title="Numeric - Stepper Controls"
description="Number input with increment/decrement controls in horizontal or vertical layout"
code={`
// For controlled component
const [dimensionGroupNumber, setDimensionGroupNumber] = useState(1);
<Numeric.Container
mode="stepper"
value={dimensionGroupNumber}
onChange={val => setDimensionGroupNumber(val as number)}
min={1}
max={5}
step={1}
>
<div className="flex flex-col items-center">
<Numeric.NumberStepper className="w-[58px]" direction="horizontal"/>
<Numeric.Label className="mt-1">Frame</Numeric.Label>
</div>
</Numeric.Container>
<Numeric.Container
mode="stepper"
min={0}
max={100}
step={1}
defaultValue={50}
>
<div className="flex items-center space-x-2">
<Numeric.Label>Opacity</Numeric.Label>
<Numeric.NumberStepper className="w-[58px]" direction="horizontal"/>
</div>
</Numeric.Container>
<Numeric.Container
mode="stepper"
min={-10}
max={10}
step={0.1}
defaultValue={0}
>
<div className="flex items-center space-x-2">
<Numeric.Label>Zoom:</Numeric.Label>
<Numeric.NumberStepper className="w-[65px]" direction="vertical"/>
</div>
</Numeric.Container>`}
>
<div className="bg-popover flex w-[300px] flex-col space-y-4 rounded p-4">
<Numeric.Container
mode="stepper"
value={dimensionGroupNumber}
onChange={val => setDimensionGroupNumber(val as number)}
min={1}
max={5}
step={1}
>
<div className="flex flex-col items-center">
<Numeric.NumberStepper
className="flex w-[78px]"
direction="horizontal"
>
<span className="text-muted-foreground text-xs">FPS</span>
</Numeric.NumberStepper>
<Numeric.Label className="mt-1">Frame</Numeric.Label>
</div>
</Numeric.Container>
<Numeric.Container
mode="stepper"
min={0}
max={100}
step={1}
defaultValue={50}
>
<div className="flex items-center space-x-2">
<Numeric.Label>Opacity</Numeric.Label>
<Numeric.NumberStepper
className="w-[58px]"
direction="horizontal"
/>
</div>
</Numeric.Container>
<Numeric.Container
mode="stepper"
min={-10}
max={10}
step={0.1}
defaultValue={0}
>
<div className="flex items-center space-x-2">
<Numeric.NumberStepper
className="w-[65px]"
direction="vertical"
/>
<Numeric.Label>Zoom</Numeric.Label>
</div>
</Numeric.Container>
</div>
</ShowcaseRow>
{/* Single Range Slider */}
<ShowcaseRow
title="Numeric - Single Range"
@@ -268,6 +371,20 @@ const [controlledValues, setControlledValues] = useState<[number, number]>([0, 1
<Numeric.NumberInput />
</Numeric.Container>
<Numeric.Container
mode="stepper"
min={-5}
max={5}
step={0.5}
defaultValue={0}
>
<div className="flex items-center justify-between">
<Numeric.Label>Offset</Numeric.Label>
<Numeric.NumberStepper className="w-[58px]">
</Numeric.NumberStepper>
</div>
</Numeric.Container>
<Numeric.Container
mode="singleRange"
min={0}
@@ -302,6 +419,22 @@ const [controlledValues, setControlledValues] = useState<[number, number]>([0, 1
<Numeric.NumberInput />
</Numeric.Container>
<Numeric.Container
mode="stepper"
min={-5}
max={5}
step={0.5}
defaultValue={0}
>
<div className="flex items-center justify-between">
<Numeric.Label>Offset</Numeric.Label>
<Numeric.NumberStepper
className="w-[58px]"
direction="horizontal"
/>
</div>
</Numeric.Container>
<Numeric.Container
mode="singleRange"
min={0}
+71
View File
@@ -2527,6 +2527,13 @@
dependencies:
"@radix-ui/react-primitive" "2.0.1"
"@radix-ui/react-arrow@1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@radix-ui/react-arrow/-/react-arrow-1.1.2.tgz#30c0d574d7bb10eed55cd7007b92d38b03c6b2ab"
integrity sha512-G+KcpzXHq24iH0uGG/pF8LyzpFJYGD4RfLjCIBfGdSLXvjLHST31RUiRVrupIBMvIppMgSzQ6l66iAxl03tdlg==
dependencies:
"@radix-ui/react-primitive" "2.0.2"
"@radix-ui/react-checkbox@^1.1.1":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@radix-ui/react-checkbox/-/react-checkbox-1.1.3.tgz#0e2ab913fddf3c88603625f7a9457d73882c8a32"
@@ -2611,6 +2618,17 @@
"@radix-ui/react-use-callback-ref" "1.1.0"
"@radix-ui/react-use-escape-keydown" "1.1.0"
"@radix-ui/react-dismissable-layer@1.1.5":
version "1.1.5"
resolved "https://registry.yarnpkg.com/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.5.tgz#96dde2be078c694a621e55e047406c58cd5fe774"
integrity sha512-E4TywXY6UsXNRhFrECa5HAvE5/4BFcGyfTyK36gP+pAW1ed7UTK4vKwdr53gAJYwqbfCWC6ATvJa3J3R/9+Qrg==
dependencies:
"@radix-ui/primitive" "1.1.1"
"@radix-ui/react-compose-refs" "1.1.1"
"@radix-ui/react-primitive" "2.0.2"
"@radix-ui/react-use-callback-ref" "1.1.0"
"@radix-ui/react-use-escape-keydown" "1.1.0"
"@radix-ui/react-dropdown-menu@^2.1.1":
version "2.1.4"
resolved "https://registry.yarnpkg.com/@radix-ui/react-dropdown-menu/-/react-dropdown-menu-2.1.4.tgz#5e1f453296dd9ae99224a26c36851832d26cf507"
@@ -2638,6 +2656,21 @@
"@radix-ui/react-primitive" "2.0.1"
"@radix-ui/react-use-callback-ref" "1.1.0"
"@radix-ui/react-hover-card@^1.1.6":
version "1.1.6"
resolved "https://registry.yarnpkg.com/@radix-ui/react-hover-card/-/react-hover-card-1.1.6.tgz#94fb87c047e1bb3bfd70439cf7ee48165ea4efa5"
integrity sha512-E4ozl35jq0VRlrdc4dhHrNSV0JqBb4Jy73WAhBEK7JoYnQ83ED5r0Rb/XdVKw89ReAJN38N492BAPBZQ57VmqQ==
dependencies:
"@radix-ui/primitive" "1.1.1"
"@radix-ui/react-compose-refs" "1.1.1"
"@radix-ui/react-context" "1.1.1"
"@radix-ui/react-dismissable-layer" "1.1.5"
"@radix-ui/react-popper" "1.2.2"
"@radix-ui/react-portal" "1.1.4"
"@radix-ui/react-presence" "1.1.2"
"@radix-ui/react-primitive" "2.0.2"
"@radix-ui/react-use-controllable-state" "1.1.0"
"@radix-ui/react-icons@^1.3.0":
version "1.3.2"
resolved "https://registry.yarnpkg.com/@radix-ui/react-icons/-/react-icons-1.3.2.tgz#09be63d178262181aeca5fb7f7bc944b10a7f441"
@@ -2718,6 +2751,22 @@
"@radix-ui/react-use-size" "1.1.0"
"@radix-ui/rect" "1.1.0"
"@radix-ui/react-popper@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@radix-ui/react-popper/-/react-popper-1.2.2.tgz#d2e1ee5a9b24419c5936a1b7f6f472b7b412b029"
integrity sha512-Rvqc3nOpwseCyj/rgjlJDYAgyfw7OC1tTkKn2ivhaMGcYt8FSBlahHOZak2i3QwkRXUXgGgzeEe2RuqeEHuHgA==
dependencies:
"@floating-ui/react-dom" "^2.0.0"
"@radix-ui/react-arrow" "1.1.2"
"@radix-ui/react-compose-refs" "1.1.1"
"@radix-ui/react-context" "1.1.1"
"@radix-ui/react-primitive" "2.0.2"
"@radix-ui/react-use-callback-ref" "1.1.0"
"@radix-ui/react-use-layout-effect" "1.1.0"
"@radix-ui/react-use-rect" "1.1.0"
"@radix-ui/react-use-size" "1.1.0"
"@radix-ui/rect" "1.1.0"
"@radix-ui/react-portal@1.1.3":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@radix-ui/react-portal/-/react-portal-1.1.3.tgz#b0ea5141103a1671b715481b13440763d2ac4440"
@@ -2726,6 +2775,14 @@
"@radix-ui/react-primitive" "2.0.1"
"@radix-ui/react-use-layout-effect" "1.1.0"
"@radix-ui/react-portal@1.1.4":
version "1.1.4"
resolved "https://registry.yarnpkg.com/@radix-ui/react-portal/-/react-portal-1.1.4.tgz#ff5401ff63c8a825c46eea96d3aef66074b8c0c8"
integrity sha512-sn2O9k1rPFYVyKd5LAJfo96JlSGVFpa1fS6UuBJfrZadudiw5tAmru+n1x7aMRQ84qDM71Zh1+SzK5QwU0tJfA==
dependencies:
"@radix-ui/react-primitive" "2.0.2"
"@radix-ui/react-use-layout-effect" "1.1.0"
"@radix-ui/react-presence@1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@radix-ui/react-presence/-/react-presence-1.1.2.tgz#bb764ed8a9118b7ec4512da5ece306ded8703cdc"
@@ -2741,6 +2798,13 @@
dependencies:
"@radix-ui/react-slot" "1.1.1"
"@radix-ui/react-primitive@2.0.2":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@radix-ui/react-primitive/-/react-primitive-2.0.2.tgz#ac8b7854d87b0d7af388d058268d9a7eb64ca8ef"
integrity sha512-Ec/0d38EIuvDF+GZjcMU/Ze6MxntVJYO/fRlCPhCaVUyPY9WTalHJw54tp9sXeJo3tlShWpy41vQRgLRGOuz+w==
dependencies:
"@radix-ui/react-slot" "1.1.2"
"@radix-ui/react-roving-focus@1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@radix-ui/react-roving-focus/-/react-roving-focus-1.1.1.tgz#3b3abb1e03646937f28d9ab25e96343667ca6520"
@@ -2829,6 +2893,13 @@
dependencies:
"@radix-ui/react-compose-refs" "1.1.1"
"@radix-ui/react-slot@1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@radix-ui/react-slot/-/react-slot-1.1.2.tgz#daffff7b2bfe99ade63b5168407680b93c00e1c6"
integrity sha512-YAKxaiGsSQJ38VzKH86/BPRC4rh+b1Jpa+JneA5LRE7skmLPNAyeG8kPJj/oo4STLvlrs8vkf/iYyc3A5stYCQ==
dependencies:
"@radix-ui/react-compose-refs" "1.1.1"
"@radix-ui/react-switch@^1.1.0":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@radix-ui/react-switch/-/react-switch-1.1.2.tgz#61323f4cccf25bf56c95fceb3b56ce1407bc9aec"
+32
View File
@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
**Note:** Version bump only for package @ohif/i18n
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
**Note:** Version bump only for package @ohif/i18n
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/i18n
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/i18n
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
**Note:** Version bump only for package @ohif/i18n
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/i18n",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "Internationalization library for The OHIF Viewer",
"author": "OHIF",
"license": "MIT",
+38
View File
@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.10.0-beta.145](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.144...v3.10.0-beta.145) (2025-04-02)
### Bug Fixes
* **seg:** Enhance segmentation tools and UI, refactor code, and update dependencies ([#4915](https://github.com/OHIF/Viewers/issues/4915)) ([8432d5f](https://github.com/OHIF/Viewers/commit/8432d5f6330b300ac6760b32372be382210ed05b))
# [3.10.0-beta.144](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.143...v3.10.0-beta.144) (2025-04-01)
### Features
* **segmentation:** Enhance Segmentation with New AI and Once Click Tools ([#4910](https://github.com/OHIF/Viewers/issues/4910)) ([c75a3f3](https://github.com/OHIF/Viewers/commit/c75a3f3af58c4cd29c349338e4065269d8d9f387))
# [3.10.0-beta.143](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.142...v3.10.0-beta.143) (2025-04-01)
**Note:** Version bump only for package @ohif/ui-next
# [3.10.0-beta.142](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.141...v3.10.0-beta.142) (2025-03-31)
**Note:** Version bump only for package @ohif/ui-next
# [3.10.0-beta.141](https://github.com/OHIF/Viewers/compare/v3.10.0-beta.140...v3.10.0-beta.141) (2025-03-28)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/ui-next",
"version": "3.10.0-beta.141",
"version": "3.10.0-beta.145",
"description": "Next version of OHIF Viewers UI, more customizable using shadcn/ui",
"main": "dist/ohif-ui-next.umd.js",
"module": "src/index.ts",
@@ -2,18 +2,111 @@ import React, { useState, useEffect } from 'react';
import { ErrorBoundary as ReactErrorBoundary } from 'react-error-boundary';
import { useTranslation } from 'react-i18next';
import { toast } from 'sonner';
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogDescription,
} from '../Dialog/Dialog';
import { Dialog, DialogContent } from '../Dialog/Dialog';
import { ScrollArea } from '../ScrollArea/ScrollArea';
import { Icons } from '../Icons';
import { Button } from '../Button/Button';
const isProduction = process.env.NODE_ENV === 'production';
/**
* Parses an error stack trace to extract important information
* Extracts the first function name from the stack trace
*/
const parseErrorStack = (error: ErrorBoundaryError) => {
if (!error.stack) {
return { filePath: null, errorTitle: null, code: null, firstFilename: null };
}
const stack = error.stack;
const stackLines = stack.split('\n');
// Extract error message from first line
const errorMessage = stackLines[0].trim();
// Extract first function name from the stack trace
let firstFilename = null;
// Find the first stack line (starts with " at ")
for (let i = 1; i < stackLines.length; i++) {
const line = stackLines[i].trim();
if (line.startsWith('at ')) {
// Extract function name pattern
const match = line.match(/at\s+([^\s(]+)[\s(]/);
if (match && match[1]) {
firstFilename = match[1];
break;
}
}
}
// Sanitize stack trace for display - safer approach to avoid ReDoS
const sanitizedStack = stackLines
.map(line => {
// Limit line length to prevent excessive processing
const limitedLine = line.substring(0, 2000);
// Process each part separately to avoid complex regex patterns
if (limitedLine.includes('(')) {
// Extract filename from paths in parentheses
const openParenIndex = limitedLine.indexOf('(');
const closeParenIndex = limitedLine.indexOf(')', openParenIndex);
if (openParenIndex >= 0 && closeParenIndex > openParenIndex) {
const pathInParens = limitedLine.substring(openParenIndex + 1, closeParenIndex);
// Find the last segment after slash or backslash
const lastSlashIndex = Math.max(
pathInParens.lastIndexOf('/'),
pathInParens.lastIndexOf('\\')
);
if (lastSlashIndex >= 0) {
const filename = pathInParens.substring(lastSlashIndex + 1);
return (
limitedLine.substring(0, openParenIndex + 1) +
filename +
limitedLine.substring(closeParenIndex)
);
}
}
}
// Handle the "at Function path:line:column" format
if (limitedLine.includes(' at ')) {
const atIndex = limitedLine.indexOf(' at ');
const afterAt = limitedLine.substring(atIndex + 4).trim();
// Split by whitespace to separate function and path
const spaceAfterFunc = afterAt.indexOf(' ');
if (spaceAfterFunc > 0) {
const funcName = afterAt.substring(0, spaceAfterFunc);
const path = afterAt.substring(spaceAfterFunc + 1);
// Check if this is a path with line/column numbers
if (path.includes(':') && /.*:[0-9]+:[0-9]+/.test(path)) {
// Find the last segment after slash or backslash
const lastSlashIndex = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\'));
if (lastSlashIndex >= 0) {
const filename = path.substring(lastSlashIndex + 1);
return limitedLine.substring(0, atIndex + 4) + funcName + ' ' + filename;
}
}
}
}
return limitedLine;
})
.join('\n');
return {
errorTitle: errorMessage,
code: sanitizedStack,
firstFilename: firstFilename,
};
};
interface ErrorBoundaryError extends Error {
message: string;
stack?: string;
@@ -45,14 +138,13 @@ const DefaultFallback = ({
const title = `${t('Something went wrong')}${!isProduction && ` ${t('in')} ${context}`}.`;
const subtitle = t('Sorry, something went wrong there. Try again.');
const copyErrorDetails = () => {
const errorDetails = `
Context: ${context}
Error Message: ${error.message}
Stack: ${error.stack}
`;
navigator.clipboard.writeText(errorDetails);
toast.success(t('Copied to clipboard'));
const { errorTitle, code, firstFilename } = parseErrorStack(error);
const copyErrorToClipboard = () => {
if (code) {
navigator.clipboard.writeText(code);
toast.success(t('Error copied to clipboard'));
}
};
useEffect(() => {
@@ -64,55 +156,76 @@ Stack: ${error.stack}
},
duration: 0,
});
}, [error]);
}, [error, subtitle, t, title]);
if (isProduction) {
return null;
}
return (
<>
<Dialog
open={showDetails}
onOpenChange={setShowDetails}
<Dialog
open={showDetails}
onOpenChange={setShowDetails}
>
<DialogContent
className="bg-muted max-w-3xl overflow-hidden border-0 p-0"
onInteractOutside={e => e.preventDefault()}
>
<DialogContent className="border-input h-[50vh] w-[90vw] border-2 sm:max-w-[900px]">
<DialogHeader>
<DialogTitle className="text-muted-foreground flex justify-between text-xl">
<div className="flex items-center">{title}</div>
<button
onClick={() => {
copyErrorDetails();
setShowDetails(false);
}}
className="text-aqua-pale hover:text-aqua-pale/80 flex items-center gap-2 rounded bg-gray-800 px-4 py-2 font-light"
>
<Icons.Code className="h-4 w-4" />
{t('Copy Details')}
</button>
</DialogTitle>
<div className="p-5 pb-4">
<div className="flex items-center justify-between">
<h2 className="text-highlight text-xl font-normal">
{errorTitle || error.message || title}
</h2>
</div>
</div>
<DialogDescription className="text-lg">{subtitle}</DialogDescription>
</DialogHeader>
<ScrollArea className="h-[100%]">
<div className="space-y-4 pr-4 font-mono text-base">
<div className="space-y-4">
<p className="text-aqua-pale break-words text-lg">
{t('Context')}: {context}
</p>
<p className="text-aqua-pale break-words text-lg">
{t('Error Message')}: {error.message}
</p>
<pre className="text-aqua-pale whitespace-pre-wrap break-words rounded bg-gray-900 p-4">
Stack: {error.stack}
</pre>
{/* Code block */}
{code && (
<>
<ScrollArea className="bg-background text-foreground mx-6 h-[321px] rounded-b-md">
<div className="bg-background border-input flex items-center justify-between rounded-t-md border-b px-4 py-2">
<div className="text-muted-foreground text-base">
{firstFilename || 'Error Stack'}
</div>
<Button
className="w-20"
onClick={copyErrorToClipboard}
title={t('Copy error')}
>
Copy
</Button>
</div>
</div>
</ScrollArea>
</DialogContent>
</Dialog>
</>
<div className="p-4 font-mono text-sm">
{code.split('\n').map((line, index) => (
<div
key={index}
className="flex"
>
<span className="whitespace-pre">{line}</span>
</div>
))}
</div>
</ScrollArea>
</>
)}
{/* Footer */}
<div className="flex items-center justify-end p-6 pt-2">
<Button
variant="link"
className="text-primary p-0"
onClick={() =>
window.open(
'https://github.com/OHIF/Viewers/issues/new?template=bug-report.yml',
'_blank'
)
}
>
Report Issue
</Button>
</div>
</DialogContent>
</Dialog>
);
};
@@ -164,9 +277,9 @@ const ErrorBoundary = ({
};
}, []);
const onErrorHandler = (error: ErrorBoundaryError, componentStack: string) => {
const onErrorHandler = (error: ErrorBoundaryError, componentStack: string | null) => {
console.debug(`${context} Error Boundary`, error, componentStack, context);
onError(error, componentStack, context);
onError(error, componentStack || '', context);
};
return (
@@ -179,7 +292,7 @@ const ErrorBoundary = ({
/>
)}
onReset={onResetHandler}
onError={onErrorHandler}
onError={(error, info) => onErrorHandler(error as ErrorBoundaryError, info.componentStack)}
>
<>
{children}
@@ -132,6 +132,7 @@ import {
ToolSegmentAnything,
ToolContract,
ToolExpand,
ToolClickSegment,
} from './Sources/Tools';
import ActionNewDialog from './Sources/ActionNewDialog';
import NotificationInfo from './Sources/NotificationInfo';
@@ -597,9 +598,10 @@ export const Icons = {
'checkbox-active': (props: IconProps) => CheckBoxChecked(props),
'icon-tool-eraser': (props: IconProps) => ToolEraser(props),
'icon-tool-brush': (props: IconProps) => ToolBrush(props),
'icon-tool-labelmap-assist': (props: IconProps) => ToolLabelmapAssist(props),
'icon-tool-segment-anything': (props: IconProps) => ToolSegmentAnything(props),
'icon-labelmap-slice-propagation': (props: IconProps) => ToolLabelmapAssist(props),
'icon-marker-labelmap': (props: IconProps) => ToolSegmentAnything(props),
'icon-tool-threshold': (props: IconProps) => ToolThreshold(props),
'icon-tool-click-segment': (props: IconProps) => ToolClickSegment(props),
'icon-tool-pet-segment': (props: IconProps) => ToolPETSegment(props),
'icon-tool-interpolation': (props: IconProps) => ToolInterpolation(props),
'icon-tool-bidirectional-segment': (props: IconProps) => ToolBidirectionalSegment(props),
@@ -97,6 +97,27 @@ export const ToolLayout = (props: IconProps) => (
</svg>
);
export const ToolClickSegment = (props: IconProps) => (
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
{...props}
>
<path
d="M18.7855 10.7063C19.0677 8.68223 18.754 6.39013 17.3334 4.86666C15.7881 3.20953 13.3171 2.78346 11.098 3.09398C9.51269 3.31581 7.93737 4.03721 6.63198 5.25454C5.24718 6.54592 4.39791 8.17926 4.11016 9.84527C3.74697 11.9481 4.27832 14.1031 5.75643 15.6882C7.30168 17.3453 9.54033 18.0136 11.7594 17.7031"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
/>
<path
d="M15.0003 18.562L15.0714 12.3038C15.0714 12.1629 15.1293 12.0689 15.2452 12.0219C15.3663 11.9749 15.4769 12.0036 15.577 12.108L19.8981 16.502C20.0034 16.6169 20.0271 16.7318 19.9692 16.8467C19.9165 16.9615 19.8164 17.0216 19.669 17.0268L17.9627 17.0973L19.353 20.2929C19.3899 20.366 19.3951 20.4391 19.3688 20.5123C19.3477 20.5854 19.303 20.6376 19.2345 20.6689L18.4445 20.9822C18.3708 21.0083 18.2997 21.0057 18.2312 20.9744C18.1628 20.943 18.1128 20.8908 18.0812 20.8177L16.754 17.5673L15.5533 18.7656C15.4532 18.8648 15.3347 18.8935 15.1978 18.8518C15.0609 18.81 14.995 18.7134 15.0003 18.562Z"
fill="currentColor"
/>
</svg>
);
export const ToolLength = (props: IconProps) => (
<svg
width="28px"
Loaded 100 of 123 files, more files were not shown because too many files have changed in this diff. Show more