Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
973631b7e8 | ||
|
|
e0f42d4f1d | ||
|
|
2800f82e3c | ||
|
|
38214f26de | ||
|
|
cb6cdafd24 | ||
|
|
aa1ba771e0 | ||
|
|
d4153f12b2 | ||
|
|
71c50db9b5 | ||
|
|
4cdcd34a33 | ||
|
|
0dfd321326 |
No files matched your search
@@ -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,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/extension-cornerstone-dicom-pmap",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"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,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/extension-cornerstone-dicom-rt",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "DICOM RT read workflow",
|
||||
"author": "OHIF",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/extension-cornerstone-dicom-seg",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"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": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/extension-cornerstone-dicom-sr",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"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.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"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": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/extension-cornerstone",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"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",
|
||||
|
||||
@@ -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,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/extension-default",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "Common/default features and functionality for basic image viewing",
|
||||
"author": "OHIF Core Team",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
@@ -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,
|
||||
|
||||
@@ -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,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/extension-dicom-microscopy",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "OHIF extension for DICOM microscopy",
|
||||
"author": "Bill Wallace, md-prog",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/extension-dicom-pdf",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"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,
|
||||
|
||||
@@ -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,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/extension-dicom-video",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"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),
|
||||
|
||||
@@ -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;
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/extension-measurement-tracking",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"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,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/extension-test",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "OHIF extension used inside e2e testing",
|
||||
"author": "OHIF",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/extension-tmtv",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "OHIF extension for Total Metabolic Tumor Volume",
|
||||
"author": "OHIF",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/extension-ultrasound-pleura-bline",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"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,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/mode-basic-dev-mode",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "Basic OHIF Viewer Using Cornerstone",
|
||||
"author": "OHIF",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -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,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/mode-test",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "Basic mode for testing",
|
||||
"author": "OHIF",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -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,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/mode-basic",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "A basic mode used to build other modes on top of",
|
||||
"author": "OHIF Contributors",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -44,7 +44,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 = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/mode-longitudinal",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "Longitudinal Workflow",
|
||||
"author": "OHIF",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/mode-microscopy",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "OHIF mode for DICOM microscopy",
|
||||
"author": "OHIF",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -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,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/mode-preclinical-4d",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "4D Workflow",
|
||||
"author": "OHIF",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/mode-segmentation",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "OHIF segmentation mode which enables labelmap segmentation read/edit/export",
|
||||
"author": "@ohif",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/mode-tmtv",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "Total Metabolic Tumor Volume Workflow",
|
||||
"author": "OHIF",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/mode-ultrasound-pleura-bline",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"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:*",
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
+1
-1
@@ -124,5 +124,5 @@
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"version": "3.13.0-beta.106"
|
||||
"version": "3.13.0-beta.111"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/app",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"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:*",
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
window.config = {
|
||||
routerBasename: null,
|
||||
customizationService: [
|
||||
'@ohif/extension-default.customizationModule.theme',
|
||||
],
|
||||
extensions: [],
|
||||
modes: [],
|
||||
showStudyList: true,
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/cli",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "A CLI to bootstrap new OHIF extension or mode",
|
||||
"type": "module",
|
||||
"main": "src/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/core",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "Generic business logic for web-based medical imaging applications",
|
||||
"author": "OHIF Core Team",
|
||||
"license": "MIT",
|
||||
@@ -35,9 +35,9 @@
|
||||
"@cornerstonejs/codec-libjpeg-turbo-8bit": "1.2.2",
|
||||
"@cornerstonejs/codec-openjpeg": "1.3.0",
|
||||
"@cornerstonejs/codec-openjph": "2.4.7",
|
||||
"@cornerstonejs/core": "5.0.2",
|
||||
"@cornerstonejs/dicom-image-loader": "5.0.2",
|
||||
"@cornerstonejs/metadata": "5.0.2",
|
||||
"@cornerstonejs/core": "5.1.3",
|
||||
"@cornerstonejs/dicom-image-loader": "5.1.3",
|
||||
"@cornerstonejs/metadata": "5.1.3",
|
||||
"@ohif/ui": "workspace:*",
|
||||
"cornerstone-math": "0.1.10",
|
||||
"dicom-parser": "1.8.21"
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
---
|
||||
sidebar_position: 8
|
||||
sidebar_label: DICOM video viewport
|
||||
title: DICOM video viewport migration
|
||||
---
|
||||
|
||||
# DICOM video viewport migration
|
||||
|
||||
The `@ohif/extension-dicom-video` extension no longer provides its own viewport module in 3.13. DICOM video rendering is handled by the Cornerstone viewport, which supports Cornerstone3D video viewports directly.
|
||||
|
||||
The DICOM video SOP class handler remains available and should still be used to identify and build video display sets:
|
||||
|
||||
```ts
|
||||
'@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video'
|
||||
```
|
||||
|
||||
## What changed
|
||||
|
||||
The following viewport namespace has been removed:
|
||||
|
||||
```ts
|
||||
'@ohif/extension-dicom-video.viewportModule.dicom-video'
|
||||
```
|
||||
|
||||
Use the Cornerstone viewport namespace instead:
|
||||
|
||||
```ts
|
||||
'@ohif/extension-cornerstone.viewportModule.cornerstone'
|
||||
```
|
||||
|
||||
## Migration
|
||||
|
||||
If your mode has a dedicated DICOM video viewport entry, replace it with the Cornerstone viewport or add the video SOP class handler to an existing Cornerstone viewport entry.
|
||||
|
||||
**Before (3.12):**
|
||||
|
||||
```ts
|
||||
const dicomvideo = {
|
||||
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
|
||||
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
|
||||
};
|
||||
|
||||
viewports: [
|
||||
{
|
||||
namespace: '@ohif/extension-cornerstone.viewportModule.cornerstone',
|
||||
displaySetsToDisplay: [ohif.sopClassHandler],
|
||||
},
|
||||
{
|
||||
namespace: dicomvideo.viewport,
|
||||
displaySetsToDisplay: [dicomvideo.sopClassHandler],
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
**After (3.13):**
|
||||
|
||||
```ts
|
||||
const dicomvideo = {
|
||||
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
|
||||
};
|
||||
|
||||
viewports: [
|
||||
{
|
||||
namespace: '@ohif/extension-cornerstone.viewportModule.cornerstone',
|
||||
displaySetsToDisplay: [ohif.sopClassHandler, dicomvideo.sopClassHandler],
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
If your mode uses a custom viewport that wraps `OHIFCornerstoneViewport` (for example, a tracked Cornerstone viewport), route DICOM video display sets through that wrapper instead of the removed DICOM video viewport namespace.
|
||||
|
||||
## Why
|
||||
|
||||
Keeping video rendering in the Cornerstone viewport avoids a separate custom React video viewport path and keeps video behavior aligned with Cornerstone3D viewport services, tools, annotations, and presentation state handling.
|
||||
@@ -23,5 +23,8 @@ The largest changes in 3.13 are infrastructure-level:
|
||||
is now **24**.
|
||||
- **[SegmentationService](./segmentation-service.md)** — the
|
||||
`removeSegmentationRepresentations` method was renamed.
|
||||
- **[DICOM video viewport](./dicom-video.md)** — the
|
||||
`@ohif/extension-dicom-video.viewportModule.dicom-video` namespace was
|
||||
removed; route DICOM video display sets through the Cornerstone viewport.
|
||||
|
||||
<DocCardList />
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ohif-docs",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/i18n",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "Internationalization library for The OHIF Viewer",
|
||||
"author": "OHIF",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"Appearance": "Appearance",
|
||||
"Theme": "Theme",
|
||||
"Default Theme": "Tonal: OHIF Blue",
|
||||
"Custom": "Custom",
|
||||
"Custom Theme": "Custom Theme",
|
||||
"Hide": "Hide",
|
||||
"Apply": "Apply",
|
||||
"Clear": "Clear",
|
||||
"No valid theme tokens found": "No valid theme tokens found. Expected lines like --primary: 220 90% 60%",
|
||||
"Paste your custom theme color tokens here": "Paste your custom theme color tokens here"
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"About": "About",
|
||||
"Appearance": "Appearance",
|
||||
"Back to Viewer": "Back to Viewer",
|
||||
"INVESTIGATIONAL USE ONLY": "INVESTIGATIONAL USE ONLY",
|
||||
"Options": "Options",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import AboutModal from './AboutModal.json';
|
||||
import AppearanceModal from './AppearanceModal.json';
|
||||
import Buttons from './Buttons.json';
|
||||
import CineDialog from './CineDialog.json';
|
||||
import Common from './Common.json';
|
||||
@@ -36,6 +37,7 @@ import USAnnotationPanel from './USAnnotationPanel.json';
|
||||
export default {
|
||||
'en-US': {
|
||||
AboutModal,
|
||||
AppearanceModal,
|
||||
Buttons,
|
||||
CineDialog,
|
||||
Common,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/ui-next",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "Next version of OHIF Viewers UI, more customizable using shadcn/ui",
|
||||
"author": "OHIF",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import * as React from 'react';
|
||||
import { cn } from '../../lib/utils';
|
||||
|
||||
interface AppearanceModalProps {
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function AppearanceModal({ children, className }: AppearanceModalProps) {
|
||||
return (
|
||||
<div className={cn('flex max-h-[80vh] w-full max-w-md flex-col overflow-hidden', className)}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
interface BodyProps {
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
function Body({ children, className }: BodyProps) {
|
||||
return (
|
||||
<div className={cn('flex-1 overflow-y-auto', className)}>
|
||||
<div className="mt-1 mb-4 flex flex-col space-y-4">{children}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
interface SectionLabelProps {
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
function SectionLabel({ children, className }: SectionLabelProps) {
|
||||
return <span className={cn('text-muted-foreground text-lg', className)}>{children}</span>;
|
||||
}
|
||||
|
||||
AppearanceModal.Body = Body;
|
||||
AppearanceModal.SectionLabel = SectionLabel;
|
||||
@@ -1,3 +1,4 @@
|
||||
export { UserPreferencesModal } from './UserPreferencesModal';
|
||||
export { ImageModal } from './ImageModal';
|
||||
export { AboutModal } from './AboutModal';
|
||||
export { AppearanceModal } from './AppearanceModal';
|
||||
@@ -69,7 +69,7 @@ import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from './Tool
|
||||
import { ToolboxUI } from './OHIFToolbox';
|
||||
import Numeric from './Numeric';
|
||||
import { InputDialog, PresetDialog } from './OHIFDialogs';
|
||||
import { AboutModal, ImageModal, UserPreferencesModal } from './OHIFModals';
|
||||
import { AboutModal, ImageModal, UserPreferencesModal, AppearanceModal } from './OHIFModals';
|
||||
import Modal from './Modal/Modal';
|
||||
import { FooterAction } from './FooterAction';
|
||||
import { InputFilter } from './InputFilter';
|
||||
@@ -296,6 +296,7 @@ export {
|
||||
AboutModal,
|
||||
ImageModal,
|
||||
UserPreferencesModal,
|
||||
AppearanceModal,
|
||||
FooterAction,
|
||||
ToolSettings,
|
||||
InputFilter,
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
import * as React from 'react';
|
||||
import '../themes/themes.css';
|
||||
import { themePresets } from '../themes';
|
||||
|
||||
const STORAGE_KEY_THEME = 'ohif:theme';
|
||||
const STORAGE_KEY_CUSTOM_CSS = 'ohif:custom-theme-css';
|
||||
const CUSTOM_STYLE_ID = 'ohif-custom-theme';
|
||||
const VALID_THEMES = new Set(['default', 'custom', ...themePresets.map(p => p.name)]);
|
||||
|
||||
type ActiveThemeContextType = {
|
||||
activeTheme: string;
|
||||
setActiveTheme: (theme: string) => void;
|
||||
customCss: string;
|
||||
applyCustomTheme: (cssText: string) => boolean;
|
||||
clearCustomTheme: () => void;
|
||||
};
|
||||
|
||||
// 'custom' is deliberately not URL-addressable: the CSS behind it lives only in
|
||||
// the visitor's own localStorage, so a ?theme=custom link cannot reproduce a look
|
||||
// and would only strand the app in a custom state with no CSS behind it.
|
||||
function isValidUrlTheme(theme: string | null): theme is string {
|
||||
return !!theme && theme !== 'custom' && VALID_THEMES.has(theme);
|
||||
}
|
||||
|
||||
const ActiveThemeContext = React.createContext<ActiveThemeContextType | undefined>(undefined);
|
||||
|
||||
function removeThemeClasses() {
|
||||
const classList = document.body.classList;
|
||||
const toRemove: string[] = [];
|
||||
classList.forEach(cls => {
|
||||
if (cls.startsWith('theme-')) {
|
||||
toRemove.push(cls);
|
||||
}
|
||||
});
|
||||
toRemove.forEach(cls => classList.remove(cls));
|
||||
}
|
||||
|
||||
function removeCustomStyleElement() {
|
||||
const style = document.getElementById(CUSTOM_STYLE_ID);
|
||||
if (style) {
|
||||
style.remove();
|
||||
}
|
||||
}
|
||||
|
||||
function parseCssVars(cssText: string): string[] {
|
||||
const vars: string[] = [];
|
||||
|
||||
// Remove comment spans entirely (text included), then any unterminated tail,
|
||||
// so comment contents never bleed into a variable value.
|
||||
const stripped = cssText.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\/\*[\s\S]*$/, '');
|
||||
|
||||
// Split on newlines AND semicolons so single-line/minified CSS parses too.
|
||||
for (const raw of stripped.split(/[\n;]/)) {
|
||||
let line = raw.trim();
|
||||
|
||||
// Tolerate a selector prefix on the same segment, e.g. ":root {" or ".dark{".
|
||||
const braceIdx = line.lastIndexOf('{');
|
||||
if (braceIdx !== -1) {
|
||||
line = line.slice(braceIdx + 1).trim();
|
||||
}
|
||||
|
||||
const colonIdx = line.indexOf(':');
|
||||
if (colonIdx === -1) continue;
|
||||
|
||||
const name = line.slice(0, colonIdx).trim();
|
||||
if (!/^--[a-zA-Z0-9-]+$/.test(name)) continue;
|
||||
|
||||
const value = line
|
||||
.slice(colonIdx + 1)
|
||||
.replace(/[{}]/g, '')
|
||||
.trim();
|
||||
if (!value) continue;
|
||||
|
||||
// Token values are plain HSL triplets — parentheses are never legitimate,
|
||||
// and rejecting them keeps url(...) out of the injected stylesheet even if
|
||||
// a future rule ever consumes a token outside hsl().
|
||||
if (value.includes('(') || value.includes(')')) continue;
|
||||
|
||||
vars.push(` ${name}: ${value};`);
|
||||
}
|
||||
|
||||
return vars;
|
||||
}
|
||||
|
||||
function injectCustomStyles(vars: string[]) {
|
||||
const block = vars.join('\n');
|
||||
const css = `:root {\n${block}\n}\n.dark {\n${block}\n}`;
|
||||
|
||||
let style = document.getElementById(CUSTOM_STYLE_ID) as HTMLStyleElement | null;
|
||||
if (!style) {
|
||||
style = document.createElement('style');
|
||||
style.id = CUSTOM_STYLE_ID;
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
style.textContent = css;
|
||||
}
|
||||
|
||||
export function ActiveThemeProvider({ children }: { children: React.ReactNode }) {
|
||||
const [activeTheme, setActiveThemeState] = React.useState<string>(() => {
|
||||
if (typeof window === 'undefined') return 'default';
|
||||
const urlTheme = new URLSearchParams(window.location.search).get('theme');
|
||||
if (isValidUrlTheme(urlTheme)) return urlTheme;
|
||||
|
||||
// Validate the stored value the same way the URL param is validated — a stale
|
||||
// key (renamed preset, older build) must not become a theme-* body class.
|
||||
const stored = localStorage.getItem(STORAGE_KEY_THEME);
|
||||
if (!stored || !VALID_THEMES.has(stored)) return 'default';
|
||||
if (stored === 'custom' && !localStorage.getItem(STORAGE_KEY_CUSTOM_CSS)) return 'default';
|
||||
return stored;
|
||||
});
|
||||
|
||||
const [customCss, setCustomCssState] = React.useState<string>(() => {
|
||||
if (typeof window === 'undefined') return '';
|
||||
return localStorage.getItem(STORAGE_KEY_CUSTOM_CSS) || '';
|
||||
});
|
||||
|
||||
const setActiveTheme = React.useCallback((theme: string) => {
|
||||
if (!VALID_THEMES.has(theme)) return;
|
||||
|
||||
setActiveThemeState(theme);
|
||||
removeThemeClasses();
|
||||
|
||||
if (theme !== 'default' && theme !== 'custom') {
|
||||
document.body.classList.add(`theme-${theme}`);
|
||||
}
|
||||
|
||||
if (theme !== 'custom') {
|
||||
removeCustomStyleElement();
|
||||
}
|
||||
|
||||
if (theme === 'default') {
|
||||
localStorage.removeItem(STORAGE_KEY_THEME);
|
||||
} else {
|
||||
localStorage.setItem(STORAGE_KEY_THEME, theme);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const applyCustomTheme = React.useCallback((cssText: string): boolean => {
|
||||
const vars = parseCssVars(cssText);
|
||||
if (vars.length === 0) return false;
|
||||
|
||||
injectCustomStyles(vars);
|
||||
|
||||
setCustomCssState(cssText);
|
||||
localStorage.setItem(STORAGE_KEY_CUSTOM_CSS, cssText);
|
||||
|
||||
setActiveThemeState('custom');
|
||||
removeThemeClasses();
|
||||
localStorage.setItem(STORAGE_KEY_THEME, 'custom');
|
||||
return true;
|
||||
}, []);
|
||||
|
||||
const clearCustomTheme = React.useCallback(() => {
|
||||
removeCustomStyleElement();
|
||||
|
||||
setCustomCssState('');
|
||||
localStorage.removeItem(STORAGE_KEY_CUSTOM_CSS);
|
||||
|
||||
setActiveThemeState('default');
|
||||
removeThemeClasses();
|
||||
localStorage.removeItem(STORAGE_KEY_THEME);
|
||||
}, []);
|
||||
|
||||
// Persist URL param override to localStorage
|
||||
React.useEffect(() => {
|
||||
const urlTheme = new URLSearchParams(window.location.search).get('theme');
|
||||
if (isValidUrlTheme(urlTheme)) {
|
||||
if (urlTheme === 'default') {
|
||||
localStorage.removeItem(STORAGE_KEY_THEME);
|
||||
} else {
|
||||
localStorage.setItem(STORAGE_KEY_THEME, urlTheme);
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Apply initial theme on mount (including custom theme re-injection on reload)
|
||||
React.useEffect(() => {
|
||||
if (activeTheme === 'custom' && customCss) {
|
||||
applyCustomTheme(customCss);
|
||||
} else if (activeTheme !== 'default') {
|
||||
document.body.classList.add(`theme-${activeTheme}`);
|
||||
}
|
||||
|
||||
return () => {
|
||||
removeThemeClasses();
|
||||
removeCustomStyleElement();
|
||||
};
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
const value = React.useMemo(
|
||||
() => ({ activeTheme, setActiveTheme, customCss, applyCustomTheme, clearCustomTheme }),
|
||||
[activeTheme, setActiveTheme, customCss, applyCustomTheme, clearCustomTheme]
|
||||
);
|
||||
|
||||
return <ActiveThemeContext.Provider value={value}>{children}</ActiveThemeContext.Provider>;
|
||||
}
|
||||
|
||||
export function useActiveTheme() {
|
||||
const context = React.useContext(ActiveThemeContext);
|
||||
if (context === undefined) {
|
||||
throw new Error('useActiveTheme must be used within an ActiveThemeProvider');
|
||||
}
|
||||
return context;
|
||||
}
|
||||
@@ -21,3 +21,6 @@ export { ImageViewerContext, ImageViewerProvider, useImageViewer };
|
||||
export { DragAndDropProvider };
|
||||
export { CineProvider, useCine };
|
||||
export { IconPresentationProvider, useIconPresentation } from './IconPresentationProvider';
|
||||
export { ActiveThemeProvider, useActiveTheme } from './ActiveThemeProvider';
|
||||
export { themePresets } from '../themes';
|
||||
export type { ThemePreset } from '../themes';
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "arctic",
|
||||
"label": "Tonal: Arctic",
|
||||
"cssVars": {
|
||||
"dark": {
|
||||
"highlight": "173 81% 52%",
|
||||
"neutral": "185 20% 55%",
|
||||
"neutral-light": "180 40% 78%",
|
||||
"neutral-dark": "190 18% 22%",
|
||||
"background": "0 0% 0%",
|
||||
"foreground": "180 10% 97%",
|
||||
"card": "203 39% 9%",
|
||||
"card-foreground": "180 10% 97%",
|
||||
"popover": "202 54% 11%",
|
||||
"popover-foreground": "180 10% 97%",
|
||||
"primary": "175 85% 42%",
|
||||
"primary-foreground": "185 50% 8%",
|
||||
"secondary": "180 45% 28%",
|
||||
"secondary-foreground": "175 50% 88%",
|
||||
"muted": "203 39% 9%",
|
||||
"muted-foreground": "185 30% 60%",
|
||||
"accent": "185 55% 18%",
|
||||
"accent-foreground": "180 10% 97%",
|
||||
"destructive": "0 65% 35%",
|
||||
"destructive-foreground": "0 0% 98%",
|
||||
"border": "190 25% 17%",
|
||||
"input": "223 40% 24%",
|
||||
"ring": "175 85% 42%"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "deep",
|
||||
"label": "Neutral: Deep",
|
||||
"cssVars": {
|
||||
"dark": {
|
||||
"highlight": "184 53% 54%",
|
||||
"neutral": "215 15% 50%",
|
||||
"neutral-light": "210 20% 68%",
|
||||
"neutral-dark": "220 18% 22%",
|
||||
"background": "0 0% 0%",
|
||||
"foreground": "215 15% 82%",
|
||||
"card": "218 25% 5%",
|
||||
"card-foreground": "215 15% 82%",
|
||||
"popover": "215 30% 8%",
|
||||
"popover-foreground": "215 15% 82%",
|
||||
"primary": "200 43% 48%",
|
||||
"primary-foreground": "210 20% 92%",
|
||||
"secondary": "218 30% 18%",
|
||||
"secondary-foreground": "215 25% 75%",
|
||||
"muted": "214 28% 5%",
|
||||
"muted-foreground": "215 18% 48%",
|
||||
"accent": "216 32% 12%",
|
||||
"accent-foreground": "215 15% 82%",
|
||||
"destructive": "0 50% 35%",
|
||||
"destructive-foreground": "0 15% 90%",
|
||||
"border": "218 22% 10%",
|
||||
"input": "216 28% 15%",
|
||||
"ring": "215 45% 42%"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import orchid from './orchid.json';
|
||||
import arctic from './arctic.json';
|
||||
import verdant from './verdant.json';
|
||||
import midnight from './midnight.json';
|
||||
import slate from './slate.json';
|
||||
import deep from './deep.json';
|
||||
|
||||
export interface ThemePreset {
|
||||
name: string;
|
||||
label: string;
|
||||
cssVars: {
|
||||
dark: Record<string, string>;
|
||||
};
|
||||
}
|
||||
|
||||
export const themePresets: ThemePreset[] = [orchid, arctic, verdant, midnight, slate, deep];
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "midnight",
|
||||
"label": "Neutral: Midnight",
|
||||
"cssVars": {
|
||||
"dark": {
|
||||
"highlight": "188 90% 58%",
|
||||
"neutral": "213 22% 59%",
|
||||
"neutral-light": "214 69% 81%",
|
||||
"neutral-dark": "214 16% 21%",
|
||||
"background": "240 15% 3%",
|
||||
"foreground": "0 0% 99%",
|
||||
"card": "240 12% 8%",
|
||||
"card-foreground": "0 0% 99%",
|
||||
"popover": "225 45% 13%",
|
||||
"popover-foreground": "0 0% 99%",
|
||||
"primary": "210 100% 62%",
|
||||
"primary-foreground": "0 0% 99%",
|
||||
"secondary": "215 55% 32%",
|
||||
"secondary-foreground": "200 60% 88%",
|
||||
"muted": "240 12% 8%",
|
||||
"muted-foreground": "210 40% 70%",
|
||||
"accent": "220 65% 20%",
|
||||
"accent-foreground": "0 0% 99%",
|
||||
"destructive": "0 70% 35%",
|
||||
"destructive-foreground": "0 0% 99%",
|
||||
"border": "240 10% 18%",
|
||||
"input": "225 35% 24%",
|
||||
"ring": "210 100% 62%"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "orchid",
|
||||
"label": "Tonal: Orchid",
|
||||
"cssVars": {
|
||||
"dark": {
|
||||
"highlight": "292 75% 62%",
|
||||
"neutral": "270 18% 55%",
|
||||
"neutral-light": "275 35% 75%",
|
||||
"neutral-dark": "268 20% 24%",
|
||||
"background": "270 45% 6%",
|
||||
"foreground": "280 15% 96%",
|
||||
"card": "268 40% 10%",
|
||||
"card-foreground": "280 15% 96%",
|
||||
"popover": "264 48% 13%",
|
||||
"popover-foreground": "280 15% 96%",
|
||||
"primary": "270 85% 65%",
|
||||
"primary-foreground": "0 0% 98%",
|
||||
"secondary": "268 45% 32%",
|
||||
"secondary-foreground": "275 45% 88%",
|
||||
"muted": "268 40% 10%",
|
||||
"muted-foreground": "272 30% 60%",
|
||||
"accent": "268 50% 20%",
|
||||
"accent-foreground": "280 15% 96%",
|
||||
"destructive": "0 65% 40%",
|
||||
"destructive-foreground": "0 0% 98%",
|
||||
"border": "268 30% 18%",
|
||||
"input": "268 40% 25%",
|
||||
"ring": "270 80% 60%"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "slate",
|
||||
"label": "Neutral: Slate",
|
||||
"cssVars": {
|
||||
"dark": {
|
||||
"highlight": "217 97% 52%",
|
||||
"neutral": "0 0% 55%",
|
||||
"neutral-light": "0 0% 75%",
|
||||
"neutral-dark": "0 0% 25%",
|
||||
"background": "0 0% 0%",
|
||||
"foreground": "0 0% 96%",
|
||||
"card": "0 0% 7%",
|
||||
"card-foreground": "0 0% 96%",
|
||||
"popover": "0 0% 9%",
|
||||
"popover-foreground": "0 0% 96%",
|
||||
"primary": "230 75% 55%",
|
||||
"primary-foreground": "0 0% 98%",
|
||||
"secondary": "0 0% 25%",
|
||||
"secondary-foreground": "0 0% 85%",
|
||||
"muted": "0 0% 7%",
|
||||
"muted-foreground": "0 0% 60%",
|
||||
"accent": "0 0% 18%",
|
||||
"accent-foreground": "0 0% 96%",
|
||||
"destructive": "0 65% 40%",
|
||||
"destructive-foreground": "0 0% 98%",
|
||||
"border": "0 0% 18%",
|
||||
"input": "0 0% 22%",
|
||||
"ring": "215 75% 55%"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
/* Theme Presets
|
||||
* Complete token sets applied via .theme-* class on <body>.
|
||||
* Default theme ("Tonal: OHIF Blue") = no class (uses :root values from tailwind.css).
|
||||
* Outside @layer base so presets override :root via proximity on <body>.
|
||||
*
|
||||
* Tonal themes: full hue-shifted palettes (surfaces, borders, text all carry the theme hue).
|
||||
* Neutral themes: desaturated/achromatic surfaces with a colored primary accent.
|
||||
*/
|
||||
|
||||
/* ─── Tonal: Orchid ──────────────────────────────────────────────────── */
|
||||
|
||||
.theme-orchid {
|
||||
--highlight: 292 75% 62%;
|
||||
--neutral: 270 18% 55%;
|
||||
--neutral-light: 275 35% 75%;
|
||||
--neutral-dark: 268 20% 24%;
|
||||
--background: 270 45% 6%;
|
||||
--foreground: 280 15% 96%;
|
||||
--card: 268 40% 10%;
|
||||
--card-foreground: 280 15% 96%;
|
||||
--popover: 264 48% 13%;
|
||||
--popover-foreground: 280 15% 96%;
|
||||
--primary: 270 85% 65%;
|
||||
--primary-foreground: 0 0% 98%;
|
||||
--secondary: 268 45% 32%;
|
||||
--secondary-foreground: 275 45% 88%;
|
||||
--muted: 268 40% 10%;
|
||||
--muted-foreground: 272 30% 60%;
|
||||
--accent: 268 50% 20%;
|
||||
--accent-foreground: 280 15% 96%;
|
||||
--destructive: 0 65% 40%;
|
||||
--destructive-foreground: 0 0% 98%;
|
||||
--border: 268 30% 18%;
|
||||
--input: 268 40% 25%;
|
||||
--ring: 270 80% 60%;
|
||||
--chart-1: 270 70% 58%;
|
||||
--chart-2: 160 55% 45%;
|
||||
--chart-3: 35 80% 55%;
|
||||
--chart-4: 200 65% 55%;
|
||||
--chart-5: 340 70% 55%;
|
||||
}
|
||||
|
||||
/* ─── Tonal: Arctic ──────────────────────────────────────────────────── */
|
||||
|
||||
.theme-arctic {
|
||||
--highlight: 173 81% 52%;
|
||||
--neutral: 185 20% 55%;
|
||||
--neutral-light: 180 40% 78%;
|
||||
--neutral-dark: 190 18% 22%;
|
||||
--background: 0 0% 0%;
|
||||
--foreground: 180 10% 97%;
|
||||
--card: 203 39% 9%;
|
||||
--card-foreground: 180 10% 97%;
|
||||
--popover: 202 54% 11%;
|
||||
--popover-foreground: 180 10% 97%;
|
||||
--primary: 175 85% 42%;
|
||||
--primary-foreground: 185 50% 8%;
|
||||
--secondary: 180 45% 28%;
|
||||
--secondary-foreground: 175 50% 88%;
|
||||
--muted: 203 39% 9%;
|
||||
--muted-foreground: 185 30% 60%;
|
||||
--accent: 185 55% 18%;
|
||||
--accent-foreground: 180 10% 97%;
|
||||
--destructive: 0 65% 35%;
|
||||
--destructive-foreground: 0 0% 98%;
|
||||
--border: 190 25% 17%;
|
||||
--input: 223 40% 24%;
|
||||
--ring: 175 85% 42%;
|
||||
--chart-1: 175 75% 45%;
|
||||
--chart-2: 140 60% 42%;
|
||||
--chart-3: 35 80% 55%;
|
||||
--chart-4: 280 65% 58%;
|
||||
--chart-5: 330 75% 55%;
|
||||
}
|
||||
|
||||
/* ─── Tonal: Verdant ─────────────────────────────────────────────────── */
|
||||
|
||||
.theme-verdant {
|
||||
--highlight: 152 79% 52%;
|
||||
--neutral: 150 15% 52%;
|
||||
--neutral-light: 145 30% 72%;
|
||||
--neutral-dark: 155 18% 24%;
|
||||
--background: 155 40% 5%;
|
||||
--foreground: 140 15% 95%;
|
||||
--card: 152 35% 9%;
|
||||
--card-foreground: 140 15% 95%;
|
||||
--popover: 167 65% 10%;
|
||||
--popover-foreground: 140 15% 95%;
|
||||
--primary: 152 75% 40%;
|
||||
--primary-foreground: 155 50% 8%;
|
||||
--secondary: 150 40% 26%;
|
||||
--secondary-foreground: 145 40% 85%;
|
||||
--muted: 152 35% 9%;
|
||||
--muted-foreground: 148 25% 55%;
|
||||
--accent: 150 45% 16%;
|
||||
--accent-foreground: 140 15% 95%;
|
||||
--destructive: 0 65% 38%;
|
||||
--destructive-foreground: 0 0% 98%;
|
||||
--border: 150 25% 16%;
|
||||
--input: 150 35% 22%;
|
||||
--ring: 152 75% 40%;
|
||||
--chart-1: 152 70% 42%;
|
||||
--chart-2: 200 60% 48%;
|
||||
--chart-3: 35 80% 55%;
|
||||
--chart-4: 280 60% 55%;
|
||||
--chart-5: 340 70% 52%;
|
||||
}
|
||||
|
||||
/* ─── Neutral: Midnight ──────────────────────────────────────────────── */
|
||||
|
||||
.theme-midnight {
|
||||
--highlight: 188 90% 58%;
|
||||
--neutral: 213 22% 59%;
|
||||
--neutral-light: 214 69% 81%;
|
||||
--neutral-dark: 214 16% 21%;
|
||||
--background: 240 15% 3%;
|
||||
--foreground: 0 0% 99%;
|
||||
--card: 240 12% 8%;
|
||||
--card-foreground: 0 0% 99%;
|
||||
--popover: 225 45% 13%;
|
||||
--popover-foreground: 0 0% 99%;
|
||||
--primary: 210 100% 62%;
|
||||
--primary-foreground: 0 0% 99%;
|
||||
--secondary: 215 55% 32%;
|
||||
--secondary-foreground: 200 60% 88%;
|
||||
--muted: 240 12% 8%;
|
||||
--muted-foreground: 210 40% 70%;
|
||||
--accent: 220 65% 20%;
|
||||
--accent-foreground: 0 0% 99%;
|
||||
--destructive: 0 70% 35%;
|
||||
--destructive-foreground: 0 0% 99%;
|
||||
--border: 240 10% 18%;
|
||||
--input: 225 35% 24%;
|
||||
--ring: 210 100% 62%;
|
||||
--chart-1: 210 85% 55%;
|
||||
--chart-2: 165 70% 42%;
|
||||
--chart-3: 35 85% 52%;
|
||||
--chart-4: 275 70% 58%;
|
||||
--chart-5: 335 80% 52%;
|
||||
}
|
||||
|
||||
/* ─── Neutral: Slate ─────────────────────────────────────────────────── */
|
||||
|
||||
.theme-slate {
|
||||
--highlight: 217 97% 52%;
|
||||
--neutral: 0 0% 55%;
|
||||
--neutral-light: 0 0% 75%;
|
||||
--neutral-dark: 0 0% 25%;
|
||||
--background: 0 0% 0%;
|
||||
--foreground: 0 0% 96%;
|
||||
--card: 0 0% 7%;
|
||||
--card-foreground: 0 0% 96%;
|
||||
--popover: 0 0% 9%;
|
||||
--popover-foreground: 0 0% 96%;
|
||||
--primary: 230 75% 55%;
|
||||
--primary-foreground: 0 0% 98%;
|
||||
--secondary: 0 0% 25%;
|
||||
--secondary-foreground: 0 0% 85%;
|
||||
--muted: 0 0% 7%;
|
||||
--muted-foreground: 0 0% 60%;
|
||||
--accent: 0 0% 18%;
|
||||
--accent-foreground: 0 0% 96%;
|
||||
--destructive: 0 65% 40%;
|
||||
--destructive-foreground: 0 0% 98%;
|
||||
--border: 0 0% 18%;
|
||||
--input: 0 0% 22%;
|
||||
--ring: 215 75% 55%;
|
||||
--chart-1: 215 70% 55%;
|
||||
--chart-2: 160 55% 45%;
|
||||
--chart-3: 35 75% 55%;
|
||||
--chart-4: 280 60% 58%;
|
||||
--chart-5: 340 70% 55%;
|
||||
}
|
||||
|
||||
/* ─── Neutral: Deep ──────────────────────────────────────────────────── */
|
||||
|
||||
.theme-deep {
|
||||
--highlight: 184 53% 54%;
|
||||
--neutral: 215 15% 50%;
|
||||
--neutral-light: 210 20% 68%;
|
||||
--neutral-dark: 220 18% 22%;
|
||||
--background: 0 0% 0%;
|
||||
--foreground: 215 15% 82%;
|
||||
--card: 218 25% 5%;
|
||||
--card-foreground: 215 15% 82%;
|
||||
--popover: 215 30% 8%;
|
||||
--popover-foreground: 215 15% 82%;
|
||||
--primary: 200 43% 48%;
|
||||
--primary-foreground: 210 20% 92%;
|
||||
--secondary: 218 30% 18%;
|
||||
--secondary-foreground: 215 25% 75%;
|
||||
--muted: 214 28% 5%;
|
||||
--muted-foreground: 215 18% 48%;
|
||||
--accent: 216 32% 12%;
|
||||
--accent-foreground: 215 15% 82%;
|
||||
--destructive: 0 50% 35%;
|
||||
--destructive-foreground: 0 15% 90%;
|
||||
--border: 218 22% 10%;
|
||||
--input: 216 28% 15%;
|
||||
--ring: 215 45% 42%;
|
||||
--chart-1: 215 50% 45%;
|
||||
--chart-2: 175 40% 38%;
|
||||
--chart-3: 35 50% 45%;
|
||||
--chart-4: 280 40% 48%;
|
||||
--chart-5: 340 45% 45%;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "verdant",
|
||||
"label": "Tonal: Verdant",
|
||||
"cssVars": {
|
||||
"dark": {
|
||||
"highlight": "152 79% 52%",
|
||||
"neutral": "150 15% 52%",
|
||||
"neutral-light": "145 30% 72%",
|
||||
"neutral-dark": "155 18% 24%",
|
||||
"background": "155 40% 5%",
|
||||
"foreground": "140 15% 95%",
|
||||
"card": "152 35% 9%",
|
||||
"card-foreground": "140 15% 95%",
|
||||
"popover": "167 65% 10%",
|
||||
"popover-foreground": "140 15% 95%",
|
||||
"primary": "152 75% 40%",
|
||||
"primary-foreground": "155 50% 8%",
|
||||
"secondary": "150 40% 26%",
|
||||
"secondary-foreground": "145 40% 85%",
|
||||
"muted": "152 35% 9%",
|
||||
"muted-foreground": "148 25% 55%",
|
||||
"accent": "150 45% 16%",
|
||||
"accent-foreground": "140 15% 95%",
|
||||
"destructive": "0 65% 38%",
|
||||
"destructive-foreground": "0 0% 98%",
|
||||
"border": "150 25% 16%",
|
||||
"input": "150 35% 22%",
|
||||
"ring": "152 75% 40%"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ohif/ui",
|
||||
"version": "3.13.0-beta.106",
|
||||
"version": "3.13.0-beta.111",
|
||||
"description": "A set of React components for Medical Imaging Viewers",
|
||||
"author": "OHIF Contributors",
|
||||
"license": "MIT",
|
||||
|
||||
Generated
+906
-232
File diff suppressed because it is too large.
Load diff
@@ -41,12 +41,17 @@ test('should display the dicom tag browser', async ({ page, mainToolbarPageObjec
|
||||
test('should render the scroll bar with the correct look-and-feel', async ({
|
||||
page,
|
||||
mainToolbarPageObject,
|
||||
DOMOverlayPageObject,
|
||||
}) => {
|
||||
const studyInstanceUID = '1.3.6.1.4.1.25403.345050719074.3824.20170125095438.5';
|
||||
const mode = 'viewer';
|
||||
await visitStudy(page, studyInstanceUID, mode, 2000);
|
||||
|
||||
await mainToolbarPageObject.moreTools.tagBrowser.click();
|
||||
|
||||
const dicomTagBrowser = DOMOverlayPageObject.dialog.dicomTagBrowser;
|
||||
await dicomTagBrowser.waitVisible();
|
||||
|
||||
await checkForScreenshot({
|
||||
page,
|
||||
normalizedClip: { x: 0.77, y: 0.25, width: 0.03, height: 0.75 },
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { test, visitStudy, checkForScreenshot, screenShotPaths } from './utils';
|
||||
|
||||
// A DICOM VL Whole Slide Microscopy (SM) study. Opened in `viewer` mode it is
|
||||
// routed to the cornerstone3D WHOLE_SLIDE viewport (mode-basic registers
|
||||
// `ohif.wsiSopClassHandler`), which is the render path that previously
|
||||
// regressed to a gray canvas. This screenshot comparison is a
|
||||
// simple safeguard: if the WSI viewport fails to mount and renders gray again,
|
||||
// the baseline no longer matches and the test fails.
|
||||
test.beforeEach(async ({ page }) => {
|
||||
const studyInstanceUID = '1.2.276.0.7230010.3.1.2.296485376.1.1665793212.499772';
|
||||
const mode = 'viewer';
|
||||
await visitStudy(page, studyInstanceUID, mode, 5000);
|
||||
});
|
||||
|
||||
test('should render the WSI viewport', async ({ page, viewportPageObject }) => {
|
||||
// WSI tiles load progressively; checkForScreenshot's built-in retry loop
|
||||
// gives the viewport time to paint before comparing against the baseline.
|
||||
await checkForScreenshot({
|
||||
page,
|
||||
locator: viewportPageObject.grid,
|
||||
screenshotPath: screenShotPaths.wsi.wsiDisplayedCorrectly,
|
||||
});
|
||||
});
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 748 B After Width: | Height: | Size: 750 B |
Binary file not shown.
|
After Width: | Height: | Size: 288 KiB |
@@ -224,6 +224,9 @@ const screenShotPaths = {
|
||||
workList: {
|
||||
scrollBarRenderedProperly: 'scrollBarRenderedProperly.png',
|
||||
},
|
||||
wsi: {
|
||||
wsiDisplayedCorrectly: 'wsiDisplayedCorrectly.png',
|
||||
},
|
||||
};
|
||||
|
||||
export { screenShotPaths };
|
||||
Reference in new issue
Block a user