[OHIF-235] Lazy processing of DICOM SR for viewport. (#1849)
* Only process SR on consumption of viewport. * remove debugger Co-authored-by: Danny Brown <danny.ri.brown@gmail.com>
This commit is contained in:
parent
f24f0bb11d
commit
c36f853a38
@ -106,6 +106,13 @@ function OHIFCornerstoneSRViewport({
|
|||||||
setElement(targetElement);
|
setElement(targetElement);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!displaySet.isLoaded) {
|
||||||
|
displaySet.load();
|
||||||
|
setIsHydrated(displaySet.isHydrated);
|
||||||
|
}
|
||||||
|
}, [displaySet]);
|
||||||
|
|
||||||
const setTrackingUniqueIdentifiersForElement = useCallback(targetElement => {
|
const setTrackingUniqueIdentifiersForElement = useCallback(targetElement => {
|
||||||
const { measurements } = displaySet;
|
const { measurements } = displaySet;
|
||||||
|
|
||||||
|
|||||||
@ -55,10 +55,6 @@ function _getDisplaySetsFromSeries(
|
|||||||
throw new Error('No instances were provided');
|
throw new Error('No instances were provided');
|
||||||
}
|
}
|
||||||
|
|
||||||
const { DisplaySetService, MeasurementService } = servicesManager.services;
|
|
||||||
const dataSources = extensionManager.getDataSources();
|
|
||||||
const dataSource = dataSources[0];
|
|
||||||
|
|
||||||
const instance = instances[0];
|
const instance = instances[0];
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -68,8 +64,8 @@ function _getDisplaySetsFromSeries(
|
|||||||
SeriesDescription,
|
SeriesDescription,
|
||||||
SeriesNumber,
|
SeriesNumber,
|
||||||
SeriesDate,
|
SeriesDate,
|
||||||
|
ConceptNameCodeSequence,
|
||||||
} = instance;
|
} = instance;
|
||||||
const { ConceptNameCodeSequence, ContentSequence } = instance;
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!ConceptNameCodeSequence ||
|
!ConceptNameCodeSequence ||
|
||||||
@ -93,22 +89,36 @@ function _getDisplaySetsFromSeries(
|
|||||||
SeriesInstanceUID,
|
SeriesInstanceUID,
|
||||||
StudyInstanceUID,
|
StudyInstanceUID,
|
||||||
SOPClassHandlerId: `${id}.sopClassHandlerModule.${sopClassHandlerName}`,
|
SOPClassHandlerId: `${id}.sopClassHandlerModule.${sopClassHandlerName}`,
|
||||||
referencedImages: _getReferencedImagesList(ContentSequence),
|
referencedImages: null,
|
||||||
measurements: _getMeasurements(ContentSequence),
|
measurements: null,
|
||||||
|
isDerivedDisplaySet: true,
|
||||||
|
isLoaded: false,
|
||||||
sopClassUids,
|
sopClassUids,
|
||||||
|
instance,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
displaySet.load = () => _load(displaySet, servicesManager, extensionManager);
|
||||||
|
|
||||||
|
return [displaySet];
|
||||||
|
}
|
||||||
|
|
||||||
|
function _load(displaySet, servicesManager, extensionManager) {
|
||||||
|
const { DisplaySetService, MeasurementService } = servicesManager.services;
|
||||||
|
const dataSources = extensionManager.getDataSources();
|
||||||
|
const dataSource = dataSources[0];
|
||||||
|
|
||||||
|
const { ContentSequence } = displaySet.instance;
|
||||||
|
|
||||||
|
displaySet.referencedImages = _getReferencedImagesList(ContentSequence);
|
||||||
|
displaySet.measurements = _getMeasurements(ContentSequence);
|
||||||
|
|
||||||
const mappings = MeasurementService.getSourceMappings(
|
const mappings = MeasurementService.getSourceMappings(
|
||||||
'CornerstoneTools',
|
'CornerstoneTools',
|
||||||
'4'
|
'4'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isRehydratable(displaySet, mappings)) {
|
displaySet.isHydrated = false;
|
||||||
displaySet.isLocked = false;
|
displaySet.isLocked = isRehydratable(displaySet, mappings) ? false : true;
|
||||||
displaySet.isHydrated = false;
|
|
||||||
} else {
|
|
||||||
displaySet.isLocked = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check currently added displaySets and add measurements if the sources exist.
|
// Check currently added displaySets and add measurements if the sources exist.
|
||||||
DisplaySetService.activeDisplaySets.forEach(activeDisplaySet => {
|
DisplaySetService.activeDisplaySets.forEach(activeDisplaySet => {
|
||||||
@ -135,8 +145,6 @@ function _getDisplaySetsFromSeries(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return [displaySet];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _checkIfCanAddMeasurementsToDisplaySet(
|
function _checkIfCanAddMeasurementsToDisplaySet(
|
||||||
|
|||||||
@ -40,6 +40,7 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
trackedStudy === m.referenceStudyUID &&
|
trackedStudy === m.referenceStudyUID &&
|
||||||
trackedSeries.includes(m.referenceSeriesUID)
|
trackedSeries.includes(m.referenceSeriesUID)
|
||||||
);
|
);
|
||||||
|
|
||||||
const mappedMeasurements = filteredMeasurements.map((m, index) =>
|
const mappedMeasurements = filteredMeasurements.map((m, index) =>
|
||||||
_mapMeasurementToDisplay(m, index, MeasurementService.VALUE_TYPES)
|
_mapMeasurementToDisplay(m, index, MeasurementService.VALUE_TYPES)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -110,6 +110,7 @@ function ViewerViewportGrid(props) {
|
|||||||
|
|
||||||
const displaySet =
|
const displaySet =
|
||||||
DisplaySetService.getDisplaySetByUID(displaySetInstanceUID) || {};
|
DisplaySetService.getDisplaySetByUID(displaySetInstanceUID) || {};
|
||||||
|
|
||||||
const ViewportComponent = _getViewportComponent(
|
const ViewportComponent = _getViewportComponent(
|
||||||
displaySet.SOPClassHandlerId,
|
displaySet.SOPClassHandlerId,
|
||||||
viewportComponents
|
viewportComponents
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user