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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | 225x 15x 15x 17x 15x 255x 17x | import _cloneDeep from 'lodash.clonedeep'; import { SegmentationRepresentationConfig, RepresentationPublicInput, } from '../../types/SegmentationStateTypes'; import Representations from '../../enums/SegmentationRepresentations'; import { getToolGroup } from '../../store/ToolGroupManager'; import { labelmapDisplay } from '../../tools/displayTools/Labelmap'; import { contourDisplay } from '../../tools/displayTools/Contour'; import { surfaceDisplay } from '../../tools/displayTools/Surface'; /** * Set the specified segmentation representations on the viewports of the specified * toolGroup. It accepts a second argument which is a toolGroup specific representation * configuration. * * @param toolGroupId - The Id of the toolGroup to add the segmentation representations to * @param representationInputArray - An array of segmentation representations to add to the toolGroup * @param toolGroupSpecificRepresentationConfig - The toolGroup specific configuration * for the segmentation representations */ Easync function addSegmentationRepresentations( toolGroupId: string, representationInputArray: RepresentationPublicInput[], toolGroupSpecificRepresentationConfig?: SegmentationRepresentationConfig ): Promise<string[]> { // Check if there exists a toolGroup with the toolGroupId const toolGroup = getToolGroup(toolGroupId); if (!toolGroup) { throw new Error(`No tool group found for toolGroupId: ${toolGroupId}`); } const promises = representationInputArray.map((representationInput) => { return _addSegmentationRepresentation( toolGroupId, representationInput, toolGroupSpecificRepresentationConfig ); }); const segmentationRepresentationUIDs = await Promise.all(promises); return segmentationRepresentationUIDs; } Iasync function _addSegmentationRepresentation( toolGroupId: string, representationInput: RepresentationPublicInput, toolGroupSpecificRepresentationConfig?: SegmentationRepresentationConfig ): Promise<string> { let segmentationRepresentationUID; if (representationInput.type === Representations.Labelmap) { segmentationRepresentationUID = await labelmapDisplay.addSegmentationRepresentation( toolGroupId, representationInput, toolGroupSpecificRepresentationConfig ); } else if (representationInput.type === Representations.Contour) { segmentationRepresentationUID = await contourDisplay.addSegmentationRepresentation( toolGroupId, representationInput, toolGroupSpecificRepresentationConfig ); } else if (representationInput.type === Representations.Surface) { segmentationRepresentationUID = await surfaceDisplay.addSegmentationRepresentation( toolGroupId, representationInput, toolGroupSpecificRepresentationConfig ); } else { throw new Error( `The representation type ${representationInput.type} is not supported` ); } return segmentationRepresentationUID; } export default addSegmentationRepresentations; |