feat: visualize overlapping segments in cornerstone (#2185)
* feat: visualize overlapping segments load multiple labelMaps (splitted by dcmjs because overlapping) in a segmentations [IDC2164] Dynamically update active labelmap [IDC2164] Co-authored-by: Davide Punzo <punzodavide@hotmail.it> Co-authored-by: Igor Octaviano <igoroctaviano@gmail.com>
This commit is contained in:
1 parent
a7a5a359dc
commit
29fceacee9
15 files changed
+182
-136
No files matched your search
+27
-5
@@ -159,12 +159,12 @@ const SegmentationPanel = ({
|
||||
const labelmapList = getLabelmapList(
|
||||
brushStackState,
|
||||
firstImageId,
|
||||
activeViewport
|
||||
activeViewport,
|
||||
);
|
||||
const segmentList = getSegmentList(
|
||||
labelmap3D,
|
||||
firstImageId,
|
||||
brushStackState
|
||||
brushStackState,
|
||||
);
|
||||
setState(state => ({
|
||||
...state,
|
||||
@@ -292,10 +292,13 @@ const SegmentationPanel = ({
|
||||
|
||||
const sameSegment = state.selectedSegment === segmentNumber;
|
||||
const setCurrentSelectedSegment = () => {
|
||||
const activeViewport = viewports[activeIndex];
|
||||
|
||||
_setActiveSegment(
|
||||
firstImageId,
|
||||
segmentNumber,
|
||||
labelmap3D.activeSegmentIndex
|
||||
labelmap3D.activeSegmentIndex,
|
||||
activeViewport
|
||||
);
|
||||
updateState('selectedSegment', sameSegment ? null : segmentNumber);
|
||||
|
||||
@@ -640,7 +643,7 @@ const _getReferencedSegDisplaysets = (StudyInstanceUID, SeriesInstanceUID) => {
|
||||
* @param {*} activeSegmentIndex
|
||||
* @returns
|
||||
*/
|
||||
const _setActiveSegment = (firstImageId, segmentIndex, activeSegmentIndex) => {
|
||||
const _setActiveSegment = (firstImageId, segmentIndex, activeSegmentIndex, activeViewport) => {
|
||||
if (segmentIndex === activeSegmentIndex) {
|
||||
log.info(`${activeSegmentIndex} is already the active segment`);
|
||||
return;
|
||||
@@ -653,8 +656,27 @@ const _setActiveSegment = (firstImageId, segmentIndex, activeSegmentIndex) => {
|
||||
brushStackState.labelmaps3D[brushStackState.activeLabelmapIndex];
|
||||
labelmap3D.activeSegmentIndex = segmentIndex;
|
||||
|
||||
refreshViewports();
|
||||
/**
|
||||
* Activates the correct label map if clicked segment
|
||||
* does not belong to the active labelmap
|
||||
*/
|
||||
const { StudyInstanceUID } = activeViewport;
|
||||
const studyMetadata = studyMetadataManager.get(StudyInstanceUID);
|
||||
const allDisplaySets = studyMetadata.getDisplaySets();
|
||||
let newLabelmapIndex = brushStackState.activeLabelmapIndex;
|
||||
allDisplaySets.forEach(displaySet => {
|
||||
if (displaySet.labelmapSegments) {
|
||||
Object.keys(displaySet.labelmapSegments).forEach(labelmapIndex => {
|
||||
if (displaySet.labelmapSegments[labelmapIndex].includes(segmentIndex)) {
|
||||
newLabelmapIndex = labelmapIndex;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
brushStackState.activeLabelmapIndex = newLabelmapIndex;
|
||||
|
||||
refreshViewports();
|
||||
return segmentIndex;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user