sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
721ea39db703db761d376bf783547ca93c6a018c4e051af44aaeadfc8ee62bc2
TypeScript
1,648
70
/** * NIIvue UIKit Demo Package * * This package provides a medical imaging demo that showcases the UIKit components * integrated with NIIvue for medical visualization. */ export interface MedicalParams { brightness: number contrast: number zoom: number opacity: number slice: number crosshair: boolea...
7b394fbe6bbf642c0e9cf377e34a7d12c7e3461007d1c94a31db021085e43786
TypeScript
1,653
52
// src/ipcHandlers/loadVolume.ts import React from 'react' import { NVImage, NVMesh, Niivue } from '@niivue/niivue' import { MESH_EXTENSIONS } from '../../../common/extensions.js' const electron = window.electron export interface HandlerProps { /** * Returns the proper Niivue instance or creates a new doc if it’...
a37719c569d10a48b0384d81a91f3c3530f9c4ec1e52ea9b6206b93a12bbb070
TypeScript
1,655
52
// src/ipcHandlers/loadMesh.ts import React from 'react' import { NVImage, NVMesh, Niivue } from '@niivue/niivue' import { MESH_EXTENSIONS } from '../../../common/extensions.js' const electron = window.electron export interface HandlerProps { /** * Returns the proper Niivue instance or creates a new doc if it’s ...
6647a76986c5a9a5a9a0b9737601a7e4eabb61bc46f7a8503e52d97816e75698
TypeScript
1,664
58
/** * Authentication service for Ray dashboard. * Provides functions to check authentication mode and authenticate with tokens. */ import axios from "axios"; import { formatUrl, get } from "../service/requestHandlers"; /** * Response type for authentication mode endpoint. */ export type AuthenticationModeRespons...
bc4cdf5b7276625fa872512d1835697514071d18c4370f2cb5bf1ced40bade8a
TypeScript
1,673
63
import { ServeApplicationStatus } from "../../type/serve"; export const mockServeApplications = { applications: { app1: { name: "app1", route_prefix: "/app1", message: null, status: ServeApplicationStatus.RUNNING, deployed_app_config: { import_path: "app1:graph", }, ...
402758d22c9254ff66a5d94929c62fd14468d62fc81467a1be28fb4df682a2a1
TypeScript
1,712
56
import { UIKRenderer } from '../src/uikrenderer' import { UIKFont } from '../src/assets/uikfont' /** * Type extensions for Niivue to include UIKit properties * This file extends the core Niivue interface to include UIKit renderer and font capabilities */ declare module '@niivue/niivue' { interface Niivue { /*...
21218cab125009c008d5b385d38a470abac1f5041b88613180e7589a8eeb6e2b
TypeScript
1,718
45
import { test, expect } from '@playwright/test' import { vec3 } from 'gl-matrix' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS, NiivueTestOptions } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }...
2f26289666b6ae11b77bec44ab2565400760f61a81f78a9b823f3377d9c44590
TypeScript
1,730
50
export function base64ToJson<T = unknown>(base64String: string): T | null { try { const decodedString = atob(base64String) const jsonObject = JSON.parse(decodedString) return jsonObject as T } catch (error) { console.error('Error converting Base64 to JSON:', error) return null } } export asyn...
7cdf67263c017bb10a459f3d4f018fe3770d67d0dee2e17de600b74f9c76220c
TypeScript
1,736
48
describe('File Loading', () => { it('should load standard MNI152 volume via IPC', async () => { // Send loadStandard event to renderer await browser.electron.execute( (electron, filename) => { const win = electron.BrowserWindow.getAllWindows()[0] win.webContents.send('loadStandard', file...
93be0547e0a5c8578cdcbfe19ad1cea3f16fdcd3eeea0b38fb8eac71d36c40a8
TypeScript
1,787
67
import { writeFile } from 'fs/promises' import { gzip } from 'zlib' import { promisify } from 'util' import { dialog } from 'electron' import { store } from './appStore.js' import { refreshMenu } from './menu.js' import path from 'path' const gzipAsync = promisify(gzip) export const saveCompressedNVDHandler = async (...
4010ea76dbc2e2557477b0ee60087ca5854b42c8e524a764423402a3354e0139
TypeScript
1,789
74
interface LogLevelMap { [key: string]: number } class Log { level: string name: string constructor({ name = 'niivue', level = 'info' } = {}) { this.name = `${name}` this.level = level } // map 'debug' 'info' 'warn' 'error' 'fatal' 'silent' to numbers // for comparison st...
b7afa8245e2153fe704d6dea233d4c67e3ad9e0c3befc0e69308fd6febc7cbd9
TypeScript
1,790
53
import { sliceTypeMap } from '../../../common/sliceTypes.js' import { layouts } from '../../../common/layouts.js' import { SHOW_RENDER, type Niivue, type SLICE_TYPE } from '@niivue/niivue' /** * Registers monkey-patches on the Niivue instance to emit IPC events * whenever view-related methods are called, keeping the...
bb00aec8e0353d041c7d8eded2d150ca7b990eda8555e696de46d266682ea167
TypeScript
1,798
61
export enum TypeTaskStatus { // Must be in sync with custom_types.py::TaskStatus NIL = "NIL", PENDING_ARGS_AVAIL = "PENDING_ARGS_AVAIL", PENDING_NODE_ASSIGNMENT = "PENDING_NODE_ASSIGNMENT", PENDING_OBJ_STORE_MEM_AVAIL = "PENDING_OBJ_STORE_MEM_AVAIL", PENDING_ARGS_FETCH = "PENDING_ARGS_FETCH", SUBMITTED_TO...
79bc8c2253c530202a8d98d317df7ebbf9a79087d3173e9e0ed7303ba8aa30b8
TypeScript
1,804
65
import { defineConfig, devices } from '@playwright/test' const isCI: boolean = Boolean(process.env.CI) /** * @see https://playwright.dev/docs/test-configuration */ export default defineConfig({ testDir: './playwright/e2e', testMatch: ['**/*.spec.ts'], testIgnore: ['**/tests-out/**', '**/dist/**'], ...
8c36b473a5b639d206d8cea18b369ffc7b288f32ab538f52e50692b2ba769a47
TypeScript
1,808
58
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) test('niivue tileMargin -1', async ({ page }) => ...
0d4045e0ba49855727775612b228c5fe6cd30518950a7f1b6441375713f7a30d
TypeScript
1,837
78
import { get } from "lodash"; import { useState } from "react"; export const useFilter = <KeyType extends string>({ overrideFilters, onFilterChange, }: | { overrideFilters?: { key: KeyType; val: string }[]; onFilterChange?: () => void; } | undefined = {}) => { const [filters, setFilters] = us...
80dfb621140128d13a4ae25cb3d11b405fbfc3b23e7990be99d026c62712fddd
TypeScript
1,869
56
import { useEffect, useState } from "react"; import { get } from "../service/requestHandlers"; let cachedRedactionEnabled: boolean | null = null; let fetchPromise: Promise<void> | null = null; // Exported for tests: reset the module-level cache so each test starts fresh. export const _resetRuntimeEnvRedactionCache = ...
fea914204d4ab0036a55506feff0ffc474a145067ee196641aade66f9ffd7314
TypeScript
1,871
57
/** * @license * Copyright 2026 Google Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or...
d342721917de21ffb9a07da59337ec720a3b6574e225df085ebf5005fb7a9d7f
TypeScript
1,890
43
import { SLICE_TYPE } from "@niivue/niivue"; export const groupedConfigMeta = { Text: [ ['isOrientationTextVisible', { type: 'boolean', requiresDraw: true }], ['measureTextHeight', { type: 'slider', min: 0, max: 0.2, step: 0.01, requiresDraw: true }], ['fontSizeScaling', { type: 'slider', min: 0.1, max: ...
e17e9d3d9820def1e0313be27a48b57bc92eaf759681107a26c069b4779f81dc
TypeScript
1,902
68
import { useRef, useState } from "react"; import useSWR from "swr"; import { API_REFRESH_INTERVAL_MS } from "../../../common/constants"; import { getJobList } from "../../../service/job"; export const useJobList = () => { const [page, setPage] = useState({ pageSize: 10, pageNo: 1 }); const [msg, setMsg] = useState...
121fa7250ed328f515d6e662df6b4ec18649b837c3c1bc2a15e5989049c9fe7e
TypeScript
1,915
60
import { test, expect } from '@playwright/test' import { Niivue, NVDocument, DEFAULT_OPTIONS, INITIAL_SCENE_DATA } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { page.on('console', (msg) => { c...
a685f3f169788590212f7d841c395821fe6b45ee0586bcb8e6327e8dd5b05e70
TypeScript
1,959
55
/** * @license * Copyright 2026 Google Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or...
80f1e04bc5e1b43d5b8173043aa8c55d29230c3d4ceb5ea83a3e31855dce35da
TypeScript
1,983
68
import { describe, it, expect } from 'vitest' import { nice } from '../../../src/utils/nice' describe('nice', () => { describe('with round = true', () => { it('should round values less than 1.5 to 1', () => { expect(nice(1.2, true)).toBe(1) expect(nice(14.9, true)).toBe(10) expect(nice(0.14, tr...
3ea01d0ea3b4f0d631fd73660f1a5606df1534c4e8c80854be1dd1ce34d02579
TypeScript
1,992
57
import { Dcm2niix } from '@niivue/dcm2niix' // Each input item either is a File or has this shape: export interface DicomInput { name: string data: ArrayBuffer } // Each output item will have a name and data (ArrayBuffer). export interface ConvertedFile { name: string data: ArrayBuffer } /** * Loads DICOM f...
a887ff112679ea385fc59a86babfe85d628891ecfafcf281fb5e9b478de86018
TypeScript
2,024
60
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) test('niivue advanced world-space demo', async ({...
211c8325768165a523e074481a5b4159aa7e47f32e4977a5c4fdd16a8272e688
TypeScript
2,138
58
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' // The header is the first 352 bytes, and the image data is dim1 * dim2 * dim3 * nbyper. // So for the test case with the mni152 i...
eae90366978c0940fbfb71e6a8cb248f33ee4425a9e4c419b42f906d6e2e6179
TypeScript
2,151
60
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) test('niivue load thumbnail preview', async ({ pa...
b26569969dc06fd5b1e27e7e761585a5e3b219690d244ab46fece3f159620d2b
TypeScript
2,154
53
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) test('niivue smooth drawing disabled renders disc...
00e5982f202360799c5e613a1a8f3d0a13bacc606adb2893b271a3ecb5c766de
TypeScript
2,179
84
/** * ColormapManager module * * Handles colormap assignment and management. * This module contains functions for: * - Setting continuous colormaps * - Setting discrete label colormaps * - Managing colormap and opacity properties */ import type { NVImage } from './index' import { cmapper, type ColorMap } from ...
d5be72b1105ad2233c342f9ab5b72ed1179eb0a8b1af3603bc751d26ca08feb5
TypeScript
2,213
70
import { GPUStats, TPUStats } from "./node"; export enum ActorEnum { DEPENDENCIES_UNREADY = "DEPENDENCIES_UNREADY", PENDING_CREATION = "PENDING_CREATION", ALIVE = "ALIVE", RESTARTING = "RESTARTING", DEAD = "DEAD", } export type Address = { nodeId: string; ipAddress: string; port: number; workerId: s...
28df626d24fa7b4ef246f60d10601e06613896400b81a465bd9eee8ef2f00d14
TypeScript
2,229
90
import { getStateApiDownloadLogUrl, MAX_LINES_FOR_LOGS } from "./log"; describe("getStateApiDownloadLogUrl", () => { it("only uses parameters provided but doesn't fetch when parameters are null", () => { expect.assertions(10); expect( getStateApiDownloadLogUrl({ nodeId: "node-id", file...
bbd110151b85676eb0f95b02a4c0b57c91eb46b9f66f7ca5310d8d1550eab307
TypeScript
2,242
64
// src/ipcHandlers/loadDicomFolder.ts import React from 'react' import { dicomLoader } from '@niivue/dicom-loader' import { Niivue, NVImage, NVMesh } from '@niivue/niivue' import { base64ToArrayBuffer } from '@renderer/utils/base64ToJSON.js' import { IpcRendererEvent } from 'electron' export interface HandlerProps { ...
89d2bafb86a959247b8098c20aff60547885ade59a0eeba38a81a5c27f12a224
TypeScript
2,249
66
import { readFile } from 'fs/promises' import volumeMni152 from '../../../resources/images/standard/mni152.nii.gz?asset' import volumeChrisT1 from '../../../resources/images/standard/chris_t1.nii.gz?asset' import meshaal from '../../../resources/images/standard/aal.mz3?asset' import volaal from '../../../resources/imag...
dd6673b7820ce29f163ca169911bfd79f3cb778f6ce0705e888b61b281fa5c9c
TypeScript
2,257
55
/// <reference types="vite/client" /> import { ElectronAPI } from '@electron-toolkit/preload' import type { CLIOptions, ResolvedInput } from '../../common/cliTypes.js' declare global { interface Window { electron: ElectronAPI & { startTabDrag: (fileName: string, jsonStr: string) => void setZoomFacto...
7dcd31953a91a479d8ce4b19150efbf3fa31839043cd3bb909b8d52492451269
TypeScript
2,296
63
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) test('niivue mouse right click and drag draws sel...
4181b4cf314579625458d858ff1af3f08616845e64b74ba9c9959aa8b5037412
TypeScript
2,328
74
import dayjs from "dayjs"; import timezone from "dayjs/plugin/timezone"; import utc from "dayjs/plugin/utc"; dayjs.extend(utc); dayjs.extend(timezone); export const formatByteAmount = ( amount: number, unit: "mebibyte" | "gibibyte", ) => `${( amount / (unit === "mebibyte" ? Math.pow(1024, 2) : Math.pow(1024...
1e412456ecce76a7e09d324807252243b38a989d6c4843562c6a0c587e0c03d2
TypeScript
2,347
79
// src/renderer/src/ipcHandlers/runNiimathCommand.ts import { Niivue, NVImage } from '@niivue/niivue' /** * Register handlers for Niimath completion and errors, decoding * the compressed output using NVImage.new. * * @param setVolumes - React setter for the array of NVImage volumes. * @param modeMap - Map<requ...
b9d4cab13eb2db879249130c4a666e054d61fda2e8f80d7a66ba08731d0ba464
TypeScript
2,353
74
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) test('niivue setSliceType axial', async ({ page }...
40fd1140a4466693ae324bf6aef8496c3505b6d028300aeea4c7ffdd9578e9e3
TypeScript
2,361
73
// src/ipcHandlers/loadDocument.ts import React from 'react' import type { IpcRendererEvent } from 'electron' import { DocumentData, NVDocument, NVImage, NVMesh, Niivue } from '@niivue/niivue' import { base64ToJson, decompressGzipBase64ToJson, isProbablyGzip } from '@renderer/utils/base64ToJSON.js' const electro...
46de83078f65af313e324ca5322fb825666133f490d60b4227b8aaeb39deb9c8
TypeScript
2,368
79
describe('View Modes', () => { // Helper to load MNI152 and wait for render async function loadMNI152(): Promise<void> { await browser.electron.execute( (electron, filename) => { const win = electron.BrowserWindow.getAllWindows()[0] win.webContents.send('loadStandard', filename) }, ...
c452ffb84f0107a8f207d452c4876e6ddbb87724330d86f7dfa212c6b8c798b1
TypeScript
2,421
75
/** * This utility file formats and sends HTTP requests such that * they fullfill the requirements expected by users of the dashboard. * * All HTTP requests should be sent using the helpers in this file. * * More HTTP Methods helpers should be added to this file when the need * arises. */ import { AxiosRequest...
2e0eba95347fafa712a897f99e3ce2b455cd65d2e2898fe7822882b93b417f13
TypeScript
2,425
75
describe('Menu Actions', () => { // Helper to load a volume and wait for render async function loadStandard(filename: string): Promise<void> { await browser.electron.execute( (electron, file) => { const win = electron.BrowserWindow.getAllWindows()[0] win.webContents.send('loadStandard', fi...
bf5c6ad6d4b6e0f623813a882a046d9249ddc7e80b58987cf601bb4ff1ab826d
TypeScript
2,444
75
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) test('niivue calMinMax do not trust header cal mi...
bc5f481ed8f619b8ce13cef2beac28c5a11234b21b7d20b99bfe660f0b073238
TypeScript
2,480
69
import * as fs from 'fs' import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS, NiivueTestOptions } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) // ge...
23dfdd367f1ef0e33307c872811e9752bd87c22297a70b132a2f52ecdafdcb39
TypeScript
2,481
56
import { isCompressed, decompressAsync, readHeaderAsync, readImage, hasExtension } from 'nifti-reader-js' import { log } from '@/logger' import type { NVImage } from '@/nvimage' import { NiiDataType } from '@/nvimage/utils' /** * Reads NIfTI format image (.nii, .nii.gz), modifying the provided NVImage header * and r...
ec763f25b0c4c6ad01aec5d25a23a7f7108b689add353b3d8e089eb26f752263
TypeScript
2,548
80
/** * @license * Copyright 2017 Google Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or...
24361dec9b2ad438e06e9590ad984ed0cf6d364b5d73698af2647a7aed52671f
TypeScript
2,588
47
import { expect, test } from 'vitest' import { NVMeshLoaders } from '../../src/niivue/index.js' // note the js extension function base64ToArrayBuffer(base64: string) { const binary_string = atob(base64) const len = binary_string.length const bytes = new Uint8Array(len) for (let i = 0; i < len; i++) { bytes...
927e995a1b9fb66dd7ceabba75ee5afe455b2aae90cac996fde3ba5a8acc2250
TypeScript
2,590
105
/** * Read data from stdin with timeout * Expects base64-encoded data for binary files */ export async function readStdin(timeout = 120000): Promise<string> { return new Promise((resolve, reject) => { // Check if stdin is a TTY (interactive terminal) if (process.stdin.isTTY) { reject(new Error('No da...
1fa5eb811157123c4b52309261e1c1333910a1bf95e6ee58541e7bb180c00e74
TypeScript
2,603
99
import readVox from 'vox-reader' import * as nifti from 'nifti-reader-js' interface VoxXYZI { x: number y: number z: number i: number } interface VoxColor { r: number g: number b: number a: number } interface VoxData { size: { x: number y: number z: number } xyzi?: { values: Vox...
5b686e7b515f22ce40151591209b5f098ff4117af0a50f712b74d48d934c3e74
TypeScript
2,631
82
/** * ImageMetadata module * * Handles image metadata access and configuration management. * This module contains functions for: * - Getting NIfTI metadata (dimensions, datatypes, etc.) * - Getting and updating image options * - Managing image configuration settings */ import type { NVImage } from './index' im...
0c7ddb3abbc39bddfd46e017b3425abc732f3c99ed639fa8bc5f721aec8223e7
TypeScript
2,646
77
describe('Preferences', () => { // Note: WebdriverIO electron.execute uses the main process, but we need renderer process // So we use a different approach - execute in renderer context via executeScript describe('Get Preferences', () => { it('should retrieve preferences from store', async () => { // U...
006b3485592c4e3346560b746849e0c17225a22c16174e41e2c41c89a524f54a
TypeScript
2,650
84
/** * @license * Copyright 2026 Google Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or...
0e74819cf6b4b325a41ec644ddd2a78b5cabcd06a4e274fd63fea51d403ee4f5
TypeScript
2,664
75
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) test('niivue removeVolume', async ({ page }) => {...
8958ae6c79e8f797602b91d8f624db78457189ed2a2ead0f9b1a27495a718339
TypeScript
2,665
72
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) test('niivue applyVolumeTransform translates over...
b6a46f3a2d6f3eca6e291b58949f684deb4475a44524584b5b857ce777e81a6b
TypeScript
2,694
70
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) test('niivue tractography regression: mesh should...
a11f0696b490f1acd6a753a34413b4bec34a59c38fb5afb1e2ccbb183e7a2d77
TypeScript
2,704
83
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) test('niivue with two instances and bounds', asyn...
5acda04b4dc2edb1ae4182a51a2a123f8c024db8b772da070237b951d8b067d2
TypeScript
2,722
75
/** * @license * Copyright 2016 Google Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or...
54f28ea02e956be2450361fd7d223731f0bfa7e1aa13221b224ec8615a686019
TypeScript
2,733
77
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) test('niivue mouse move updates renderAzimuth and...
2f2fefbd087f5a420bc634f1d43a8509900724c89ab7da0fc2006e7657911356
TypeScript
2,743
83
// Copyright (C) CVAT.ai Corporation // // SPDX-License-Identifier: MIT import { Project, QualitySettings, Task } from 'cvat-core-wrapper'; export function sorter(path: string) { return (obj1: any, obj2: any): number => { let currentObj1 = obj1; let currentObj2 = obj2; let field1: string |...
9254de6065acbfda36c6a9ee181bc79945a7098106b361cad6234e1fe2d18f45
TypeScript
2,748
87
/** * Volume colormap management functions for handling colormap textures and label colormaps. */ import { NVImage } from '@/nvimage' import { Shader } from '@/shader' /** * Parameters for refreshing colormaps */ export interface RefreshColormapsParams { gl: WebGL2RenderingContext colormapTexture: WebGLTe...
b7a7fbe94f0fadf2b0edbc844497f4cdcfdb3788524c72507f9bc429cb03f49f
TypeScript
2,761
111
import { Actor } from "./actor"; import { Raylet } from "./raylet"; import { Worker } from "./worker"; export type NodeDetail = { now: number; hostname: string; ip: string; cpu: number; // cpu usage cpus?: number[]; // Logic CPU Count, Physical CPU Count mem?: number[]; // total memory, free memory, memory...
673ea6b2a13152f6af12b4b342295ab329d49711df44dc74d9a0a3cd9bdd14b2
TypeScript
2,764
85
/** * @license * Copyright 2018 Google Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or...
ca5f7aca2be46ce1e5f0b95b9fa0cecc254e9cad6cdaa8024ef8398fed6b4dc6
TypeScript
2,771
110
import { get } from "./requestHandlers"; export const MAX_LINES_FOR_LOGS = 50_000; export type StateApiLogInput = { nodeId?: string | null; /** * If actorId is provided, nodeId is not necessary */ actorId?: string | null; /** * If taskId is provided, nodeId is not necessary */ taskId?: string | ...
fc9ad974e84dcc9c072de9f4b0a4cefec6350302444ad97a5ae35d419cff5eee
TypeScript
2,785
80
// src/ipcHandlers/loadRecentFiles.ts import React from 'react' import { NVImage, NVMesh, Niivue, NVDocument, DocumentData } from '@niivue/niivue' import { MESH_EXTENSIONS } from '../../../common/extensions.js' import { base64ToJson, decompressGzipBase64ToJson, isProbablyGzip } from '@renderer/utils/base64ToJSON....
d60cda17e9addd6308dc765b5a06abf3c532746eb768595b82912557f6cbcf69
TypeScript
2,791
91
/** * @license * Copyright 2026 Google Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or...
0c4e89ec56cfbd55e15b3dd3737b25065e037a187e7c2a5bf4be3714fe32d3dc
TypeScript
2,818
80
/** * Regression test for https://github.com/niivue/niivue/issues/862 */ import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddressFlexbox } from './helpers.js' test.beforeEach(async ({ page }) => { await page.setViewportSize({ width: 600, height: 600...
9160a3ae920fdb624b7b1a4673aba1a6948e97a6bf8957fd0b92b87c325bba7a
TypeScript
2,842
115
/** * CLI Options interface for headless subcommand architecture */ export interface CLIOptions { /** The subcommand to execute */ subcommand: 'view' | 'segment' | 'extract' | 'dcm2niix' | 'niimath' | null /** Second-level subcommand (for dcm2niix: 'list' | 'convert') */ subcommandMode?: string /** Input fi...
9e57cde58fa9a8f97e98207f741c73751f3aa2132a3e4d5734bae9447b8941a5
TypeScript
2,861
94
import _ from "lodash"; import { useState } from "react"; import useSWR from "swr"; import { API_REFRESH_INTERVAL_MS } from "../../../common/constants"; import { getNodeList } from "../../../service/node"; import { useSorter } from "../../../util/hook"; export const useNodeList = () => { const [msg, setMsg] = useSta...
8fee406555e20a94b3bd61128fc4079b058965ab4f14fc054fa779d9e239f2a0
TypeScript
2,881
77
import { log } from '@/logger' // shader.js is taken from github user Twinklebear: https://github.com/Twinklebear/webgl-util // Compile and link the shaders vert and frag. vert and frag should contain // the shader source code for the vertex and fragment shaders respectively // Returns the compiled and linked program,...
2f39f00091178cbf2960cccfd9725668845dd76f825075a4a11e9299d3f73193
TypeScript
2,882
79
/** * @license * Copyright 2026 Google Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or...
d910cf7ee8e7b332ccd1e3367af5cd8eb6e6e64037d8cd66339a88da7f377e5b
TypeScript
2,884
86
import { v4 as uuidv4 } from '@lukeed/uuid' export abstract class UIKAsset { protected gl: WebGL2RenderingContext protected texture: WebGLTexture | null = null protected width: number = 0 protected height: number = 0 public id: string constructor(gl: WebGL2RenderingContext) { this.gl = gl this.id ...
2e5ca9e9551d604d3c34e272700d615da67ded44d187749337fee9de15119472
TypeScript
2,897
139
import type { NVImage } from '@niivue/niivue' import type * as tf from '@tensorflow/tfjs' /** * Segmentation model types */ export type ModelType = 'tissue-segmentation' | 'brain-extraction' | 'parcellation' /** * Model category for organization */ export type ModelCategory = 'Tissue Segmentation' | 'Brain Extrac...
2c67b3292fd8314f5139fc42c061c50c5c698304546b196b47c04ec3361c16e9
TypeScript
2,909
97
import { log } from '@/logger' // Internal function to compress drawing using run length encoding // inputs // data: Uint8Array to compress // output // returns rle compressed Uint8Array export function encodeRLE(data: Uint8Array): Uint8Array { // https://en.wikipedia.org/wiki/PackBits // run length encoding ...
761f0f70efbe422cdd8d0ce4a117eefcfcdba9bda8ed288dbaa35bb2ed609cff
TypeScript
2,915
88
// Copyright (C) CVAT.ai Corporation // // SPDX-License-Identifier: MIT import { AudioIntervalState } from 'cvat-core-wrapper'; import { toClipboard } from 'utils/to-clipboard'; import { clamp } from 'utils/math'; export interface AudioTimeRange { start: number; end: number; } export interface AudioPlaybackR...
96a0b2b8aea362ac58506be7f529d15b5e4944ac59bc9e6a6ad7424ccc7932c8
TypeScript
2,963
87
// src/ipcHandlers/loadStandard.ts import React from 'react' import { DocumentData, NVDocument, NVImage, NVMesh, Niivue } from '@niivue/niivue' import { MESH_EXTENSIONS } from '../../../common/extensions.js' import { base64ToJson, decompressGzipBase64ToJson, isProbablyGzip } from '@renderer/utils/base64ToJSON.js'...
1b01c68906d681e2d6338d3ea75450b68f585ed15e306a2f640ce9ef8d653391
TypeScript
2,986
103
// packages/niivue-desktop/electron.vite.config.ts import { resolve, dirname } from 'path' import { fileURLToPath } from 'url' import { defineConfig } from 'electron-vite' import react from '@vitejs/plugin-react' const __filename = fileURLToPath(import.meta.url) const __dirname = dirname(__filename) /** * electron-v...
1e909d4e1a80cb2bfba9641ef7042480fe8731c6d3d500b81569e80684fd85e0
TypeScript
3,000
75
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddressSync } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddressSync) }) test('niivue broadcastTo', async ({ page ...
fa2d0a7d0fef23369804f31e12ec9a8eebe834e1ab360099f8ce7d49fe686e78
TypeScript
3,054
90
import { log } from '../../src/logger'; import { expect, test, describe, beforeEach, vi } from 'vitest' describe('Logger', () => { beforeEach(() => { // Reset log level and name before each test log.setLogLevel('debug'); log.setName('niivue'); }); test('should set the log level corr...
a7dfec1b44c85bc2ed21fff7f8eb12475094f4170cb54506632263a36c300e03
TypeScript
3,074
91
import { Volume, NiftiHeader } from '@/types' import { NVUtilities } from '@/nvutilities' // rotate image to match right-anterior-superior voxel order export function img2ras16(volume: Volume): Int16Array { // return image oriented to RAS space as int16 const dims = volume.hdr.dims // reverse to original c...
d38353bf73e92f6cd25d3ca4a96f0e515909753183c7aa1608b48e01b20b06a1
TypeScript
3,083
123
import { Actor } from "../../../type/actor"; const MOCK_ACTORS: { [actorId: string]: Actor } = { ACTOR_1: { actorId: "ACTOR_1", jobId: "01000000", address: { nodeId: "426854e68e4225b3941deaf03c8dcfcb1daacc69a92711d370dbb0e1", ipAddress: "172.31.11.178", port: 10003, workerId: "b8b...
a542c20ff99b066aa0f70bc337ca1a9ee1fe29d7ed989b3488284509761e5d00
TypeScript
3,084
107
// src/ipcHandlers/draw.ts import { Niivue } from '@niivue/niivue' const electron = window.electron /** * Listen for 'draw-command' from the main menu, * execute it on the current Niivue instance, then persist * the updated opts back into your AppContext. */ export function registerDrawHandler( nv: Niivue // ...
a17b6e689e2280b54732039d5f24da6c71be55e0d8089348bddf1a93610f1625
TypeScript
3,104
78
import { NIFTI1 } from 'nifti-reader-js' import type { NVImage } from '@/nvimage' import { NiiDataType } from '@/nvimage/utils' /** * Helper function to convert an ArrayBuffer to ImageData using the browser's Image API. * @param buffer - ArrayBuffer containing image data (BMP, PNG, JPG, etc.) * @returns Promise res...
16abf7ab1c09914f5dccaff071015e58462a8c79b941ffa2ea4c8fa3837d9406
TypeScript
3,119
120
import { get } from "../../service/requestHandlers"; const GRAFANA_HEALTHCHECK_URL = "/api/grafana_health"; const PROMETHEUS_HEALTHCHECK_URL = "/api/prometheus_health"; const TIMEZONE_URL = "/timezone"; export type DashboardUids = { default: string; serve: string; serveDeployment: string; data: string; }; ty...
ee7a44ad87b212f67563a21259ea1dd56dea61e5cf45ec463cd81999e3a287eb
TypeScript
3,124
106
export enum LabelTextAlignment { LEFT = 'left', RIGHT = 'right', CENTER = 'center' } export enum LabelLineTerminator { NONE = 'none', CIRCLE = 'circle', RING = 'ring' } export enum LabelAnchorFlag { NONE = 0, LEFT = 1 << 0, CENTER = 1 << 1, RIGHT = 1 << 2, TOP = 1 << 3, ...
31c3519daae08da65c49b684bcd6e1a46478803cba58a31e39cba97c56eff333
TypeScript
3,138
92
import type { ModelType, ModelCategory } from './types.js' /** * Schema for settings.json files that accompany brainchop models. * This enables self-describing models that can be loaded without manual configuration. */ export interface ModelSettings { name: string description: string type: ModelType outputC...
942fafb355523a4cc0f15b567b8cb71335670cccdf37708d47740350cda23d8d
TypeScript
3,201
132
import { spawn } from 'child_process' import path from 'path' import { fileURLToPath } from 'url' const __dirname = path.dirname(fileURLToPath(import.meta.url)) export interface CLIResult { stdout: string stderr: string exitCode: number } /** * Run the niivue-desktop CLI with the given arguments * @param arg...
5c074b20883e508353e9249678ca01a2389eff3e2eca22184ea0f9856237fe86
TypeScript
3,224
125
import { GPUStats, TPUStats } from "../type/node"; import { normalizeAccelerators } from "./accelerator"; describe("normalizeAccelerators", () => { it("handles undefined inputs", () => { expect(normalizeAccelerators(undefined, undefined)).toEqual([]); }); it("normalizes gpus correctly", () => { const gp...
48939c258c768a9c50afc29688b54ad744d75d3ac2bdc05bce8ba9afca43367f
TypeScript
3,250
107
import type { Options } from '@wdio/types' import { execSync } from 'child_process' import path from 'path' import { fileURLToPath } from 'url' const __filename = fileURLToPath(import.meta.url) const __dirname = path.dirname(__filename) // IMPORTANT: Unset ELECTRON_RUN_AS_NODE to allow Electron to run as an app, not ...
76027fa7736721890d8a758486b6e3eb078d922e6ceb2c5ac0458c5baccc87c2
TypeScript
3,255
133
/** * ZarrChunkCache - LRU cache for zarr chunks (TypedArrays). * * LRU cache that stores TypedArrays. * TypedArrays are garbage collected automatically, so no explicit cleanup needed. */ export type TypedArray = Uint8Array | Uint16Array | Int16Array | Int32Array | Uint32Array | Float32Array | Float64Array expor...
bb3b60b8dffd3bcae7ba5d9d567e670bba0f38fa3a2ec4e352c57bfc37501d7e
TypeScript
3,256
178
import { blueGrey, grey, lightBlue } from "@mui/material/colors"; import { createTheme, ThemeOptions } from "@mui/material/styles"; const basicTheme: ThemeOptions = { typography: { fontSize: 12, fontFamily: [ "Roboto", "-apple-system", "BlinkMacSystemFont", '"Segoe UI"', '"Helve...
9091578ddc8d960f49ff37152e63d676cabbe7973179b864012c862b99ad03c1
TypeScript
3,265
91
// Copyright (C) CVAT.ai Corporation // // SPDX-License-Identifier: MIT import { CombinedState } from 'reducers'; import { ActionUnion, createAction, ThunkDispatch } from 'utils/redux'; import { selectionActions } from './selection-actions'; export enum BulkActionsTypes { START_BULK_ACTION = 'START_BULK_ACTION', ...
6f113925629f35dbd8c23604aa52c17d24f9c9ae5fd619c6a3d3b6f7234d070d
TypeScript
3,321
161
import { vec3 } from 'gl-matrix' import { LUT } from '@/colortables' export type ValuesArray = Array<{ id: string vals: Float32Array global_min?: number global_max?: number cal_min?: number cal_max?: number }> // export type AnyNumberArray = number[] | TypedNumberArray export type AnyNumberAr...
7ff9e978f173ebbe5b352b90f516b2e1abf7a3fdaa066305fa29ec55fa6f7c46
TypeScript
3,323
123
// Copyright (C) 2019-2022 Intel Corporation // Copyright (C) CVAT.ai Corporation // // SPDX-License-Identifier: MIT import PluginRegistry from './plugins'; import { LabelType, ModelProviders, ModelKind, ShapeType, } from './enums'; import { SerializedModel, ModelParams, MLModelTip, MLModelLabel, } from './cor...
2f17658f76a44a7c7a7b66383a6da8c24a4667c788a2e1e69082853905413f0d
TypeScript
3,335
112
// Copyright (C) CVAT.ai Corporation // // SPDX-License-Identifier: MIT import { ObjectState, ObjectType } from 'cvat-core-wrapper'; const OBJECT_DRAG_ID_PREFIX = 'object:'; const LAYER_DRAG_ID_PREFIX = 'drag-layer:'; const LAYER_DROP_ID_PREFIX = 'layer:'; const LAYER_OBJECT_DROP_ID_PREFIX = 'layer-object:'; const LA...
3678b360771530dc856be01573ceed4f881a5cf65984a8db5ab786841144547a
TypeScript
3,343
114
/** * ZarrProcessor module * * Handles Zarr format-specific loading logic: * - Parses Zarr URL parameters for slice selection * - Fetches Zarr array data from remote stores * - Handles 3D and 4D array slicing * - Validates slice indices against array dimensions * * Zarr is a cloud-optimized format for chunked,...
6730cbcb33d4d133cd6b4c1b81fa8478b6be9dfdcd19d7ebdf8b4e6183a536c5
TypeScript
3,363
134
export enum ServeApplicationStatus { // Keep in sync with ApplicationStatus in python/ray/serve/_private/common.py NOT_STARTED = "NOT_STARTED", DEPLOYING = "DEPLOYING", RUNNING = "RUNNING", DEPLOY_FAILED = "DEPLOY_FAILED", DELETING = "DELETING", UNHEALTHY = "UNHEALTHY", } export type ServeApplication = {...
64e114df90392c82705d9fd17828c5dac5dbae049087a7794166b4e2f62ee94a
TypeScript
3,408
135
// types.ts import { vec2, vec3, vec4 } from 'gl-matrix' import { UIKFont } from './assets/uikfont' // Define Color type for clarity export type Color = [number, number, number, number] | Float32List // Define Vec2, Vec3, and Vec4 types export type Vec2 = vec2 | [number, number] export type Vec3 = vec3 | [number, nu...
7e2f724fe5ccce93b93d6de5b0ad7b26bd1fd0e2249533a18dc2171ca8af8f80
TypeScript
3,477
85
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) // Regression test for https://github.com/niivue/...
3f49fcec5287e09076bc7cbf79b9c58d781339f5d292a8162bef2330e612cb84
TypeScript
3,532
109
import { test, expect } from '@playwright/test' import { Niivue } from '../../dist/index.js' import { httpServerAddress } from './helpers.js' import { TEST_OPTIONS } from './test.types.js' test.beforeEach(async ({ page }) => { await page.goto(httpServerAddress) }) test.skip('niivue mesh features demo: mesh tradeo...
a16a83f3c907a957e2c7fc2e93b846c4c64149735abf4aa98ae23a8d99aa273e
TypeScript
3,557
93
import { NIFTI1 } from 'nifti-reader-js' import type { NVImage } from '@/nvimage' import { NiiDataType } from '@/nvimage/utils' /** * Helper function to convert ZXY RGB data to XYZ format for Zarr arrays. * @param data - Input data in ZXY order * @param X - Width dimension * @param Y - Height dimension * @param Z...