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 | 18x 18x 20x 20x 20x 17x | import * as Enums from '../../../enums';
import { SegmentationPublicInput } from '../../../types/SegmentationStateTypes';
import { validatePublic as validatePublicLabelmap } from '../../../tools/displayTools/Labelmap/validateLabelmap';
/**
* Validates the given segmentationInputArray to ensure it contains
* appropriate representationProps for the representation type being used.
*
* @param segmentationInputArray - Array of segmentation inputs
* @throws If the segmentationInputArray is undefined or empty
* @throws If the segmentationInput.segmentationId is undefined
* @throws If the segmentationInput.representation is undefined
* @internal
*/
function validateSegmentationInput(
segmentationInputArray: SegmentationPublicInput[]
): void {
Iif (!segmentationInputArray || segmentationInputArray.length === 0) {
throw new Error(
'The segmentationInputArray is undefined or an empty array'
);
}
segmentationInputArray.forEach((segmentationInput) => {
Iif (segmentationInput.segmentationId === undefined) {
throw new Error(
'Undefined segmentationInput.segmentationId. Please provide a valid segmentationId'
);
}
Iif (segmentationInput.representation === undefined) {
throw new Error(
'Undefined segmentationInput.representation. Please provide a valid representation'
);
}
if (
segmentationInput.representation.type ===
Enums.SegmentationRepresentations.Labelmap
) {
validatePublicLabelmap(segmentationInput);
}
});
}
export default validateSegmentationInput;
|