src/stateManagement/imageIdSpecificStateManager.js
// As modules that restore saved state
As modules that restore saved state
As modules that restore saved state
function addImageIdSpecificToolState(element, toolType, data) {
    const enabledElement = external.cornerstone.getEnabledElement(element);
    if (!enabledElement.image) {
      return;
    }
    if (toolState.hasOwnProperty(enabledElement.image.imageId) === false) {
      toolState[enabledElement.image.imageId] = {};
    }
    const imageIdToolState = toolState[enabledElement.image.imageId];
    if (imageIdToolState.hasOwnProperty(toolType) === false) {
      imageIdToolState[toolType] = {
        data: [],
      };
    }
    const toolData = imageIdToolState[toolType];
    toolData.data.push(data);
  }
function addImageIdSpecificToolState ( element , toolType , data ) { const enabledElement = external . cornerstone . getEnabledElement ( element ) ; if ( ! enabledElement . image ) { return ; } if ( toolState . hasOwnProperty ( enabledElement . image . imageId ) === false ) { toolState [ enabledElement . image . imageId ] = { } ; } const imageIdToolState = toolState [ enabledElement . image . imageId ] ; if ( imageIdToolState . hasOwnProperty ( toolType ) === false ) { imageIdToolState [ toolType ] = { data : [ ] , } ; } const toolData = imageIdToolState [ toolType ] ; toolData . data . push ( data ) ; }
As modules that restore saved state
As modules that restore saved state
// If we don't have an image for this element exit early // If we don't have any tool state for this imageId, add an empty object // If we don't have tool state for this type of tool, add an empty object // Finally, add this new tool to the state