Fibers
+(.trk / .tko)
+Volumes
+(.nii / .nii.gz / DICOM)
+Models
+(.obj / .vtk / .stl / FreeSurfer)
+diff --git a/.gitignore b/.gitignore index 5d0f2c4..dbc1c3e 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ # nfs *.nfs* + +.vscode/ diff --git a/reload/dropHandler.js b/reload/dropHandler.js new file mode 100644 index 0000000..6215ebf --- /dev/null +++ b/reload/dropHandler.js @@ -0,0 +1,88 @@ +import viewer from "./viewer.js"; + +class DropZoneHandler { + constructor() { + this.dropZone = document.getElementById("dropZone"); + this.dropText = document.getElementById("dropText"); + this.fileInput = document.getElementById("fileInput"); + this.drawerContainer = document.querySelector(".drawer-container"); + this.landingContainer = document.getElementById("landingContainer"); + this.viewerContainer = document.getElementById("viewerContainer"); + this.initialize(); + } + + initialize() { + // Bind event listeners + this.dropZone.addEventListener( + "dragenter", + this.handleDragEnter.bind(this) + ); + this.dropZone.addEventListener( + "dragleave", + this.handleDragLeave.bind(this) + ); + this.dropZone.addEventListener("dragover", this.handleDragOver.bind(this)); + this.dropZone.addEventListener("drop", this.handleDrop.bind(this)); + this.fileInput.addEventListener("change", this.handleFileSelect.bind(this)); + } + + showViewer() { + this.landingContainer.classList.add("hidden"); + this.viewerContainer.classList.remove("hidden"); + this.drawerContainer.classList.add("visible"); + } + + handleDragEnter(e) { + e.preventDefault(); + e.stopPropagation(); + this.dropZone.classList.add("dragging"); + this.dropText.textContent = "Drop to load files"; + } + + handleDragLeave(e) { + e.preventDefault(); + e.stopPropagation(); + this.dropZone.classList.remove("dragging"); + this.dropText.textContent = "Drag & drop your files here"; + } + + handleDragOver(e) { + e.preventDefault(); + e.stopPropagation(); + } + + async handleDrop(e) { + e.preventDefault(); + e.stopPropagation(); + this.dropZone.classList.remove("dragging"); + + const files = Array.from(e.dataTransfer.files); + const results = await Promise.all( + files.map((file) => viewer.loadFile(file)) + ); + + if (results.some(Boolean)) { + this.dropZone.classList.add("hidden"); + this.drawerContainer.classList.add("visible"); + viewer.updateDrawerStates(); // Force update after all files are loaded + this.showViewer(); + } + } + + async handleFileSelect(e) { + const files = Array.from(e.target.files); + const results = await Promise.all( + files.map((file) => viewer.loadFile(file)) + ); + + if (results.some(Boolean)) { + this.dropZone.classList.add("hidden"); + this.drawerContainer.classList.add("visible"); + viewer.updateDrawerStates(); // Force update after all files are loaded + this.showViewer(); + } + } +} + +// Initialize drop zone handler +new DropZoneHandler(); diff --git a/reload/images/14yrold.png b/reload/images/14yrold.png new file mode 100644 index 0000000..13926f4 Binary files /dev/null and b/reload/images/14yrold.png differ diff --git a/reload/images/2yrold_small.png b/reload/images/2yrold_small.png new file mode 100644 index 0000000..2453276 Binary files /dev/null and b/reload/images/2yrold_small.png differ diff --git a/reload/images/SliceDropReloaded.svg b/reload/images/SliceDropReloaded.svg new file mode 100644 index 0000000..705d68c --- /dev/null +++ b/reload/images/SliceDropReloaded.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/reload/images/avf_small.png b/reload/images/avf_small.png new file mode 100644 index 0000000..41af6fa Binary files /dev/null and b/reload/images/avf_small.png differ diff --git a/reload/images/brainstem_small.png b/reload/images/brainstem_small.png new file mode 100644 index 0000000..544a083 Binary files /dev/null and b/reload/images/brainstem_small.png differ diff --git a/reload/images/dicom.png b/reload/images/dicom.png new file mode 100644 index 0000000..a3a781f Binary files /dev/null and b/reload/images/dicom.png differ diff --git a/reload/images/fibers.png b/reload/images/fibers.png new file mode 100644 index 0000000..be9e198 Binary files /dev/null and b/reload/images/fibers.png differ diff --git a/reload/images/slicedrop.png b/reload/images/slicedrop.png new file mode 100644 index 0000000..04e10b0 Binary files /dev/null and b/reload/images/slicedrop.png differ diff --git a/reload/images/slicedrop_transparent.png b/reload/images/slicedrop_transparent.png new file mode 100644 index 0000000..3a91a10 Binary files /dev/null and b/reload/images/slicedrop_transparent.png differ diff --git a/reload/images/surface.png b/reload/images/surface.png new file mode 100644 index 0000000..226b01f Binary files /dev/null and b/reload/images/surface.png differ diff --git a/reload/index.html b/reload/index.html new file mode 100644 index 0000000..0b549cf --- /dev/null +++ b/reload/index.html @@ -0,0 +1,494 @@ + + +
+ + +Instantly view scientific and medical imaging data in 3D
+(.trk / .tko)
+(.nii / .nii.gz / DICOM)
+(.obj / .vtk / .stl / FreeSurfer)
+