Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 3x 3x 3x 3x 3x 3x 3x | import { state } from '../../stateManagement/segmentation';
import { ContourSegmentationAnnotation } from '../../types';
/**
* Removes a contour segmentation annotation from the given annotation.
* If the annotation does not have a segmentation data, this method returns
* quietly. This can occur for interpolated segmentations that have not yet
* been converted to real segmentations or other in-process segmentations.
* @param annotation - The contour segmentation annotation to remove.
*/
export function removeContourSegmentationAnnotation(
annotation: ContourSegmentationAnnotation
) {
Iif (!annotation.data.segmentation) {
throw new Error(
'removeContourSegmentationAnnotation: annotation does not have a segmentation data'
);
}
const { segmentationId, segmentIndex } = annotation.data.segmentation;
const segmentation = state.getSegmentation(segmentationId);
const { annotationUIDsMap } = segmentation?.representationData.CONTOUR || {};
const annotationsUIDsSet = annotationUIDsMap?.get(segmentIndex);
Eif (!annotationsUIDsSet) {
return;
}
annotationsUIDsSet.delete(annotation.annotationUID);
// Delete segmentIndex Set if there is no more annotations
if (!annotationsUIDsSet.size) {
annotationUIDsMap.delete(segmentIndex);
}
}
|