@janelia-flyem/neuroglancer
Advanced tools
Comparing version 2.33.1 to 2.34.0
@@ -12,2 +12,4 @@ import { bindDefaultCopyHandler, bindDefaultPasteHandler } from './neuroglancer/ui/default_clipboard_handling'; | ||
import './neuroglancer/datasource/precomputed/register_default'; | ||
import './neuroglancer/datasource/n5/register_default'; | ||
import './neuroglancer/datasource/zarr/register_default'; | ||
import './neuroglancer/segmentation_user_layer'; | ||
@@ -14,0 +16,0 @@ import './neuroglancer/image_user_layer'; |
@@ -46,13 +46,19 @@ import _Object$assign from 'babel-runtime/core-js/object/assign'; | ||
} | ||
export function appendQueryString(url, name, value) { | ||
return `${url}${url.includes('?') ? '&' : '?'}${name}=${value}`; | ||
} | ||
export function appendQueryStringForDvid(url, user) { | ||
let newUrl = appendQueryString(url, 'app', 'Neuroglancer'); | ||
/* | ||
if (url.includes('?')) { | ||
url += '&'; | ||
url += '&'; | ||
} else { | ||
url += '?'; | ||
url += '?'; | ||
} | ||
url += 'app=Neuroglancer'; | ||
*/ | ||
if (user) { | ||
url += `&u=${user}`; | ||
newUrl += `&u=${user}`; | ||
} | ||
return url; | ||
return newUrl; | ||
} | ||
@@ -59,0 +65,0 @@ export function responseText(response) { |
@@ -39,3 +39,3 @@ import _Object$assign from "babel-runtime/core-js/object/assign"; | ||
import { WithSharedCredentialsProviderCounterpart } from "../../credentials_provider/shared_counterpart"; | ||
import { DVIDInstance, makeRequestWithCredentials, appendQueryStringForDvid, fetchMeshDataFromService } from "./api"; | ||
import { DVIDInstance, makeRequestWithCredentials, appendQueryStringForDvid, fetchMeshDataFromService, appendQueryString } from "./api"; | ||
import { DVIDAnnotationFacade } from "./utils"; | ||
@@ -54,2 +54,5 @@ import { verifyObject, verifyObjectProperty, verifyString, parseIntVec } from "../../util/json"; | ||
if (parameters.supervoxels) { | ||
return _Promise.reject(); | ||
} | ||
let bodyid = `${chunk.objectId}`; | ||
@@ -76,6 +79,10 @@ const url = `${parameters.baseUrl}/api/node/${parameters['nodeKey']}` + `/${parameters['dataInstanceKey']}/key/` + bodyid + '_swc'; | ||
download(chunk) { | ||
// DVID does not currently store meshes chunked, the main | ||
// use-case is for low-resolution 3D views. | ||
// for now, fragmentId is the body id | ||
chunk.fragmentIds = [`${chunk.objectId}`]; | ||
if (this.parameters.supervoxels) { | ||
chunk.fragmentIds = []; | ||
} else { | ||
// DVID does not currently store meshes chunked, the main | ||
// use-case is for low-resolution 3D views. | ||
// for now, fragmentId is the body id | ||
chunk.fragmentIds = [`${chunk.objectId}`]; | ||
} | ||
return _Promise.resolve(undefined); | ||
@@ -290,2 +297,5 @@ } | ||
path = this.getPath(chunkPosition, chunkDataSize); | ||
if (params.supervoxels) { | ||
path = appendQueryString(path, 'supervoxels', 'true'); | ||
} | ||
} | ||
@@ -292,0 +302,0 @@ const decoder = this.getDecoder(params); |
@@ -153,9 +153,3 @@ import _Promise from 'babel-runtime/core-js/promise'; | ||
} | ||
let volParameters = { | ||
'baseUrl': parameters.baseUrl, | ||
'nodeKey': parameters.nodeKey, | ||
'dataInstanceKey': dataInstanceKey, | ||
'dataScale': level.toString(), | ||
'encoding': encoding | ||
}; | ||
let volParameters = _Object$assign(_Object$assign({}, parameters), { dataInstanceKey, dataScale: level.toString(), encoding }); | ||
const chunkToMultiscaleTransform = mat4.create(); | ||
@@ -427,2 +421,5 @@ for (let i = 0; i < 3; ++i) { | ||
} | ||
get supervoxels() { | ||
return this.sourceParameters.supervoxels || false; | ||
} | ||
getSegmentPosition(id) { | ||
@@ -433,3 +430,3 @@ const dvidService = this.sourceParameters.dvidService; | ||
// dvid=${dvidConfig.protocol}://${dvidConfig.host}&uuid=${dvidConfig.uuid}&${(user ? `&u=${user}` : '')} | ||
return fetch(`${dvidService}/locate-body?dvid=${this.baseUrl}&uuid=${this.nodeKey}&body=${id.toString()}`, { | ||
return fetch(`${dvidService}/locate-body?dvid=${this.baseUrl}&uuid=${this.nodeKey}&body=${id.toString()}${this.supervoxels ? '&supervoxels=true' : ''}`, { | ||
method: 'GET' | ||
@@ -442,7 +439,3 @@ }).then(response => response.json()).then(location => new Float32Array(location)); | ||
getSources(volumeSourceOptions) { | ||
return this.info.getSources(this.chunkManager, { | ||
'baseUrl': this.baseUrl, | ||
'nodeKey': this.nodeKey, | ||
'dataInstanceKey': this.dataInstanceKey | ||
}, volumeSourceOptions, this.credentialsProvider); | ||
return this.info.getSources(this.chunkManager, this.sourceParameters, volumeSourceOptions, this.credentialsProvider); | ||
} | ||
@@ -483,2 +476,3 @@ } | ||
} | ||
sourceParameters.supervoxels = parameters.supervoxels === 'true'; | ||
} | ||
@@ -677,13 +671,11 @@ sourceParameters.authServer = getDefaultAuthServer(sourceParameters.baseUrl); | ||
export function getDataSource(options) { | ||
const sourceParameters = parseSourceUrl(options.providerUrl); | ||
const baseUrl = sourceParameters.baseUrl, | ||
nodeKey = sourceParameters.nodeKey, | ||
dataInstanceKey = sourceParameters.dataInstanceKey; | ||
return options.chunkManager.memoize.getUncounted({ | ||
type: 'dvid:MultiscaleVolumeChunkSource', | ||
baseUrl, | ||
nodeKey: nodeKey, | ||
dataInstanceKey | ||
sourceUrl: options.providerUrl | ||
}, async () => { | ||
const sourceParameters = parseSourceUrl(options.providerUrl); | ||
const baseUrl = sourceParameters.baseUrl, | ||
nodeKey = sourceParameters.nodeKey, | ||
dataInstanceKey = sourceParameters.dataInstanceKey; | ||
const credentialsProvider = options.credentialsManager.getCredentialsProvider(credentialsKey, { dvidServer: sourceParameters.baseUrl, authServer: sourceParameters.authServer }); | ||
@@ -690,0 +682,0 @@ const serverInfo = await getServerInfo(options.chunkManager, baseUrl, credentialsProvider); |
@@ -81,4 +81,4 @@ import _WeakMap from 'babel-runtime/core-js/weak-map'; | ||
} else if (typeof value === 'number') { | ||
newLow = newBaseLow = value; | ||
newHigh = newBaseHigh = 0; | ||
newLow = newBaseLow = value >>> 0; | ||
newHigh = newBaseHigh = value < 0 ? 0xffffffff : 0; | ||
hasSelectedSegment = true; | ||
@@ -144,3 +144,3 @@ } else if (value instanceof Uint64MapEntry) { | ||
if (typeof value === 'number') { | ||
id = new Uint64(value, 0); | ||
id = new Uint64(value >>> 0, value < 0 ? 0xffffffff : 0); | ||
} else if (typeof value === 'string') { | ||
@@ -147,0 +147,0 @@ id = Uint64.parseString(value); |
@@ -335,2 +335,9 @@ import _Map from 'babel-runtime/core-js/map'; | ||
} | ||
isReady() { | ||
let chunk = this.source.chunks.get(SINGLE_MESH_CHUNK_KEY); | ||
if (chunk === undefined || chunk.state !== ChunkState.GPU_MEMORY) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
draw(renderContext, attachment) { | ||
@@ -337,0 +344,0 @@ if (!renderContext.emitColor && renderContext.alreadyEmittedPickID) { |
@@ -162,3 +162,3 @@ /** | ||
`]; | ||
export const glsl_int8 = ` | ||
export const glsl_int8 = [glsl_uint64, ` | ||
struct int8_t { | ||
@@ -183,6 +183,12 @@ highp int value; | ||
highp ivec4 toRaw(int8x4_t x) { return x.value; } | ||
uint64_t toUint64(int8_t x) { | ||
uint64_t result; | ||
result.value[0] = uint(x.value); | ||
result.value[1] = uint(x.value >> 31); | ||
return result; | ||
} | ||
int8_t int8FromFloat(highp float x) { | ||
return int8_t(int(clamp(x, -128.0, 127.0))); | ||
} | ||
`; | ||
`]; | ||
export const glsl_float = ` | ||
@@ -222,3 +228,3 @@ highp float toRaw(highp float x) { return x; } | ||
`]; | ||
export const glsl_int16 = ` | ||
export const glsl_int16 = [glsl_uint64, ` | ||
struct int16_t { | ||
@@ -235,6 +241,12 @@ highp int value; | ||
highp ivec2 toRaw(int16x2_t x) { return x.value; } | ||
uint64_t toUint64(int16_t x) { | ||
uint64_t result; | ||
result.value[0] = uint(x.value); | ||
result.value[1] = uint(x.value >> 31); | ||
return result; | ||
} | ||
int16_t int16FromFloat(highp float x) { | ||
return int16_t(int(clamp(x, -32768.0, 32767.0))); | ||
} | ||
`; | ||
`]; | ||
export const glsl_uint32 = [glsl_uint64, ` | ||
@@ -259,3 +271,3 @@ struct uint32_t { | ||
`]; | ||
export const glsl_int32 = ` | ||
export const glsl_int32 = [glsl_uint64, ` | ||
struct int32_t { | ||
@@ -268,6 +280,12 @@ highp int value; | ||
highp int toRaw(int32_t x) { return x.value; } | ||
uint64_t toUint64(int32_t x) { | ||
uint64_t result; | ||
result.value[0] = uint(x.value); | ||
result.value[1] = uint(x.value >> 31); | ||
return result; | ||
} | ||
int32_t int32FromFloat(highp float x) { | ||
return int32_t(int(clamp(x, 2147483648.0, 2147483647.0))); | ||
} | ||
`; | ||
`]; | ||
export var glsl_getFortranOrderIndex = ` | ||
@@ -274,0 +292,0 @@ highp int getFortranOrderIndex(ivec3 subscripts, ivec3 size) { |
@@ -5,3 +5,3 @@ { | ||
"license": "Apache-2.0", | ||
"version": "2.33.1", | ||
"version": "2.34.0", | ||
"main": "dist/module/main_module.js", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -13,2 +13,4 @@ import {bindDefaultCopyHandler, bindDefaultPasteHandler} from 'neuroglancer/ui/default_clipboard_handling'; | ||
import 'neuroglancer/datasource/precomputed/register_default'; | ||
import 'neuroglancer/datasource/n5/register_default'; | ||
import 'neuroglancer/datasource/zarr/register_default'; | ||
import 'neuroglancer/segmentation_user_layer'; | ||
@@ -15,0 +17,0 @@ import 'neuroglancer/image_user_layer'; |
@@ -67,3 +67,9 @@ /** | ||
export function appendQueryString(url: string, name: string, value: string) { | ||
return `${url}${url.includes('?') ? '&' : '?'}${name}=${value}`; | ||
} | ||
export function appendQueryStringForDvid(url: string, user: string|null|undefined) { | ||
let newUrl = appendQueryString(url, 'app', 'Neuroglancer'); | ||
/* | ||
if (url.includes('?')) { | ||
@@ -75,6 +81,7 @@ url += '&'; | ||
url += 'app=Neuroglancer'; | ||
*/ | ||
if (user) { | ||
url += `&u=${user}`; | ||
newUrl += `&u=${user}`; | ||
} | ||
return url; | ||
return newUrl; | ||
} | ||
@@ -81,0 +88,0 @@ |
@@ -30,3 +30,3 @@ /** | ||
import {WithSharedCredentialsProviderCounterpart} from 'neuroglancer/credentials_provider/shared_counterpart'; | ||
import {DVIDInstance, DVIDToken, makeRequestWithCredentials, appendQueryStringForDvid, fetchMeshDataFromService} from 'neuroglancer/datasource/dvid/api'; | ||
import {DVIDInstance, DVIDToken, makeRequestWithCredentials, appendQueryStringForDvid, fetchMeshDataFromService, appendQueryString} from 'neuroglancer/datasource/dvid/api'; | ||
import {DVIDPointAnnotation, DVIDAnnotation, DVIDAnnotationFacade} from 'neuroglancer/datasource/dvid/utils'; | ||
@@ -49,2 +49,6 @@ import {verifyObject, verifyObjectProperty, verifyString, parseIntVec} from 'neuroglancer/util/json'; | ||
const {parameters} = this; | ||
if (parameters.supervoxels) { | ||
return Promise.reject(); | ||
} | ||
let bodyid = `${chunk.objectId}`; | ||
@@ -77,6 +81,10 @@ const url = `${parameters.baseUrl}/api/node/${parameters['nodeKey']}` + | ||
download(chunk: ManifestChunk) { | ||
// DVID does not currently store meshes chunked, the main | ||
// use-case is for low-resolution 3D views. | ||
// for now, fragmentId is the body id | ||
chunk.fragmentIds = [`${chunk.objectId}`]; | ||
if (this.parameters.supervoxels) { | ||
chunk.fragmentIds = []; | ||
} else { | ||
// DVID does not currently store meshes chunked, the main | ||
// use-case is for low-resolution 3D views. | ||
// for now, fragmentId is the body id | ||
chunk.fragmentIds = [`${chunk.objectId}`]; | ||
} | ||
return Promise.resolve(undefined); | ||
@@ -338,2 +346,5 @@ } | ||
path = this.getPath(chunkPosition, chunkDataSize); | ||
if (params.supervoxels) { | ||
path = appendQueryString(path, 'supervoxels', 'true'); | ||
} | ||
} | ||
@@ -340,0 +351,0 @@ const decoder = this.getDecoder(params); |
@@ -37,2 +37,3 @@ /** | ||
dvidService?: string; | ||
supervoxels?: boolean; | ||
} | ||
@@ -39,0 +40,0 @@ |
@@ -192,7 +192,6 @@ /** | ||
let volParameters: VolumeChunkSourceParameters = { | ||
'baseUrl': parameters.baseUrl, | ||
'nodeKey': parameters.nodeKey, | ||
'dataInstanceKey': dataInstanceKey, | ||
'dataScale': level.toString(), | ||
'encoding': encoding, | ||
...parameters, | ||
dataInstanceKey, | ||
dataScale: level.toString(), | ||
encoding | ||
}; | ||
@@ -498,2 +497,6 @@ const chunkToMultiscaleTransform = mat4.create(); | ||
get supervoxels() { | ||
return this.sourceParameters.supervoxels || false; | ||
} | ||
constructor( | ||
@@ -508,3 +511,3 @@ chunkManager: ChunkManager, public sourceParameters: DVIDSourceParameters, public info: VolumeDataInstanceInfo, public credentialsProvider: CredentialsProvider<DVIDToken>) { | ||
// dvid=${dvidConfig.protocol}://${dvidConfig.host}&uuid=${dvidConfig.uuid}&${(user ? `&u=${user}` : '')} | ||
return fetch(`${dvidService}/locate-body?dvid=${this.baseUrl}&uuid=${this.nodeKey}&body=${id.toString()}`, { | ||
return fetch(`${dvidService}/locate-body?dvid=${this.baseUrl}&uuid=${this.nodeKey}&body=${id.toString()}${this.supervoxels ? '&supervoxels=true' : ''}`, { | ||
method: 'GET', | ||
@@ -519,9 +522,3 @@ }).then((response) => response.json()).then((location) => new Float32Array(location)); | ||
return this.info.getSources( | ||
this.chunkManager, { | ||
'baseUrl': this.baseUrl, | ||
'nodeKey': this.nodeKey, | ||
'dataInstanceKey': this.dataInstanceKey, | ||
}, | ||
volumeSourceOptions, | ||
this.credentialsProvider); | ||
this.chunkManager, this.sourceParameters, volumeSourceOptions, this.credentialsProvider); | ||
} | ||
@@ -569,2 +566,4 @@ } | ||
} | ||
sourceParameters.supervoxels = (parameters.supervoxels === 'true'); | ||
} | ||
@@ -823,13 +822,11 @@ sourceParameters.authServer = getDefaultAuthServer(sourceParameters.baseUrl); | ||
export function getDataSource(options: GetDataSourceOptions): Promise<DataSource> { | ||
const sourceParameters = parseSourceUrl(options.providerUrl); | ||
const {baseUrl, nodeKey, dataInstanceKey} = sourceParameters; | ||
return options.chunkManager.memoize.getUncounted( | ||
{ | ||
type: 'dvid:MultiscaleVolumeChunkSource', | ||
baseUrl, | ||
nodeKey: nodeKey, | ||
dataInstanceKey, | ||
sourceUrl: options.providerUrl, | ||
}, | ||
async () => { | ||
const sourceParameters = parseSourceUrl(options.providerUrl); | ||
const {baseUrl, nodeKey, dataInstanceKey} = sourceParameters; | ||
const credentialsProvider = options.credentialsManager.getCredentialsProvider<DVIDToken>( | ||
@@ -836,0 +833,0 @@ credentialsKey, |
@@ -80,4 +80,4 @@ /** | ||
} else if (typeof value === 'number') { | ||
newLow = newBaseLow = value; | ||
newHigh = newBaseHigh = 0; | ||
newLow = newBaseLow = (value >>> 0); | ||
newHigh = newBaseHigh = value < 0 ? 0xffffffff : 0; | ||
hasSelectedSegment = true; | ||
@@ -185,3 +185,3 @@ } else if (value instanceof Uint64MapEntry) { | ||
if (typeof value === 'number') { | ||
id = new Uint64(value, 0); | ||
id = new Uint64((value >>> 0), value < 0 ? 0xffffffff : 0); | ||
} else if (typeof value === 'string') { | ||
@@ -188,0 +188,0 @@ id = Uint64.parseString(value); |
@@ -398,2 +398,10 @@ /** | ||
isReady() { | ||
let chunk = <SingleMeshChunk|undefined>this.source.chunks.get(SINGLE_MESH_CHUNK_KEY); | ||
if (chunk === undefined || chunk.state !== ChunkState.GPU_MEMORY) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
draw( | ||
@@ -400,0 +408,0 @@ renderContext: PerspectiveViewRenderContext, |
@@ -64,3 +64,4 @@ /** | ||
} | ||
`]; | ||
` | ||
]; | ||
@@ -110,3 +111,3 @@ export const glsl_equalUint64 = [ | ||
export const glsl_addSaturateUint64 = [ | ||
glsl_addUint64, glsl_compareLessThanUint64, ` | ||
glsl_addUint64, glsl_compareLessThanUint64, ` | ||
uint64_t addSaturate(uint64_t a, uint64_t b) { | ||
@@ -123,3 +124,3 @@ a = add(a, b); | ||
export const glsl_subtractSaturateUint64 = [ | ||
glsl_subtractUint64, glsl_compareLessThanUint64, ` | ||
glsl_subtractUint64, glsl_compareLessThanUint64, ` | ||
uint64_t subtractSaturate(uint64_t a, uint64_t b) { | ||
@@ -201,3 +202,4 @@ b = subtract(a, b); | ||
export const glsl_int8 = ` | ||
export const glsl_int8 = [ | ||
glsl_uint64, ` | ||
struct int8_t { | ||
@@ -222,6 +224,13 @@ highp int value; | ||
highp ivec4 toRaw(int8x4_t x) { return x.value; } | ||
uint64_t toUint64(int8_t x) { | ||
uint64_t result; | ||
result.value[0] = uint(x.value); | ||
result.value[1] = uint(x.value >> 31); | ||
return result; | ||
} | ||
int8_t int8FromFloat(highp float x) { | ||
return int8_t(int(clamp(x, -128.0, 127.0))); | ||
} | ||
`; | ||
` | ||
]; | ||
@@ -267,3 +276,4 @@ | ||
export const glsl_int16 = ` | ||
export const glsl_int16 = [ | ||
glsl_uint64, ` | ||
struct int16_t { | ||
@@ -280,6 +290,13 @@ highp int value; | ||
highp ivec2 toRaw(int16x2_t x) { return x.value; } | ||
uint64_t toUint64(int16_t x) { | ||
uint64_t result; | ||
result.value[0] = uint(x.value); | ||
result.value[1] = uint(x.value >> 31); | ||
return result; | ||
} | ||
int16_t int16FromFloat(highp float x) { | ||
return int16_t(int(clamp(x, -32768.0, 32767.0))); | ||
} | ||
`; | ||
` | ||
]; | ||
@@ -308,3 +325,4 @@ export const glsl_uint32 = [ | ||
export const glsl_int32 = ` | ||
export const glsl_int32 = [ | ||
glsl_uint64, ` | ||
struct int32_t { | ||
@@ -317,6 +335,13 @@ highp int value; | ||
highp int toRaw(int32_t x) { return x.value; } | ||
uint64_t toUint64(int32_t x) { | ||
uint64_t result; | ||
result.value[0] = uint(x.value); | ||
result.value[1] = uint(x.value >> 31); | ||
return result; | ||
} | ||
int32_t int32FromFloat(highp float x) { | ||
return int32_t(int(clamp(x, 2147483648.0, 2147483647.0))); | ||
} | ||
`; | ||
` | ||
]; | ||
@@ -399,3 +424,4 @@ export var glsl_getFortranOrderIndex = ` | ||
export const glsl_addSaturateInt32 = [glsl_addSaturateUint32, ` | ||
export const glsl_addSaturateInt32 = [ | ||
glsl_addSaturateUint32, ` | ||
highp int addSaturate(highp int x, highp uint y) { | ||
@@ -410,5 +436,7 @@ if (x >= 0) { | ||
} | ||
`]; | ||
` | ||
]; | ||
export const glsl_subtractSaturateInt32 = [glsl_addSaturateUint32, ` | ||
export const glsl_subtractSaturateInt32 = [ | ||
glsl_addSaturateUint32, ` | ||
highp int subtractSaturate(highp int x, highp uint y) { | ||
@@ -423,3 +451,4 @@ if (x < 0) { | ||
} | ||
`]; | ||
` | ||
]; | ||
@@ -426,0 +455,0 @@ export function getShaderType(dataType: DataType, numComponents: number = 1) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9320179
201090