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
This commit is contained in:
1 parent
2800f82e3c
commit
e0f42d4f1d
18 files changed
+446
-130
No files matched your search
@@ -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;
|
||||
Reference in new issue
Block a user