fix(bugs): and replace seriesInstanceUID and seriesInstanceUIDs URL with seriesInstanceUIDs (#4049)

This commit is contained in:
Alireza authored and GitHub committed 2024-04-17 21:59:47 -04:00
1 parent 058da93863
commit da7c1a5d8c
19 files changed
+173 -118

No files matched your search

+18
View File
@@ -61,6 +61,24 @@ const cornerstoneExtension: Types.Extensions.Extension = {
*/
id,
onModeEnter: ({ servicesManager }): void => {
const { cornerstoneViewportService, toolbarService, segmentationService } =
servicesManager.services;
toolbarService.registerEventForToolbarUpdate(cornerstoneViewportService, [
cornerstoneViewportService.EVENTS.VIEWPORT_DATA_CHANGED,
]);
toolbarService.registerEventForToolbarUpdate(segmentationService, [
segmentationService.EVENTS.SEGMENTATION_ADDED,
segmentationService.EVENTS.SEGMENTATION_REMOVED,
segmentationService.EVENTS.SEGMENTATION_UPDATED,
]);
toolbarService.registerEventForToolbarUpdate(cornerstone.eventTarget, [
cornerstoneTools.Enums.Events.TOOL_ACTIVATED,
]);
},
onModeExit: ({ servicesManager }): void => {
const { cineService } = servicesManager.services;
// Empty out the image load and retrieval pools to prevent memory leaks
-16
View File
@@ -99,26 +99,10 @@ export default async function init({
uiNotificationService,
cornerstoneViewportService,
hangingProtocolService,
toolbarService,
viewportGridService,
stateSyncService,
segmentationService,
} = servicesManager.services as CornerstoneServices;
toolbarService.registerEventForToolbarUpdate(cornerstoneViewportService, [
cornerstoneViewportService.EVENTS.VIEWPORT_DATA_CHANGED,
]);
toolbarService.registerEventForToolbarUpdate(segmentationService, [
segmentationService.EVENTS.SEGMENTATION_ADDED,
segmentationService.EVENTS.SEGMENTATION_REMOVED,
segmentationService.EVENTS.SEGMENTATION_UPDATED,
]);
toolbarService.registerEventForToolbarUpdate(eventTarget, [
cornerstoneTools.Enums.Events.TOOL_ACTIVATED,
]);
window.services = servicesManager.services;
window.extensionManager = extensionManager;
window.commandsManager = commandsManager;
@@ -98,7 +98,21 @@ class CornerstoneCacheService {
const volume = cs3DCache.getVolume(volumeId);
if (volume) {
cs3DCache.removeVolumeLoadObject(volumeId);
if (volume.imageIds) {
// also for each imageId in the volume, remove the imageId from the cache
// since that will hold the old metadata as well
volume.imageIds.forEach(imageId => {
if (cs3DCache.getImageLoadObject(imageId)) {
cs3DCache.removeImageLoadObject(imageId);
}
});
}
// this shouldn't be via removeVolumeLoadObject, since that will
// remove the texture as well, but here we really just need a remove
// from registry so that we load it again
cs3DCache._volumeCache.delete(volumeId);
this.volumeImageIds.delete(volumeId);
}
@@ -1147,6 +1147,10 @@ class SegmentationService extends PubSubService {
displaySet.isHydrated = isHydrated;
displaySetService.setDisplaySetMetadataInvalidated(displaySetUID, false);
this._broadcastEvent(this.EVENTS.SEGMENTATION_UPDATED, {
segmentation: this.getSegmentation(displaySetUID),
});
}
private _highlightLabelmap(
@@ -2,6 +2,7 @@ import SUPPORTED_TOOLS from './constants/supportedTools';
import { getDisplayUnit } from './utils';
import getSOPInstanceAttributes from './utils/getSOPInstanceAttributes';
import { utils } from '@ohif/core';
import { getStatisticDisplayString } from './utils/getValueDisplayString';
const CircleROI = {
toAnnotation: measurement => {},
@@ -193,11 +194,7 @@ function getDisplayText(mappedAnnotations, displaySet, customizationService) {
mappedAnnotations.forEach(mappedAnnotation => {
const { unit, max, SeriesNumber } = mappedAnnotation;
let maxStr = '';
if (max) {
const roundedMax = utils.roundNumber(max, 2);
maxStr = `Max: ${roundedMax} <small>${getDisplayUnit(unit)}</small> `;
}
const maxStr = getStatisticDisplayString(max, unit, 'max');
const str = `${maxStr}(S:${SeriesNumber}${instanceText}${frameText})`;
if (!displayText.includes(str)) {
@@ -2,6 +2,7 @@ import SUPPORTED_TOOLS from './constants/supportedTools';
import { getDisplayUnit } from './utils';
import getSOPInstanceAttributes from './utils/getSOPInstanceAttributes';
import { utils } from '@ohif/core';
import { getStatisticDisplayString } from './utils/getValueDisplayString';
const EllipticalROI = {
toAnnotation: measurement => {},
@@ -192,12 +193,7 @@ function getDisplayText(mappedAnnotations, displaySet, customizationService) {
mappedAnnotations.forEach(mappedAnnotation => {
const { unit, max, SeriesNumber } = mappedAnnotation;
let maxStr = '';
if (max) {
const roundedMax = utils.roundNumber(max, 2);
maxStr = `Max: ${roundedMax} <small>${getDisplayUnit(unit)}</small> `;
}
const maxStr = getStatisticDisplayString(max, unit, 'max');
const str = `${maxStr}(S:${SeriesNumber}${instanceText}${frameText})`;
if (!displayText.includes(str)) {
displayText.push(str);
@@ -2,6 +2,7 @@ import SUPPORTED_TOOLS from './constants/supportedTools';
import { getDisplayUnit } from './utils';
import getSOPInstanceAttributes from './utils/getSOPInstanceAttributes';
import { utils } from '@ohif/core';
import { getStatisticDisplayString } from './utils/getValueDisplayString';
const RectangleROI = {
toAnnotation: measurement => {},
@@ -193,11 +194,7 @@ function getDisplayText(mappedAnnotations, displaySet, customizationService) {
mappedAnnotations.forEach(mappedAnnotation => {
const { unit, max, SeriesNumber } = mappedAnnotation;
let maxStr = '';
if (max) {
const roundedMax = utils.roundNumber(max, 2);
maxStr = `Max: ${roundedMax} <small>${getDisplayUnit(unit)}</small> `;
}
const maxStr = getStatisticDisplayString(max, unit, 'max');
const str = `${maxStr}(S:${SeriesNumber}${instanceText}${frameText})`;
if (!displayText.includes(str)) {
@@ -1,6 +1,5 @@
import SUPPORTED_TOOLS from './constants/supportedTools';
import getSOPInstanceAttributes from './utils/getSOPInstanceAttributes';
import { getDisplayUnit } from './utils';
import { utils } from '@ohif/core';
/**
@@ -0,0 +1,12 @@
import { utils } from '@ohif/core';
import getDisplayUnit from './getDisplayUnit';
export const getStatisticDisplayString = (numbers, unit, key) => {
if (Array.isArray(numbers) && numbers.length > 0) {
const results = numbers.map(number => utils.roundNumber(number, 2));
return `${key.charAt(0).toUpperCase() + key.slice(1)}: ${results.join(', ')} <small>${getDisplayUnit(unit)}</small>`;
}
const result = utils.roundNumber(numbers, 2);
return `${key.charAt(0).toUpperCase() + key.slice(1)}: ${result} <small>${getDisplayUnit(unit)}</small>`;
};