sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9725d9a0ae92b1322494e090293be350183f61cca02b3fce721eb8fd1dafb79a | TypeScript | 576 | 29 | import { JobStatus } from "../../../type/job";
export const JOB_LIST = [
{
job_id: "01000000",
submission_id: "raysubmit_12345",
status: JobStatus.PENDING,
},
{
job_id: "02000000",
submission_id: null,
status: JobStatus.FAILED,
},
{
job_id: null,
submission_id: "raysubmit_2345... |
720d3121a441f6a772271fbb0ea71e62f1fd12a276786df50940a93e02d8c326 | TypeScript | 579 | 22 | export class Log {
static debugEnabled = false
static info(message: string, ...args: unknown[]): void {
console.info(`[INFO] ${message}`, ...args)
}
static warn(message: string, ...args: unknown[]): void {
console.warn(`[WARN] ${message}`, ...args)
}
static error(message: st... |
7111f79f9a4f6b94c5bc01827846094a84811b869b3de715cc2214b6852447bf | TypeScript | 593 | 38 | export type Event = {
eventId: string;
jobId: string;
nodeId: string;
sourceType: string;
sourceHostname: string;
hostName: string;
sourcePid: number;
pid: number;
label: string;
message: string;
timestamp: number;
timeStamp: number;
jobName: string;
severity: string;
customFields: {
[... |
c0b8ff4e588ae0810f1f59906e5ee3b200a6cb1b2e17fd4689c991c8d60e5c67 | TypeScript | 602 | 27 | export const nice = (x: number, round: boolean): number => {
const exp = Math.floor(Math.log(x) / Math.log(10))
const f = x / Math.pow(10, exp)
let nf
if (round) {
if (f < 1.5) {
nf = 1
} else if (f < 3) {
nf = 2
} else if (f < 7) {
nf = 5
... |
496e017bb2cac9eccfd903b5bc66d75bfe4902f424c19ab870ab3c9238e45744 | TypeScript | 604 | 19 | // src/ipcHandlers/loadOverlay.ts
import { Niivue, NVImage } from '@niivue/niivue'
const electron = window.electron
export function registerLoadOverlayHandler(
nv: Niivue,
setVolumes: React.Dispatch<React.SetStateAction<NVImage[]>>
): void {
electron.ipcRenderer.on('loadOverlay', async (_evt, paths: string[]) =... |
c7377579bb66fc1ea4b9af45b6ca020ca8e2dfb0685db69a17ef203fc1b8d344 | TypeScript | 605 | 31 | import useSWR from "swr";
import {
getStateApiDownloadLogUrl,
getStateApiLog,
StateApiLogInput,
} from "../../service/log";
export const useStateApiLogs = (
props: StateApiLogInput,
path: string | undefined,
) => {
const downloadUrl = getStateApiDownloadLogUrl({ ...props, maxLines: -1 });
const {
da... |
49683f750c654c3b24a74a49d97114f3368a5b006d4da23583615e8cc3a2336d | TypeScript | 613 | 24 | import useSWR from "swr";
import { API_REFRESH_INTERVAL_MS } from "../../../common/constants";
import { getRayStatus } from "../../../service/status";
export const useRayStatus = () => {
const { data: clusterStatus } = useSWR(
"useClusterStatus",
async () => {
try {
const rsp = await getRayStat... |
83f46ef43aff19f67b814cdbe1f4af0ca5d3e501a7515e6819ad3cd25f631b3a | TypeScript | 622 | 32 | export type PlatformEventSource = {
platform: string;
component: string;
metadata: { [key: string]: string };
};
export type PlatformEventData = {
source?: PlatformEventSource;
objectKind: string;
objectName: string;
message: string;
reason: string;
customFields?: { [key: string]: string };
};
expor... |
bdf0e9a8a7b091c9ad8021f676499d05f26aad4009785bd55ec26cec1f6fb3d0 | TypeScript | 642 | 22 | import { dialog, BrowserWindow } from 'electron'
export const openMeshFileDialog = (): void => {
const win = BrowserWindow.getAllWindows()[0]
dialog
.showOpenDialog(win, {
title: 'Open Mesh Image',
properties: ['openFile']
})
.then((result) => {
if (!result.canceled && result.filePath... |
5063a091c1b4c5301641d39281fb151aa637a55a8516a44937de7ab5bc941740 | TypeScript | 673 | 21 | 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 attachTo', async ({ page }) => {
... |
ee39659a09ba56f54b8eb0986bc87783f8687a20a8c953aac8883455ddebb113 | TypeScript | 674 | 31 | export type ViewMeasures = {
tags: string;
int_value?: number;
double_value?: number;
distribution_min?: number;
distribution_mean?: number;
distribution_max?: number;
distribution_count?: number;
distribution_bucket_boundaries?: number[];
distribution_bucket_counts?: number[];
};
type LabelMap = {
... |
d33c15986330e4b1f5d2e36b10f60971f3411676ea03b11126eb7d47573bced2 | TypeScript | 688 | 33 | // Interactive UIKit Components (extensionless, matching the type re-exports below)
export * from './UIKButton'
export * from './UIKSlider'
export * from './UIKToggle'
export * from './UIKPanel'
export * from './UIKColormapSelector'
export * from './UIKViewModeSelector'
// Component type definitions and interfaces
exp... |
0ef941499f15510af4f2e4c35c208831c2be234ede4b647382f572b84cd68912 | TypeScript | 701 | 17 | /**
* Zarr Viewer Module
*
* Provides chunk-based viewing of zarr datasets (commonly used for large
* microscopy and scientific imaging data). NiiVue acts as a chunk client,
* fetching chunks from a remote zarr store and assembling them into a
* virtual NIfTI volume.
*
* For 3D datasets, the virtual volume enab... |
4b3adc668bcb3ae66872f0536e21c6911503b86ad4a320f89ddcec48f347fe1f | TypeScript | 702 | 19 | import { resolve } from 'path'
import { existsSync, mkdirSync } from 'fs'
export const httpServerAddress = 'http://localhost:8888/tests/index.html'
export const httpServerAddressSync = 'http://localhost:8888/tests/sync.html'
export const httpServerAddressFlexbox = 'http://localhost:8888/tests/flexbox.html'
export cons... |
628818b631d1ba04dd3fdae51587d14a6518429c6ca0673244237d02816ab61d | TypeScript | 710 | 21 | // @vitest-environment node
import { expect, test } from 'vitest'
import { NVImage } from '../../src/niivue/index.js' // note the js extension
import { readFileSync } from 'node:fs'
import path from 'path'
test('nvimage getValue', async () => {
const name = 'hippo.nii.gz'
const dataBuffer = readFileSync(path.join(... |
5496b61fe0c654056208b93f2d43aad1731ed40e9d51c0adaaa21979b2e05c46 | TypeScript | 716 | 18 | import { expect, test } from 'vitest'
import { mat4 } from 'gl-matrix'
import { NVUtilities } from '../../src/niivue/index.js' // note the js extension
test('nvutilities sph2cartDeg', () => {
const xyz = NVUtilities.sph2cartDeg(42, 42)
expect(xyz).toEqual([0.4972609476841367, -0.5522642316338268, -0.66913060635885... |
4b4a017304639411e8af738c1373c876096b82921db959ba803cbd8011c86bdf | TypeScript | 717 | 26 | import { nativeImage, app } from 'electron'
import path from 'path'
// This will be replaced with a string path at build time by Vite
import devIconPath from '../../../resources/icons/app_icon.png?asset'
export function getPlatformIcon(): string | Electron.NativeImage {
if (!app.isPackaged) {
// In dev, use the... |
3d417246b9bb894c37dda47821a8fa3f29999b26a05e36e67ee9cb59915c7350 | TypeScript | 725 | 20 | 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 loadDocumentFromUrl nifti volume', a... |
d42391d3da7e428d13feffe2f174c08d72f1dd2715a6f573b47d87d03c180b8b | TypeScript | 739 | 20 | 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 loadDocumentFromUrl compound documen... |
d1a9bdf6f036ec9df4dcd83baba9ad27c68bdce004c74a293e529df713cbebfc | TypeScript | 740 | 32 | import { defineConfig } from 'vite'
import { resolve } from 'path'
export default defineConfig({
// For development, serve the HTML file directly
root: '.',
build: {
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'NiivueUIKit',
fileName: (format) => `index.${format === 'es' ? 'e... |
baf48123b901ea54d96afc8b1b9c91e8efd414c2f3d0c22cec38ae27dd71ae66 | TypeScript | 743 | 41 | export type DatasetResponse = {
datasets: DatasetMetrics[];
};
export type DatasetMetrics = DataMetrics & {
dataset: string;
job_id: string;
operators: OperatorMetrics[];
start_time: number;
end_time: number | undefined;
};
export type OperatorMetrics = DataMetrics & {
operator: string;
name: string;
... |
404dffbc6ebd9ca25800820993c038f099247b524df54f20ed9574d70a464b6a | TypeScript | 759 | 38 | import { NVLabel3D } from "@niivue/niivue"
type AnyNumberArray =
| number[]
| Float64Array
| Float32Array
| Uint32Array
| Uint16Array
| Uint8Array
| Int32Array
| Int16Array
| Int8Array
export type NVMeshLayer = {
url?: string
name?: string
opacity?: number
colormap?: string
colormapNegativ... |
753cf590a67630be47027d0aa1362b8366bb59eb2050e06a8ca48ccb5fa92981 | TypeScript | 760 | 22 | 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 crosshairWidth can be set', async ({... |
2f5c1a6e62b9c730d38938f993d191e9376b0f57ad51383b6bc20ef13584d3d4 | TypeScript | 764 | 20 | 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 loadDocumentFromUrl nifti volume dra... |
58020f4bb5375b06ad4ad799cf3887ff23ea6e51557971c12f85f44a05b0585c | TypeScript | 765 | 19 | import { describe, it, expect } from 'vitest'
import { promises as fs } from 'fs'
import { join } from 'path'
import { vox2nii } from '../src/lib/loader.js'
import * as nifti from 'nifti-reader-js'
describe('MagicaVoxel Conversion Tests', () => {
it('should convert MagicaVoxel Vox to a NIfTI and test properties', as... |
7eaac8fa59a19cf8da7297852197251a9ca042475431fca28b9c116188b9311b | TypeScript | 767 | 28 | import { useState } from "react";
import useSWR from "swr";
import { API_REFRESH_INTERVAL_MS } from "../../../common/constants";
import { getClusterMetadata } from "../../../service/global";
export const useClusterDetail = () => {
const [msg, setMsg] = useState("Loading the job detail");
const [refreshing, setRefr... |
5badc6b7eff3b9c0eace7ae40c08968a69038c8a7c0435999090574b4aaa6067 | TypeScript | 790 | 34 | import { filterRuntimeEnvSystemVariables } from "./util";
describe("filterRuntimeEnvSystemVariables", () => {
it("filters out system variables", () => {
expect(
filterRuntimeEnvSystemVariables({
pip: {
pip_check: true,
packages: ["chess", "foo", "bar"],
pip_version: "1... |
45ecdade036268ec955ecda06af4cbc7bc1c8577d2aff2aea74a50f0f3af61ee | TypeScript | 791 | 23 | import { dialog, BrowserWindow } from 'electron'
export const openReplaceVolumeFileDialog = (index: number): void => {
const win = BrowserWindow.getAllWindows()[0]
dialog
.showOpenDialog(win, {
title: 'Select Replacement Volume',
properties: ['openFile'],
filters: [{ name: 'NIfTI files', exte... |
e55a9c3b54c084d8c084eaf4dfff7af55984ba1a5ac5704119d5841b88523597 | TypeScript | 793 | 27 | import {
JobListRsp,
StateApiJobProgressByTaskNameRsp,
StateApiNestedJobProgressRsp,
UnifiedJob,
} from "../type/job";
import { get } from "./requestHandlers";
export const getJobList = () => {
return get<JobListRsp>("api/jobs/");
};
export const getJobDetail = (id: string) => {
return get<UnifiedJob>(`ap... |
6fd0997146e0da3210a0f4cc450be38d7162e255777644207a4df05dc134c384 | TypeScript | 805 | 26 | import { StateApiResponse } from "../type/stateApi";
import { Task } from "../type/task";
import { get } from "./requestHandlers";
export const getTasks = (jobId: string | undefined) => {
let url = "api/v0/tasks?detail=1&limit=10000";
if (jobId) {
url += `&filter_keys=job_id&filter_predicates=%3D&filter_values... |
9a4005c56eac1d251ae5473952b6b9a8b33b5d6e469ac92d01c027101130f875 | TypeScript | 822 | 23 | // https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants
// gl.TEXTURE0..31 are constants 0x84C0..0x84DF = 33984..34015
// https://github.com/niivue/niivue/blob/main/docs/development-notes/webgl.md
// persistent textures
export const TEXTURE_CONSTANTS = {
TEXTURE0_BACK_VOL: 33984,
TEXTURE1_COLORM... |
750aefb7968e46a39c4702a92c05e537a0b6c41a34ab815ac5ede414babe3161 | TypeScript | 827 | 27 | import { ElectronAPI } from '@electron-toolkit/preload'
declare global {
interface Window {
electron: ElectronAPI & {
startTabDrag: (fileName: string, jsonStr: string) => void
setZoomFactor: (factor: number) => void
resourcesPath: string
getResourcesPath: () => string
loadBrainchopM... |
e2766024a8da31223188f09c78770ea77e308b9e9648c407d67dbe85fa02bed2 | TypeScript | 848 | 40 | import { memoryConverter } from "./converter";
describe("memoryConverter", () => {
const table: { name: string; input: number; expected: string }[] = [
{
name: "convert to Bytes",
input: 4,
expected: "4.0000B",
},
{
name: "convert to KB",
input: 5 * 1024 ** 1,
expected... |
4917be09286fb5ca1a48d06be533c8adb492bef93e1192a871d7e10daed9f74e | TypeScript | 865 | 31 | import { useState } from "react";
import { useParams } from "react-router-dom";
import useSWR from "swr";
import { API_REFRESH_INTERVAL_MS } from "../../../common/constants";
import { getJobDetail } from "../../../service/job";
export const useJobDetail = () => {
const params = useParams() as { id: string };
const... |
753830e30a67f07ecae7125b144cfa7ea6586c7f1ba488c6d81a8e3c6fcb7bfd | TypeScript | 875 | 30 | import { defineConfig } from 'vite'
import glsl from 'vite-plugin-glsl';
import path from 'path'
export default defineConfig({
build: {
lib: {
entry: path.resolve(__dirname, 'src/index.ts'), // Entry file
name: 'UIKit', // Global variable name for UMD build
fileName: (format) => `index.${format... |
f5429885ee052fe5bd24a8ad98a50582eb7f6e10928feebabbd65c0823e04263 | TypeScript | 882 | 36 | import React, { useContext, useEffect, useState } from "react";
export type SideTabContextType = {
selectedTab?: string;
setSelectedTab: (value?: string) => void;
};
export const DEFAULT_VALUE: SideTabContextType = {
setSelectedTab: () => {
/* purposefully empty */
},
};
export const SideTabContext =
R... |
0ec0aeabd4b2e1e99d4f8ad56095a8129a554c61362839bc2c832acea13f5264 | TypeScript | 890 | 24 | 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 loadDocumentFromUrl mesh', async ({ ... |
8b9c63f036d5473a3a8206328f4fdf221e52df5fc6c26bda2194e00d16811d57 | TypeScript | 892 | 31 | import { readFile } from 'fs/promises'
import { store } from './appStore.js'
import { refreshMenu } from './menu.js' // Import refreshMenu
// read a file and return it as a base64 string
export const readFromFile = async (_: unknown, path: string): Promise<string> => {
console.log('[Main] readFromFile requested', pa... |
e70cd44d9e304d1a9fc283cbac2479b60cc00d59e4248525bf25bb159523d77e | TypeScript | 896 | 22 | import { NIFTI1, NIFTI2 } from 'nifti-reader-js'
import { ImageType } from '@/nvimage/utils'
export interface ParsedVolumeData {
hdr: NIFTI1 | NIFTI2 | null
imgRaw: ArrayBufferLike | null
imageType: ImageType
error?: string
}
export * as Afni from '@/nvimage/ImageReaders/afni'
export * as BrainVoyager... |
51a8ee400964223de19dd3aa519e180e8831a93bdc0abd913ea63f3c3017c967 | TypeScript | 904 | 25 | 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 defaultOptions set correctly', async... |
c36f618da260acb78d09304b62639706deffe593046bc014999dd67aa9dbd6b5 | TypeScript | 907 | 52 | import { axiosInstance } from "./requestHandlers";
type CMDRsp = {
result: boolean;
msg: string;
data: {
output: string;
};
};
export const getJstack = (ip: string, pid: string) => {
return axiosInstance.get<CMDRsp>("utils/jstack", {
params: {
ip,
pid,
},
});
};
export const getJm... |
7824069331dbd256d2b8f108ee07f1b70e3ed594e2bc4a5ca7e64ba29e80ccc3 | TypeScript | 911 | 22 | 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 loadDocumentFromUrl replaces previou... |
a7a7a885845be02fffac91a69beac2a28a2bcd918507c4f260bcbee379102045 | TypeScript | 919 | 34 | import { resolve } from 'path'
import { defineConfig, coverageConfigDefaults } from 'vitest/config'
export default defineConfig({
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
test: {
coverage: {
provider: 'v8',
reporter: ['text', 'html'... |
57ce0865a5ce4b0b92ff11cdb8ac6cdb834659bb42cc01df6b15f3ffc3a2b784 | TypeScript | 928 | 24 | 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 renders non-Latin Unicode text with ... |
69f58688d661cacf593f90e2289f6d584c0b1b675e7c7b7e77bc08a44197c48f | TypeScript | 929 | 34 | /**
* Brainchop Brain Segmentation Service
*
* Provides deep learning-based brain segmentation using TensorFlow.js
* Supports tissue segmentation, brain extraction, and regional parcellation
*/
// Main service export (singleton)
export { brainchopService, BrainchopService } from './BrainchopService.js'
// Compon... |
b8028d76dca46b7724accf61f3d0940be7f52a268a454baa52894806370ec35a | TypeScript | 946 | 28 | import { log } from '@/logger'
import { decodeRLE } from '@/drawing/rle'
interface DrawUndoArgs {
drawUndoBitmaps: Uint8Array[]
currentDrawUndoBitmap: number
drawBitmap: Uint8Array
}
export const drawUndo = ({ drawUndoBitmaps, currentDrawUndoBitmap, drawBitmap }: DrawUndoArgs): { drawBitmap: Uint8Array; cu... |
d554b12444a7501ee2d1653d77814f842101afeebd9f2dd0cfc66c93dfd40bf5 | TypeScript | 959 | 30 | 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 setColormap', async ({ page }) => {
... |
7652ccb2f481a8ea26c51deb954d433c801936593183a7bf1823409dfeee7b28 | TypeScript | 967 | 50 | export interface DicomSeries {
seriesNumber?: number
seriesInstanceUID?: string
protocolName?: string
seriesDescription?: string
echoNumber?: number
images?: number
modality?: string
text: string
}
export interface ConvertSeriesOptions {
outDir?: string
pattern?: string
compress?: 'y' | 'n'
bid... |
5ac8dee98f7238655d75eb3c40228aa6dd54ebfa586c42ef85598d5458e52b72 | TypeScript | 975 | 30 | // Copyright (C) CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT
import _ from 'lodash';
import { Config } from '@react-awesome-query-builder/antd';
import { config as jobPageFilterConfig } from 'components/jobs-page/jobs-filter-configuration';
export const config: Partial<Config> = {
fields: {
...... |
ef4b3de7d889b451c9c66689ea0483800a0f2df00892ba841decbea258ff0c60 | TypeScript | 975 | 31 | describe('Application Launch', () => {
it('should open the main window', async () => {
const title = await browser.getTitle()
expect(title).toContain('NiiVue')
})
it('should have the root element', async () => {
const root = await $('#root')
expect(await root.isDisplayed()).toBe(true)
})
it(... |
44ad6237ab4785209abd8304375c35b6cbc00ab85291fe5026f86b9649541767 | TypeScript | 981 | 30 | 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 setOpacity', async ({ page }) => {
... |
647a30d730fac14010fbd901e0f0d16156915a8406140cd7dab36bcefebce79a | TypeScript | 996 | 39 | export enum PlacementGroupState {
// Must be in sync with gcs.proto PlacementGroupState
PENDING = "PENDING",
CREATED = "CREATED",
REMOVED = "REMOVED",
RESCHEDULING = "RESCHEDULING",
}
export type Bundle = {
bundle_id: string;
node_id: string | null;
unit_resources: {
[key: string]: number;
};
l... |
cec2aea82b7e7317b23d1d2c5e206df58fa707ce8cd9d8ee996740304ba27de2 | TypeScript | 1,056 | 31 | 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 set RadiologicalConvention', async (... |
462ea28f3565fd8e30cfe1490f7007b6a808badadcf162a8bef7934f1c25b284 | TypeScript | 1,086 | 32 | 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 setCrosshairColor', async ({ page })... |
9c719e752477c8012d053b36245765a9dbdbe07393f49dd0242af1492dd0feec | TypeScript | 1,087 | 33 | export function readFileAsDataURL(input: File | FileSystemFileEntry): Promise<string> {
return new Promise<string>((resolve, reject) => {
let filePromise: Promise<File>
if (input instanceof File) {
filePromise = Promise.resolve(input)
} else {
filePromise = new Promi... |
f5d4b1a72a48b36df9588436dec4982ea6bb6b6d3a81f59df08cafdc4ddeedcc | TypeScript | 1,098 | 61 | export const bundles = [
{
bundle_id: "bundle-1",
node_id: "node-1",
unit_resources: {
cpu: 4,
memory: 8192,
},
},
{
bundle_id: "bundle-2",
node_id: null,
unit_resources: {
cpu: 2,
memory: 4096,
},
},
{
bundle_id: "bundle-3",
node_id: "node-2",
... |
3678d16d3b151183ac30942202ce680759f8be4e18b56bb504e91f00a165a680 | TypeScript | 1,099 | 32 | 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 saveDocument without embedded images... |
50991eb50b3d8476c9643bbb07bbc2cffed1c7d5cfa762f23e4ef24ebe833bb5 | TypeScript | 1,121 | 32 | 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 click moves crosshairs', async... |
702d8f0a17e02f98c6be8b3a627cfe9393a4a6d0adfd9a2ec632858f7ebdb3eb | TypeScript | 1,180 | 51 | import { SHOW_RENDER, SLICE_TYPE } from '@niivue/niivue'
export const sliceTypeMap = {
'3D Render': {
name: '3D Render',
sliceType: SLICE_TYPE.RENDER,
showRender: SHOW_RENDER.ALWAYS,
noseLeft: false
},
Axial: {
name: 'axial',
sliceType: SLICE_TYPE.AXIAL,
showRender: SHOW_RENDER.NEVER,
... |
0586ec72b12e898ab7b3173354ede0075d9205e9939f66db8ab475c02f3efa51 | TypeScript | 1,208 | 35 | 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 wheel changes slices in 2D vie... |
bfb6c17824a72b5120889d3ee3cb75ba061b8aea44717be10970936521496acf | TypeScript | 1,209 | 40 | // src/ipcHandlers/saveDocument.ts
import { Niivue } from '@niivue/niivue'
const electron = window.electron
/**
* @param nv your Niivue instance
* @param docId the ID of this document
* @param getTitle a zero‐arg function that returns the *React* title for this doc
*/
export function registerSaveCompresse... |
4086619cbe4689ee0021b387b8268ce94333797a8a10e4fb0878c624dbd9dd0d | TypeScript | 1,214 | 33 | // tests/niivue-hdr-img.spec.ts
import { test, expect } from '@playwright/test'
import { Niivue } from '../../dist/index.js'
import { httpServerAddress } from './helpers.js' // adjust path to your test helper
import { TEST_OPTIONS } from './test.types.js'
test.beforeEach(async ({ page }) => {
// go to the served i... |
b8daf8e1830278dc8f4b11d164b14a616233ba1521648c80cacfecda2da4d72b | TypeScript | 1,240 | 34 | 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 draw 2D set cull front face', async ... |
0a286d41552f2df9890e159cd514c951bd607ee027f0bca9cf958c6c9315794f | TypeScript | 1,242 | 41 | 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 event onLocationChange 4D', async ({... |
928c7630ee71de4ceaff9e4ffdfe87b171040c6c33e1ab709aab3e8af3377646 | TypeScript | 1,242 | 34 | 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 mm2frac', async ({ page }) => {
... |
339c0f30a3aa82e2a128cf0da9994116b0ee6ee0270c7934db207da26e78d7c8 | TypeScript | 1,247 | 40 | #!/usr/bin/env node
import * as fs from 'fs/promises'
import path from 'path'
import { fileURLToPath } from 'url'
import { vox2nii } from './lib/loader.js'
import { performance } from 'perf_hooks'
// Convert `import.meta.url` to __dirname equivalent for ES modules
const __filename = fileURLToPath(import.meta.url)
cons... |
307912329a9ae9a38147f1fd4ef5850e7204c379bac792788586197dd6ff383c | TypeScript | 1,250 | 47 | import { app } from 'electron'
import { NVConfigOptions } from '@niivue/niivue'
import Store from 'electron-store'
// Define AppStore class using ElectronStore correctly
export class AppStore {
private store: Store
constructor() {
this.store = new Store()
}
// Recent Files Methods
getRecentFiles(): st... |
771048796045d4d949f7dbe59544f0ef5cb1f938f90296f01f7de7deb595bd2b | TypeScript | 1,272 | 40 | import { mat4, vec3, vec4 } from 'gl-matrix'
export function swizzleVec3(vec: vec3, order = [0, 1, 2]): vec3 {
const vout = vec3.create()
vout[0] = vec[order[0]]
vout[1] = vec[order[1]]
vout[2] = vec[order[2]]
return vout
}
// return boolean is 2D slice view is radiological
// n.b. ambiguous for p... |
ccfc15a2b5557c96e5de997d7a5bcb8bdfe1c7d50ef74a5013a478b48dc7ddc8 | TypeScript | 1,272 | 40 | // src/ipcHandlers/loadMesh.ts
import React from 'react'
import { NVMesh, Niivue } from '@niivue/niivue'
import { MESH_EXTENSIONS } from '../../../common/extensions.js'
const electron = window.electron
export interface HandlerProps {
nv: Niivue
setMeshes: React.Dispatch<React.SetStateAction<NVMesh[]>>
}
export c... |
7c1346bf8fdc5b282c6e3f639d6e2b353e7f135a4a6dc4a3c79e40851d1d3143 | TypeScript | 1,284 | 37 | /**
* @license
* Copyright 2024 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... |
d19e64e0e2ebfc3789e9beece3b9ca7c6dd807acb0971d050edf1e92fe7ef1c0 | TypeScript | 1,284 | 52 | import { AxiosResponse } from "axios";
import useSWR, { Key } from "swr";
import { PER_JOB_PAGE_REFRESH_INTERVAL_MS } from "../../../common/constants";
import { getTask } from "../../../service/task";
import {
AsyncFunction,
StateApiResponse,
StateApiTypes,
} from "../../../type/stateApi";
export const useStateA... |
dfd3db26c1eed8500c1621dcceb66cdc54004ecd9a1efb6c8519f6ba9a225383 | TypeScript | 1,312 | 37 | 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 setSelectionBoxColor', async ({ page... |
8c89fd0618e3e2379d81543867884a88565d8243ed7e5c172227d49f173b0097 | TypeScript | 1,352 | 37 | /**
* @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... |
777b739109617e45e22474242ee06ee251d605a25268e295f6b48b0543cd8a8b | TypeScript | 1,358 | 43 | import { NVImage } from '@niivue/niivue'
/**
* Extract a subvolume from a base volume using a label mask.
* Returns a new volume with original intensities where selected labels exist, zeros elsewhere.
*/
export function extractSubvolume(
baseVolume: NVImage,
labelVolume: NVImage,
selectedLabels: Set<number>
)... |
7a1dafdf6041578e9fd3546b8aee929535b919c6a6f29d68358a3c21e52bac70 | TypeScript | 1,360 | 47 | /**
* Write base64-encoded data to stdout with proper backpressure handling
* For large data, we need to wait for drain events to avoid truncation
*/
export async function writeBase64ToStdout(base64Data: string): Promise<void> {
return new Promise((resolve, reject) => {
// Write synchronously using fs to ensur... |
668cc6b92cb89e12e5285fa6cfc93d6b78a1274e88336d24bfcfd1d88434a24d | TypeScript | 1,384 | 35 | // @vitest-environment node
import { readFileSync } from 'node:fs'
import path from 'path'
import { expect, test } from 'vitest'
import { vec3 } from 'gl-matrix'
import { NVImage } from '../../src/niivue/index.js' // note the js extension
test('nvimage convertVox2Frac', async () => {
const name = 'mni152.nii.gz'
c... |
7a90f40e683e1fba8f3063716de6b228bd8f665ed11fad8d61ef3a5dd2981eda | TypeScript | 1,391 | 42 | 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 setModulationImage', async ({ page }... |
9c41db1bb6b962a2a3d22d93b8fb11daf3f8112fa9974a02b3953fd0c937e0a6 | TypeScript | 1,400 | 41 | 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 nvdocument preserve gradientOpacity ... |
0b5fb7c3d59d5e18d635a557308c27da705957014a05b3f6649bc9986a7856a1 | TypeScript | 1,401 | 46 | // Copyright (C) 2020-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT
import {
Canvas,
CanvasMode,
CanvasHistorySource,
RectDrawingMethod,
CuboidDrawingMethod,
finalizePastedShapePoints,
InteractionData as _InteractionData,
InteractionResult as _InteractionResult,
Highligh... |
1087d00a8ed6cfb35391bba43285187adc7070130ab8cfd0e9f208017e21c132 | TypeScript | 1,402 | 40 | 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 by url', async ({ page ... |
a37e437ed0cbdd38659db1722b8517c1c29a6d5ebb2e04604d4e589c83e9e0d2 | TypeScript | 1,420 | 67 | // Copyright (C) CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT
import {
LabelType, ModelKind, RQStatus, ShapeType,
} from './enums';
export interface ModelAttribute {
name: string;
values: string[];
input_type: 'select' | 'number' | 'checkbox' | 'radio' | 'text';
}
export interface ModelPara... |
4d2c6eb46d64beef429266a8f5d2347e45315554fc02105801c083e4e48a9b1a | TypeScript | 1,426 | 49 | import { UIKShader } from '../uikshader.js'
import bitmapVertShader from '../shaders/vert/bitmap.vert.glsl'
import bitmapFragShader from '../shaders/frag/bitmap.frag.glsl'
import { UIKAsset } from './uikasset.js'
export class UIKBitmap extends UIKAsset {
public bitmapShader: UIKShader
constructor(gl: WebGL2Render... |
8ec21b773cd2afc7309685a99d9f52591948b503664773b7ee3164812d7b0895 | TypeScript | 1,458 | 43 | 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 canvasPos2frac', async ({ page }) =>... |
a124e39644df8547f606e73f415e401409eaf51561dc2ac92cde17951b2fc4cf | TypeScript | 1,459 | 56 | import _ from "lodash";
export const getWeightedAverage = (
input: {
weight: number;
value: number;
}[],
) => {
if (input.length === 0) {
return 0;
}
let totalWeightTimesValue = 0;
let totalWeight = 0;
for (const { weight, value } of input) {
totalWeightTimesValue += weight * value;
... |
c4858eeaed39a6de69b21efc378826a361d5550b411a1f3e8c3e30d9955b06d2 | TypeScript | 1,466 | 42 | // src/ipcHandlers/saveHTML.ts
import { Niivue } from '@niivue/niivue'
import { esm } from '@niivue/niivue/min'
const electron = window.electron
/**
* @param nv your Niivue instance
* @param docId the ID of this document (used for both canvas#… and tab tracking)
* @param getTitle zero‑arg fn returning the... |
056c57b2ed6fd8533cfde9d19e6b549141b1a7c05516becb39dc688af9191d49 | TypeScript | 1,485 | 53 | import { Niivue } from '@niivue/niivue'
export type FMRIEvent = {
onset: number
duration: number
trial_type: string
}
export let fmriEvents: FMRIEvent[] = []
export const trialTypeColorMap: Record<string, [number, number, number, number]> = {}
let nextColorIndex = 0
const defaultColors: [number, number, numbe... |
3df5b5982aab312f7afc1f7d037c7238f2b01a0cb568e753f7486d4a2ff757c2 | TypeScript | 1,492 | 42 | import { test, expect } from '@playwright/test'
import { Niivue } from '../../dist/index.js'
import { httpServerAddress } from './helpers.js'
import { NiivueTestOptions, NiivueTestOptionsFilePath, TEST_OPTIONS } from './test.types.js'
const numpyFiles = [
'01_float32_blobs_64x64x48.npy',
'02_int16_signed_gradi... |
2e8847a06e0d804c5f053ee49e6cce401ad228a026bd56636cb548a84cda00a0 | TypeScript | 1,505 | 48 | export type ResourceSlot = {
slot: number;
allocation: number;
};
export type ResourceAllocations = {
resourceSlots: ResourceSlot[];
};
export type CoreWorkerStats = {
ipAddress: string;
port: string;
actorId: string;
usedResources: { [key: string]: ResourceAllocations };
numExecutedTasks: number;
n... |
a0b297270b78dd8aa5aca7a2ab7d0f556934f5e0f1bef6113d189934f7139864 | TypeScript | 1,511 | 42 | import { NVImage, NVMesh } from '@niivue/niivue'
import { Dispatch, SetStateAction } from 'react'
const volumeExtensions = ['.nii', '.nii.gz'] // TODO: list all supported file types
const meshExtensions = ['mz3'] // TODO: list all supported file types
const electron = window.electron
export const loadDroppedFiles = a... |
292bd26e8aa1ffc41e629d2c7aa250de549ace769882a498f1bcff1ca822a439 | TypeScript | 1,517 | 61 | export const descendingComparator = <T>(a: T, b: T, orderBy: keyof T) => {
if (b[orderBy] < a[orderBy]) {
return -1;
}
if (b[orderBy] > a[orderBy]) {
return 1;
}
return 0;
};
const descendingComparatorFnAccessor = <T>(
a: T,
b: T,
orderByFn: Accessor<T>,
) => {
const aVal = orderByFn(a);
co... |
d22914119bcfc78834aa5a720c23e91ccf392e5840649e47f7979fa04a03b17b | TypeScript | 1,517 | 56 | import { useContext, useState } from "react";
import { useParams } from "react-router-dom";
import useSWR from "swr";
import { GlobalContext } from "../../../App";
import { API_REFRESH_INTERVAL_MS } from "../../../common/constants";
import { ActorResp, getActor } from "../../../service/actor";
export const useFetchAct... |
a391825c9bfbee83a42a5a8b291c82b3251a8fb09a8b7e3d85e6649c7daa16d1 | TypeScript | 1,525 | 43 | 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 moveVolumeToTop', async ({ page }) =... |
7b71949bbb73e3d9206b238a0a3a83491e77c6e66b208a3b3970fd9ebe8130b0 | TypeScript | 1,526 | 44 | 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)
}... |
768d2eb0267379203fa99491ac09ae913c77327d26dd55b279d19ed73fb8cff5 | TypeScript | 1,531 | 43 | 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 moveVolumeToBottom', async ({ page }... |
9484518744e58f740a8e908aad539b71244461734d9b55010597c7ca8376f686 | TypeScript | 1,540 | 60 | import { GPUStats, ProcessGPUUsage, TPUStats } from "../type/node";
export type UnifiedProcessAcceleratorUsage = {
pid: number;
memoryUsage: number;
};
export type UnifiedAcceleratorStat = {
uuid?: string;
name: string;
index: number;
type: "GPU" | "TPU";
utilization?: number;
memoryUsed: number;
me... |
c880fdaebd132b0a56a00c3dcaaafd265589d0a82b25e4502094297cc8bca280 | TypeScript | 1,566 | 41 | 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 double click to reset brightne... |
8e72d8c874975e75d664baaa5eb1f4ee334253aa1cd316a266970c52c52f0eb6 | TypeScript | 1,570 | 57 | import { useContext, useState } from "react";
import { useParams } from "react-router-dom";
import useSWR from "swr";
import { GlobalContext } from "../../../App";
import { API_REFRESH_INTERVAL_MS } from "../../../common/constants";
import { getNodeDetail } from "../../../service/node";
export const useNodeDetail = ()... |
6b7578cd6c0cd8dcf74d120347f8f06e39204fa537af0f7b485d3e8ba480aa3f | TypeScript | 1,579 | 52 | import { nice } from '@/utils/nice'
function loose_label(min: number, max: number, ntick = 4): [number, number, number, boolean] {
const range = nice(max - min, false)
const d = nice(range / (ntick - 1), true)
const graphmin = Math.floor(min / d) * d
const graphmax = Math.ceil(max / d) * d
const pe... |
bdd000c1a1e109f75c4de610637826fdf0cc5bfa1e72fc3ee2807c96b6e328c7 | TypeScript | 1,630 | 47 | import { ObjectState } from 'cvat-core-wrapper';
export const OBJECTS_SIDEBAR_EXPAND_Z_LAYER_EVENT = 'cvat.objects-sidebar.expand-z-layer';
export const OBJECTS_SIDEBAR_OPEN_Z_LAYER_EVENT = 'cvat.objects-sidebar.open-z-layer';
export const OBJECTS_SIDEBAR_OPEN_EVENT = 'cvat.objects-sidebar.open';
const objectStateInd... |
aa9cb73a7afb64b92802dd898086e8e361c2cba543bc1cde261fda6592b7c8d8 | TypeScript | 1,647 | 42 | /**
* @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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.