feat(PDF):Add PDF viewer (#2730)

Display DICOM encapsulated PDF documents in a PDF viewer.
Addressed the remaining PR comments, and am merging this.
This commit is contained in:
Bill Wallace authored and GitHub committed 2022-04-04 09:48:14 -04:00
1 parent f3822f98a3
commit 82df3eac03
23 files changed
+376 -71

No files matched your search

@@ -1,51 +1,36 @@
import React, { useCallback, useContext, useEffect, useState } from 'react';
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import cornerstoneTools from 'cornerstone-tools';
import cornerstone from 'cornerstone-core';
import CornerstoneViewport from 'react-cornerstone-viewport';
import OHIF, { DicomMetadataStore, utils } from '@ohif/core';
import {
Notification,
ViewportActionBar,
useViewportGrid,
useViewportDialog,
} from '@ohif/ui';
import { adapters } from 'dcmjs';
import id from '../id';
function OHIFCornerstoneVideoViewport({
children,
dataSource,
displaySet,
viewportIndex,
servicesManager,
extensionManager,
}) {
const {
DisplaySetService,
MeasurementService,
ToolBarService,
} = servicesManager.services;
const { videoUrl } = displaySet;
const mimeType = "video/mp4";
const [url, setUrl] = useState(null);
useEffect(async () => {
setUrl(await videoUrl);
});
// Need to copies of the source to fix a firefox bug
return (
<div className="bg-primary-black w-full h-full">
<video
src={videoUrl}
src={url}
controls
controlsList="nodownload"
preload="auto"
className="w-full h-full"
>
<source src={videoUrl} type={mimeType} />
<source src={videoUrl} type={mimeType} />
Video src/type not supported: <a href={videoUrl}>{videoUrl} of type {mimeType}</a>
<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 = {
displaySet: PropTypes.object.isRequired,
};
export default OHIFCornerstoneVideoViewport;