fix(staticwado): SM and RT and update the server with new data (#3422)

* fix bugs for the RT for the new demo

* fix SM with the static-wado server

* remove thumbnail from tmtv

* migration guide

* fix stability for the rt struct

* apply review comments

* add loading indicator to SM

* pdf works

* try to fix relative bulkData

* fix the rest

* fix preflight for the SM

* fix typo

* apply review comments

* yarn lock
This commit is contained in:
Alireza authored and GitHub committed 2023-05-29 09:04:49 -04:00
1 parent b684d80426
commit c7bcf1134d
30 files changed
+290 -156

No files matched your search

@@ -2,6 +2,7 @@ import React, { Component } from 'react';
import ReactResizeDetector from 'react-resize-detector';
import PropTypes from 'prop-types';
import debounce from 'lodash.debounce';
import { LoadingIndicatorProgress } from '@ohif/ui';
import './DicomMicroscopyViewport.css';
import ViewportOverlay from './components/ViewportOverlay';
@@ -10,9 +11,20 @@ import dcmjs from 'dcmjs';
import cleanDenaturalizedDataset from './utils/cleanDenaturalizedDataset';
import MicroscopyService from './services/MicroscopyService';
function transformImageTypeUnnaturalized(entry) {
if (entry.vr === 'CS') {
return {
vr: 'US',
Value: entry.Value[0].split('\\'),
};
}
return entry;
}
class DicomMicroscopyViewport extends Component {
state = {
error: null as any,
isLoaded: false,
};
microscopyService: MicroscopyService;
@@ -132,6 +144,10 @@ class DicomMicroscopyViewport extends Component {
// );
// m['00200052'].Value[0] = volumeImages[0].FrameOfReferenceUID;
// }
// NOTE: depending on different data source, image.ImageType sometimes
// is a string, not a string array.
// m['00080008'] = transformImageTypeUnnaturalized(m['00080008']);
// const image = new metadataUtils.VLWholeSlideMicroscopyImage({
// metadata: m,
// });
@@ -143,8 +159,20 @@ class DicomMicroscopyViewport extends Component {
// }
metadata.forEach(m => {
// NOTE: depending on different data source, image.ImageType sometimes
// is a string, not a string array.
m.ImageType =
typeof m.ImageType === 'string'
? m.ImageType.split('\\')
: m.ImageType;
const inst = cleanDenaturalizedDataset(
dcmjs.data.DicomMetaDictionary.denaturalizeDataset(m)
dcmjs.data.DicomMetaDictionary.denaturalizeDataset(m),
{
StudyInstanceUID: m.StudyInstanceUID,
SeriesInstanceUID: m.SeriesInstanceUID,
dataSourceConfig: this.props.dataSource.getConfig(),
}
);
if (!inst['00480105']) {
// Optical Path Sequence, no OpticalPathIdentifier?
@@ -165,13 +193,7 @@ class DicomMicroscopyViewport extends Component {
metadata: inst,
});
// NOTE: depending on different data source, image.ImageType sometimes
// is a string, not a string array.
const imageType =
typeof image.ImageType === 'string'
? image.ImageType.split('\\')
: image.ImageType;
const imageFlavor = imageType[2];
const imageFlavor = image.ImageType[2];
if (imageFlavor === 'VOLUME' || imageFlavor === 'THUMBNAIL') {
volumeImages.push(image);
}
@@ -182,7 +204,7 @@ class DicomMicroscopyViewport extends Component {
client,
metadata: volumeImages,
retrieveRendered: false,
controls: ['overview', 'position', 'zoom'],
controls: ['overview', 'position'],
};
this.viewer = new microscopyViewer(options);
@@ -237,7 +259,11 @@ class DicomMicroscopyViewport extends Component {
componentDidMount() {
const { displaySets, viewportIndex } = this.props;
const displaySet = displaySets[viewportIndex];
this.installOpenLayersRenderer(this.container.current, displaySet);
this.installOpenLayersRenderer(this.container.current, displaySet).then(
() => {
this.setState({ isLoaded: true });
}
);
}
componentDidUpdate(
@@ -316,6 +342,9 @@ class DicomMicroscopyViewport extends Component {
) : (
<div style={style} ref={this.container} />
)}
{this.state.isLoaded ? null : (
<LoadingIndicatorProgress className={'w-full h-full bg-black'} />
)}
</div>
);
}
@@ -1,6 +1,5 @@
import React from 'react';
import classnames from 'classnames';
import ConfigPoint from 'config-point';
import listComponentGenerator from './listComponentGenerator';
import './ViewportOverlay.css';
@@ -11,7 +10,7 @@ import {
formatPN,
} from './utils';
interface OverylayItem {
interface OverlayItem {
id: string;
title: string;
value?: (props: any) => string;
@@ -28,17 +27,17 @@ interface OverylayItem {
* @returns
*/
export const generateFromConfig = ({
topLeft,
topRight,
bottomLeft,
bottomRight,
itemGenerator,
topLeft = [],
topRight = [],
bottomLeft = [],
bottomRight = [],
itemGenerator = () => {},
}: {
topLeft: OverylayItem[];
topRight: OverylayItem[];
bottomLeft: OverylayItem[];
bottomRight: OverylayItem[];
itemGenerator: (props: any) => any;
topLeft?: OverlayItem[];
topRight?: OverlayItem[];
bottomLeft?: OverlayItem[];
bottomRight?: OverlayItem[];
itemGenerator?: (props: any) => any;
}) => {
return (props: any) => {
const topLeftClass = 'top-viewport left-viewport text-primary-light';
@@ -127,29 +126,4 @@ const itemGenerator = (props: any) => {
);
};
const { MicroscopyViewportOverlay } = ConfigPoint.register({
MicroscopyViewportOverlay: {
configBase: {
topLeft: [
// {
// id: 'sm-overlay-patient-name',
// title: 'PatientName',
// condition: ({ instance }) =>
// instance && instance.PatientName && instance.PatientName.Alphabetic,
// value: ({ instance }) =>
// instance.PatientName && instance.PatientName.Alphabetic,
// } as OverylayItem,
],
topRight: [] as OverylayItem[],
bottomLeft: [] as OverylayItem[],
bottomRight: [] as OverylayItem[],
itemGenerator,
generateFromConfig,
},
...(window.config?.MicroscopyViewportOverlay || {}),
},
});
export default MicroscopyViewportOverlay.generateFromConfig(
MicroscopyViewportOverlay
);
export default generateFromConfig({});
@@ -1,3 +1,5 @@
import { dicomWebUtils } from '@ohif/extension-default';
function isPrimitive(v: any) {
return !(typeof v == 'object' || Array.isArray(v));
}
@@ -24,10 +26,17 @@ const vrNumerics = [
* @param obj
* @returns
*/
export default function cleanDenaturalizedDataset(obj: any): any {
export default function cleanDenaturalizedDataset(
obj: any,
options: {
StudyInstanceUID: string;
SeriesInstanceUID: string;
dataSourceConfig: unknown;
}
): any {
if (Array.isArray(obj)) {
const newAry = obj.map(o =>
isPrimitive(o) ? o : cleanDenaturalizedDataset(o)
isPrimitive(o) ? o : cleanDenaturalizedDataset(o, options)
);
return newAry;
} else if (isPrimitive(obj)) {
@@ -38,7 +47,11 @@ export default function cleanDenaturalizedDataset(obj: any): any {
delete obj[key].Value;
} else if (Array.isArray(obj[key].Value) && obj[key].vr) {
if (obj[key].Value.length === 1 && obj[key].Value[0].BulkDataURI) {
obj[key].BulkDataURI = obj[key].Value[0].BulkDataURI;
obj[key].Value[0] = dicomWebUtils.fixBulkDataURI(
obj[key].Value[0],
options,
options.dataSourceConfig
);
// prevent mixed-content blockage
if (
@@ -54,7 +67,9 @@ export default function cleanDenaturalizedDataset(obj: any): any {
} else if (vrNumerics.includes(obj[key].vr)) {
obj[key].Value = obj[key].Value.map(v => +v);
} else {
obj[key].Value = obj[key].Value.map(cleanDenaturalizedDataset);
obj[key].Value = obj[key].Value.map(entry =>
cleanDenaturalizedDataset(entry, options)
);
}
}
});
@@ -1,6 +1,12 @@
import { api } from 'dicomweb-client';
import { errorHandler, DicomMetadataStore } from '@ohif/core';
const { DICOMwebClient } = api;
DICOMwebClient._buildMultipartAcceptHeaderFieldValue = () => {
return '*/*';
};
/**
* create a DICOMwebClient object to be used by Dicom Microscopy Viewer
*