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 | 1x 2x 2x 2x 2x 2x 2x 2x | import { utilities } from '@cornerstonejs/core'; import type { Types } from '@cornerstonejs/core'; const { calibratedPixelSpacingMetadataProvider } = utilities; /** * It adds the provided spacing to the Cornerstone internal calibratedPixelSpacing * metadata provider, then it invalidates all the tools that have the imageId as * their reference imageIds. Finally, it triggers a re-render for invalidated annotations. * @param imageId - ImageId for the calibrated image * @param rowPixelSpacing - Spacing in row direction * @param columnPixelSpacing - Spacing in column direction * @param renderingEngine - Cornerstone RenderingEngine instance */ export default function calibrateImageSpacing( imageId: string, renderingEngine: Types.IRenderingEngine, rowPixelSpacing: number, columnPixelSpacing: number ): void { // 1. Add the calibratedPixelSpacing metadata to the metadata provider // If no column spacing provided, assume square pixels Iif (!columnPixelSpacing) { columnPixelSpacing = rowPixelSpacing; } calibratedPixelSpacingMetadataProvider.add(imageId, [ rowPixelSpacing, columnPixelSpacing, ]); // 2. Update the actor for stackViewports const viewports = renderingEngine.getStackViewports(); // 2.1 If imageId is already being used in a stackViewport -> update actor viewports.forEach((viewport) => { const imageIds = viewport.getImageIds(); Eif (imageIds.includes(imageId)) { viewport.calibrateSpacing(imageId); } }); // 2.2 If imageId is cached but not being displayed in a viewport, stackViewport // will handle using the calibratedPixelSpacing since it has been added // to the provider } |