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 | 15x 15x 17x 17x 17x 17x | import * as Enums from '../../../enums';
import { SegmentationPublicInput } from '../../../types/SegmentationStateTypes';
import validateLabelmap from '../../../tools/displayTools/Labelmap/validateRepresentationData';
/**
* Checks if the segmentationInputArray is valid meaning it contains
* correct representationProps for the representation type that is being used.
*
* @param segmentationInputArray - Array of segmentation inputs
* @internal
*/
function validateSegmentationInput(
segmentationInputArray: SegmentationPublicInput[]
): void {
Iif (!segmentationInputArray || !segmentationInputArray.length) {
throw new Error('The segmentationInputArray is undefined or empty array');
}
segmentationInputArray.forEach((segmentationInput) => {
Iif (segmentationInput.segmentationId === undefined) {
throw new Error(
'The segmentationInput.segmentationId is undefined, please provide a valid segmentationId'
);
}
Iif (segmentationInput.representation === undefined) {
throw new Error(
'The segmentationInput.representation is undefined, please provide a valid representation'
);
}
Eif (
segmentationInput.representation.type ===
Enums.SegmentationRepresentations.Labelmap
) {
validateLabelmap(segmentationInput);
}
});
}
export default validateSegmentationInput;
|