Don't try and "getImageSrc" for datasets without imageIds (DICOM SR)

This commit is contained in:
dannyrb 2020-06-16 23:02:16 -04:00
parent 86c758e2f9
commit be6a04684b
2 changed files with 49 additions and 25 deletions

View File

@ -49,6 +49,7 @@ function PanelStudyBrowser({
} }
StudyInstanceUIDs.forEach(sid => fetchStudiesForPatient(sid)); StudyInstanceUIDs.forEach(sid => fetchStudiesForPatient(sid));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [StudyInstanceUIDs, getStudiesForPatientByStudyInstanceUID]); }, [StudyInstanceUIDs, getStudiesForPatientByStudyInstanceUID]);
// ~~ Initial Thumbnails // ~~ Initial Thumbnails
@ -62,12 +63,18 @@ function PanelStudyBrowser({
const imageIds = dataSource.getImageIdsForDisplaySet(displaySet); const imageIds = dataSource.getImageIdsForDisplaySet(displaySet);
const imageId = imageIds[Math.floor(imageIds.length / 2)]; const imageId = imageIds[Math.floor(imageIds.length / 2)];
// TODO: Is it okay that imageIds are not returned here for SR displaysets?
if (imageId) {
// When the image arrives, render it and store the result in the thumbnailImgSrcMap // When the image arrives, render it and store the result in the thumbnailImgSrcMap
newImageSrcEntry[dSet.displaySetInstanceUID] = await getImageSrc(imageId); newImageSrcEntry[dSet.displaySetInstanceUID] = await getImageSrc(
imageId
);
setThumbnailImageSrcMap(prevState => { setThumbnailImageSrcMap(prevState => {
return { ...prevState, ...newImageSrcEntry }; return { ...prevState, ...newImageSrcEntry };
}); });
}
}); });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
// ~~ displaySets // ~~ displaySets
@ -80,6 +87,7 @@ function PanelStudyBrowser({
); );
setDisplaySets(mappedDisplaySets); setDisplaySets(mappedDisplaySets);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [thumbnailImageSrcMap]); }, [thumbnailImageSrcMap]);
// ~~ subscriptions --> displaySets // ~~ subscriptions --> displaySets
@ -96,6 +104,8 @@ function PanelStudyBrowser({
const imageIds = dataSource.getImageIdsForDisplaySet(displaySet); const imageIds = dataSource.getImageIdsForDisplaySet(displaySet);
const imageId = imageIds[Math.floor(imageIds.length / 2)]; const imageId = imageIds[Math.floor(imageIds.length / 2)];
// TODO: Is it okay that imageIds are not returned here for SR displaysets?
if (imageId) {
// When the image arrives, render it and store the result in the thumbnailImgSrcMap // When the image arrives, render it and store the result in the thumbnailImgSrcMap
newImageSrcEntry[dSet.displaySetInstanceUID] = await getImageSrc( newImageSrcEntry[dSet.displaySetInstanceUID] = await getImageSrc(
imageId imageId
@ -103,6 +113,7 @@ function PanelStudyBrowser({
setThumbnailImageSrcMap(prevState => { setThumbnailImageSrcMap(prevState => {
return { ...prevState, ...newImageSrcEntry }; return { ...prevState, ...newImageSrcEntry };
}); });
}
}); });
} }
); );
@ -125,6 +136,7 @@ function PanelStudyBrowser({
SubscriptionDisplaySetsAdded.unsubscribe(); SubscriptionDisplaySetsAdded.unsubscribe();
SubscriptionDisplaySetsChanged.unsubscribe(); SubscriptionDisplaySetsChanged.unsubscribe();
}; };
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
const tabs = _createStudyBrowserTabs( const tabs = _createStudyBrowserTabs(

View File

@ -54,6 +54,7 @@ function PanelStudyBrowserTracking({
); );
return unsubscribe; return unsubscribe;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [MeasurementService, activeViewportIndex, sendTrackedMeasurementsEvent]); }, [MeasurementService, activeViewportIndex, sendTrackedMeasurementsEvent]);
const { trackedStudy, trackedSeries } = trackedMeasurements.context; const { trackedStudy, trackedSeries } = trackedMeasurements.context;
@ -82,6 +83,7 @@ function PanelStudyBrowserTracking({
} }
StudyInstanceUIDs.forEach(sid => fetchStudiesForPatient(sid)); StudyInstanceUIDs.forEach(sid => fetchStudiesForPatient(sid));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [StudyInstanceUIDs, getStudiesForPatientByStudyInstanceUID]); }, [StudyInstanceUIDs, getStudiesForPatientByStudyInstanceUID]);
// ~~ Initial Thumbnails // ~~ Initial Thumbnails
@ -95,12 +97,18 @@ function PanelStudyBrowserTracking({
const imageIds = dataSource.getImageIdsForDisplaySet(displaySet); const imageIds = dataSource.getImageIdsForDisplaySet(displaySet);
const imageId = imageIds[Math.floor(imageIds.length / 2)]; const imageId = imageIds[Math.floor(imageIds.length / 2)];
// TODO: Is it okay that imageIds are not returned here for SR displaysets?
if (imageId) {
// When the image arrives, render it and store the result in the thumbnailImgSrcMap // When the image arrives, render it and store the result in the thumbnailImgSrcMap
newImageSrcEntry[dSet.displaySetInstanceUID] = await getImageSrc(imageId); newImageSrcEntry[dSet.displaySetInstanceUID] = await getImageSrc(
imageId
);
setThumbnailImageSrcMap(prevState => { setThumbnailImageSrcMap(prevState => {
return { ...prevState, ...newImageSrcEntry }; return { ...prevState, ...newImageSrcEntry };
}); });
}
}); });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [DisplaySetService, dataSource, getImageSrc]); }, [DisplaySetService, dataSource, getImageSrc]);
// ~~ displaySets // ~~ displaySets
@ -115,6 +123,7 @@ function PanelStudyBrowserTracking({
); );
setDisplaySets(mappedDisplaySets); setDisplaySets(mappedDisplaySets);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [ }, [
DisplaySetService.activeDisplaySets, DisplaySetService.activeDisplaySets,
trackedSeries, trackedSeries,
@ -135,7 +144,8 @@ function PanelStudyBrowserTracking({
); );
const imageIds = dataSource.getImageIdsForDisplaySet(displaySet); const imageIds = dataSource.getImageIdsForDisplaySet(displaySet);
const imageId = imageIds[Math.floor(imageIds.length / 2)]; const imageId = imageIds[Math.floor(imageIds.length / 2)];
// TODO: Is it okay that imageIds are not returned here for SR displaysets?
if (imageId) {
// When the image arrives, render it and store the result in the thumbnailImgSrcMap // When the image arrives, render it and store the result in the thumbnailImgSrcMap
newImageSrcEntry[dSet.displaySetInstanceUID] = await getImageSrc( newImageSrcEntry[dSet.displaySetInstanceUID] = await getImageSrc(
imageId imageId
@ -143,6 +153,7 @@ function PanelStudyBrowserTracking({
setThumbnailImageSrcMap(prevState => { setThumbnailImageSrcMap(prevState => {
return { ...prevState, ...newImageSrcEntry }; return { ...prevState, ...newImageSrcEntry };
}); });
}
}); });
} }
); );
@ -167,6 +178,7 @@ function PanelStudyBrowserTracking({
SubscriptionDisplaySetsAdded.unsubscribe(); SubscriptionDisplaySetsAdded.unsubscribe();
SubscriptionDisplaySetsChanged.unsubscribe(); SubscriptionDisplaySetsChanged.unsubscribe();
}; };
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [ }, [
DisplaySetService, DisplaySetService,
dataSource, dataSource,