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 | 18x 18x 18x 20x 18x 18x | import {
SegmentationRepresentationConfig,
RepresentationPublicInput,
} from '../../types/SegmentationStateTypes';
import { getToolGroup } from '../../store/ToolGroupManager';
import { addSegmentationRepresentation } from './addSegmentationRepresentation';
/**
* Set the specified segmentation representations on the viewports of the specified
* toolGroup. It accepts a second argument which is a toolGroup specific representation
* configuration.
*
* @param toolGroupId - The Id of the toolGroup to add the segmentation representations to
* @param representationInputArray - An array of segmentation representations to add to the toolGroup
* @param toolGroupSpecificRepresentationConfig - The toolGroup specific configuration
* for the segmentation representations
*/
async function addSegmentationRepresentations(
toolGroupId: string,
representationInputArray: RepresentationPublicInput[],
toolGroupSpecificRepresentationConfig?: SegmentationRepresentationConfig
): Promise<string[]> {
// Check if there exists a toolGroup with the toolGroupId
const toolGroup = getToolGroup(toolGroupId);
Iif (!toolGroup) {
throw new Error(`No tool group found for toolGroupId: ${toolGroupId}`);
}
const promises = representationInputArray.map((representationInput) => {
return addSegmentationRepresentation(
toolGroupId,
representationInput,
toolGroupSpecificRepresentationConfig
);
});
const segmentationRepresentationUIDs = await Promise.all(promises);
return segmentationRepresentationUIDs;
}
export default addSegmentationRepresentations;
|