diff --git a/dicom-viewer/src/App.tsx b/dicom-viewer/src/App.tsx
index 2fcc5b0..af772c3 100644
--- a/dicom-viewer/src/App.tsx
+++ b/dicom-viewer/src/App.tsx
@@ -1455,6 +1455,7 @@ function App({ container_id, imageStacks, autoCacheStack, ...props }: AppProps)
const numVisible = viewportGrid.rows * viewportGrid.cols;
const viewports = [];
//for (let i = 0; i < MAX_VIEWPORTS; i++) {
+ // Viewports rendering loop
for (let i = 0; i < numVisible; i++) {
// Determine if this viewport should be visible in the current grid
const isVisible = i < viewportGrid.rows * viewportGrid.cols;
@@ -1640,6 +1641,103 @@ function App({ container_id, imageStacks, autoCacheStack, ...props }: AppProps)
)}
+ // Annotations buttons
+{viewportModes[i] === "stack" && (() => {
+ // Get all annotations for this stack
+ const imageIds = viewportImageIds[i];
+ const allAnnotations = cornerstoneTools.annotation.state.getAllAnnotations() || [];
+ const stackAnnotations = allAnnotations.filter(
+ ann =>
+ ann.metadata &&
+ ann.metadata.referencedImageId &&
+ imageIds.includes(ann.metadata.referencedImageId)
+ );
+ if (!stackAnnotations.length) return null;
+ return (
+
+
+
+
+ );
+})()}
+// ...existing code...
{/* Overlay info (bottom left of viewport) */}
imageIds.findIndex(id => id === ann.metadata.referencedImageId))
+ .filter(idx => idx !== -1)
+ .sort((a, b) => a - b);
+
+ if (!annIndices.length) return null;
+
+ // Find the next/prev annotation index
+ if (direction === 1) {
+ // Next
+ for (let idx of annIndices) {
+ if (idx > currentIdx) return idx;
+ }
+ return annIndices[0]; // wrap around
+ } else {
+ // Previous
+ for (let i = annIndices.length - 1; i >= 0; i--) {
+ if (annIndices[i] < currentIdx) return annIndices[i];
+ }
+ return annIndices[annIndices.length - 1]; // wrap around
+ }
+}
\ No newline at end of file