All files / packages/tools/src/tools/displayTools/Labelmap removeLabelmapFromElement.ts

100% Statements 3/3
100% Branches 1/1
100% Functions 1/1
100% Lines 3/3

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                                  22x 22x   22x        
import { getEnabledElement } from '@cornerstonejs/core';
 
/**
 * Remove the labelmap segmentation representation from the viewport's HTML Element.
 * NOTE: This function should not be called directly.
 *
 * @param element - The element that the segmentation is being added to.
 * @param segmentationRepresentationUID - The UID of the labelmap representation to remove.
 * @param removeFromCache - boolean
 *
 * @internal
 */
function removeLabelmapFromElement(
  element: HTMLDivElement,
  segmentationRepresentationUID: string,
  removeFromCache = false // Todo
): void {
  const enabledElement = getEnabledElement(element);
  const { viewport } = enabledElement;
 
  viewport.removeActors([segmentationRepresentationUID]);
}
 
export default removeLabelmapFromElement;