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 | 6x 6x 6x 1x 1x 1x 1x 1x 1x 1x 1x | import { utilities } from '@cornerstonejs/core';
import type { PublicToolProps } from '../../types';
import type { AnnotationRenderContext } from '../../types';
import { PlanarFreehandContourSegmentationAnnotation } from '../../types/ToolSpecificAnnotationTypes';
import { triggerSegmentationDataModified } from '../../stateManagement/segmentation/triggerSegmentationEvents';
import PlanarFreehandROITool from './PlanarFreehandROITool';
class PlanarFreehandContourSegmentationTool extends PlanarFreehandROITool {
static toolName;
constructor(toolProps: PublicToolProps) {
const initialProps = utilities.deepMerge(
{
configuration: {
calculateStats: false,
/**
* Allow open contours false means to not allow a final/complete
* annotation to be done as an open contour. This does not mean
* that the contour won't be open during creation.
*/
allowOpenContours: false,
},
},
toolProps
);
super(initialProps);
}
protected isContourSegmentationTool(): boolean {
// Re-enable contour segmentation behavior disabled by PlanarFreehandROITool
return true;
}
protected renderAnnotationInstance(
renderContext: AnnotationRenderContext
): boolean {
const annotation =
renderContext.annotation as PlanarFreehandContourSegmentationAnnotation;
const { invalidated } = annotation;
// Render the annotation before triggering events
const renderResult = super.renderAnnotationInstance(renderContext);
Eif (invalidated) {
const { segmentationId } = annotation.data.segmentation;
// This event is trigged by ContourSegmentationBaseTool but PlanarFreehandROITool
// is the only contour class that does not call `renderAnnotationInstace` from
// its base class.
triggerSegmentationDataModified(segmentationId);
}
return renderResult;
}
}
PlanarFreehandContourSegmentationTool.toolName =
'PlanarFreehandContourSegmentationTool';
export default PlanarFreehandContourSegmentationTool;
|