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

Co-authored-by: Ibrahim <93064150+IbrahimCSAE@users.noreply.github.com>
This commit is contained in:
nithin-trenserandIbrahim authored and GitHub committed 2025-01-03 10:57:25 -05:00
1 parent e11ceb9d20
commit 55fe185c72
1 file changed
+30 -3
@@ -57,6 +57,7 @@ const Length = {
const mappedAnnotations = getMappedAnnotations(annotation, displaySetService); const mappedAnnotations = getMappedAnnotations(annotation, displaySetService);
const displayText = getDisplayText(mappedAnnotations, displaySet); const displayText = getDisplayText(mappedAnnotations, displaySet);
const getReport = () => _getReport(mappedAnnotations, points, FrameOfReferenceUID);
return { return {
uid: annotationUID, uid: annotationUID,
@@ -77,9 +78,7 @@ const Length = {
displayText: displayText, displayText: displayText,
data: data.cachedStats, data: data.cachedStats,
type: getValueTypeFromToolType(toolName), type: getValueTypeFromToolType(toolName),
getReport: () => { getReport,
throw new Error('Not implemented');
},
}; };
}, },
}; };
@@ -145,4 +144,32 @@ function getDisplayText(mappedAnnotations, displaySet) {
return displayText; 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; export default Length;