94 lines
2.2 KiB
Plaintext
94 lines
2.2 KiB
Plaintext
import * as cornerstoneTools from '@cornerstonejs/tools'
|
|
const {
|
|
utilities
|
|
|
|
} = cornerstoneTools
|
|
|
|
const { roundNumber } = utilities
|
|
|
|
class CircleROITool extends cornerstoneTools.CircleROITool {
|
|
// static toolName;
|
|
// touchDragCallback: any;
|
|
// mouseDragCallback: any;
|
|
// _throttledCalculateCachedStats: any;
|
|
// editData: {
|
|
// annotation: any;
|
|
// viewportIdsToRender: Array<string>;
|
|
// handleIndex?: number;
|
|
// movingTextBox?: boolean;
|
|
// newAnnotation?: boolean;
|
|
// hasMoved?: boolean;
|
|
// } | null;
|
|
// isDrawing: boolean;
|
|
// isHandleOutsideImage = false;
|
|
|
|
constructor(
|
|
toolProps = {},
|
|
defaultToolProps = {
|
|
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
configuration: {
|
|
shadow: true,
|
|
preventHandleOutsideImage: false,
|
|
centerPointRadius: 0
|
|
}
|
|
}
|
|
) {
|
|
super(toolProps, defaultToolProps)
|
|
|
|
// this._throttledCalculateCachedStats = utilities.throttle(
|
|
// this._calculateCachedStats,
|
|
// 100,
|
|
// { trailing: true }
|
|
// )
|
|
this._getTextLines = this.getTextLines
|
|
}
|
|
getTextLines(data, targetId) {
|
|
const cachedVolumeStats = data.cachedStats[targetId]
|
|
const {
|
|
radius,
|
|
radiusUnit,
|
|
area,
|
|
mean,
|
|
stdDev,
|
|
max,
|
|
isEmptyArea,
|
|
areaUnit,
|
|
modalityUnit
|
|
} = cachedVolumeStats
|
|
// console.log(data)
|
|
const textLines = []
|
|
|
|
if (radius) {
|
|
const radiusLine = isEmptyArea
|
|
? `Radius: Oblique not supported`
|
|
: `Radius: ${roundNumber(radius)} ${radiusUnit}`
|
|
textLines.push(radiusLine)
|
|
}
|
|
|
|
if (area) {
|
|
const areaLine = isEmptyArea
|
|
? `Area: Oblique not supported`
|
|
: `Area: ${roundNumber(area)} ${areaUnit}`
|
|
textLines.push(areaLine)
|
|
}
|
|
|
|
if (mean) {
|
|
textLines.push(`Mean: ${roundNumber(mean)} ${modalityUnit}`)
|
|
}
|
|
|
|
if (max) {
|
|
textLines.push(`Max: ${roundNumber(max)} ${modalityUnit}`)
|
|
}
|
|
|
|
if (stdDev) {
|
|
textLines.push(`Std Dev: ${roundNumber(stdDev)} ${modalityUnit}`)
|
|
}
|
|
|
|
return textLines
|
|
}
|
|
}
|
|
|
|
CircleROITool.toolName = 'CircleROI'
|
|
export default CircleROITool
|
|
|