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 | 40x 40x 40x 40x 40x 40x 40x | import type { IStackViewport, IStackInput, IRenderingEngine, IVideoViewport, } from '../../types'; /** * For each provided viewport it adds a volume to the viewport using the * provided renderingEngine * * * @param renderingEngine - The rendering engine to use to get viewports from * @param volumeInputs - Array of volume inputs including volumeId. Other properties * such as visibility, callback, blendMode, slabThickness are optional * @param viewportIds - Array of viewport IDs to add the volume to * @param immediateRender - If true, the volumes will be rendered immediately * @returns A promise that resolves when all volumes have been added */ function addImageSlicesToViewports( renderingEngine: IRenderingEngine, stackInputs: IStackInput[], viewportIds: string[] ): Promise<void> { for (const viewportId of viewportIds) { const viewport = renderingEngine.getViewport(viewportId) as IStackViewport; Iif (!viewport) { throw new Error(`Viewport with Id ${viewportId} does not exist`); } // if the viewport does not support addImages, log a warning and skip Iif (!viewport.addImages) { console.warn( `Viewport with Id ${viewportId} does not have addImages. Cannot add image segmentation to this viewport.` ); return; } } viewportIds.forEach((viewportId) => { const viewport = renderingEngine.getViewport(viewportId) as | IStackViewport | IVideoViewport; viewport.addImages(stackInputs); }); } export default addImageSlicesToViewports; |