some cleanup and start movinig to multiple instances

This commit is contained in:
Ross
2025-06-02 10:39:07 +01:00
parent 3f6c68523e
commit 43c3f75889
3 changed files with 15 additions and 17 deletions
+2 -1
View File
@@ -7,7 +7,8 @@
<title>Vite + React + TS</title> <title>Vite + React + TS</title>
</head> </head>
<body> <body>
<div id="root" style="max-height:500px; height:500px; overflow:auto;"></div> <div id="root" class="dicom-viewer-root" style="max-height:500px; height:500px; overflow:auto;"></div>
<div id="root2" class="dicom-viewer-root" style="max-height:500px; height:500px; overflow:auto;"></div>
<script type="module" src="/src/main.tsx"></script> <script type="module" src="/src/main.tsx"></script>
<input type="file" id="dicomInput" multiple /> <input type="file" id="dicomInput" multiple />
-10
View File
@@ -65,8 +65,6 @@ const { MouseBindings, KeyboardBindings } = csToolsEnums;
const { IMAGE_RENDERED } = Enums.Events; const { IMAGE_RENDERED } = Enums.Events;
const STACK_TOOL_GROUP_ID = 'STACK_TOOL_GROUP_ID';
const VOLUME_TOOL_GROUP_ID = 'VOLUME_TOOL_GROUP_ID';
const MAIN_TOOL_GROUP_ID = 'MAIN_TOOL_GROUP_ID'; const MAIN_TOOL_GROUP_ID = 'MAIN_TOOL_GROUP_ID';
// Common CT presets (add more as needed) // Common CT presets (add more as needed)
@@ -121,7 +119,6 @@ const ALL_MOUSE_BINDINGS = [
// App definintion // App definintion
function App() { function App() {
const elementRef = useRef<HTMLDivElement>(null) const elementRef = useRef<HTMLDivElement>(null)
const viewportRef = useRef<any>(null) // Store the viewport instance
const running = useRef(false) const running = useRef(false)
// State to control preset menu open/close // State to control preset menu open/close
@@ -131,13 +128,6 @@ function App() {
const [fullscreenHoverIdx, setFullscreenHoverIdx] = useState<number | null>(null); const [fullscreenHoverIdx, setFullscreenHoverIdx] = useState<number | null>(null);
const [openDropdownIdx, setOpenDropdownIdx] = useState<number | null>(null); const [openDropdownIdx, setOpenDropdownIdx] = useState<number | null>(null);
// State for overlay info
const [imageInfo, setImageInfo] = useState({
index: 0,
total: 0,
windowCenter: "",
windowWidth: "",
})
const MAX_VIEWPORTS = 9; const MAX_VIEWPORTS = 9;
const renderingEngineId = "mainRenderingEngine"; const renderingEngineId = "mainRenderingEngine";
+13 -6
View File
@@ -1,12 +1,19 @@
import React from 'react' import React from 'react'
import { createRoot } from "react-dom/client";
import ReactDOM from 'react-dom/client' import ReactDOM from 'react-dom/client'
import App from './App.tsx' import App from './App.tsx'
import Nifti from './Nifti.tsx' import Nifti from './Nifti.tsx'
import './index.css' import './index.css'
ReactDOM.createRoot(document.getElementById('root')!).render( //ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode> // <React.StrictMode>
<App /> // <App />
{/* <Nifti /> */} // {/* <Nifti /> */}
</React.StrictMode>, // </React.StrictMode>,
) //)
// Render to multiple containers
const containers = document.querySelectorAll(".dicom-viewer-root");
containers.forEach((container) => {
createRoot(container).render(<App />);
});