* fix: 🐛 Local file: failing when retrieving segmentation data Fix segmentation data retrieval issues for local file. Changed from fecthing to use cornerstone loadAndCache method BREAKING CHANGE: DICOM Seg Closes: part of #838 * Switch SEG retrieval to WADO-RS * Forgot a debugger * refactor: 💡 Code refactor. Minor changes into methods * fix: 🐛 Load local files: PDF Items: 1. FileLoaderService: used for serveral operations on local files(load it, get list of studies, group them, accepting dicom and pdf) 2. DicomLoaderService: used for loading dicom based on dataset and studies. Depending on type of dicom loader might change. WIP 3. Refactor PDF and handleSegmentationStorage to use DicomLoaderService * fix: 🐛 Code review * fix: 🐛 Code review. Changed:Folder organization and dicom file Move fileLoaderService and others to a specific folder. When loading dicom file change to only retrieve the file(not use cornerstone to cache or anything else). * fix: 🐛 Code review. Move dicomLoaderService to core Moved dicomLoaderService to ohif/core and localFileLoaders to a specific folder. * fix: 🐛 Code review Simplified method to get study for dicom file. Added error handling on file loading. DicomLoaderService to be exposed on ohif/core/utils instead. * fix: 🐛 Reduce local load to one method only Reduced local file load to one method only * fix: 🐛 HTML to use dicomLoaderService. Prefer wadors than (uri) * fix: 🐛 Code implementation for multiframe files * fix: 🐛 Code review. Default local loader to dicom Closes: 838 * fix: 🐛 Code review. Use relative path to require DICOMWeb Closes: 838 * fix: 🐛 Code review. Fix unit test. Added DicomLoaderService mod Closes: 838 * fix: 🐛 Code review. Add 'Seg' on left thumb When getting/creating dataset get modality for file/image read Closes: 838
75 lines
1.7 KiB
JavaScript
75 lines
1.7 KiB
JavaScript
import React, { Component } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import OHIF from '@ohif/core';
|
|
import OHIFComponentPlugin from './OHIFComponentPlugin.js';
|
|
import DicomPDFViewport from './DicomPDFViewport';
|
|
|
|
const { DicomLoaderService } = OHIF.utils;
|
|
|
|
class OHIFDicomPDFViewport extends Component {
|
|
static propTypes = {
|
|
studies: PropTypes.object,
|
|
displaySet: PropTypes.object,
|
|
viewportIndex: PropTypes.number,
|
|
};
|
|
|
|
state = {
|
|
byteArray: null,
|
|
error: null,
|
|
};
|
|
|
|
static id = 'DicomPDFViewportPDF';
|
|
|
|
static init() {
|
|
console.log('DicomPDFViewport init()');
|
|
}
|
|
|
|
static destroy() {
|
|
console.log('DicomPDFViewport destroy()');
|
|
}
|
|
|
|
componentDidMount() {
|
|
const { displaySet, studies } = this.props.viewportData;
|
|
const {
|
|
studyInstanceUid,
|
|
seriesInstanceUid,
|
|
sopInstanceUid,
|
|
wadoRoot,
|
|
wadoUri,
|
|
authorizationHeaders,
|
|
} = displaySet;
|
|
|
|
DicomLoaderService.findDicomDataPromise(displaySet, studies).then(
|
|
data => {
|
|
const byteArray = new Uint8Array(data);
|
|
this.setState({
|
|
byteArray: byteArray,
|
|
});
|
|
},
|
|
error => {
|
|
this.setState({
|
|
error,
|
|
});
|
|
|
|
throw new Error(error);
|
|
}
|
|
);
|
|
}
|
|
|
|
render() {
|
|
const { id, init, destroy } = OHIFDicomPDFViewport;
|
|
const pluginProps = { id, init, destroy };
|
|
|
|
return (
|
|
<OHIFComponentPlugin {...pluginProps}>
|
|
{this.state.byteArray && (
|
|
<DicomPDFViewport byteArray={this.state.byteArray} />
|
|
)}
|
|
{this.state.error && <h2>{JSON.stringify(this.state.error)}</h2>}
|
|
</OHIFComponentPlugin>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default OHIFDicomPDFViewport;
|