Compare commits

..
Author SHA1 Message Date
ohif-bot b996070583 chore(version): Update package versions to 3.13.0-beta.115 [skip ci] 2026-07-08 18:15:05 +00:00
Bill Wallace 1b6fa2194e Revert "feat: Add extensibility for tmtv and segmentation modes"
This reverts commit 84c7d17b13.
2026-07-08 14:11:24 -04:00
Bill Wallace 84c7d17b13 feat: Add extensibility for tmtv and segmentation modes 2026-07-08 14:08:59 -04:00
ohif-bot 76687cf496 chore(version): Update package versions to 3.13.0-beta.114 [skip ci] 2026-07-07 19:33:37 +00:00
Bill WallaceandClaude Opus 4.8 3dd5c70cb2 feat: Add customization URL parameter (#5992)
* Add customization URL parameter

* fix: Preserve should be customizeable

* Update customizations docs

* fix: Overlay items on patient name

* Add customization test

* Fix resolve to absolute path

* fix: Warn on no data in load

* Remove unused customization stuff

* fix: PR comments

* Update stored parameters to only use an array for mulitples

* Remove requires ohif.* special call out

* Remove strict mode

* PR comments

* Document segmentation examples

* Add three examples as requested

* PR comments

* lock

* Remove old customizatoin export

* fix: Ordering issues on customization loads

* fix: Use correct default for dev builds app config

* Fixes for conflicts

* chore: restore pnpm-lock.yaml to match master

The lockfile diff was incidental peer-descriptor churn and carried no
functional dependency change. It tripped the CircleCI security-audit gate
(which only runs when pnpm-lock.yaml is in the PR diff), surfacing a
pre-existing critical `decompress` transitive vuln that also exists on
master. Restoring master's lockfile removes the audit trigger.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(ci): restore json5 lockfile entry; ignore unfixable decompress GHSA

The previous commit restored pnpm-lock.yaml from master, which dropped the
json5@2.2.3 entry that platform/core legitimately depends on (JSONC parsing
for the customization feature). That broke `--frozen-lockfile` install
(ERR_PNPM_OUTDATED_LOCKFILE). This restores the correct lockfile.

Because the lockfile must change (json5), the CircleCI security-audit gate
runs and previously failed on a critical `decompress` <=4.2.1 zip-slip
advisory. This is a pre-existing transitive vuln (present on master too) with
no published patch — decompress's latest release is 4.2.1, so no version
bump/override can resolve it. It reaches the tree only via @itk-wasm/dam, a
build/data-asset extraction tool under @cornerstonejs/labelmap-interpolation.

Add GHSA-mp2f-45pm-3cg9 to the existing pnpm-workspace.yaml auditConfig
ignoreGhsas accepted-risk list, matching how the repo already exempts other
build-tooling advisories. `pnpm audit --audit-level high` now passes locally
(1 critical ignored, 0 high).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test(e2e): fix visitStudy URL encoding that broke mpr2 study load

The visitStudy rewrite (added for the ?customization= option) built the URL
with new URLSearchParams({ StudyInstanceUIDs: studyInstanceUID }), which
percent-encodes the value. mpr2.spec.ts embeds an extra param in the UID
string ('<uid>&hangingprotocolid=mpr'), so the & and = were encoded and the
whole thing collapsed into one invalid StudyInstanceUIDs value -> the study
could not be found ('studies are not available'), the viewer never rendered,
and the side-panel-header-right click timed out.

Restore master's raw concatenation for StudyInstanceUIDs (so embedded params
survive as separate query params) while still appending the customization
option separately. Only mpr2 embeds & in the UID, matching the single failure.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* PR comments

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 15:30:27 -04:00
ohif-bot 3d9a17bc0c chore(version): Update package versions to 3.13.0-beta.113 [skip ci] 2026-07-07 18:01:19 +00:00
Joe Boccanfuso 333d73e334 fix(security): ignore decompress security vulnerability (#6125) 2026-07-07 13:58:15 -04:00
ohif-bot e381d22200 chore(version): Update package versions to 3.13.0-beta.112 [skip ci] 2026-07-07 17:21:45 +00:00
Alireza f8546ce0e0 fix: recipe config cleanup, report-only CSP, logout redirect validation (#6124) 2026-07-07 13:18:46 -04:00
ohif-bot 973631b7e8 chore(version): Update package versions to 3.13.0-beta.111 [skip ci] 2026-07-06 13:38:47 +00:00
Alireza e0f42d4f1d fix(dicom-pdf): enhance PDF loading with authentication support
- move authenticated rendered media loading into the datasource\n- route DICOM video display sets through Cornerstone video viewports\n- add a 3.12 to 3.13 migration note for the removed DICOM-video viewport namespace
2026-07-06 09:35:26 -04:00
ohif-bot 2800f82e3c chore(version): Update package versions to 3.13.0-beta.110 [skip ci] 2026-07-02 13:00:56 +00:00
Joe Boccanfuso 38214f26de fix(wsi): mount WSI/SM viewports via setDisplaySets (#6107) 2026-07-02 08:57:13 -04:00
ohif-bot cb6cdafd24 chore(version): Update package versions to 3.13.0-beta.109 [skip ci] 2026-06-30 13:28:46 +00:00
Alireza aa1ba771e0 fix(test): stabilize DICOM Tag Browser scrollbar screenshot (#6118) 2026-06-30 09:25:37 -04:00
ohif-bot d4153f12b2 chore(version): Update package versions to 3.13.0-beta.108 [skip ci] 2026-06-29 16:58:29 +00:00
Alireza 71c50db9b5 fix(ci): deploy docs with Netlify CLI monorepo filter (#6115) 2026-06-29 12:55:01 -04:00
ohif-bot 4cdcd34a33 chore(version): Update package versions to 3.13.0-beta.107 [skip ci] 2026-06-29 16:42:34 +00:00
Dan Rukas 0dfd321326 feat(ui-next): Adds appearance dialog with theme presets and custom theme support (#6041) 2026-06-29 12:38:46 -04:00
ohif-bot 0fcebe05c6 chore(version): Update package versions to 3.13.0-beta.106 [skip ci] 2026-06-29 16:36:28 +00:00
Dan Rukas ac45a9497f docs(site): add ui-next component documentation and upgrade Docusaurus (#6102) 2026-06-29 12:33:16 -04:00
Dan Rukas 03b180f185 fix(colors): Replace hardcoded colors with theme tokens (#6040) 2026-06-29 12:32:40 -04:00
ohif-bot e1bc625ab8 chore(version): Update package versions to 3.13.0-beta.105 [skip ci] 2026-06-26 12:23:19 +00:00
Joe Boccanfuso 661ecb5b2e fix(hotkeyBindings): consolidate Escape hotkey behavior for contour drawing tools (#6104)
* fix(hotkeyBindings): consolidate Escape hotkey behavior for contour drawing tools

* PR feedback.

* PR feedback.
2026-06-26 08:20:22 -04:00
ohif-bot b7c8b865dd chore(version): Update package versions to 3.13.0-beta.104 [skip ci] 2026-06-24 19:21:51 +00:00
ee165b4d8e Fix: Segmentation Hide All fails when switching from 2D to 3D fourUp (#5995)
* Fix: Segmentation "Hide All" fails when switching from 2D to 3D four-up viewport

* Update based on the review comment on segmentation load in 3d fourup

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* fix: simplify the conditional logic

* fix: playwright test

* fix: playwright test

* fix: render timeout in test

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Belbin-GK <150322972+Belbin-GK@users.noreply.github.com>
Co-authored-by: Devu Jayalekshmi <devu.jayalekshmi@trenser.com>
Co-authored-by: Bill Wallace <wayfarer3130@gmail.com>
2026-06-24 15:18:16 -04:00
320 changed files with 16113 additions and 7591 deletions

No files matched your search

+3 -2
View File
@@ -117,8 +117,9 @@ jobs:
# would otherwise pick up the repo-root netlify.toml (configured for the
# main viewer app) and build the wrong project. --dir is resolved
# relative to the repo root (the netlify.toml base), not the cwd, so it
# must be the full path to the prebuilt docs output.
run: npx netlify-cli deploy --dir=platform/docs/build --prod --no-build
# must be the full path to the prebuilt docs output. --filter selects
# the ohif-docs package so Netlify CLI does not abort on monorepo detection.
run: npx netlify-cli deploy --filter ohif-docs --dir=platform/docs/build --prod --no-build
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
+1
View File
@@ -23,6 +23,7 @@ concurrency:
jobs:
playwright-tests:
timeout-minutes: 120
environment: fork-pr-approval
runs-on: [self-hosted, nashua]
strategy:
fail-fast: false
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dicom-pmap",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "DICOM Parametric Map read workflow",
"author": "OHIF",
"license": "MIT",
@@ -41,8 +41,8 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/adapters": "5.0.2",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/adapters": "5.1.3",
"@cornerstonejs/core": "5.1.3",
"@kitware/vtk.js": "35.5.3"
},
"devDependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dicom-rt",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "DICOM RT read workflow",
"author": "OHIF",
"license": "MIT",
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dicom-seg",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "DICOM SEG read workflow",
"author": "OHIF",
"license": "MIT",
@@ -41,8 +41,8 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/adapters": "5.0.2",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/adapters": "5.1.3",
"@cornerstonejs/core": "5.1.3",
"@kitware/vtk.js": "35.5.3"
},
"devDependencies": {
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dicom-sr",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "OHIF extension for an SR Cornerstone Viewport",
"author": "OHIF",
"license": "MIT",
@@ -40,9 +40,9 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/adapters": "5.0.2",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/tools": "5.0.2",
"@cornerstonejs/adapters": "5.1.3",
"@cornerstonejs/core": "5.1.3",
"@cornerstonejs/tools": "5.1.3",
"classnames": "2.5.1"
},
"devDependencies": {
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dynamic-volume",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "OHIF extension for 4D volumes data",
"author": "OHIF",
"license": "MIT",
@@ -45,8 +45,8 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/tools": "5.0.2",
"@cornerstonejs/core": "5.1.3",
"@cornerstonejs/tools": "5.1.3",
"classnames": "2.5.1"
},
"devDependencies": {
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "OHIF extension for Cornerstone",
"author": "OHIF",
"license": "MIT",
@@ -38,7 +38,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "1.2.2",
"@cornerstonejs/codec-openjpeg": "1.3.0",
"@cornerstonejs/codec-openjph": "2.4.7",
"@cornerstonejs/dicom-image-loader": "5.0.2",
"@cornerstonejs/dicom-image-loader": "5.1.3",
"@ohif/core": "workspace:*",
"@ohif/extension-default": "workspace:*",
"@ohif/ui": "workspace:*",
@@ -52,13 +52,13 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/adapters": "5.0.2",
"@cornerstonejs/ai": "5.0.2",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/labelmap-interpolation": "5.0.2",
"@cornerstonejs/metadata": "5.0.2",
"@cornerstonejs/polymorphic-segmentation": "5.0.2",
"@cornerstonejs/tools": "5.0.2",
"@cornerstonejs/adapters": "5.1.3",
"@cornerstonejs/ai": "5.1.3",
"@cornerstonejs/core": "5.1.3",
"@cornerstonejs/labelmap-interpolation": "5.1.3",
"@cornerstonejs/metadata": "5.1.3",
"@cornerstonejs/polymorphic-segmentation": "5.1.3",
"@cornerstonejs/tools": "5.1.3",
"@icr/polyseg-wasm": "0.4.0",
"@itk-wasm/morphological-contour-interpolation": "1.1.0",
"@kitware/vtk.js": "35.5.3",
@@ -14,7 +14,7 @@ import './CustomizableViewportOverlay.css';
import { useViewportRendering } from '../../hooks';
const EPSILON = 1e-4;
const { formatPN } = utils;
const { formatPN, formatValue } = utils;
type ViewportData = StackViewportData | VolumeViewportData;
@@ -184,7 +184,12 @@ function CustomizableViewportOverlay({
} else {
const renderItem = customizationService.transform(item);
if (typeof renderItem.contentF === 'function') {
if (
renderItem &&
typeof renderItem === 'object' &&
'contentF' in renderItem &&
typeof renderItem.contentF === 'function'
) {
return renderItem.contentF(overlayItemProps);
}
}
@@ -357,7 +362,8 @@ function OverlayItem(props) {
const { instance, customization = {} } = props;
const { color, attribute, title, label, background } = customization;
const value = customization.contentF?.(props, customization) ?? instance?.[attribute];
if (value === undefined || value === null) {
const displayValue = formatValue(value);
if (displayValue === null || displayValue === '') {
return null;
}
return (
@@ -367,7 +373,7 @@ function OverlayItem(props) {
title={title}
>
{label ? <span className="mr-1 shrink-0">{label}</span> : null}
<span className="ml-0 shrink-0">{value}</span>
<span className="ml-0 shrink-0">{displayValue}</span>
</div>
);
}
@@ -11,6 +11,7 @@ import {
annotation,
Types as ToolTypes,
SplineContourSegmentationTool,
cancelActiveManipulations,
} from '@cornerstonejs/tools';
import {
SegmentInfo,
@@ -306,6 +307,20 @@ function commandsModule({
commandsManager.run('setDisplaySetsForViewports', { viewportsToUpdate: updatedViewports });
},
/**
* Cancels any in-progress annotation manipulation (e.g. drawing a Spline,
* Livewire or PlanarFreehand contour) on the active viewport. Reached on
* Escape via the `cancelActiveOperation` command. `cancelActiveManipulations`
* invokes the `cancel` method of each active/passive tool that has an
* in-progress annotation, so it is a no-op when nothing is being drawn.
*/
cancelMeasurement: () => {
const element = _getActiveViewportEnabledElement()?.viewport?.element;
if (element) {
cancelActiveManipulations(element);
}
},
hydrateSecondaryDisplaySet: async ({ displaySet, viewportId }) => {
if (!displaySet) {
return;
@@ -2028,6 +2043,24 @@ function commandsModule({
rejectPreview: () => {
actions._handlePreviewAction('reject');
},
/**
* Generic Escape handler. A single Escape press should discard whatever the
* user has in progress, but that can be one of two unrelated things: a
* provisional segmentation preview, or an annotation being drawn. Rather
* than bind both `rejectPreview` and `cancelMeasurement` to `esc` (Mousetrap
* keeps only one handler per key, so the second silently shadows the first),
* this command orchestrates both single-purpose commands. Each is a no-op
* when its state is not active, so running both is safe and order-independent.
*/
cancelActiveOperation: () => {
try {
actions.rejectPreview();
} catch (error) {
console.debug('Error rejecting active preview', error);
} finally {
actions.cancelMeasurement();
}
},
clearMarkersForMarkerLabelmap: () => {
const { viewport } = _getActiveViewportEnabledElement();
const toolGroup = cornerstoneTools.ToolGroupManager.getToolGroupForViewport(viewport.id);
@@ -2550,6 +2583,9 @@ function commandsModule({
removeMeasurement: {
commandFn: actions.removeMeasurement,
},
cancelMeasurement: {
commandFn: actions.cancelMeasurement,
},
toggleLockMeasurement: {
commandFn: actions.toggleLockMeasurement,
},
@@ -2798,6 +2834,7 @@ function commandsModule({
toggleSegmentSelect: actions.toggleSegmentSelect,
acceptPreview: actions.acceptPreview,
rejectPreview: actions.rejectPreview,
cancelActiveOperation: actions.cancelActiveOperation,
toggleUseCenterSegmentIndex: actions.toggleUseCenterSegmentIndex,
toggleLabelmapAssist: actions.toggleLabelmapAssist,
interpolateScrollForMarkerLabelmap: actions.interpolateScrollForMarkerLabelmap,
@@ -60,11 +60,11 @@ const DicomUploadProgressItem = memo(
/>
);
case UploadStatus.InProgress:
return <Icons.ByName name="icon-transferring" />;
return <Icons.ByName name="icon-transferring" className="text-highlight" />;
case UploadStatus.Failed:
return <Icons.ByName name="icon-alert-small" />;
return <Icons.ByName name="icon-alert-small" className="text-destructive" />;
case UploadStatus.Cancelled:
return <Icons.ByName name="icon-alert-outline" />;
return <Icons.ByName name="icon-alert-outline" className="text-highlight" />;
default:
return <></>;
}
@@ -18,7 +18,7 @@ function TrackingStatus({ viewportId }: { viewportId: string }) {
<Tooltip>
<TooltipTrigger asChild>
<span>
<Icons.StatusTracking className="h-4 w-4" />
<Icons.StatusTracking className="h-4 w-4 text-highlight" />
</span>
</TooltipTrigger>
<TooltipContent side="bottom">
@@ -1,9 +1,11 @@
import type { Button } from '@ohif/core/types';
import { EVENTS } from '@cornerstonejs/core';
import { ViewportGridService } from '@ohif/core';
import { ViewportGridService, ToolbarService } from '@ohif/core';
import i18n from 'i18next';
const { TOOLBAR_SECTIONS } = ToolbarService;
const callbacks = (toolName: string) => [
{
commandName: 'setViewportForToolConfiguration',
@@ -708,4 +710,91 @@ const toolbarButtons: Button[] = [
// },
];
export default toolbarButtons;
/**
* Default toolbar layout: which buttons appear in each toolbar section.
* Registered as a customization so modes (and `?customization=` modules) can
* append/replace entries without rebuilding.
*/
export const toolbarSections = {
[TOOLBAR_SECTIONS.primary]: [
'MeasurementTools',
'Zoom',
'Pan',
'TrackballRotate',
'WindowLevel',
'Capture',
'Layout',
'Crosshairs',
'MoreTools',
],
[TOOLBAR_SECTIONS.viewportActionMenu.topLeft]: ['orientationMenu', 'dataOverlayMenu'],
[TOOLBAR_SECTIONS.viewportActionMenu.bottomMiddle]: ['AdvancedRenderingControls'],
AdvancedRenderingControls: [
'windowLevelMenuEmbedded',
'voiManualControlMenu',
'Colorbar',
'opacityMenu',
'thresholdMenu',
],
[TOOLBAR_SECTIONS.viewportActionMenu.topRight]: [
'modalityLoadBadge',
'trackingStatus',
'navigationComponent',
],
[TOOLBAR_SECTIONS.viewportActionMenu.bottomLeft]: ['windowLevelMenu'],
MeasurementTools: [
'Length',
'Bidirectional',
'ArrowAnnotate',
'EllipticalROI',
'RectangleROI',
'CircleROI',
'PlanarFreehandROI',
'SplineROI',
'LivewireContour',
],
MoreTools: [
'Reset',
'rotate-right',
'flipHorizontal',
'ImageSliceSync',
'ReferenceLines',
'ImageOverlayViewer',
'StackScroll',
'invert',
'Probe',
'Cine',
'Angle',
'CobbAngle',
'Magnify',
'CalibrationLine',
'TagBrowser',
'AdvancedMagnify',
'UltrasoundDirectionalTool',
'WindowLevelRegion',
'SegmentLabelTool',
],
};
/**
* Customizations registered (at default scope) by the cornerstone extension:
* - `cornerstone.toolbarButtons` – the default toolbar button definitions
* - `cornerstone.toolbarSections` – the default toolbar layout (section -> button ids)
*
* Modes read these by name in `onModeEnter`; URL `?customization=` modules can
* extend them with immutability-helper commands (e.g. `$push` a new button).
*/
const toolbarButtonsCustomization = {
'cornerstone.toolbarButtons': toolbarButtons,
'cornerstone.toolbarSections': toolbarSections,
};
export { toolbarButtons };
export default toolbarButtonsCustomization;
@@ -8,6 +8,7 @@ import volumeRenderingCustomization from './customizations/volumeRenderingCustom
import colorbarCustomization from './customizations/colorbarCustomization';
import modalityColorMapCustomization from './customizations/modalityColorMapCustomization';
import windowLevelPresetsCustomization from './customizations/windowLevelPresetsCustomization';
import toolbarButtonsCustomization from './customizations/toolbarButtonsCustomization';
import miscCustomization from './customizations/miscCustomization';
import captureViewportModalCustomization from './customizations/captureViewportModalCustomization';
import viewportDownloadWarningCustomization from './customizations/viewportDownloadWarningCustomization';
@@ -32,6 +33,7 @@ function getCustomizationModule({ commandsManager, servicesManager, extensionMan
...colorbarCustomization,
...modalityColorMapCustomization,
...windowLevelPresetsCustomization,
...toolbarButtonsCustomization,
...miscCustomization,
...captureViewportModalCustomization,
...viewportDownloadWarningCustomization,
@@ -3,6 +3,7 @@ import {
WindowLevelTool,
SegmentBidirectionalTool,
StackScrollTool,
PlanarRotateTool,
VolumeRotateTool,
ZoomTool,
MIPJumpToClickTool,
@@ -74,6 +75,7 @@ export default function initCornerstoneTools(configuration = {}) {
addTool(SegmentBidirectionalTool);
addTool(WindowLevelTool);
addTool(StackScrollTool);
addTool(PlanarRotateTool);
addTool(VolumeRotateTool);
addTool(ZoomTool);
addTool(ProbeTool);
@@ -138,6 +140,7 @@ const toolNames = {
WindowLevel: WindowLevelTool.toolName,
StackScroll: StackScrollTool.toolName,
Zoom: ZoomTool.toolName,
PlanarRotate: PlanarRotateTool.toolName,
VolumeRotate: VolumeRotateTool.toolName,
MipJumpToClick: MIPJumpToClickTool.toolName,
Length: LengthTool.toolName,
@@ -531,10 +531,8 @@ const connectMeasurementServiceToTools = ({
}
// Cancel any active tool manipulation (e.g., Spline/Livewire) to avoid leaving the tool
// in a drawing state after deleting a not completed measurement, which can block viewport interactivity.
const element = getActiveViewportEnabledElement(viewportGridService)?.viewport?.element;
if (element) {
cancelActiveManipulations(element);
}
commandsManager.run('cancelMeasurement');
const removedAnnotation = annotation.state.getAnnotation(removedMeasurementId);
removeAnnotation(removedMeasurementId);
// Ensure `removedAnnotation` is available before triggering the memo,
@@ -88,12 +88,17 @@ const segmentationRepresentationModifiedCallback = async (
return;
}
// Ensure the segmentation representation aligns with the target viewport type.
const type: Enums.SegmentationRepresentations =
isVolume3DViewportType(viewport)
? Enums.SegmentationRepresentations.Surface
: ((segmentationRepresentationType as Enums.SegmentationRepresentations) ??
Enums.SegmentationRepresentations.Labelmap);
// Ensure the segmentation representation aligns with the target viewport type
const is3D = isVolume3DViewportType(viewport);
const requestedRepresentation =
segmentationRepresentationType as Enums.SegmentationRepresentations;
const { Surface, Labelmap } = Enums.SegmentationRepresentations;
const type: Enums.SegmentationRepresentations = is3D
? Surface
: requestedRepresentation && requestedRepresentation !== Surface
? requestedRepresentation
: Labelmap;
await segmentationService.addSegmentationRepresentation(targetViewportId, {
segmentationId,
@@ -8,6 +8,7 @@ import {
utilities as csUtils,
cache,
Enums as csEnums,
metaData,
} from '@cornerstonejs/core';
import { utilities as csToolsUtils, Enums as csToolsEnums } from '@cornerstonejs/tools';
@@ -849,10 +850,21 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
_presentations: Presentations = {}
): Promise<void> {
const [displaySet] = viewportData.data;
// CS3D's "redo viewports" replaced setDataIds with the generic
// setDisplaySets({ displaySetId }) API; the legacy adapters key off
// imageIds[0] as the displaySetId, so do the same here.
await viewport.setDisplaySets({ displaySetId: displaySet.imageIds[0] });
const displaySetId = displaySet.imageIds[0];
// Register the WSI dataset so the viewport can resolve its imageIds +
// webClient by display-set id, then mount via setDisplaySets. The webClient
// was registered under the WADO_WEB_CLIENT module (keyed by imageIds[0]) by
// the SM SOP class handler. CS3D's "redo viewports" reads this same registry
// (genericViewportDisplaySetMetadataProvider) from its WSI data provider;
// without this entry setDisplaySets throws "No registered WSI dataset" and
// the viewport renders gray.
const webClient = metaData.get(csEnums.MetadataModules.WADO_WEB_CLIENT, displaySetId);
csUtils.genericViewportDisplaySetMetadataProvider.add(displaySetId, {
imageIds: displaySet.imageIds,
kind: 'wsi',
options: { webClient },
});
await viewport.setDisplaySets({ displaySetId });
const viewReference = viewportInfo.getViewReference();
if (viewReference) {
viewport.setViewReference(viewReference);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-default",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "Common/default features and functionality for basic image viewing",
"author": "OHIF Core Team",
"license": "MIT",
@@ -152,7 +152,7 @@ function DataSourceConfigurationModalComponent({
>
<div className="text- flex items-center gap-2">
{itemLabelIndex < selectedItems.length ? (
<Icons.ByName name="status-tracked" />
<Icons.ByName name="status-tracked" className="text-highlight" />
) : (
<Icons.ByName name="status-untracked" />
)}
@@ -12,8 +12,7 @@
.dicom-tag-browser-table tr {
padding-left: 10px;
padding-right: 10px;
color: #ffffff;
border-top: 1px solid #ddd;
color: hsl(var(--foreground));
white-space: nowrap;
}
@@ -43,7 +42,6 @@
padding-left: 10px;
padding-right: 10px;
text-align: center;
color: '#20A5D6';
}
.dicom-tag-browser-table th.dicom-tag-browser-table-left {
@@ -18,6 +18,7 @@ import getDirectURL from '../utils/getDirectURL';
import { fixBulkDataURI } from './utils/fixBulkDataURI';
import { HeadersInterface } from '@ohif/core/src/types/RequestHeaders';
import { getGetThumbnailSrc, ThumbnailContext } from './retrieveThumbnail';
import { getRenderedURL } from './retrieveRendered';
const { DicomMetaDictionary, DicomDict } = dcmjs.data;
@@ -108,7 +109,6 @@ export type BulkDataURIConfig = {
relativeResolution?: 'studies' | 'series';
};
/**
* The header options are the options passed into the generateWadoHeader
* command. This takes an extensible set of attributes to allow future enhancements.
@@ -291,6 +291,14 @@ function createDicomWebApi(dicomWebConfig: DicomWebConfig, servicesManager) {
params
);
},
renderedURL: (params, options) => {
return getRenderedURL({
config: dicomWebConfig,
getAuthorizationHeader,
retrieve: implementation.retrieve,
userAuthenticationService,
})(params, options);
},
/**
* Provide direct access to the dicom web client for certain use cases
* where the dicom web client is used by an external library such as the
@@ -52,6 +52,7 @@ function processResults(qidoStudies) {
accession: getString(qidoStudy['00080050']) || '', // short string, probably a number?
mrn: getString(qidoStudy['00100020']) || '', // medicalRecordNumber
patientName: utils.formatPN(getName(qidoStudy['00100010'])) || '',
patientBirthDate: getString(qidoStudy['00100030']) || '', // YYYYMMDD
instances: Number(getString(qidoStudy['00201208'])) || 0, // number
description: getString(qidoStudy['00081030']) || '',
modalities: getString(getModalities(qidoStudy['00080060'], qidoStudy['00080061'])) || '',
@@ -153,6 +154,7 @@ function mapParams(params, options = {}) {
'00081030', // Study Description
'00080060', // Modality
'00080090', // Referring Physician's Name
'00100030', // Patient's Birth Date
// Add more fields here if you want them in the result
].join(',');
@@ -0,0 +1,147 @@
import { fetchRenderedURL, getRenderedURL, isTrustedWadoURL } from './retrieveRendered';
describe('retrieveRendered', () => {
const originalFetch = global.fetch;
const originalCreateObjectURL = URL.createObjectURL;
const originalRevokeObjectURL = URL.revokeObjectURL;
beforeEach(() => {
global.fetch = jest.fn();
URL.createObjectURL = jest.fn(() => 'blob:rendered') as jest.Mock;
URL.revokeObjectURL = jest.fn() as jest.Mock;
jest.spyOn(console, 'warn').mockImplementation(() => {});
});
afterEach(() => {
jest.restoreAllMocks();
global.fetch = originalFetch;
URL.createObjectURL = originalCreateObjectURL;
URL.revokeObjectURL = originalRevokeObjectURL;
});
it('returns null when there is no resolved URL', async () => {
const result = await fetchRenderedURL({
url: undefined,
wadoRoot: 'https://example.com/dicomweb',
headers: { Authorization: 'Bearer token' },
});
expect(result).toEqual({ url: null });
expect(global.fetch).not.toHaveBeenCalled();
});
it('returns the direct URL without fetching when there is no authorization header', async () => {
const result = await fetchRenderedURL({
url: 'https://example.com/dicomweb/rendered',
wadoRoot: 'https://example.com/dicomweb',
headers: {},
});
expect(result).toEqual({ url: 'https://example.com/dicomweb/rendered' });
expect(global.fetch).not.toHaveBeenCalled();
});
it('does not attach auth headers to untrusted absolute URLs', async () => {
const result = await fetchRenderedURL({
url: 'https://untrusted.example.com/rendered',
wadoRoot: 'https://example.com/dicomweb',
headers: { Authorization: 'Bearer token' },
});
expect(result).toEqual({ url: 'https://untrusted.example.com/rendered' });
expect(global.fetch).not.toHaveBeenCalled();
});
it('fetches trusted URLs with auth and returns a revocable object URL', async () => {
(global.fetch as jest.Mock).mockResolvedValueOnce({
ok: true,
blob: jest.fn().mockResolvedValueOnce(new Blob(['pdf'], { type: 'application/pdf' })),
});
const result = await fetchRenderedURL({
url: 'https://example.com/dicomweb/studies/1/rendered',
wadoRoot: 'https://example.com/dicomweb',
headers: { Authorization: 'Bearer token' },
});
expect(global.fetch).toHaveBeenCalledWith(
'https://example.com/dicomweb/studies/1/rendered',
expect.objectContaining({
method: 'GET',
headers: { Authorization: 'Bearer token' },
})
);
expect(result.url).toBe('blob:rendered');
result.revoke?.();
result.revoke?.();
expect(URL.revokeObjectURL).toHaveBeenCalledTimes(1);
expect(URL.revokeObjectURL).toHaveBeenCalledWith('blob:rendered');
});
it('returns null and triggers unauthenticated handling on 401/403 responses', async () => {
const handleUnauthenticated = jest.fn();
(global.fetch as jest.Mock).mockResolvedValueOnce({
ok: false,
status: 401,
});
const result = await fetchRenderedURL({
url: 'https://example.com/dicomweb/studies/1/rendered',
wadoRoot: 'https://example.com/dicomweb',
headers: { Authorization: 'Bearer token' },
userAuthenticationService: { handleUnauthenticated },
});
expect(result).toEqual({ url: null });
expect(handleUnauthenticated).toHaveBeenCalledTimes(1);
});
it('revokes an object URL created after the request was aborted', async () => {
const abortController = new AbortController();
(global.fetch as jest.Mock).mockResolvedValueOnce({
ok: true,
blob: jest.fn().mockImplementationOnce(async () => {
abortController.abort();
return new Blob(['pdf'], { type: 'application/pdf' });
}),
});
const result = await fetchRenderedURL({
url: 'https://example.com/dicomweb/studies/1/rendered',
wadoRoot: 'https://example.com/dicomweb',
headers: { Authorization: 'Bearer token' },
signal: abortController.signal,
});
expect(result).toEqual({ url: null });
expect(URL.revokeObjectURL).toHaveBeenCalledWith('blob:rendered');
});
it('resolves directURL through the datasource retrieve API', async () => {
const renderedURL = getRenderedURL({
config: { wadoRoot: 'https://example.com/dicomweb' },
getAuthorizationHeader: () => ({}),
retrieve: {
directURL: jest.fn().mockResolvedValueOnce('https://example.com/dicomweb/rendered'),
},
});
await expect(renderedURL({ instance: {} })).resolves.toEqual({
url: 'https://example.com/dicomweb/rendered',
});
});
it('trusts URLs that share the configured WADO origin', () => {
expect(
isTrustedWadoURL('/dicomweb/studies/1/rendered', `${window.location.origin}/dicomweb`)
).toBe(true);
expect(
isTrustedWadoURL(
'https://other.example.com/dicomweb/studies/1/rendered',
'https://example.com/dicomweb'
)
).toBe(false);
});
});
@@ -0,0 +1,141 @@
import { HeadersInterface } from '@ohif/core/src/types/RequestHeaders';
type RetrieveApi = {
directURL: (params: unknown) => unknown;
};
type RenderedURLConfig = {
wadoRoot?: string;
};
type UserAuthenticationService = {
handleUnauthenticated?: () => unknown;
};
type GetRenderedURLDeps = {
config: RenderedURLConfig;
getAuthorizationHeader: () => HeadersInterface;
retrieve: RetrieveApi;
userAuthenticationService?: UserAuthenticationService;
};
type RenderedURLOptions = {
signal?: AbortSignal;
};
type FetchRenderedURLOptions = RenderedURLOptions & {
url?: string | null;
wadoRoot?: string;
headers?: HeadersInterface;
userAuthenticationService?: UserAuthenticationService;
};
export type RenderedURLResult = {
url: string | null;
revoke?: () => void;
};
export function getRenderedURL({
config,
getAuthorizationHeader,
retrieve,
userAuthenticationService,
}: GetRenderedURLDeps) {
return async function renderedURL(
params: unknown,
options: RenderedURLOptions = {}
): Promise<RenderedURLResult> {
const resolvedUrl = (await retrieve.directURL(params)) as string | undefined | null;
return fetchRenderedURL({
url: resolvedUrl,
wadoRoot: config.wadoRoot,
headers: getAuthorizationHeader(),
signal: options.signal,
userAuthenticationService,
});
};
}
export async function fetchRenderedURL({
url,
wadoRoot,
headers,
signal,
userAuthenticationService,
}: FetchRenderedURLOptions): Promise<RenderedURLResult> {
if (!url || signal?.aborted) {
return { url: null };
}
if (!headers?.Authorization || !isTrustedWadoURL(url, wadoRoot)) {
return { url };
}
try {
const response = await fetch(url, {
method: 'GET',
headers: headers as Record<string, string>,
signal,
});
if (!response.ok) {
if (response.status === 401 || response.status === 403) {
userAuthenticationService?.handleUnauthenticated?.();
}
console.warn(`rendered media fetch failed with status ${response.status}`);
return { url: null };
}
const blob = await response.blob();
const objectUrl = URL.createObjectURL(blob);
if (signal?.aborted) {
URL.revokeObjectURL(objectUrl);
return { url: null };
}
return {
url: objectUrl,
revoke: createRevokeOnce(objectUrl),
};
} catch (error) {
if ((error as { name?: string })?.name === 'AbortError') {
return { url: null };
}
console.warn('rendered media fetch failed', error);
return { url: null };
}
}
export function isTrustedWadoURL(url: string, wadoRoot?: string): boolean {
if (!wadoRoot) {
return false;
}
try {
const parsedUrl = new URL(url, window.location.href);
const parsedWadoRoot = new URL(wadoRoot, window.location.href);
const isHttpUrl = parsedUrl.protocol === 'http:' || parsedUrl.protocol === 'https:';
const isHttpWadoRoot =
parsedWadoRoot.protocol === 'http:' || parsedWadoRoot.protocol === 'https:';
return isHttpUrl && isHttpWadoRoot && parsedUrl.origin === parsedWadoRoot.origin;
} catch {
return false;
}
}
function createRevokeOnce(objectUrl: string) {
let revoked = false;
return () => {
if (revoked) {
return;
}
URL.revokeObjectURL(objectUrl);
revoked = true;
};
}
@@ -52,6 +52,7 @@ function createDicomWebProxyApi(dicomWebProxyConfig, servicesManager: AppTypes.S
retrieve: {
getGetThumbnailSrc: (...args) => dicomWebDelegate.retrieve.getGetThumbnailSrc(...args),
directURL: (...args) => dicomWebDelegate.retrieve.directURL(...args),
renderedURL: (...args) => dicomWebDelegate.retrieve.renderedURL(...args),
series: {
metadata: async (...args) => dicomWebDelegate.retrieve.series.metadata(...args),
},
@@ -62,7 +63,8 @@ function createDicomWebProxyApi(dicomWebProxyConfig, servicesManager: AppTypes.S
reject: {
series: (...args) => dicomWebDelegate?.reject?.series?.(...args),
},
deleteStudyMetadataPromise: (...args) => dicomWebDelegate?.deleteStudyMetadataPromise?.(...args),
deleteStudyMetadataPromise: (...args) =>
dicomWebDelegate?.deleteStudyMetadataPromise?.(...args),
getImageIdsForDisplaySet: (...args) => dicomWebDelegate?.getImageIdsForDisplaySet?.(...args),
getImageIdsForInstance: (...args) => dicomWebDelegate?.getImageIdsForInstance?.(...args),
getConfig: (...args) =>
@@ -242,6 +242,24 @@ function createMergeDataSourceApi(
defaultDataSourceName,
extensionManager,
}),
renderedURL: (...args: unknown[]) => {
const [dataSource] = extensionManager.getDataSources(defaultDataSourceName);
const renderedURL = get(dataSource, 'retrieve.renderedURL');
if (renderedURL) {
return renderedURL.apply(dataSource, args);
}
const directURL = get(dataSource, 'retrieve.directURL');
if (!directURL) {
return Promise.resolve({ url: null });
}
return Promise.resolve(directURL.apply(dataSource, [args[0]])).then(url => ({
url: (url as string | undefined | null) || null,
}));
},
series: {
metadata: (...args: unknown[]) =>
callForAllDataSourcesAsync({
@@ -28,7 +28,7 @@ function ViewerHeader({ appConfig }: withAppTypes<{ appConfig: AppTypes.Config }
if (dataSourceIdx !== -1 && existingDataSource) {
searchQuery.append('datasources', pathname.substring(dataSourceIdx + 1));
}
preserveQueryParameters(searchQuery);
preserveQueryParameters(searchQuery, customizationService);
navigate({
pathname: '/',
@@ -43,6 +43,10 @@ function ViewerHeader({ appConfig }: withAppTypes<{ appConfig: AppTypes.Config }
'ohif.aboutModal'
) as Types.MenuComponentCustomization;
const AppearanceModal = customizationService.getCustomization(
'ohif.appearanceModal'
) as Types.MenuComponentCustomization;
const UserPreferencesModal = customizationService.getCustomization(
'ohif.userPreferencesModal'
) as Types.MenuComponentCustomization;
@@ -71,6 +75,19 @@ function ViewerHeader({ appConfig }: withAppTypes<{ appConfig: AppTypes.Config }
},
];
if (AppearanceModal) {
menuOptions.splice(1, 0, {
title: AppearanceModal.menuTitle ?? t('Header:Appearance'),
icon: 'ColorChange',
onClick: () =>
show({
content: AppearanceModal,
title: AppearanceModal.title ?? t('AppearanceModal:Appearance'),
containerClassName: AppearanceModal.containerClassName ?? 'max-w-md',
}),
});
}
if (appConfig.oidc) {
menuOptions.push({
title: t('Header:Logout'),
@@ -0,0 +1,143 @@
import React from 'react';
import {
AppearanceModal,
Select,
SelectTrigger,
SelectValue,
SelectContent,
SelectItem,
Button,
useActiveTheme,
themePresets,
} from '@ohif/ui-next';
import { useTranslation } from 'react-i18next';
function AppearanceModalDefault() {
const { activeTheme, setActiveTheme, customCss, applyCustomTheme, clearCustomTheme } =
useActiveTheme();
const { t } = useTranslation('AppearanceModal');
const [draftCss, setDraftCss] = React.useState(() => customCss);
const [isCustomOpen, setIsCustomOpen] = React.useState(() => activeTheme === 'custom');
const [parseFailed, setParseFailed] = React.useState(false);
const handleToggleCustom = () => {
setIsCustomOpen(!isCustomOpen);
};
const handleSave = () => {
setParseFailed(!applyCustomTheme(draftCss));
};
const handleClear = () => {
clearCustomTheme();
setDraftCss('');
setParseFailed(false);
setIsCustomOpen(false);
};
const handlePresetChange = (value: string) => {
if (value === 'custom') {
// Selecting "Custom" restores the saved custom theme; the draft is only
// committed through the explicit Apply button.
setIsCustomOpen(true);
if (customCss) {
applyCustomTheme(customCss);
}
} else {
setIsCustomOpen(false);
setActiveTheme(value);
}
};
const handleTextChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
setDraftCss(e.target.value);
setParseFailed(false);
};
return (
<AppearanceModal>
<AppearanceModal.Body>
<div className="grid grid-cols-[auto_1fr] items-center gap-x-6 gap-y-4">
<AppearanceModal.SectionLabel>{t('Theme')}</AppearanceModal.SectionLabel>
<div>
<Select
value={activeTheme}
onValueChange={handlePresetChange}
>
<SelectTrigger
className="w-[200px]"
aria-label={t('Theme')}
>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="default">{t('Default Theme')}</SelectItem>
{themePresets.map(preset => (
<SelectItem
key={preset.name}
value={preset.name}
>
{preset.label}
</SelectItem>
))}
{(customCss || draftCss) && <SelectItem value="custom">{t('Custom')}</SelectItem>}
</SelectContent>
</Select>
</div>
<div className="col-start-2">
<Button
variant="ghost"
size="sm"
onClick={handleToggleCustom}
>
{isCustomOpen ? t('Hide') : t('Custom Theme')}
</Button>
</div>
</div>
{isCustomOpen && (
<div className="mt-4 flex flex-col space-y-2">
<textarea
value={draftCss}
onChange={handleTextChange}
placeholder={t('Paste your custom theme color tokens here')}
aria-label={t('Paste your custom theme color tokens here')}
rows={8}
className="bg-muted text-foreground border-input placeholder:text-muted-foreground focus:ring-ring rounded-md border px-3 py-2 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-inset"
/>
{parseFailed && (
<span
className="text-destructive text-sm"
role="alert"
>
{t('No valid theme tokens found')}
</span>
)}
<div className="flex space-x-2">
<Button
variant="default"
size="sm"
onClick={handleSave}
>
{t('Apply')}
</Button>
<Button
variant="ghost"
size="sm"
onClick={handleClear}
>
{t('Clear')}
</Button>
</div>
</div>
)}
</AppearanceModal.Body>
</AppearanceModal>
);
}
export default {
'ohif.appearanceModal': AppearanceModalDefault,
};
@@ -1,4 +1,5 @@
import React from 'react';
import { utils } from '@ohif/core';
export default {
'ohif.overlayItem': function (props) {
@@ -13,7 +14,8 @@ export default {
: this.contentF && typeof this.contentF === 'function'
? this.contentF(props)
: null;
if (!value) {
const displayValue = utils.formatValue(value);
if (!displayValue) {
return null;
}
@@ -24,7 +26,7 @@ export default {
title={this.title || ''}
>
{this.label && <span className="mr-1 shrink-0">{this.label}</span>}
<span className="font-light">{value}</span>
<span className="font-light">{displayValue}</span>
</span>
);
},
@@ -18,6 +18,7 @@ import progressLoadingBarCustomization from './customizations/progressLoadingBar
import labellingFlowCustomization from './customizations/labellingFlowCustomization';
import viewportNotificationCustomization from './customizations/notificationCustomization';
import aboutModalCustomization from './customizations/aboutModalCustomization';
import appearanceModalCustomization from './customizations/appearanceModalCustomization';
import userPreferencesCustomization from './customizations/userPreferencesCustomization';
import reportDialogCustomization from './customizations/reportDialogCustomization';
import hotkeyBindingsCustomization from './customizations/hotkeyBindingsCustomization';
@@ -39,6 +40,10 @@ export default function getCustomizationModule({ servicesManager, extensionManag
name: 'helloPage',
value: helloPageCustomization,
},
{
name: 'theme',
value: appearanceModalCustomization,
},
{
name: 'datasources',
value: datasourcesCustomization,
+12
View File
@@ -1,5 +1,6 @@
import { DicomMetadataStore, classes } from '@ohif/core';
import { calculateSUVScalingFactors } from '@cornerstonejs/calculate-suv';
import { ActiveThemeProvider } from '@ohif/ui-next';
import getPTImageIdInstanceMetadata from './getPTImageIdInstanceMetadata';
import { registerHangingProtocolAttributes } from './hangingprotocols';
@@ -16,7 +17,18 @@ export default function init({
servicesManager,
commandsManager,
hotkeysManager,
serviceProvidersManager,
appConfig,
}: withAppTypes): void {
const hasThemeModule =
Array.isArray(appConfig.customizationService) &&
appConfig.customizationService.some(
ref => typeof ref === 'string' && ref.includes('customizationModule.theme')
);
if (hasThemeModule) {
serviceProvidersManager.registerProvider('activeTheme', ActiveThemeProvider);
}
const { toolbarService, cineService, viewportGridService } = servicesManager.services;
toolbarService.registerEventForToolbarUpdate(cineService, [
@@ -1,3 +1,4 @@
.chrome-picker {
background: #090c29 !important;
background: transparent !important;
box-shadow: none !important;
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-dicom-microscopy",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "OHIF extension for DICOM microscopy",
"author": "Bill Wallace, md-prog",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-dicom-pdf",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "OHIF extension for PDF display",
"author": "OHIF",
"license": "MIT",
@@ -14,12 +14,17 @@ const _getDisplaySetsFromSeries = (instances, servicesManager, extensionManager)
const { Modality, SOPInstanceUID } = instance;
const { SeriesDescription = 'PDF', MIMETypeOfEncapsulatedDocument } = instance;
const { SeriesNumber, SeriesDate, SeriesInstanceUID, StudyInstanceUID, SOPClassUID } = instance;
const renderedUrl = dataSource.retrieve.directURL({
const renderedUrlParams = {
instance,
tag: 'EncapsulatedDocument',
defaultType: MIMETypeOfEncapsulatedDocument || 'application/pdf',
singlepart: 'pdf',
});
};
const renderedUrl = dataSource.retrieve.directURL(renderedUrlParams);
const getRenderedUrl = dataSource.retrieve.renderedURL
? options =>
dataSource.retrieve.renderedURL({ ...renderedUrlParams, url: renderedUrl }, options)
: undefined;
const displaySet = {
//plugin: id,
@@ -36,6 +41,7 @@ const _getDisplaySetsFromSeries = (instances, servicesManager, extensionManager)
referencedImages: null,
measurements: null,
renderedUrl: renderedUrl,
getRenderedUrl,
instances: [instance],
thumbnailSrc: null,
isDerivedDisplaySet: true,
+2 -8
View File
@@ -28,15 +28,9 @@ const dicomPDFExtension = {
* @param {object} [configuration={}]
* @param {object|array} [configuration.csToolsConfig] - Passed directly to `initCornerstoneTools`
*/
getViewportModule({ servicesManager, extensionManager }) {
getViewportModule() {
const ExtendedOHIFCornerstonePdfViewport = props => {
return (
<OHIFCornerstonePdfViewport
servicesManager={servicesManager}
extensionManager={extensionManager}
{...props}
/>
);
return <OHIFCornerstonePdfViewport {...props} />;
};
return [{ name: 'dicom-pdf', component: ExtendedOHIFCornerstonePdfViewport }];
@@ -33,14 +33,43 @@ function OHIFCornerstonePdfViewport({ displaySets, viewportId = 'pdf-viewport' }
}
const { renderedUrl } = displaySets[0];
const { getRenderedUrl } = displaySets[0];
useEffect(() => {
let isCancelled = false;
let revokeUrl;
const abortController = new AbortController();
const load = async () => {
setUrl(await renderedUrl);
try {
const result = getRenderedUrl
? await getRenderedUrl({ signal: abortController.signal })
: { url: await renderedUrl };
if (isCancelled) {
result?.revoke?.();
return;
}
revokeUrl = result?.revoke;
setUrl(result?.url || null);
} catch (error) {
console.warn('Failed to load PDF', error);
if (!isCancelled) {
setUrl(null);
}
return;
}
};
load();
}, [renderedUrl]);
return () => {
isCancelled = true;
abortController.abort();
revokeUrl?.();
};
}, [renderedUrl, getRenderedUrl]);
return (
<div
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-dicom-video",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "OHIF extension for video display",
"author": "OHIF",
"license": "MIT",
@@ -57,12 +57,16 @@ const _getDisplaySetsFromSeries = (instances, servicesManager, extensionManager)
const { Modality, SOPInstanceUID, SeriesDescription = 'VIDEO', imageId } = instance;
const { SeriesNumber, SeriesDate, SeriesInstanceUID, StudyInstanceUID, NumberOfFrames, url } =
instance;
const videoUrl = dataSource.retrieve.directURL({
const videoUrlParams = {
instance,
singlepart: 'video',
tag: 'PixelData',
url,
});
};
const videoUrl = dataSource.retrieve.directURL(videoUrlParams);
const getVideoUrl = dataSource.retrieve.renderedURL
? options => dataSource.retrieve.renderedURL({ ...videoUrlParams, url: videoUrl }, options)
: undefined;
const displaySet = {
//plugin: id,
Modality,
@@ -76,6 +80,8 @@ const _getDisplaySetsFromSeries = (instances, servicesManager, extensionManager)
SOPClassHandlerId,
referencedImages: null,
measurements: null,
videoUrl,
getVideoUrl,
viewportType: csEnums.ViewportType.VIDEO,
instances: [instance],
getThumbnailSrc: dataSource.retrieve.getGetThumbnailSrc?.(instance),
-44
View File
@@ -1,19 +1,6 @@
import React from 'react';
import getSopClassHandlerModule from './getSopClassHandlerModule';
import { id } from './id';
const Component = React.lazy(() => {
return import(/* webpackPrefetch: true */ './viewports/OHIFCornerstoneVideoViewport');
});
const OHIFCornerstoneVideoViewport = props => {
return (
<React.Suspense fallback={<div>Loading...</div>}>
<Component {...props} />
</React.Suspense>
);
};
/**
*
*/
@@ -23,38 +10,7 @@ const dicomVideoExtension = {
*/
id,
/**
*
*
* @param {object} [configuration={}]
* @param {object|array} [configuration.csToolsConfig] - Passed directly to `initCornerstoneTools`
*/
getViewportModule({ servicesManager, extensionManager }) {
const ExtendedOHIFCornerstoneVideoViewport = props => {
return (
<OHIFCornerstoneVideoViewport
servicesManager={servicesManager}
extensionManager={extensionManager}
{...props}
/>
);
};
return [{ name: 'dicom-video', component: ExtendedOHIFCornerstoneVideoViewport }];
},
getSopClassHandlerModule,
};
function _getToolAlias(toolName) {
let toolAlias = toolName;
switch (toolName) {
case 'EllipticalRoi':
toolAlias = 'SREllipticalRoi';
break;
}
return toolAlias;
}
export default dicomVideoExtension;
@@ -1,55 +0,0 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
function OHIFCornerstoneVideoViewport({ displaySets }) {
if (displaySets && displaySets.length > 1) {
throw new Error(
'OHIFCornerstoneVideoViewport: only one display set is supported for dicom video right now'
);
}
const { videoUrl } = displaySets[0];
const mimeType = 'video/mp4';
const [url, setUrl] = useState(null);
useEffect(() => {
const load = async () => {
setUrl(await videoUrl);
};
load();
}, [videoUrl]);
// Need to copies of the source to fix a firefox bug
return (
<div className="bg-primary-black h-full w-full">
<video
src={url}
controls
controlsList="nodownload"
preload="auto"
className="h-full w-full"
crossOrigin="anonymous"
>
<source
src={url}
type={mimeType}
/>
<source
src={url}
type={mimeType}
/>
Video src/type not supported:{' '}
<a href={url}>
{url} of type {mimeType}
</a>
</video>
</div>
);
}
OHIFCornerstoneVideoViewport.propTypes = {
displaySets: PropTypes.arrayOf(PropTypes.object).isRequired,
};
export default OHIFCornerstoneVideoViewport;
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-measurement-tracking",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "Tracking features and functionality for basic image viewing",
"author": "OHIF Core Team",
"license": "MIT",
@@ -27,8 +27,8 @@
"start": "pnpm run dev"
},
"peerDependencies": {
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/tools": "5.0.2",
"@cornerstonejs/core": "5.1.3",
"@cornerstonejs/tools": "5.1.3",
"@ohif/core": "workspace:*",
"@ohif/extension-cornerstone-dicom-sr": "workspace:*",
"@ohif/extension-default": "workspace:*",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-test",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "OHIF extension used inside e2e testing",
"author": "OHIF",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-tmtv",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "OHIF extension for Total Metabolic Tumor Volume",
"author": "OHIF",
"license": "MIT",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-ultrasound-pleura-bline",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "",
"author": "Rodrigo Basilio",
"license": "MIT",
@@ -36,8 +36,8 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/tools": "5.0.2",
"@cornerstonejs/core": "5.1.3",
"@cornerstonejs/tools": "5.1.3",
"@ohif/core": "workspace:*",
"@ohif/extension-cornerstone": "workspace:*",
"@ohif/extension-default": "workspace:*",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-basic-dev-mode",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "Basic OHIF Viewer Using Cornerstone",
"author": "OHIF",
"license": "MIT",
+1 -6
View File
@@ -26,7 +26,6 @@ const dicomsr = {
const dicomvideo = {
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
const dicompdf = {
@@ -141,11 +140,7 @@ function modeFactory({ modeConfiguration }) {
viewports: [
{
namespace: cs3d.viewport,
displaySetsToDisplay: [ohif.sopClassHandler],
},
{
namespace: dicomvideo.viewport,
displaySetsToDisplay: [dicomvideo.sopClassHandler],
displaySetsToDisplay: [ohif.sopClassHandler, dicomvideo.sopClassHandler],
},
{
namespace: dicompdf.viewport,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-test",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "Basic mode for testing",
"author": "OHIF",
"license": "MIT",
-5
View File
@@ -33,7 +33,6 @@ const dicomsr = {
const dicomvideo = {
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
const dicompdf = {
@@ -254,10 +253,6 @@ function modeFactory() {
namespace: dicomsr.viewport,
displaySetsToDisplay: [dicomsr.sopClassHandler, dicomsr.sopClassHandler3D],
},
{
namespace: dicomvideo.viewport,
displaySetsToDisplay: [dicomvideo.sopClassHandler],
},
{
namespace: dicompdf.viewport,
displaySetsToDisplay: [dicompdf.sopClassHandler],
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-basic",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "A basic mode used to build other modes on top of",
"author": "OHIF Contributors",
"license": "MIT",
+22 -77
View File
@@ -1,11 +1,9 @@
import update from 'immutability-helper';
import { ToolbarService, utils } from '@ohif/core';
import { utils } from '@ohif/core';
import initToolGroups from './initToolGroups';
import toolbarButtons from './toolbarButtons';
import { id } from './id';
const { TOOLBAR_SECTIONS } = ToolbarService;
const { structuredCloneWithFunctions } = utils;
/**
@@ -44,7 +42,6 @@ export const dicomsr = {
export const dicomvideo = {
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
export const dicomecg = {
@@ -146,9 +143,22 @@ export function onModeEnter({
// Init Default and SR ToolGroups
initToolGroups(extensionManager, toolGroupService, commandsManager);
toolbarService.register(this.toolbarButtons);
// Toolbar buttons and layout may be supplied either as a customization name
// (a string, resolved through the customization service so `?customization=`
// modules can extend the cornerstone-registered defaults) or as a literal
// value (the button array / sections object) for modes that define them inline.
const resolveToolbarCustomization = (value: unknown) =>
typeof value === 'string' ? customizationService.getCustomization(value) : value;
for (const [key, section] of Object.entries(this.toolbarSections)) {
const toolbarButtons = resolveToolbarCustomization(this.toolbarButtons) as any;
const toolbarSections = (resolveToolbarCustomization(this.toolbarSections) ?? {}) as Record<
string,
string[]
>;
toolbarService.register(toolbarButtons);
for (const [key, section] of Object.entries(toolbarSections)) {
toolbarService.updateSection(key, section);
}
@@ -213,74 +223,6 @@ export function onModeExit({ servicesManager }: withAppTypes) {
cornerstoneViewportService.destroy();
}
export const toolbarSections = {
[TOOLBAR_SECTIONS.primary]: [
'MeasurementTools',
'Zoom',
'Pan',
'TrackballRotate',
'WindowLevel',
'Capture',
'Layout',
'Crosshairs',
'MoreTools',
],
[TOOLBAR_SECTIONS.viewportActionMenu.topLeft]: ['orientationMenu', 'dataOverlayMenu'],
[TOOLBAR_SECTIONS.viewportActionMenu.bottomMiddle]: ['AdvancedRenderingControls'],
AdvancedRenderingControls: [
'windowLevelMenuEmbedded',
'voiManualControlMenu',
'Colorbar',
'opacityMenu',
'thresholdMenu',
],
[TOOLBAR_SECTIONS.viewportActionMenu.topRight]: [
'modalityLoadBadge',
'trackingStatus',
'navigationComponent',
],
[TOOLBAR_SECTIONS.viewportActionMenu.bottomLeft]: ['windowLevelMenu'],
MeasurementTools: [
'Length',
'Bidirectional',
'ArrowAnnotate',
'EllipticalROI',
'RectangleROI',
'CircleROI',
'PlanarFreehandROI',
'SplineROI',
'LivewireContour',
],
MoreTools: [
'Reset',
'rotate-right',
'flipHorizontal',
'ImageSliceSync',
'ReferenceLines',
'ImageOverlayViewer',
'StackScroll',
'invert',
'Probe',
'Cine',
'Angle',
'CobbAngle',
'Magnify',
'CalibrationLine',
'TagBrowser',
'AdvancedMagnify',
'UltrasoundDirectionalTool',
'WindowLevelRegion',
'SegmentLabelTool',
],
};
export const basicLayout = {
id: ohif.layout,
props: {
@@ -343,7 +285,10 @@ export const modeInstance = {
hide: false,
displayName: 'Non-Longitudinal Basic',
_activatePanelTriggersSubscriptions: [],
toolbarSections,
// Toolbar buttons and layout are referenced by customization name; the
// cornerstone extension registers the defaults and `?customization=` modules
// can extend them. onModeEnter resolves these names via the customization service.
toolbarSections: 'cornerstone.toolbarSections',
/**
* Lifecycle hooks
@@ -365,7 +310,7 @@ export const modeInstance = {
// general handler needs to come last. For this case, the dicomvideo must
// come first to remove video transfer syntax before ohif uses images
sopClassHandlers,
toolbarButtons,
toolbarButtons: 'cornerstone.toolbarButtons',
enableSegmentationEdit: false,
nonModeModalities: NON_IMAGE_MODALITIES,
};
@@ -390,4 +335,4 @@ export const mode = {
};
export default mode;
export { initToolGroups, toolbarButtons };
export { initToolGroups };
+1
View File
@@ -69,6 +69,7 @@ function initDefaultToolGroup(extensionManager, toolGroupService, commandsManage
{ toolName: toolNames.Angle },
{ toolName: toolNames.CobbAngle },
{ toolName: toolNames.Magnify },
{ toolName: toolNames.PlanarRotate },
{ toolName: toolNames.CalibrationLine },
{
toolName: toolNames.PlanarFreehandContourSegmentation,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-longitudinal",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "Longitudinal Workflow",
"author": "OHIF",
"license": "MIT",
+2 -2
View File
@@ -1,6 +1,6 @@
import i18n from 'i18next';
import { id } from './id';
import { initToolGroups, toolbarButtons, cornerstone,
import { initToolGroups, cornerstone,
ohif,
dicomsr,
dicomvideo,
@@ -73,4 +73,4 @@ const mode = {
};
export default mode;
export { initToolGroups, toolbarButtons };
export { initToolGroups };
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-microscopy",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "OHIF mode for DICOM microscopy",
"author": "OHIF",
"license": "MIT",
+1 -2
View File
@@ -17,7 +17,6 @@ export const cornerstone = {
const dicomvideo = {
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
const dicompdf = {
@@ -107,7 +106,7 @@ function modeFactory({ modeConfiguration }) {
],
},
{
namespace: dicomvideo.viewport,
namespace: cornerstone.viewport,
displaySetsToDisplay: [dicomvideo.sopClassHandler],
},
{
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-preclinical-4d",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "4D Workflow",
"author": "OHIF",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-segmentation",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "OHIF segmentation mode which enables labelmap segmentation read/edit/export",
"author": "@ohif",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-tmtv",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "Total Metabolic Tumor Volume Workflow",
"author": "OHIF",
"license": "MIT",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-ultrasound-pleura-bline",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"description": "Allows users to annotate ultrasound images with pleura B-line annotations.",
"author": "OHIF",
"license": "MIT",
@@ -29,8 +29,8 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/tools": "5.0.2",
"@cornerstonejs/core": "5.1.3",
"@cornerstonejs/tools": "5.1.3",
"@ohif/core": "workspace:*",
"@ohif/extension-cornerstone-dicom-sr": "workspace:*",
"@ohif/extension-ultrasound-pleura-bline": "workspace:*",
-1
View File
@@ -32,7 +32,6 @@ const dicomsr = {
const dicomvideo = {
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
const dicompdf = {
+8
View File
@@ -24,6 +24,14 @@
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
# Report-Only CSP: observational only, enforces nothing. Watch browser
# consoles for violation reports before ever promoting this to an
# enforcing Content-Security-Policy header. cdnjs.cloudflare.com is for
# the Rollbar snippet in html-templates/rollbar.html (demo builds);
# connect-src stays broad because deployments point the viewer at
# arbitrary DICOMweb origins.
Content-Security-Policy-Report-Only = "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdnjs.cloudflare.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' https: blob:; worker-src 'self' blob:; object-src 'self' blob:; frame-src 'self' blob:; frame-ancestors 'none'; base-uri 'self'; form-action 'self'"
cache-control = '''
max-age=0,
no-cache,
+1 -1
View File
@@ -124,5 +124,5 @@
"git add"
]
},
"version": "3.13.0-beta.103"
"version": "3.13.0-beta.115"
}
@@ -0,0 +1,7 @@
# Copy this file to .env next to docker-compose.yml and fill in strong
# values. docker compose refuses to start while either is unset.
KEYCLOAK_ADMIN_PASSWORD=
# POSTGRES_PASSWORD is the single PostgreSQL credential: it provisions the
# keycloak database role and Keycloak reuses it to connect (KC_DB_PASSWORD is
# derived from it in docker-compose.yml), so there is one value, not two.
POSTGRES_PASSWORD=
@@ -0,0 +1,42 @@
# Security notes for this recipe
## Secrets
This recipe no longer ships working credential values. Before `docker compose up`:
- Generate a fresh OAuth client secret for the `ohif_viewer` client and use it
to replace the `REPLACE_WITH_A_GENERATED_CLIENT_SECRET` placeholder in BOTH
`config/ohif-keycloak-realm.json` and `config/oauth2-proxy.cfg` (the two
values must match). To generate one after the realm is imported: Keycloak
admin console -> Clients -> ohif_viewer -> Credentials -> Regenerate.
- Copy `.env.example` to `.env` and set `POSTGRES_PASSWORD` and
`KEYCLOAK_ADMIN_PASSWORD` to strong values. `docker compose` refuses to
start while either is unset. `POSTGRES_PASSWORD` is the single PostgreSQL
credential - it both provisions the `keycloak` database role and is what
Keycloak uses to connect (the compose file derives `KC_DB_PASSWORD` from it),
so there is one database password to set, not two.
## Rotate if you deployed from an earlier checkout
Earlier versions of this recipe committed a fixed client secret and default
admin/database passwords to the public repository. A committed secret stays
burned even after this change, so any deployment created from an earlier
checkout must rotate:
- the `ohif_viewer` client secret (Keycloak admin console -> Clients ->
ohif_viewer -> Credentials -> Regenerate, then update
`config/oauth2-proxy.cfg` to match), and
- the Keycloak admin and PostgreSQL passwords. Note that changing
`POSTGRES_PASSWORD` in `.env` alone does not re-password an existing
database: Postgres only applies it when the `postgres_data` volume is first
initialized. To actually rotate it on an existing deployment, either
`ALTER ROLE keycloak WITH PASSWORD ...` inside the running database or
recreate the `postgres_data` volume.
## CORS
The wildcard `Access-Control-Allow-Origin: *` defaults were removed from
`config/nginx.conf`. The viewer is served by the same nginx as the dcm4chee
proxy, so same-origin deployments need no CORS headers. If you host the viewer
on a different origin, use the commented explicit-origin example in the nginx
config - never `*` on an authenticated endpoint that serves PHI.
@@ -54,6 +54,15 @@ http {
gzip_comp_level 9;
etag on;
# Content-Security-Policy: test in Report-Only mode first and watch
# the browser console for violations before switching the header name
# to the enforcing Content-Security-Policy. Note: nginx add_header does
# not merge into a location that sets its own add_header - if you
# promote this to an active header, re-declare it inside every location
# block that already uses add_header (several proxy locations here do)
# or it will silently not apply there.
# add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdnjs.cloudflare.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' https: blob:; worker-src 'self' blob:; object-src 'self' blob:; frame-src 'self' blob:; frame-ancestors 'none'; base-uri 'self'; form-action 'self'" always;
location /sw.js {
add_header Cache-Control "no-cache";
proxy_cache_bypass $http_pragma;
@@ -101,19 +110,25 @@ http {
expires 0;
add_header Cache-Control private;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept' always;
if ($request_method = OPTIONS) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
# CORS: this recipe serves the viewer from this same nginx, so
# browser requests to this endpoint are same-origin and need NO
# CORS headers at all. If you host the viewer on a different
# origin, allow that origin explicitly and only that origin -
# never use '*' on an authenticated endpoint that serves PHI.
# Cross-origin example (response headers plus OPTIONS preflight):
# add_header 'Access-Control-Allow-Origin' 'https://viewer.example.com' always;
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
# add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept' always;
#
# if ($request_method = OPTIONS) {
# add_header 'Access-Control-Allow-Origin' 'https://viewer.example.com';
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
# add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept';
# add_header 'Access-Control-Max-Age' 1728000;
# add_header 'Content-Type' 'text/plain; charset=utf-8';
# add_header 'Content-Length' 0;
# return 204;
# }
rewrite ^/pacs/(.*) /dcm4chee-arc/aets/DCM4CHEE/rs/$1 break;
proxy_pass http://arc:8080;
@@ -155,19 +170,8 @@ http {
expires 0;
add_header Cache-Control private;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept' always;
if ($request_method = OPTIONS) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
# CORS: same-origin deployment - no CORS headers needed here; see
# the note on the /pacs/ location above before adding any.
proxy_pass http://arc:8080;
}
@@ -4,7 +4,7 @@ email_domains=["*"]
cookie_secure="false"
cookie_expire="9m30s"
cookie_refresh="5m"
client_secret="2Xtlde7aozdkzzYHdIxQNfPDr0wNPTgg"
client_secret="REPLACE_WITH_A_GENERATED_CLIENT_SECRET"
client_id="ohif_viewer"
redirect_url="http://YOUR_DOMAIN/oauth2/callback"
@@ -686,7 +686,7 @@
"enabled": true,
"alwaysDisplayInConsole": false,
"clientAuthenticatorType": "client-secret",
"secret": "2Xtlde7aozdkzzYHdIxQNfPDr0wNPTgg",
"secret": "REPLACE_WITH_A_GENERATED_CLIENT_SECRET",
"redirectUris": [
"http://127.0.0.1/oauth2/callback"
],
@@ -94,14 +94,17 @@ services:
KC_DB_URL: 'jdbc:postgresql://postgres:5432/keycloak'
KC_DB_SCHEMA: public
KC_DB_USERNAME: keycloak
KC_DB_PASSWORD: password
# Keycloak authenticates to Postgres as the keycloak role provisioned
# below, so this must be the same value as POSTGRES_PASSWORD. Sourced
# from the single POSTGRES_PASSWORD variable to keep them in lockstep.
KC_DB_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in your .env}
KC_HOSTNAME_ADMIN_URL: http://YOUR_DOMAIN/keycloak/
KC_HOSTNAME_URL: http://YOUR_DOMAIN/keycloak/
KC_HOSTNAME_STRICT_BACKCHANNEL: true
KC_HOSTNAME_STRICT_HTTPS: false
KC_HTTP_ENABLED: true
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD:?set KEYCLOAK_ADMIN_PASSWORD in your .env}
KC_HEALTH_ENABLED: true
KC_METRICS_ENABLED: true
KC_PROXY: edge
@@ -139,7 +142,7 @@ services:
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: password
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in your .env}
restart: unless-stopped
networks:
- default
@@ -0,0 +1,7 @@
# Copy this file to .env next to docker-compose.yml and fill in strong
# values. docker compose refuses to start while either is unset.
KEYCLOAK_ADMIN_PASSWORD=
# POSTGRES_PASSWORD is the single PostgreSQL credential: it provisions the
# keycloak database role and Keycloak reuses it to connect (KC_DB_PASSWORD is
# derived from it in docker-compose.yml), so there is one value, not two.
POSTGRES_PASSWORD=
@@ -0,0 +1,42 @@
# Security notes for this recipe
## Secrets
This recipe no longer ships working credential values. Before `docker compose up`:
- Generate a fresh OAuth client secret for the `ohif_viewer` client and use it
to replace the `REPLACE_WITH_A_GENERATED_CLIENT_SECRET` placeholder in BOTH
`config/ohif-keycloak-realm.json` and `config/oauth2-proxy.cfg` (the two
values must match). To generate one after the realm is imported: Keycloak
admin console -> Clients -> ohif_viewer -> Credentials -> Regenerate.
- Copy `.env.example` to `.env` and set `POSTGRES_PASSWORD` and
`KEYCLOAK_ADMIN_PASSWORD` to strong values. `docker compose` refuses to
start while either is unset. `POSTGRES_PASSWORD` is the single PostgreSQL
credential - it both provisions the `keycloak` database role and is what
Keycloak uses to connect (the compose file derives `KC_DB_PASSWORD` from it),
so there is one database password to set, not two.
## Rotate if you deployed from an earlier checkout
Earlier versions of this recipe committed a fixed client secret and default
admin/database passwords to the public repository. A committed secret stays
burned even after this change, so any deployment created from an earlier
checkout must rotate:
- the `ohif_viewer` client secret (Keycloak admin console -> Clients ->
ohif_viewer -> Credentials -> Regenerate, then update
`config/oauth2-proxy.cfg` to match), and
- the Keycloak admin and PostgreSQL passwords. Note that changing
`POSTGRES_PASSWORD` in `.env` alone does not re-password an existing
database: Postgres only applies it when the `postgres_data` volume is first
initialized. To actually rotate it on an existing deployment, either
`ALTER ROLE keycloak WITH PASSWORD ...` inside the running database or
recreate the `postgres_data` volume.
## CORS
The wildcard `Access-Control-Allow-Origin: *` defaults were removed from
`config/nginx.conf`. The viewer is served by the same nginx as the DICOMweb
proxy, so same-origin deployments need no CORS headers. If you host the viewer
on a different origin, use the commented explicit-origin example in the nginx
config - never `*` on an authenticated endpoint that serves PHI.
@@ -50,6 +50,15 @@ http {
gzip_comp_level 9;
etag on;
# Content-Security-Policy: test in Report-Only mode first and watch
# the browser console for violations before switching the header name
# to the enforcing Content-Security-Policy. Note: nginx add_header does
# not merge into a location that sets its own add_header - if you
# promote this to an active header, re-declare it inside every location
# block that already uses add_header (several proxy locations here do)
# or it will silently not apply there.
# add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdnjs.cloudflare.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' https: blob:; worker-src 'self' blob:; object-src 'self' blob:; frame-src 'self' blob:; frame-ancestors 'none'; base-uri 'self'; form-action 'self'" always;
location /sw.js {
add_header Cache-Control "no-cache";
proxy_cache_bypass $http_pragma;
@@ -105,19 +114,25 @@ http {
expires 0;
add_header Cache-Control private;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept' always;
if ($request_method = OPTIONS) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
# CORS: this recipe serves the viewer from this same nginx, so
# browser requests to this endpoint are same-origin and need NO
# CORS headers at all. If you host the viewer on a different
# origin, allow that origin explicitly and only that origin -
# never use '*' on an authenticated endpoint that serves PHI.
# Cross-origin example (response headers plus OPTIONS preflight):
# add_header 'Access-Control-Allow-Origin' 'https://viewer.example.com' always;
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
# add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept' always;
#
# if ($request_method = OPTIONS) {
# add_header 'Access-Control-Allow-Origin' 'https://viewer.example.com';
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
# add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept';
# add_header 'Access-Control-Max-Age' 1728000;
# add_header 'Content-Type' 'text/plain; charset=utf-8';
# add_header 'Content-Length' 0;
# return 204;
# }
proxy_pass http://orthanc:8042/;
}
@@ -137,19 +152,25 @@ http {
expires 0;
add_header Cache-Control private;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept' always;
if ($request_method = OPTIONS) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
# CORS: this recipe serves the viewer from this same nginx, so
# browser requests to this endpoint are same-origin and need NO
# CORS headers at all. If you host the viewer on a different
# origin, allow that origin explicitly and only that origin -
# never use '*' on an authenticated endpoint that serves PHI.
# Cross-origin example (response headers plus OPTIONS preflight):
# add_header 'Access-Control-Allow-Origin' 'https://viewer.example.com' always;
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
# add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept' always;
#
# if ($request_method = OPTIONS) {
# add_header 'Access-Control-Allow-Origin' 'https://viewer.example.com';
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
# add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept';
# add_header 'Access-Control-Max-Age' 1728000;
# add_header 'Content-Type' 'text/plain; charset=utf-8';
# add_header 'Content-Length' 0;
# return 204;
# }
proxy_pass http://orthanc:8042/dicom-web/;
}
@@ -4,7 +4,7 @@ email_domains=["*"]
cookie_secure="false"
cookie_expire="9m30s"
cookie_refresh="5m"
client_secret="2Xtlde7aozdkzzYHdIxQNfPDr0wNPTgg"
client_secret="REPLACE_WITH_A_GENERATED_CLIENT_SECRET"
client_id="ohif_viewer"
redirect_url="http://YOUR_DOMAIN/oauth2/callback"
@@ -686,7 +686,7 @@
"enabled": true,
"alwaysDisplayInConsole": false,
"clientAuthenticatorType": "client-secret",
"secret": "2Xtlde7aozdkzzYHdIxQNfPDr0wNPTgg",
"secret": "REPLACE_WITH_A_GENERATED_CLIENT_SECRET",
"redirectUris": [
"http://127.0.0.1/oauth2/callback"
],
@@ -51,14 +51,17 @@ services:
KC_DB_URL: 'jdbc:postgresql://postgres:5432/keycloak'
KC_DB_SCHEMA: public
KC_DB_USERNAME: keycloak
KC_DB_PASSWORD: password
# Keycloak authenticates to Postgres as the keycloak role provisioned
# below, so this must be the same value as POSTGRES_PASSWORD. Sourced
# from the single POSTGRES_PASSWORD variable to keep them in lockstep.
KC_DB_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in your .env}
KC_HOSTNAME_ADMIN_URL: http://YOUR_DOMAIN/keycloak/
KC_HOSTNAME_URL: http://YOUR_DOMAIN/keycloak/
KC_HOSTNAME_STRICT_BACKCHANNEL: true
KC_HOSTNAME_STRICT_HTTPS: false
KC_HTTP_ENABLED: true
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD:?set KEYCLOAK_ADMIN_PASSWORD in your .env}
KC_HEALTH_ENABLED: true
KC_METRICS_ENABLED: true
KC_PROXY: edge
@@ -104,7 +107,7 @@ services:
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: password
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in your .env}
restart: unless-stopped
networks:
- default
@@ -24,3 +24,12 @@ localhost/pacs -> Orthanc
See [here](../../../docs/docs/deployment/nginx--image-archive.md) for more information about this recipe.
# Security notes
- CORS: earlier versions of this recipe set `Access-Control-Allow-Origin: *`
on the `/pacs/` proxy. That default has been removed. The viewer is served
by the same nginx as the proxy, so same-origin deployments need no CORS
headers. If you host the viewer on a different origin, set that origin
explicitly in `config/nginx.conf` - never `*` on an endpoint that serves
PHI.
@@ -32,6 +32,15 @@ http {
gzip_comp_level 9;
etag on;
# Content-Security-Policy: test in Report-Only mode first and watch the
# browser console for violations before switching the header name to the
# enforcing Content-Security-Policy. Note: nginx add_header does not merge
# into a location that sets its own add_header - if you promote this to an
# active header, re-declare it inside every location block that already
# uses add_header (the /pacs/ proxy here does) or it will silently not
# apply there.
# add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdnjs.cloudflare.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' https: blob:; worker-src 'self' blob:; object-src 'self' blob:; frame-src 'self' blob:; frame-ancestors 'none'; base-uri 'self'; form-action 'self'" always;
# Reverse Proxy for `orthanc` APIs (including DICOMWeb)
#
@@ -47,17 +56,14 @@ http {
expires 0;
add_header Cache-Control private;
# Add CORS headers
# Note: uncomment the following line to allow all domains to access the Orthanc APIs
# You should actually only allow the domains you trust to access the APIs
# add_header 'Access-Control-Allow-Origin' '*' always;
# CORS: this recipe serves the viewer from this same nginx, so browser
# requests to /pacs/ are same-origin and need NO CORS header at all.
# If you host the viewer on a different origin, allow that origin
# explicitly and only that origin - never use '*' on an endpoint that
# serves PHI. Example:
# add_header 'Access-Control-Allow-Origin' 'https://viewer.example.com' always;
proxy_pass http://orthanc:8042/;
# By default, this endpoint is protected by CORS (cross-origin-resource-sharing)
# You can add headers to allow other domains to request this resource.
# See the "Updating CORS Settings" example below
add_header 'Access-Control-Allow-Origin' '*' always;
}
+6 -1
View File
@@ -15,7 +15,6 @@ const WATCH_IGNORED = /node_modules[\\/](?!@cornerstonejs(?:[\\/]|$))/;
// ~~ Env Vars
const HTML_TEMPLATE = process.env.HTML_TEMPLATE || 'index.html';
const PUBLIC_URL = process.env.PUBLIC_URL || '/';
const APP_CONFIG = process.env.APP_CONFIG || 'config/default.js';
// proxy settings
const PROXY_TARGET = process.env.PROXY_TARGET;
@@ -103,6 +102,12 @@ const setHeaders = (res, path) => {
module.exports = (env, argv) => {
const baseConfig = webpackBase(env, argv, { SRC_DIR, DIST_DIR });
const isProdBuild = process.env.NODE_ENV === 'production';
// Honor an explicit APP_CONFIG; otherwise the dev server gets the
// full-featured `config/dev.js` and a production build the locked-down
// `config/default.js`. This lets `APP_CONFIG=config/foo.js pnpm run dev`
// override the default instead of being clobbered by the script.
const APP_CONFIG =
process.env.APP_CONFIG || (isProdBuild ? 'config/default.js' : 'config/dev.js');
const hasProxy = PROXY_TARGET && PROXY_DOMAIN;
const mergedConfig = merge(baseConfig, {
+1
View File
@@ -0,0 +1 @@
2800f82e3cd02d991146af3f2887fca18c4ab161
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/app",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.115",
"productVersion": "3.4.0",
"description": "OHIF Viewer",
"author": "OHIF Contributors",
@@ -51,7 +51,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "1.2.2",
"@cornerstonejs/codec-openjpeg": "1.3.0",
"@cornerstonejs/codec-openjph": "2.4.7",
"@cornerstonejs/dicom-image-loader": "5.0.2",
"@cornerstonejs/dicom-image-loader": "5.1.3",
"@emotion/serialize": "1.3.3",
"@ohif/core": "workspace:*",
"@ohif/i18n": "workspace:*",
+38 -5
View File
@@ -11,11 +11,44 @@ window.config = {
strictZSpacingForVolumeViewport: true,
// filterQueryParam: false,
// Add some customizations to the default e2e datasource
customizationService: [
'@ohif/extension-default.customizationModule.datasources',
'@ohif/extension-default.customizationModule.helloPage',
],
// Allowlist for the `?customization=` URL parameter and for
// `customizationService.requires` below. The `default` prefix (no slashes)
// resolves a value to `<publicUrl>/customizations/<value>.jsonc`. Files are
// fetched as DATA (JSON with comments) and never executed.
customizationUrlPrefixes: {
default: './customizations/',
},
// Phase-tagged startup customizations. Each block is applied at a fixed point
// in the lifecycle so ordering is deterministic regardless of when extensions
// and modes load:
// - requires: URL customization data files to resolve up front.
// - bootstrap: applied (Global) BEFORE extensions register.
// - global: applied (Global) AFTER extensions register.
// - mode: applied (Mode) on each mode enter — `*` (general) first,
// then a block keyed by the mode id / routeName.
customizationService: {
// Pulls in platform/app/public/customizations/patientBirthDate.jsonc, which
// adds a "Birth Date" column to the WorkList study list (global phase).
requires: ['patientBirthDate'],
// The previous (legacy-array) customizations, now in the explicit `global`
// phase. A `global` block accepts the same input as setCustomizations: an
// array mixing string references and inline object maps.
global: [
'@ohif/extension-default.customizationModule.datasources',
'@ohif/extension-default.customizationModule.helloPage',
],
// Example of mode-scoped customizations (cleared/reapplied per mode):
// the `*` block applies to every mode first; a mode-named block (matched
// against the mode id or routeName, e.g. 'viewer') applies after it.
//
// mode: {
// '*': { 'someCustomizationId': { $set: 'applies to all modes' } },
// viewer: { 'someCustomizationId': { $set: 'overrides for the viewer mode' } },
// },
},
defaultDataSourceName: 'e2e',
investigationalUseDialog: {
+42 -251
View File
@@ -1,5 +1,21 @@
/** @type {AppTypes.Config} */
// Secure, minimal default configuration.
//
// This is what a plain production build with no APP_CONFIG produces, so it is
// deliberately locked down:
// - The local file data source (`dicomlocal`) and the runtime `?url=` sources
// (`dicomjson`, `dicomwebproxy`) are NOT enabled — they widen the attack
// surface of a default deployment.
// - `?customization=` URL loading is OFF: no `customizationUrlPrefixes` are
// configured, so any `?customization=` value is rejected (and aborts boot
// rather than silently loading).
// - `dangerouslyUseDynamicConfig` (the `configUrl` query parameter) is off.
//
// It does not need to "just work" untouched — point the data source below at
// your own DICOMweb server. For a fully-featured setup with every data source
// and customization loading enabled, see config/dev.js (local development) and
// config/netlify.js (the public demo deploy).
window.config = {
name: 'config/default.js',
routerBasename: null,
@@ -7,6 +23,21 @@ window.config = {
extensions: [],
modes: [],
customizationService: {},
// --- URL-driven customizations (?customization=) ----------------------------
// OFF by default. To allow loading customization data files from the URL, set
// `customizationUrlPrefixes` to a map of allowed prefixes. The `default` prefix
// (no slashes) is used for values with no leading slash; every other prefix
// must start AND end with a slash and is matched against the leading
// `/segment/` of the value. Files are fetched and parsed as JSONC data — they
// are never executed. Example (left disabled here on purpose):
//
// customizationUrlPrefixes: {
// default: './customizations/', // ?customization=ctPresets
// '/remote/': 'https://cdn.example.com/ohif-custom/', // ?customization=/remote/siteA
// },
// ----------------------------------------------------------------------------
showStudyList: true,
// some windows systems have issues with more than 3 web workers
maxNumberOfWebWorkers: 3,
@@ -26,81 +57,13 @@ window.config = {
prefetch: 25,
},
showErrorDetails: 'always', // 'always', 'dev', 'production'
// filterQueryParam: false,
// Defines multi-monitor layouts
multimonitor: [
{
id: 'split',
test: ({ multimonitor }) => multimonitor === 'split',
screens: [
{
id: 'ohif0',
screen: null,
location: {
screen: 0,
width: 0.5,
height: 1,
left: 0,
top: 0,
},
options: 'location=no,menubar=no,scrollbars=no,status=no,titlebar=no',
},
{
id: 'ohif1',
screen: null,
location: {
width: 0.5,
height: 1,
left: 0.5,
top: 0,
},
options: 'location=no,menubar=no,scrollbars=no,status=no,titlebar=no',
},
],
},
{
id: '2',
test: ({ multimonitor }) => multimonitor === '2',
screens: [
{
id: 'ohif0',
screen: 0,
location: {
width: 1,
height: 1,
left: 0,
top: 0,
},
options: 'fullscreen=yes,location=no,menubar=no,scrollbars=no,status=no,titlebar=no',
},
{
id: 'ohif1',
screen: 1,
location: {
width: 1,
height: 1,
left: 0,
top: 0,
},
options: 'fullscreen=yes,location=no,menubar=no,scrollbars=no,status=no,titlebar=no',
},
],
},
],
// `dangerouslyUseDynamicConfig` (load configuration from a `configUrl` query
// parameter) is intentionally left OFF in the secure default build. See
// config/dev.js for the documented shape.
defaultDataSourceName: 'ohif',
/* Dynamic config allows user to pass "configUrl" query string this allows to load config without recompiling application. The regex will ensure valid configuration source */
// dangerouslyUseDynamicConfig: {
// enabled: true,
// // regex will ensure valid configuration source and default is /.*/ which matches any character. To use this, setup your own regex to choose a specific source of configuration only.
// // Example 1, to allow numbers and letters in an absolute or sub-path only.
// // regex: /(0-9A-Za-z.]+)(\/[0-9A-Za-z.]+)*/
// // Example 2, to restricts to either hosptial.com or othersite.com.
// // regex: /(https:\/\/hospital.com(\/[0-9A-Za-z.]+)*)|(https:\/\/othersite.com(\/[0-9A-Za-z.]+)*)/
// regex: /.*/,
// },
dataSources: [
{
// Read-only public demo server. Replace with your own DICOMweb server.
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'ohif',
configuration: {
@@ -118,9 +81,6 @@ window.config = {
supportsWildcard: true,
staticWado: true,
singlepart: 'bulkdata,video',
// whether the data source should use retrieveBulkData to grab metadata,
// and in case of relative path, what would it be relative to, options
// are in the series level or study level (some servers like series some study)
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
@@ -130,157 +90,13 @@ window.config = {
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'ohif2',
configuration: {
friendlyName: 'AWS S3 Static wado secondary server',
name: 'aws',
wadoUriRoot: 'https://dd14fa38qiwhyfd.cloudfront.net/dicomweb',
qidoRoot: 'https://dd14fa38qiwhyfd.cloudfront.net/dicomweb',
wadoRoot: 'https://dd14fa38qiwhyfd.cloudfront.net/dicomweb',
qidoSupportsIncludeField: false,
supportsReject: false,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: false,
supportsWildcard: true,
staticWado: true,
singlepart: 'bulkdata,video',
// whether the data source should use retrieveBulkData to grab metadata,
// and in case of relative path, what would it be relative to, options
// are in the series level or study level (some servers like series some study)
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
},
omitQuotationForMultipartRequest: true,
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'ohif3',
configuration: {
friendlyName: 'AWS S3 Static wado secondary server',
name: 'aws',
wadoUriRoot: 'https://d3t6nz73ql33tx.cloudfront.net/dicomweb',
qidoRoot: 'https://d3t6nz73ql33tx.cloudfront.net/dicomweb',
wadoRoot: 'https://d3t6nz73ql33tx.cloudfront.net/dicomweb',
qidoSupportsIncludeField: false,
supportsReject: false,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: false,
supportsWildcard: true,
staticWado: true,
singlepart: 'bulkdata,video',
// whether the data source should use retrieveBulkData to grab metadata,
// and in case of relative path, what would it be relative to, options
// are in the series level or study level (some servers like series some study)
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
},
omitQuotationForMultipartRequest: true,
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'local5000',
configuration: {
friendlyName: 'Static WADO Local Data',
name: 'DCM4CHEE',
qidoRoot: 'http://localhost:5000/dicomweb',
wadoRoot: 'http://localhost:5000/dicomweb',
qidoSupportsIncludeField: false,
supportsReject: true,
supportsStow: true,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: false,
supportsWildcard: true,
staticWado: true,
singlepart: 'video',
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
},
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'orthanc',
configuration: {
friendlyName: 'local Orthanc DICOMWeb Server',
name: 'DCM4CHEE',
wadoUriRoot: 'http://localhost/pacs/dicom-web',
qidoRoot: 'http://localhost/pacs/dicom-web',
wadoRoot: 'http://localhost/pacs/dicom-web',
qidoSupportsIncludeField: true,
supportsReject: true,
dicomUploadEnabled: true,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: true,
supportsWildcard: true,
omitQuotationForMultipartRequest: true,
bulkDataURI: {
enabled: true,
// This is an example config that can be used to fix the retrieve URL
// where it has the wrong prefix (eg a canned prefix). It is better to
// just use the correct prefix out of the box, but that is sometimes hard
// when URLs go through several systems.
// Example URLS are:
// "BulkDataURI" : "http://localhost/dicom-web/studies/1.2.276.0.7230010.3.1.2.2344313775.14992.1458058363.6979/series/1.2.276.0.7230010.3.1.3.1901948703.36080.1484835349.617/instances/1.2.276.0.7230010.3.1.4.1901948703.36080.1484835349.618/bulk/00420011",
// when running on http://localhost:3003 with no server running on localhost. This can be corrected to:
// /orthanc/dicom-web/studies/1.2.276.0.7230010.3.1.2.2344313775.14992.1458058363.6979/series/1.2.276.0.7230010.3.1.3.1901948703.36080.1484835349.617/instances/1.2.276.0.7230010.3.1.4.1901948703.36080.1484835349.618/bulk/00420011
// which is a valid relative URL, and will result in using the http://localhost:3003/orthanc/.... path
// startsWith: 'http://localhost/',
// prefixWith: '/orthanc/',
},
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomwebproxy',
sourceName: 'dicomwebproxy',
configuration: {
friendlyName: 'dicomweb delegating proxy',
name: 'dicomwebproxy',
// Security controls for runtime ?url=... datasource loading:
// In authenticated environments, runtime ?url origins must be allowlisted:
// dangerouslyAllowedOriginsForAuthenticatedEnvironments: [
// 'https://config.example.com',
// 'http://localhost:5000',
// ],
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomjson',
sourceName: 'dicomjson',
configuration: {
friendlyName: 'dicom json',
name: 'json',
// Security controls for runtime ?url=... datasource loading:
// In authenticated environments, runtime ?url origins must be allowlisted:
// dangerouslyAllowedOriginsForAuthenticatedEnvironments: [
// 'https://config.example.com',
// 'http://localhost:5000',
// ],
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomlocal',
sourceName: 'dicomlocal',
configuration: {
friendlyName: 'dicom local',
},
},
// The following data sources are intentionally NOT enabled in the secure
// default because they broaden the attack surface of a default deployment.
// Enable them only in a deployment you control (see config/dev.js):
// - dicomlocal: loads DICOM files from the user's machine.
// - dicomjson: loads metadata from an arbitrary `?url=` (gate with
// `dangerouslyAllowedOriginsForAuthenticatedEnvironments`).
// - dicomwebproxy: delegating proxy driven by `?url=`.
],
httpErrorHandler: error => {
// This is 429 when rejected from the public idc sandbox too often.
@@ -289,29 +105,4 @@ window.config = {
// Could use services manager here to bring up a dialog/modal if needed.
console.warn('test, navigate to https://ohif.org/');
},
// segmentation: {
// segmentLabel: {
// enabledByDefault: true,
// labelColor: [255, 255, 0, 1], // must be an array
// hoverTimeout: 1,
// background: 'rgba(100, 100, 100, 0.5)', // can be any valid css color
// },
// },
// whiteLabeling: {
// createLogoComponentFn: function (React) {
// return React.createElement(
// 'a',
// {
// target: '_self',
// rel: 'noopener noreferrer',
// className: 'text-purple-600 line-through',
// href: '_X___IDC__LOGO__LINK___Y_',
// },
// React.createElement('img', {
// src: './Logo.svg',
// className: 'w-14 h-14',
// })
// );
// },
// },
};
+272
View File
@@ -0,0 +1,272 @@
/** @type {AppTypes.Config} */
// Local development configuration.
//
// This is the default config for the dev server (`pnpm run dev`, `dev:fast`,
// `start`). Like config/netlify.js it is full-featured — every data source is
// enabled and the `?customization=` URL feature is ON via
// `customizationUrlPrefixes` — so the whole app can be exercised locally. The
// locked-down config/default.js is what a plain production build emits instead.
window.config = {
name: 'config/dev.js',
routerBasename: null,
// whiteLabeling: {},
extensions: [],
modes: [],
customizationService: {},
// URL-driven customizations (?customization=). The `default` prefix (no
// slashes) is used for values without a leading slash; every other prefix
// must start AND end with a slash and matches the leading `/segment/` of the
// value. Files are fetched and parsed as JSONC data — never executed.
// e.g. ?customization=ctPresets -> ./customizations/ctPresets.jsonc
customizationUrlPrefixes: {
default: './customizations/',
},
showStudyList: true,
// some windows systems have issues with more than 3 web workers
maxNumberOfWebWorkers: 3,
// below flag is for performance reasons, but it might not work for all servers
showWarningMessageForCrossOrigin: true,
showCPUFallbackMessage: true,
showLoadingIndicator: true,
experimentalStudyBrowserSort: false,
strictZSpacingForVolumeViewport: true,
groupEnabledModesFirst: true,
allowMultiSelectExport: false,
maxNumRequests: {
interaction: 100,
thumbnail: 5,
// Prefetch number is dependent on the http protocol. For http 2 or
// above, the number of requests can be go a lot higher.
prefetch: 25,
},
showErrorDetails: 'always', // 'always', 'dev', 'production'
// filterQueryParam: false,
// Defines multi-monitor layouts
multimonitor: [
{
id: 'split',
test: ({ multimonitor }) => multimonitor === 'split',
screens: [
{
id: 'ohif0',
screen: null,
location: {
screen: 0,
width: 0.5,
height: 1,
left: 0,
top: 0,
},
options: 'location=no,menubar=no,scrollbars=no,status=no,titlebar=no',
},
{
id: 'ohif1',
screen: null,
location: {
width: 0.5,
height: 1,
left: 0.5,
top: 0,
},
options: 'location=no,menubar=no,scrollbars=no,status=no,titlebar=no',
},
],
},
{
id: '2',
test: ({ multimonitor }) => multimonitor === '2',
screens: [
{
id: 'ohif0',
screen: 0,
location: {
width: 1,
height: 1,
left: 0,
top: 0,
},
options: 'fullscreen=yes,location=no,menubar=no,scrollbars=no,status=no,titlebar=no',
},
{
id: 'ohif1',
screen: 1,
location: {
width: 1,
height: 1,
left: 0,
top: 0,
},
options: 'fullscreen=yes,location=no,menubar=no,scrollbars=no,status=no,titlebar=no',
},
],
},
],
defaultDataSourceName: 'ohif',
/* Dynamic config allows user to pass "configUrl" query string this allows to load config without recompiling application. The regex will ensure valid configuration source */
// dangerouslyUseDynamicConfig: {
// enabled: true,
// regex: /.*/,
// },
dataSources: [
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'ohif',
configuration: {
friendlyName: 'AWS S3 Static wado server',
name: 'aws',
wadoUriRoot: 'https://d14fa38qiwhyfd.cloudfront.net/dicomweb',
qidoRoot: 'https://d14fa38qiwhyfd.cloudfront.net/dicomweb',
wadoRoot: 'https://d14fa38qiwhyfd.cloudfront.net/dicomweb',
qidoSupportsIncludeField: false,
imageRendering: 'wadors',
thumbnailRendering: 'thumbnail',
thumbnailRequestStrategy: 'fetch',
enableStudyLazyLoad: true,
supportsFuzzyMatching: true,
supportsWildcard: true,
staticWado: true,
singlepart: 'bulkdata,video',
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
transform: url => url.replace('/pixeldata.mp4', '/rendered'),
},
omitQuotationForMultipartRequest: true,
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'ohif2',
configuration: {
friendlyName: 'AWS S3 Static wado secondary server',
name: 'aws',
wadoUriRoot: 'https://dd14fa38qiwhyfd.cloudfront.net/dicomweb',
qidoRoot: 'https://dd14fa38qiwhyfd.cloudfront.net/dicomweb',
wadoRoot: 'https://dd14fa38qiwhyfd.cloudfront.net/dicomweb',
qidoSupportsIncludeField: false,
supportsReject: false,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: false,
supportsWildcard: true,
staticWado: true,
singlepart: 'bulkdata,video',
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
},
omitQuotationForMultipartRequest: true,
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'ohif3',
configuration: {
friendlyName: 'AWS S3 Static wado secondary server',
name: 'aws',
wadoUriRoot: 'https://d3t6nz73ql33tx.cloudfront.net/dicomweb',
qidoRoot: 'https://d3t6nz73ql33tx.cloudfront.net/dicomweb',
wadoRoot: 'https://d3t6nz73ql33tx.cloudfront.net/dicomweb',
qidoSupportsIncludeField: false,
supportsReject: false,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: false,
supportsWildcard: true,
staticWado: true,
singlepart: 'bulkdata,video',
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
},
omitQuotationForMultipartRequest: true,
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'local5000',
configuration: {
friendlyName: 'Static WADO Local Data',
name: 'DCM4CHEE',
qidoRoot: 'http://localhost:5000/dicomweb',
wadoRoot: 'http://localhost:5000/dicomweb',
qidoSupportsIncludeField: false,
supportsReject: true,
supportsStow: true,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: false,
supportsWildcard: true,
staticWado: true,
singlepart: 'video',
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
},
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'orthanc',
configuration: {
friendlyName: 'local Orthanc DICOMWeb Server',
name: 'DCM4CHEE',
wadoUriRoot: 'http://localhost/pacs/dicom-web',
qidoRoot: 'http://localhost/pacs/dicom-web',
wadoRoot: 'http://localhost/pacs/dicom-web',
qidoSupportsIncludeField: true,
supportsReject: true,
dicomUploadEnabled: true,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: true,
supportsWildcard: true,
omitQuotationForMultipartRequest: true,
bulkDataURI: {
enabled: true,
},
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomwebproxy',
sourceName: 'dicomwebproxy',
configuration: {
friendlyName: 'dicomweb delegating proxy',
name: 'dicomwebproxy',
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomjson',
sourceName: 'dicomjson',
configuration: {
friendlyName: 'dicom json',
name: 'json',
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomlocal',
sourceName: 'dicomlocal',
configuration: {
friendlyName: 'dicom local',
},
},
],
httpErrorHandler: error => {
// This is 429 when rejected from the public idc sandbox too often.
console.warn(error.status);
// Could use services manager here to bring up a dialog/modal if needed.
console.warn('test, navigate to https://ohif.org/');
},
};
+5
View File
@@ -20,6 +20,11 @@ window.config = {
routerBasename: null,
extensions: [],
modes: ['@ohif/mode-test'],
// Allow the `default` prefix so e2e specs can exercise `?customization=` (e.g.
// Customization.spec.ts loads `?customization=veterinaryOverlay`).
customizationUrlPrefixes: {
default: './customizations/',
},
showStudyList: true,
// below flag is for performance reasons, but it might not work for all servers
maxNumberOfWebWorkers: 3,
+119 -28
View File
@@ -1,10 +1,30 @@
/** @type {AppTypes.Config} */
// Public demo / Netlify deploy configuration.
//
// This is the full-featured config used for the Netlify deploy (build:viewer:ci).
// Unlike the locked-down config/default.js, it enables every data source and
// turns the `?customization=` URL feature ON via `customizationUrlPrefixes`.
window.config = {
name: 'config/netlify.js',
routerBasename: null,
// whiteLabeling: {},
extensions: [],
modes: [],
customizationService: ['@ohif/extension-default.customizationModule.theme'],
// URL-driven customizations (?customization=). The `default` prefix (no
// slashes) is used for values without a leading slash; every other prefix
// must start AND end with a slash and matches the leading `/segment/` of the
// value. Files are fetched and parsed as JSONC data — never executed.
// e.g. ?customization=ctPresets -> ./customizations/ctPresets.jsonc
customizationUrlPrefixes: {
default: './customizations/',
},
showStudyList: true,
// some windows systems have issues with more than 3 web workers
maxNumberOfWebWorkers: 3,
// below flag is for performance reasons, but it might not work for all servers
showWarningMessageForCrossOrigin: true,
showCPUFallbackMessage: true,
@@ -12,8 +32,83 @@ window.config = {
experimentalStudyBrowserSort: false,
strictZSpacingForVolumeViewport: true,
groupEnabledModesFirst: true,
allowMultiSelectExport: false,
maxNumRequests: {
interaction: 100,
thumbnail: 5,
// Prefetch number is dependent on the http protocol. For http 2 or
// above, the number of requests can be go a lot higher.
prefetch: 25,
},
showErrorDetails: 'always', // 'always', 'dev', 'production'
// filterQueryParam: false,
// Defines multi-monitor layouts
multimonitor: [
{
id: 'split',
test: ({ multimonitor }) => multimonitor === 'split',
screens: [
{
id: 'ohif0',
screen: null,
location: {
screen: 0,
width: 0.5,
height: 1,
left: 0,
top: 0,
},
options: 'location=no,menubar=no,scrollbars=no,status=no,titlebar=no',
},
{
id: 'ohif1',
screen: null,
location: {
width: 0.5,
height: 1,
left: 0.5,
top: 0,
},
options: 'location=no,menubar=no,scrollbars=no,status=no,titlebar=no',
},
],
},
{
id: '2',
test: ({ multimonitor }) => multimonitor === '2',
screens: [
{
id: 'ohif0',
screen: 0,
location: {
width: 1,
height: 1,
left: 0,
top: 0,
},
options: 'fullscreen=yes,location=no,menubar=no,scrollbars=no,status=no,titlebar=no',
},
{
id: 'ohif1',
screen: 1,
location: {
width: 1,
height: 1,
left: 0,
top: 0,
},
options: 'fullscreen=yes,location=no,menubar=no,scrollbars=no,status=no,titlebar=no',
},
],
},
],
defaultDataSourceName: 'ohif',
/* Dynamic config allows user to pass "configUrl" query string this allows to load config without recompiling application. The regex will ensure valid configuration source */
// dangerouslyUseDynamicConfig: {
// enabled: true,
// regex: /.*/,
// },
dataSources: [
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
@@ -29,13 +124,10 @@ window.config = {
thumbnailRendering: 'thumbnail',
thumbnailRequestStrategy: 'fetch',
enableStudyLazyLoad: true,
supportsFuzzyMatching: false,
supportsFuzzyMatching: true,
supportsWildcard: true,
staticWado: true,
singlepart: 'bulkdata,video',
// whether the data source should use retrieveBulkData to grab metadata,
// and in case of relative path, what would it be relative to, options
// are in the series level or study level (some servers like series some study)
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
@@ -63,9 +155,6 @@ window.config = {
supportsWildcard: true,
staticWado: true,
singlepart: 'bulkdata,video',
// whether the data source should use retrieveBulkData to grab metadata,
// and in case of relative path, what would it be relative to, options
// are in the series level or study level (some servers like series some study)
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
@@ -73,7 +162,6 @@ window.config = {
omitQuotationForMultipartRequest: true,
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'ohif3',
@@ -92,9 +180,6 @@ window.config = {
supportsWildcard: true,
staticWado: true,
singlepart: 'bulkdata,video',
// whether the data source should use retrieveBulkData to grab metadata,
// and in case of relative path, what would it be relative to, options
// are in the series level or study level (some servers like series some study)
bulkDataURI: {
enabled: true,
relativeResolution: 'studies',
@@ -127,6 +212,29 @@ window.config = {
},
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
sourceName: 'orthanc',
configuration: {
friendlyName: 'local Orthanc DICOMWeb Server',
name: 'DCM4CHEE',
wadoUriRoot: 'http://localhost/pacs/dicom-web',
qidoRoot: 'http://localhost/pacs/dicom-web',
wadoRoot: 'http://localhost/pacs/dicom-web',
qidoSupportsIncludeField: true,
supportsReject: true,
dicomUploadEnabled: true,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
supportsFuzzyMatching: true,
supportsWildcard: true,
omitQuotationForMultipartRequest: true,
bulkDataURI: {
enabled: true,
},
},
},
{
namespace: '@ohif/extension-default.dataSourcesModule.dicomwebproxy',
@@ -160,20 +268,3 @@ window.config = {
console.warn('test, navigate to https://ohif.org/');
},
};
function waitForElement(selector, maxAttempts = 20, interval = 25) {
return new Promise(resolve => {
let attempts = 0;
const checkForElement = setInterval(() => {
const element = document.querySelector(selector);
if (element || attempts >= maxAttempts) {
clearInterval(checkForElement);
resolve();
}
attempts++;
}, interval);
});
}
@@ -0,0 +1,21 @@
// Example URL-loaded customization: ctPresets
//
// Replaces the CT window/level presets offered in the window-level menu with a
// site-specific set (key: `cornerstone.windowLevelPresets`). Other modalities
// keep their defaults because only the `CT` entry is overridden.
//
// Load it with `?customization=ctPresets`.
{
"global": {
"cornerstone.windowLevelPresets": {
"$merge": {
"CT": [
{ "id": "ct-soft-tissue", "description": "Soft tissue", "window": "400", "level": "40" },
{ "id": "ct-lung", "description": "Lung", "window": "1500", "level": "-600" },
{ "id": "ct-angio", "description": "Angio", "window": "600", "level": "300" },
{ "id": "ct-bone", "description": "Bone", "window": "2500", "level": "480" }
]
}
}
}
}
@@ -0,0 +1,23 @@
// Example URL-loaded customization: measurementLabels
//
// Makes the viewer prompt for a label from a fixed list whenever a measurement
// is created (key: `measurementLabels`). `labelOnMeasure` triggers the prompt on
// creation and `exclusive` restricts entries to the provided items.
//
// Load it with `?customization=measurementLabels`.
{
"global": {
"measurementLabels": {
"$set": {
"labelOnMeasure": true,
"exclusive": true,
"items": [
{ "value": "Head", "label": "Head" },
{ "value": "Shoulder", "label": "Shoulder" },
{ "value": "Knee", "label": "Knee" },
{ "value": "Toe", "label": "Toe" }
]
}
}
}
}
@@ -0,0 +1,34 @@
// Example URL-loaded customization: patientBirthDate
//
// Adds a "Birth Date" column to the WorkList study list, right after the
// Patient column. Because a URL customization file is DATA (never executed), it
// cannot carry a render function — it inserts a plain, serializable column spec
// (`id` + `meta`) and WorkList expands it into a display-only text column that
// reads `row.patientBirthDate` (surfaced by the DICOMweb data source from DICOM
// tag 00100030).
//
// This applies in the `global` phase, so it is in place before the WorkList
// renders. Load it with `?customization=patientBirthDate`, or pull it in from
// `appConfig.customizationService.requires`.
{
"global": {
"workList.columns": {
// Insert at index 1 (immediately after the Patient column). Using a
// fixed index keeps the trailing `actions` column last.
"$splice": [
[
1,
0,
{
"id": "patientBirthDate",
"meta": {
"label": "Birth Date",
"minWidth": 130,
"priority": 40
}
}
]
]
}
}
}
@@ -0,0 +1,42 @@
// Example URL-loaded customization: smoothRotate
//
// Adds a "Smooth Rotate" tool button to the More Tools menu of the basic and
// longitudinal viewers. It activates the cornerstone `PlanarRotate` tool, which
// rotates the image freely as you drag (unlike the fixed 90° "Rotate Right").
//
// It extends the default toolbar customizations registered by the cornerstone
// extension (`cornerstone.toolbarButtons` / `cornerstone.toolbarSections`) using
// immutability-helper `$push` commands, so the built-in buttons are preserved.
//
// Load it with `?customization=smoothRotate`.
{
"global": {
"cornerstone.toolbarButtons": {
"$push": [
{
"id": "SmoothRotate",
"uiType": "ohif.toolButton",
"props": {
"type": "tool",
// Re-use the existing rotate icon.
"icon": "tool-rotate-right",
"label": "Smooth Rotate",
"tooltip": "Smooth Rotate (drag to rotate the image freely)",
"commands": {
"commandName": "setToolActiveToolbar",
"commandOptions": {
"toolName": "PlanarRotate"
}
},
"evaluate": "evaluate.cornerstoneTool"
}
}
]
},
"cornerstone.toolbarSections": {
"MoreTools": {
"$push": ["SmoothRotate"]
}
}
}
}
@@ -0,0 +1,5 @@
// Example chaining module: ensures `veterinaryOverlay` is loaded and applied
// first when using `?customization=veterinary` alone.
{
"requires": ["veterinaryOverlay"]
}
@@ -0,0 +1,56 @@
// Example URL-loaded customization: veterinaryOverlay
//
// Demonstrates a runtime-loaded customization that overrides the default
// viewport overlay with a veterinary-style demographics layout. Loaded via
// `?customization=veterinaryOverlay` (see CustomizationService URL handling).
//
// Uses the same `global`-at-top-level shape as the cornerstone overlay samples
// and `inheritsFrom: 'ohif.overlayItem'` on each row, matching
// extensions/cornerstone/.../viewportOverlayCustomization.tsx.
{
"global": {
"viewportOverlay.topLeft": {
"$set": [
{
"id": "PatientName",
"inheritsFrom": "ohif.overlayItem",
"attribute": "PatientName",
"label": "Patient",
"title": "Patient name"
},
{
"id": "PatientID",
"inheritsFrom": "ohif.overlayItem",
"attribute": "PatientID",
"label": "ID",
"title": "Patient ID"
},
{
"id": "StudyDate",
"inheritsFrom": "ohif.overlayItem",
"attribute": "StudyDate",
"label": "Date",
"title": "Study date"
}
]
},
"viewportOverlay.topRight": {
"$set": [
{
"id": "PatientSpecies",
"inheritsFrom": "ohif.overlayItem",
"attribute": "PatientSpecies",
"label": "Species",
"title": "Patient species"
},
{
"id": "PatientBreed",
"inheritsFrom": "ohif.overlayItem",
"attribute": "PatientBreed",
"label": "Breed",
"title": "Patient breed"
}
]
}
}
}
@@ -1,6 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<!--
Content-Security-Policy is delivered via hosting headers (netlify.toml
for Netlify deploys; commented add_header examples in the nginx
recipes under platform/app/.recipes), not as a meta tag: a meta tag
cannot express Report-Only mode. See the deployment docs
(docs/deployment) for the policy and the criteria for promoting it
from Report-Only to enforcing.
-->
<meta charset="UTF-8" />
<meta
name="viewport"
+2 -3
View File
@@ -110,7 +110,6 @@ function App({
cineService,
userAuthenticationService,
uiNotificationService,
customizationService,
} = servicesManager.services;
const providers = [
@@ -142,8 +141,8 @@ function App({
let authRoutes = null;
// Should there be a generic call to init on the extension manager?
customizationService.init(extensionManager);
// customizationService.init(extensionManager) runs in appInit after extensions register;
// do not call init again here — repeated init would duplicate-merge unless guarded (see CustomizationService.init).
// Use config to create routes
const appRoutes = createRoutes({
+18 -1
View File
@@ -28,7 +28,7 @@ import loadModules, { loadModule as peerImport } from './pluginImports';
import { publicUrl } from './utils/publicUrl';
/**
* @param {object|func} appConfigOrFunc - application configuration, or a function that returns application configuration
* @param {object|function} appConfigOrFunc - application configuration, or a function that returns application configuration
* @param {object[]} defaultExtensions - array of extension objects
*/
async function appInit(appConfigOrFunc, defaultExtensions, defaultModes) {
@@ -91,8 +91,25 @@ async function appInit(appConfigOrFunc, defaultExtensions, defaultModes) {
* Example2: [[ext1, config], ext2, [ext3, config]]
*/
const loadedExtensions = await loadModules([...defaultExtensions, ...appConfig.extensions]);
const { customizationService } = servicesManager.services;
// Resolve every customization module up front — from
// `appConfig.customizationService.requires` and the `?customization=` URL
// parameter — long before any mode loads, then apply the `bootstrap` phase
// BEFORE extensions register so it is in place while they initialize. Modules
// are only loaded when `appConfig.customizationUrlPrefixes` allows their
// prefix; the feature is off by default, and a value with an unconfigured
// prefix throws here (aborting startup) rather than being silently ignored.
await customizationService.loadAndApplyBootstrapCustomizations(extensionManager);
await extensionManager.registerExtensions(loadedExtensions, appConfig.dataSources);
// Merge extension default/global modules, then layer on the `global` phase of
// the structured config + the URL modules resolved above (so `$apply`-style
// overrides see the extension-provided defaults they build on).
customizationService.init(extensionManager);
customizationService.applyGlobalCustomizations();
// TODO: We no longer use `utils.addServer`
// TODO: We no longer init webWorkers at app level
// TODO: We no longer init the user Manager
@@ -175,7 +175,9 @@ function parseFiltersFromURL(params: URLSearchParams): ColumnFiltersState {
* Build URL query string from study list state preserving key query parameters.
*/
function buildQueryFromState(state: StudyListState): string {
const query: Record<string, string> = {};
// preserveQueryStrings may write repeated values as arrays, so the value type
// must allow string[] in addition to string.
const query: Record<string, string | string[]> = {};
// Sorting
if (state.sorting.length > 0) {
+6
View File
@@ -221,6 +221,12 @@ export default function ModeRoute({
appConfig,
});
// `extensionManager.onModeEnter` resets the customization mode scope via
// `customizationService.onModeEnter`; now layer on the `mode` phase blocks
// for this mode — the general (`*`) block first, then any block keyed by
// this mode's id / routeName so a single mode can override the general one.
customizationService.applyModeCustomizations([mode.id, mode.routeName]);
// use the URL hangingProtocolId if it exists, otherwise use the one
// defined in the mode configuration
const hangingProtocolIdToUse = hangingProtocolService.getProtocolById(
@@ -15,7 +15,7 @@ const NotFound = ({
return (
<div className="absolute flex h-full w-full items-center justify-center bg-background">
<div className="flex flex-col">
<div className="bg-background flex items-center justify-center rounded-t-2xl p-6">
<div className="bg-background flex items-center justify-center rounded-t-2xl p-6 text-primary">
<Icons.IllustrationNotFound />
</div>
<div className="bg-input h-px" />
@@ -30,7 +30,7 @@ export function defaultSettingsMenuItems({
const items: SettingsMenuItem[] = [
{
id: 'about',
label: 'About OHIF Viewer',
label: t('Header:About'),
onClick: () => {
const AboutModal = customizationService.getCustomization('ohif.aboutModal');
show({
@@ -42,7 +42,7 @@ export function defaultSettingsMenuItems({
},
{
id: 'userPreferences',
label: 'User Preferences',
label: t('Header:Preferences'),
onClick: () => {
const UserPreferencesModal = customizationService.getCustomization(
'ohif.userPreferencesModal'
@@ -57,6 +57,21 @@ export function defaultSettingsMenuItems({
},
];
const AppearanceModal = customizationService.getCustomization('ohif.appearanceModal');
if (AppearanceModal) {
items.splice(1, 0, {
id: 'appearance',
label: AppearanceModal.menuTitle ?? t('Header:Appearance'),
onClick: () => {
show({
content: AppearanceModal,
title: AppearanceModal.title ?? t('AppearanceModal:Appearance'),
containerClassName: AppearanceModal.containerClassName ?? 'max-w-md',
});
},
});
}
if (appConfig.oidc) {
items.push({
id: 'logout',
@@ -107,7 +122,7 @@ export function StudyListSettingsPopover() {
>
<Icons.SettingsStudyList
aria-hidden="true"
className="h-4 w-4"
className="text-primary h-4 w-4"
/>
</Button>
</StudyList.SettingsPopover.Trigger>
+11 -2
View File
@@ -51,7 +51,16 @@ export default function WorkList({
// `workList.columns` is registered as a value (StudyList.defaultColumns) and
// merged via customization commands, so we read the result directly.
const customized = customizationService.getCustomization('workList.columns');
return Array.isArray(customized) ? customized : StudyList.defaultColumns;
const resolved = Array.isArray(customized) ? customized : StudyList.defaultColumns;
// Expand data-only column specs. A `?customization=` JSONC file (or any
// serializable source) cannot carry render functions, so an entry that has
// an `id` but no `accessorFn`/`cell` is turned into a display-only text
// column that reads `row[id]` — matching `StudyList.textColumn`.
return resolved.map((col: any) =>
col && typeof col === 'object' && col.id && !col.accessorFn && !col.cell
? StudyList.textColumn(col.id, col.meta?.label ?? col.id, col.meta)
: col
);
}, [customizationService]);
const logoComponent = appConfig?.whiteLabeling?.createLogoComponentFn?.(React) ?? (
@@ -107,7 +116,7 @@ export default function WorkList({
isLoading={showStudyListLoading}
loadingComponent={
LoadingIndicatorProgress ? (
<LoadingIndicatorProgress className="!relative bg-black" />
<LoadingIndicatorProgress className="bg-background !relative" />
) : (
<div className="h-8 w-8" />
)
Loaded 100 of 320 files, more files were not shown because too many files have changed in this diff. Show more