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 87 88 89 90 91 92 93 94 95 | 140x 140x 140x 140x 140x 140x 140x 140x 1476x 1476x 1476x 1476x 1476x 1476x 1476x 1476x 1476x 140x | import * as metaData from '../metaData'; import isEqual from './isEqual'; /** * Checks if the given imageIds form a valid volume. A volume is considered valid if all imageIds * have the same series instance UID, modality, columns, rows, image orientation patient, and pixel * spacing. * * @param imageIds - The imageIds to check. * @returns true if the imageIds form a valid volume, false otherwise. */ function isValidVolume(imageIds: string[]): boolean { Iif (imageIds.length <= 1) { return false; } const imageId0 = imageIds[0]; const { modality, seriesInstanceUID } = metaData.get( 'generalSeriesModule', imageId0 ); const { imageOrientationPatient, pixelSpacing, frameOfReferenceUID, columns, rows, usingDefaultValues, } = metaData.get('imagePlaneModule', imageId0); Iif (usingDefaultValues) { return false; } const baseMetadata = { modality, imageOrientationPatient, pixelSpacing, frameOfReferenceUID, columns, rows, seriesInstanceUID, }; let validVolume = true; for (let i = 0; i < imageIds.length; i++) { const imageId = imageIds[i]; const { modality, seriesInstanceUID } = metaData.get( 'generalSeriesModule', imageId ); const { imageOrientationPatient, pixelSpacing, columns, rows } = metaData.get('imagePlaneModule', imageId); Iif (seriesInstanceUID !== baseMetadata.seriesInstanceUID) { validVolume = false; break; } Iif (modality !== baseMetadata.modality) { validVolume = false; break; } Iif (columns !== baseMetadata.columns) { validVolume = false; break; } Iif (rows !== baseMetadata.rows) { validVolume = false; break; } Iif ( !isEqual(imageOrientationPatient, baseMetadata.imageOrientationPatient) ) { validVolume = false; break; } Iif (!isEqual(pixelSpacing, baseMetadata.pixelSpacing)) { validVolume = false; break; } } return validVolume; } export { isValidVolume }; |