fix(SR): KO series being displayed in browser list (#3382)
* fix: KO series being displayed in browser list * fix sr for volume viewports * move highlight labelmap to RAF * remove commented code * fix the hydration bug for the SR * apply review comments * revert the key images for sr * Remove some obsolete changes * set initial image for sr instead of jump * Remove viewportType stack --------- Co-authored-by: Alireza <ar.sedghi@gmail.com>
This commit is contained in:
1 parent
4172d0427b
commit
d5c5951e57
20 files changed
+243
-223
No files matched your search
+38
-11
@@ -31,12 +31,11 @@ function TrackedMeasurementsContextProvider(
|
||||
) {
|
||||
const [viewportGrid, viewportGridService] = useViewportGrid();
|
||||
const { activeViewportIndex, viewports } = viewportGrid;
|
||||
const { measurementService, displaySetService } = servicesManager.services;
|
||||
|
||||
const machineOptions = Object.assign({}, defaultOptions);
|
||||
machineOptions.actions = Object.assign({}, machineOptions.actions, {
|
||||
jumpToFirstMeasurementInActiveViewport: (ctx, evt) => {
|
||||
const { measurementService } = servicesManager.services;
|
||||
|
||||
const { trackedStudy, trackedSeries } = ctx;
|
||||
const measurements = measurementService.getMeasurements();
|
||||
const trackedMeasurements = measurements.filter(
|
||||
@@ -45,21 +44,51 @@ function TrackedMeasurementsContextProvider(
|
||||
trackedSeries.includes(m.referenceSeriesUID)
|
||||
);
|
||||
|
||||
const uid = trackedMeasurements[0].uid;
|
||||
|
||||
console.log(
|
||||
'jumping to measurement reset viewport',
|
||||
viewportGrid.activeViewportIndex,
|
||||
trackedMeasurements[0]
|
||||
);
|
||||
|
||||
const referencedDisplaySetUID =
|
||||
trackedMeasurements[0].displaySetInstanceUID;
|
||||
const referencedDisplaySet = displaySetService.getDisplaySetByUID(
|
||||
referencedDisplaySetUID
|
||||
);
|
||||
|
||||
const referencedImages = referencedDisplaySet.images;
|
||||
const isVolumeIdReferenced = referencedImages[0].imageId.startsWith(
|
||||
'volumeId'
|
||||
);
|
||||
|
||||
const measurementData = trackedMeasurements[0].data;
|
||||
|
||||
let imageIndex = 0;
|
||||
if (!isVolumeIdReferenced && measurementData) {
|
||||
// if it is imageId referenced find the index of the imageId, we don't have
|
||||
// support for volumeId referenced images yet
|
||||
imageIndex = referencedImages.findIndex(image => {
|
||||
const imageIdToUse = Object.keys(measurementData)[0].substring(8);
|
||||
return image.imageId === imageIdToUse;
|
||||
});
|
||||
|
||||
if (imageIndex === -1) {
|
||||
console.warn(
|
||||
'Could not find image index for tracked measurement, using 0'
|
||||
);
|
||||
imageIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
viewportGridService.setDisplaySetsForViewport({
|
||||
viewportIndex: viewportGrid.activeViewportIndex,
|
||||
displaySetInstanceUIDs: [trackedMeasurements[0].displaySetInstanceUID],
|
||||
displaySetInstanceUIDs: [referencedDisplaySetUID],
|
||||
viewportOptions: {
|
||||
initialImageOptions: {
|
||||
index: imageIndex,
|
||||
},
|
||||
},
|
||||
});
|
||||
measurementService.jumpToMeasurement(
|
||||
viewportGrid.activeViewportIndex,
|
||||
uid
|
||||
);
|
||||
},
|
||||
showStructuredReportDisplaySetInActiveViewport: (ctx, evt) => {
|
||||
if (evt.data.createdDisplaySetInstanceUIDs.length > 0) {
|
||||
@@ -73,7 +102,6 @@ function TrackedMeasurementsContextProvider(
|
||||
}
|
||||
},
|
||||
discardPreviouslyTrackedMeasurements: (ctx, evt) => {
|
||||
const { measurementService } = servicesManager.services;
|
||||
const measurements = measurementService.getMeasurements();
|
||||
const filteredMeasurements = measurements.filter(ms =>
|
||||
ctx.prevTrackedSeries.includes(ms.referenceSeriesUID)
|
||||
@@ -85,7 +113,6 @@ function TrackedMeasurementsContextProvider(
|
||||
}
|
||||
},
|
||||
clearAllMeasurements: (ctx, evt) => {
|
||||
const { measurementService } = servicesManager.services;
|
||||
const measurements = measurementService.getMeasurements();
|
||||
const measurementIds = measurements.map(fm => fm.uid);
|
||||
|
||||
|
||||
+114
-108
@@ -439,124 +439,130 @@ function _mapDisplaySets(
|
||||
) {
|
||||
const thumbnailDisplaySets = [];
|
||||
const thumbnailNoImageDisplaySets = [];
|
||||
displaySets.forEach(ds => {
|
||||
const imageSrc = thumbnailImageSrcMap[ds.displaySetInstanceUID];
|
||||
const componentType = _getComponentType(ds.Modality);
|
||||
const numPanes = viewportGridService.getNumViewportPanes();
|
||||
const viewportIdentificator =
|
||||
numPanes === 1
|
||||
? []
|
||||
: viewports.reduce((acc, viewportData, index) => {
|
||||
if (
|
||||
index < numPanes &&
|
||||
viewportData?.displaySetInstanceUIDs?.includes(
|
||||
ds.displaySetInstanceUID
|
||||
)
|
||||
) {
|
||||
acc.push(viewportData.viewportLabel);
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
displaySets
|
||||
.filter(ds => !ds.excludeFromThumbnailBrowser)
|
||||
.forEach(ds => {
|
||||
const imageSrc = thumbnailImageSrcMap[ds.displaySetInstanceUID];
|
||||
const componentType = _getComponentType(ds.Modality);
|
||||
const numPanes = viewportGridService.getNumViewportPanes();
|
||||
const viewportIdentificator =
|
||||
numPanes === 1
|
||||
? []
|
||||
: viewports.reduce((acc, viewportData, index) => {
|
||||
if (
|
||||
index < numPanes &&
|
||||
viewportData?.displaySetInstanceUIDs?.includes(
|
||||
ds.displaySetInstanceUID
|
||||
)
|
||||
) {
|
||||
acc.push(viewportData.viewportLabel);
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
const array =
|
||||
componentType === 'thumbnailTracked'
|
||||
? thumbnailDisplaySets
|
||||
: thumbnailNoImageDisplaySets;
|
||||
const array =
|
||||
componentType === 'thumbnailTracked'
|
||||
? thumbnailDisplaySets
|
||||
: thumbnailNoImageDisplaySets;
|
||||
|
||||
const { displaySetInstanceUID } = ds;
|
||||
const { displaySetInstanceUID } = ds;
|
||||
|
||||
const thumbnailProps = {
|
||||
displaySetInstanceUID,
|
||||
description: ds.SeriesDescription,
|
||||
seriesNumber: ds.SeriesNumber,
|
||||
modality: ds.Modality,
|
||||
seriesDate: formatDate(ds.SeriesDate),
|
||||
numInstances: ds.numImageFrames,
|
||||
countIcon: ds.countIcon,
|
||||
StudyInstanceUID: ds.StudyInstanceUID,
|
||||
componentType,
|
||||
imageSrc,
|
||||
dragData: {
|
||||
type: 'displayset',
|
||||
const thumbnailProps = {
|
||||
displaySetInstanceUID,
|
||||
// .. Any other data to pass
|
||||
},
|
||||
isTracked: trackedSeriesInstanceUIDs.includes(ds.SeriesInstanceUID),
|
||||
viewportIdentificator,
|
||||
};
|
||||
description: ds.SeriesDescription,
|
||||
seriesNumber: ds.SeriesNumber,
|
||||
modality: ds.Modality,
|
||||
seriesDate: formatDate(ds.SeriesDate),
|
||||
numInstances: ds.numImageFrames,
|
||||
countIcon: ds.countIcon,
|
||||
StudyInstanceUID: ds.StudyInstanceUID,
|
||||
componentType,
|
||||
imageSrc,
|
||||
dragData: {
|
||||
type: 'displayset',
|
||||
displaySetInstanceUID,
|
||||
// .. Any other data to pass
|
||||
},
|
||||
isTracked: trackedSeriesInstanceUIDs.includes(ds.SeriesInstanceUID),
|
||||
viewportIdentificator,
|
||||
};
|
||||
|
||||
if (componentType === 'thumbnailNoImage') {
|
||||
if (dataSource.reject && dataSource.reject.series) {
|
||||
thumbnailProps.canReject = true;
|
||||
thumbnailProps.onReject = () => {
|
||||
uiDialogService.create({
|
||||
id: 'ds-reject-sr',
|
||||
centralize: true,
|
||||
isDraggable: false,
|
||||
showOverlay: true,
|
||||
content: Dialog,
|
||||
contentProps: {
|
||||
title: 'Delete Report',
|
||||
body: () => (
|
||||
<div className="p-4 text-white bg-primary-dark">
|
||||
<p>Are you sure you want to delete this report?</p>
|
||||
<p>This action cannot be undone.</p>
|
||||
</div>
|
||||
),
|
||||
actions: [
|
||||
{ id: 'cancel', text: 'Cancel', type: 'secondary' },
|
||||
{
|
||||
id: 'yes',
|
||||
text: 'Yes',
|
||||
type: 'primary',
|
||||
classes: ['reject-yes-button'],
|
||||
if (componentType === 'thumbnailNoImage') {
|
||||
if (dataSource.reject && dataSource.reject.series) {
|
||||
thumbnailProps.canReject = true;
|
||||
thumbnailProps.onReject = () => {
|
||||
uiDialogService.create({
|
||||
id: 'ds-reject-sr',
|
||||
centralize: true,
|
||||
isDraggable: false,
|
||||
showOverlay: true,
|
||||
content: Dialog,
|
||||
contentProps: {
|
||||
title: 'Delete Report',
|
||||
body: () => (
|
||||
<div className="p-4 text-white bg-primary-dark">
|
||||
<p>Are you sure you want to delete this report?</p>
|
||||
<p>This action cannot be undone.</p>
|
||||
</div>
|
||||
),
|
||||
actions: [
|
||||
{ id: 'cancel', text: 'Cancel', type: 'secondary' },
|
||||
{
|
||||
id: 'yes',
|
||||
text: 'Yes',
|
||||
type: 'primary',
|
||||
classes: ['reject-yes-button'],
|
||||
},
|
||||
],
|
||||
onClose: () => uiDialogService.dismiss({ id: 'ds-reject-sr' }),
|
||||
onShow: () => {
|
||||
const yesButton = document.querySelector(
|
||||
'.reject-yes-button'
|
||||
);
|
||||
|
||||
yesButton.focus();
|
||||
},
|
||||
],
|
||||
onClose: () => uiDialogService.dismiss({ id: 'ds-reject-sr' }),
|
||||
onShow: () => {
|
||||
const yesButton = document.querySelector('.reject-yes-button');
|
||||
|
||||
yesButton.focus();
|
||||
},
|
||||
onSubmit: async ({ action }) => {
|
||||
switch (action.id) {
|
||||
case 'yes':
|
||||
try {
|
||||
await dataSource.reject.series(
|
||||
ds.StudyInstanceUID,
|
||||
ds.SeriesInstanceUID
|
||||
);
|
||||
displaySetService.deleteDisplaySet(displaySetInstanceUID);
|
||||
onSubmit: async ({ action }) => {
|
||||
switch (action.id) {
|
||||
case 'yes':
|
||||
try {
|
||||
await dataSource.reject.series(
|
||||
ds.StudyInstanceUID,
|
||||
ds.SeriesInstanceUID
|
||||
);
|
||||
displaySetService.deleteDisplaySet(
|
||||
displaySetInstanceUID
|
||||
);
|
||||
uiDialogService.dismiss({ id: 'ds-reject-sr' });
|
||||
uiNotificationService.show({
|
||||
title: 'Delete Report',
|
||||
message: 'Report deleted successfully',
|
||||
type: 'success',
|
||||
});
|
||||
} catch (error) {
|
||||
uiDialogService.dismiss({ id: 'ds-reject-sr' });
|
||||
uiNotificationService.show({
|
||||
title: 'Delete Report',
|
||||
message: 'Failed to delete report',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'cancel':
|
||||
uiDialogService.dismiss({ id: 'ds-reject-sr' });
|
||||
uiNotificationService.show({
|
||||
title: 'Delete Report',
|
||||
message: 'Report deleted successfully',
|
||||
type: 'success',
|
||||
});
|
||||
} catch (error) {
|
||||
uiDialogService.dismiss({ id: 'ds-reject-sr' });
|
||||
uiNotificationService.show({
|
||||
title: 'Delete Report',
|
||||
message: 'Failed to delete report',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'cancel':
|
||||
uiDialogService.dismiss({ id: 'ds-reject-sr' });
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
} else {
|
||||
thumbnailProps.canReject = false;
|
||||
});
|
||||
};
|
||||
} else {
|
||||
thumbnailProps.canReject = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
array.push(thumbnailProps);
|
||||
});
|
||||
array.push(thumbnailProps);
|
||||
});
|
||||
|
||||
return [...thumbnailDisplaySets, ...thumbnailNoImageDisplaySets];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user