Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ const config = {
},
colorMode: {
defaultMode: 'light',
disableSwitch: true,
disableSwitch: false,
respectPrefersColorScheme: true,
},
prism: {
theme: prismThemes.github,
Expand Down
15 changes: 7 additions & 8 deletions src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@
}
}

/* Reduce footer height */
/* Reduce footer height and match the page background */
.footer {
padding-top: 0rem;
padding-bottom: 0.75rem;
--ifm-footer-background-color: var(--ifm-background-color);
}

.footer__links {
Expand All @@ -90,37 +91,35 @@

.sidebar-container {
width: 330px;
background-color: #f8f9fa;
border: 1px solid #ddd;
background-color: var(--ifm-background-color);
padding: 20px;
min-height: 72vh;
max-height: 72vh;
overflow-y: auto;
position: sticky;
top: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sidebar-container h3 {
font-size: 1.2rem;
margin-bottom: 15px;
color: #333;
color: var(--ifm-heading-color);
font-weight: 500;
border-bottom: 2px solid #e9ecef;
border-bottom: 2px solid var(--ifm-color-emphasis-200);
padding-bottom: 8px;
}

.sidebar-container h4 {
font-size: 1rem;
margin-bottom: 10px;
color: #333;
color: var(--ifm-heading-color);
font-weight: 500;
}

.sidebar-container-divider {
border: none;
height: 1px;
background-color: #dee2e6;
background-color: var(--ifm-color-emphasis-300);
margin: 15px 0;
}

Expand Down
16 changes: 8 additions & 8 deletions src/pages/DmriNiivueCanvasHuman.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,20 +248,20 @@ export const DmriNiivueCanvasHuman = () => (
<table style={{ width: '100%', fontSize: '0.9em' }}>
<tbody>
<tr style={{ border: 'none' }}>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid #ddd', background: '#F7F8F9' }}>Scroll slices</td>
<td style={{ padding: '6px' , borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: 'none', background: '#F7F8F9' }}>Scroll wheel</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid var(--ifm-color-emphasis-300)', background: 'var(--ifm-background-color)' }}>Scroll slices</td>
<td style={{ padding: '6px' , borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: 'none', background: 'var(--ifm-background-color)' }}>Scroll wheel</td>
</tr>
<tr>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid #ddd', background: '#F7F8F9' }}>Move crosshair</td>
<td style={{ padding: '6px', border: 'none', background: '#F7F8F9' }}>Left click</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid var(--ifm-color-emphasis-300)', background: 'var(--ifm-background-color)' }}>Move crosshair</td>
<td style={{ padding: '6px', border: 'none', background: 'var(--ifm-background-color)' }}>Left click</td>
</tr>
<tr>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid #ddd', background: '#F7F8F9' }}>Pan</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: 'none', background: '#F7F8F9' }}>Middle click</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid var(--ifm-color-emphasis-300)', background: 'var(--ifm-background-color)' }}>Pan</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: 'none', background: 'var(--ifm-background-color)' }}>Middle click</td>
</tr>
<tr>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid #ddd', background: '#F7F8F9' }}>Zoom</td>
<td style={{ padding: '6px', border: 'none', background: '#F7F8F9' }}>Right click</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid var(--ifm-color-emphasis-300)', background: 'var(--ifm-background-color)' }}>Zoom</td>
<td style={{ padding: '6px', border: 'none', background: 'var(--ifm-background-color)' }}>Right click</td>
</tr>
</tbody>
</table>
Expand Down
16 changes: 8 additions & 8 deletions src/pages/DmriNiivueCanvasMacaque.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,20 +335,20 @@ export const DmriNiivueCanvasMacaque = () => (
<table style={{ width: '100%', fontSize: '0.9em' }}>
<tbody>
<tr style={{ border: 'none' }}>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid #ddd', background: '#F7F8F9' }}>Scroll slices</td>
<td style={{ padding: '6px' , borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: 'none', background: '#F7F8F9' }}>Scroll wheel</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid var(--ifm-color-emphasis-300)', background: 'var(--ifm-background-color)' }}>Scroll slices</td>
<td style={{ padding: '6px' , borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: 'none', background: 'var(--ifm-background-color)' }}>Scroll wheel</td>
</tr>
<tr>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid #ddd', background: '#F7F8F9' }}>Move crosshair</td>
<td style={{ padding: '6px', border: 'none', background: '#F7F8F9' }}>Left click</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid var(--ifm-color-emphasis-300)', background: 'var(--ifm-background-color)' }}>Move crosshair</td>
<td style={{ padding: '6px', border: 'none', background: 'var(--ifm-background-color)' }}>Left click</td>
</tr>
<tr>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid #ddd', background: '#F7F8F9' }}>Pan</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: 'none', background: '#F7F8F9' }}>Middle click</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid var(--ifm-color-emphasis-300)', background: 'var(--ifm-background-color)' }}>Pan</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: 'none', background: 'var(--ifm-background-color)' }}>Middle click</td>
</tr>
<tr>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid #ddd', background: '#F7F8F9' }}>Zoom</td>
<td style={{ padding: '6px', border: 'none', background: '#F7F8F9' }}>Right click</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid var(--ifm-color-emphasis-300)', background: 'var(--ifm-background-color)' }}>Zoom</td>
<td style={{ padding: '6px', border: 'none', background: 'var(--ifm-background-color)' }}>Right click</td>
</tr>
</tbody>
</table>
Expand Down
42 changes: 31 additions & 11 deletions src/pages/PathwaysNiivueCanvas.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from "react";
import { Niivue, DRAG_MODE, cmapper } from "@niivue/niivue";
import BrowserOnly from "@docusaurus/BrowserOnly";
import { useColorMode } from "@docusaurus/theme-common";

const trackList = [
{
Expand Down Expand Up @@ -296,14 +297,19 @@ export const PathwaysNiivueCanvas = () => (
const niivue_render = React.useRef(null);
const niivue_slice = React.useRef(null);

const { colorMode } = useColorMode();
const isDark = colorMode === 'dark';
const backColor = isDark ? [0, 0, 0, 1] : [1, 1, 1, 1];
const imageColormap = isDark ? 'gray' : 'whiteBackgroundGray';

React.useEffect(() => {
async function loadImages() {
niivue_slice.current = new Niivue({logLevel: 'debug',
backColor: [1, 1, 1, 1],
backColor: backColor,
crosshairWidth: 1,
isColorbar: false});
niivue_render.current = new Niivue({logLevel: 'debug',
backColor: [1, 1, 1, 1],
backColor: backColor,
show3Dcrosshair: false,
isColorbar: false,
isOrientCube: true});
Expand All @@ -325,7 +331,7 @@ export const PathwaysNiivueCanvas = () => (
{
url:"https://dandiarchive.s3.amazonaws.com/blobs/5df/2ec/5df2ec3d-ec43-4a33-aa38-49a141f8f05d",
name: "sub-Hb1_sample-hemi_acq-highb_desc-mean+norm+brain.nii.gz",
colormap: "whiteBackgroundGray",
colormap: imageColormap,
},
];
const nucleiList=[
Expand Down Expand Up @@ -363,6 +369,20 @@ export const PathwaysNiivueCanvas = () => (
loadImages();
}, []);

// React to light/dark toggles to update the background of both canvases and
// the slice image colormap
React.useEffect(() => {
[niivue_slice.current, niivue_render.current].forEach((nv) => {
if (!nv) return;
nv.opts.backColor = backColor;
nv.drawScene();
});
if (niivue_slice.current?.volumes?.length) {
niivue_slice.current.volumes[0].colormap = imageColormap;
niivue_slice.current.updateGLVolume();
}
}, [colorMode]);

// Handlers for showing MRI, crosshair, and each tract
const [isMRI, setIsMRI] = useState(true);

Expand Down Expand Up @@ -572,20 +592,20 @@ export const PathwaysNiivueCanvas = () => (
<table style={{ width: '100%', fontSize: '0.9em' }}>
<tbody>
<tr style={{ border: 'none' }}>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid #ddd', background: '#F7F8F9' }}>Scroll slices</td>
<td style={{ padding: '6px' , borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: 'none', background: '#F7F8F9' }}>Scroll wheel</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid var(--ifm-color-emphasis-300)', background: 'var(--ifm-background-color)' }}>Scroll slices</td>
<td style={{ padding: '6px' , borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: 'none', background: 'var(--ifm-background-color)' }}>Scroll wheel</td>
</tr>
<tr>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid #ddd', background: '#F7F8F9' }}>Move crosshair</td>
<td style={{ padding: '6px', border: 'none', background: '#F7F8F9' }}>Left click</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid var(--ifm-color-emphasis-300)', background: 'var(--ifm-background-color)' }}>Move crosshair</td>
<td style={{ padding: '6px', border: 'none', background: 'var(--ifm-background-color)' }}>Left click</td>
</tr>
<tr>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid #ddd', background: '#F7F8F9' }}>Pan</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: 'none', background: '#F7F8F9' }}>Middle click</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid var(--ifm-color-emphasis-300)', background: 'var(--ifm-background-color)' }}>Pan</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: 'none', background: 'var(--ifm-background-color)' }}>Middle click</td>
</tr>
<tr>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid #ddd', background: '#F7F8F9' }}>Zoom</td>
<td style={{ padding: '6px', border: 'none', background: '#F7F8F9' }}>Right click</td>
<td style={{ padding: '6px', borderTop: 'none', borderBottom: 'none', borderLeft: 'none', borderRight: '1px solid var(--ifm-color-emphasis-300)', background: 'var(--ifm-background-color)' }}>Zoom</td>
<td style={{ padding: '6px', border: 'none', background: 'var(--ifm-background-color)' }}>Right click</td>
</tr>
</tbody>
</table>
Expand Down
Loading