feat: Implemented CSV support for Arrow annotation. (#4623)

Co-authored-by: Ibrahim <93064150+IbrahimCSAE@users.noreply.github.com>
This commit is contained in:
nithin-trenser 2025-01-03 21:27:25 +05:30 committed by GitHub
parent e11ceb9d20
commit 55fe185c72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,6 +57,7 @@ const Length = {
const mappedAnnotations = getMappedAnnotations(annotation, displaySetService);
const displayText = getDisplayText(mappedAnnotations, displaySet);
const getReport = () => _getReport(mappedAnnotations, points, FrameOfReferenceUID);
return {
uid: annotationUID,
@ -77,9 +78,7 @@ const Length = {
displayText: displayText,
data: data.cachedStats,
type: getValueTypeFromToolType(toolName),
getReport: () => {
throw new Error('Not implemented');
},
getReport,
};
},
};
@ -145,4 +144,32 @@ function getDisplayText(mappedAnnotations, displaySet) {
return displayText;
}
function _getReport(mappedAnnotations, points, FrameOfReferenceUID) {
const columns = [];
const values = [];
columns.push('AnnotationType');
values.push('Cornerstone:ArrowAnnote');
mappedAnnotations.forEach(annotation => {
const { text } = annotation;
columns.push(`Text`);
values.push(text);
});
if (FrameOfReferenceUID) {
columns.push('FrameOfReferenceUID');
values.push(FrameOfReferenceUID);
}
if (points) {
columns.push('points');
values.push(points.map(p => p.join(' ')).join(';'));
}
return {
columns,
values,
};
}
export default Length;