Skip to content
Snippets Groups Projects
Unverified Commit 230877bc authored by xgui3783's avatar xgui3783 Committed by GitHub
Browse files

Merge pull request #1034 from FZJ-INM1-BDA/bugfix_newSiibraApi

bugfix: use new siibra-api
parents 17033f8a 9fb6704b
No related branches found
No related tags found
No related merge requests found
node_modules node_modules
dist dist
package-lock.json
src/res/raw src/res/raw
src/plugin_examples/*/ src/plugin_examples/*/
.vscode .vscode
......
...@@ -28,15 +28,13 @@ objects: ...@@ -28,15 +28,13 @@ objects:
- name: SESSION_SECRET - name: SESSION_SECRET
value: ${SESSION_SECRET} value: ${SESSION_SECRET}
- name: HOSTNAME - name: HOSTNAME
value: https://siibra-explorer.apps-dev.hbp.eu value: https://siibra-explorer.apps${PATH_POSTFIX}.hbp.eu
- name: HOST_PATHNAME - name: HOST_PATHNAME
value: /${SANITIZED_BRANCH_NAME} value: /${SANITIZED_BRANCH_NAME}
- name: IAV_STAGE - name: IAV_STAGE
value: ${SANITIZED_BRANCH_NAME} value: ${SANITIZED_BRANCH_NAME}
- name: BUILD_TEXT - name: BUILD_TEXT
value: ${BUILD_TEXT} value: ${BUILD_TEXT}
- name: SCRIPT_SRC
value: '["stats-dev.humanbrainproject.eu"]'
- name: REDIS_PASSWORD - name: REDIS_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
......
This diff is collapsed.
This diff is collapsed.
...@@ -9,12 +9,26 @@ import { LoggingService } from "src/logging"; ...@@ -9,12 +9,26 @@ import { LoggingService } from "src/logging";
import { viewerStateFetchedAtlasesSelector, viewerStateSelectedTemplateSelector } from "src/services/state/viewerState/selectors"; import { viewerStateFetchedAtlasesSelector, viewerStateSelectedTemplateSelector } from "src/services/state/viewerState/selectors";
import { BS_ENDPOINT, BACKENDURL } from "src/util/constants"; import { BS_ENDPOINT, BACKENDURL } from "src/util/constants";
import { flattenReducer } from 'common/util' import { flattenReducer } from 'common/util'
import { TAtlas, TId, TParc, TRegion, TRegionDetail, TSpaceFull, TSpaceSummary } from "./siibraApiConstants/types"; import { IVolumeTypeDetail, TAtlas, TId, TParc, TRegion, TRegionDetail, TSpaceFull, TSpaceSummary, TVolumeSrc } from "./siibraApiConstants/types";
import { MultiDimMap, recursiveMutate } from "./fn"; import { MultiDimMap, recursiveMutate } from "./fn";
const validVolumeType = new Set([
'neuroglancer/precomputed',
'neuroglancer/precompmesh',
'threesurfer/gii',
'threesurfer/gii-label',
])
function getNgId(atlasId: string, tmplId: string, parcId: string, regionKey: string){ function getNgId(atlasId: string, tmplId: string, parcId: string, regionKey: string){
// console.log(
// 'getNgId',
// ...arguments
// )
const proxyId = MultiDimMap.GetProxyKeyMatch(atlasId, tmplId, parcId, regionKey) const proxyId = MultiDimMap.GetProxyKeyMatch(atlasId, tmplId, parcId, regionKey)
if (proxyId) return proxyId if (proxyId) {
console.log('proxyid', proxyId)
return proxyId}
return '_' + MultiDimMap.GetKey(atlasId, tmplId, parcId, regionKey) return '_' + MultiDimMap.GetKey(atlasId, tmplId, parcId, regionKey)
} }
...@@ -264,15 +278,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" ...@@ -264,15 +278,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}"
* select only parcellations that contain renderable volume(s) * select only parcellations that contain renderable volume(s)
*/ */
const filteredParcellations = parcellations.filter(p => { const filteredParcellations = parcellations.filter(p => {
for (const spaceKey in p.volumeSrc) { return p._dataset_specs.some(spec => spec["@type"] === 'fzj/tmp/volume_type/v0.0.1' && validVolumeType.has(spec.volume_type))
for (const hemisphereKey in p.volumeSrc[spaceKey]) {
if (p.volumeSrc[spaceKey][hemisphereKey].some(vol => vol.volume_type === 'neuroglancer/precomputed')) return true
if (p.volumeSrc[spaceKey][hemisphereKey].some(vol => vol.volume_type === 'neuroglancer/precompmesh')) return true
if (p.volumeSrc[spaceKey][hemisphereKey].some(vol => vol.volume_type === 'threesurfer/gii')) return true
if (p.volumeSrc[spaceKey][hemisphereKey].some(vol => vol.volume_type === 'threesurfer/gii-label')) return true
}
}
return false
}) })
/** /**
...@@ -390,7 +396,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" ...@@ -390,7 +396,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}"
name: parc.name name: parc.name
} }
}), }),
originDatainfos: tmpl.originDatainfos || [] originDatainfos: (tmpl._dataset_specs || []).filter(spec => spec["@type"] === 'fzj/tmp/simpleOriginInfo/v0.0.1')
} }
}), }),
parcellations: parcellations.filter(p => { parcellations: parcellations.filter(p => {
...@@ -420,7 +426,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" ...@@ -420,7 +426,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}"
// }] // }]
} }
}), }),
originDatainfos: parc.originDatainfos || [] originDatainfos: (parc._dataset_specs || []).filter(spec => spec["@type"] === 'fzj/tmp/simpleOriginInfo/v0.0.1')
} }
}) })
} }
...@@ -510,8 +516,8 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" ...@@ -510,8 +516,8 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}"
region.children = [] region.children = []
return return
} }
const hemispheredNgId = getNgId(atlas['@id'], tmpl.id, parc.id, hemisphereKey) const hemispheredNgId = getNgId(atlas['@id'], tmpl.id, parc.id, hemisphereKey)
console.log('ngId', hemispheredNgId)
region['ngId'] = hemispheredNgId region['ngId'] = hemispheredNgId
} }
} }
...@@ -524,21 +530,45 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" ...@@ -524,21 +530,45 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}"
* populate maps for parc * populate maps for parc
*/ */
for (const parc of parcellations) { for (const parc of parcellations) {
if (tmpl.id in (parc.volumeSrc || {})) { const precomputedVols = parc._dataset_specs.filter(
// key: 'left hemisphere' | 'right hemisphere' | 'whole brain' spec => spec["@type"] === 'fzj/tmp/volume_type/v0.0.1'
for (const key in (parc.volumeSrc[tmpl.id] || {})) { && spec.volume_type === 'neuroglancer/precomputed'
for (const vol of parc.volumeSrc[tmpl.id][key]) { && spec.space_id === tmpl.id
if (vol.volume_type === 'neuroglancer/precomputed') { ) as TVolumeSrc<'neuroglancer/precomputed'>[]
const ngIdKey = getNgId(atlas['@id'], tmpl.id, parseId(parc.id), key)
ngLayerObj[tmpl.id][ngIdKey] = { if (precomputedVols.length === 1) {
source: `precomputed://${vol.url}`, const vol = precomputedVols[0]
type: "segmentation", const key = 'whole brain'
transform: vol.detail['neuroglancer/precomputed'].transform
} const ngIdKey = getNgId(atlas['@id'], tmpl.id, parseId(parc.id), key)
} ngLayerObj[tmpl.id][ngIdKey] = {
source: `precomputed://${vol.url}`,
type: "segmentation",
transform: vol.detail['neuroglancer/precomputed'].transform
}
}
if (precomputedVols.length === 2) {
const mapIndexKey = [{
mapIndex: 0,
key: 'left hemisphere'
}, {
mapIndex: 1,
key: 'right hemisphere'
}]
for (const { key, mapIndex } of mapIndexKey) {
const ngIdKey = getNgId(atlas['@id'], tmpl.id, parseId(parc.id), key)
ngLayerObj[tmpl.id][ngIdKey] = {
source: `precomputed://${precomputedVols[mapIndex].url}`,
type: "segmentation",
transform: precomputedVols[mapIndex].detail['neuroglancer/precomputed'].transform
} }
} }
} }
if (precomputedVols.length > 2) {
console.error(`precomputedVols.length > 0, most likely an error`)
}
} }
}), }),
catchError((err, obs) => { catchError((err, obs) => {
...@@ -557,10 +587,11 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" ...@@ -557,10 +587,11 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}"
// configuring three-surfer // configuring three-surfer
let threeSurferConfig = {} let threeSurferConfig = {}
const threeSurferVolSrc = tmpl.volume_src.find(v => v.volume_type === 'threesurfer/gii') const volumes = tmpl._dataset_specs.filter(v => v["@type"] === 'fzj/tmp/volume_type/v0.0.1') as TVolumeSrc<keyof IVolumeTypeDetail>[]
const threeSurferVolSrc = volumes.find(v => v.volume_type === 'threesurfer/gii')
if (threeSurferVolSrc) { if (threeSurferVolSrc) {
const foundP = parcellations.find(p => { const foundP = parcellations.find(p => {
return !!p.volumeSrc[tmpl.id] return p._dataset_specs.some(spec => spec["@type"] === 'fzj/tmp/volume_type/v0.0.1' && spec.space_id === tmpl.id)
}) })
const url = threeSurferVolSrc.url const url = threeSurferVolSrc.url
const { surfaces } = threeSurferVolSrc.detail['threesurfer/gii'] as { surfaces: {mode: string, hemisphere: 'left' | 'right', url: string}[] } const { surfaces } = threeSurferVolSrc.detail['threesurfer/gii'] as { surfaces: {mode: string, hemisphere: 'left' | 'right', url: string}[] }
...@@ -593,12 +624,16 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" ...@@ -593,12 +624,16 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}"
/** /**
* only concat first matching gii map * only concat first matching gii map
*/ */
const mapIndex = hemisphereKey === 'left hemisphere'
? 0
: 1
const labelMaps = foundP._dataset_specs.filter(spec => spec["@type"] === 'fzj/tmp/volume_type/v0.0.1' && spec.volume_type === 'threesurfer/gii-label') as TVolumeSrc<'threesurfer/gii-label'>[]
const key = surface.mode const key = surface.mode
const modeToConcat = { const modeToConcat = {
mesh: surface.url, mesh: surface.url,
hemisphere: surface.hemisphere, hemisphere: surface.hemisphere,
colormap: (() => { colormap: (() => {
const lbl = foundP.volumeSrc[tmpl.id][hemisphereKey].find(v => v.volume_type === 'threesurfer/gii-label') const lbl = labelMaps[mapIndex]
return lbl?.url return lbl?.url
})() })()
} }
...@@ -633,7 +668,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" ...@@ -633,7 +668,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}"
const tmplNgId = tmpl.name const tmplNgId = tmpl.name
const tmplAuxMesh = `${tmpl.name} auxmesh` const tmplAuxMesh = `${tmpl.name} auxmesh`
const precomputed = tmpl.volume_src.find(src => src.volume_type === 'neuroglancer/precomputed') const precomputed = tmpl._dataset_specs.find(src => src["@type"] === 'fzj/tmp/volume_type/v0.0.1' && src.volume_type === 'neuroglancer/precomputed') as TVolumeSrc<'neuroglancer/precomputed'>
if (precomputed) { if (precomputed) {
initialLayers[tmplNgId] = { initialLayers[tmplNgId] = {
type: "image", type: "image",
...@@ -647,7 +682,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" ...@@ -647,7 +682,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}"
// https://github.com/FZJ-INM1-BDA/siibra-python/pull/55 // https://github.com/FZJ-INM1-BDA/siibra-python/pull/55
// use url to determine for now // use url to determine for now
// const precompmesh = tmpl.volume_src.find(src => src.volume_type === 'neuroglancer/precompmesh') // const precompmesh = tmpl.volume_src.find(src => src.volume_type === 'neuroglancer/precompmesh')
const precompmesh = tmpl.volume_src.find(src => !!src.detail?.['neuroglancer/precompmesh']) const precompmesh = tmpl._dataset_specs.find(src => src["@type"] === 'fzj/tmp/volume_type/v0.0.1' && !!src.detail?.['neuroglancer/precompmesh']) as TVolumeSrc<'neuroglancer/precompmesh'>
const auxMeshes = [] const auxMeshes = []
if (precompmesh){ if (precompmesh){
initialLayers[tmplAuxMesh] = { initialLayers[tmplAuxMesh] = {
...@@ -691,7 +726,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" ...@@ -691,7 +726,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}"
'@id': parc.id, '@id': parc.id,
name: parc.name, name: parc.name,
regions, regions,
originDatainfos: fullParcInfo?.originDatainfos || [] originDatainfos: (fullParcInfo?._dataset_specs || []).filter(spec => spec["@type"] === 'fzj/tmp/simpleOriginInfo/v0.0.1')
} }
}), }),
...threeSurferConfig ...threeSurferConfig
......
...@@ -14,7 +14,7 @@ type TAuxMesh = { ...@@ -14,7 +14,7 @@ type TAuxMesh = {
labelIndicies: number[] labelIndicies: number[]
} }
interface IVolumeTypeDetail { export interface IVolumeTypeDetail {
'nii': null 'nii': null
'neuroglancer/precomputed': { 'neuroglancer/precomputed': {
'neuroglancer/precomputed': { 'neuroglancer/precomputed': {
...@@ -28,17 +28,30 @@ interface IVolumeTypeDetail { ...@@ -28,17 +28,30 @@ interface IVolumeTypeDetail {
} }
} }
'detailed maps': null 'detailed maps': null
'threesurfer/gii': any
'threesurfer/gii-label': any
} }
type TVolumeSrc<VolumeType extends keyof IVolumeTypeDetail> = { export type TVolumeSrc<VolumeType extends keyof IVolumeTypeDetail> = {
'@id': string '@id': string
'@type': 'fzj/tmp/volume_type/v0.0.1' '@type': 'fzj/tmp/volume_type/v0.0.1'
name: string name: string
url: string url: string
volume_type: TVolumeType volume_type: TVolumeType
detail: IVolumeTypeDetail[VolumeType] detail: IVolumeTypeDetail[VolumeType]
space_id: string
map_type: string
}
type TSimpleInfo = {
"@type": 'fzj/tmp/simpleOriginInfo/v0.0.1'
name: string
description: string
} }
type TDatasetSpec = TVolumeSrc<keyof IVolumeTypeDetail> | TSimpleInfo
type TKgIdentifier = { type TKgIdentifier = {
kgSchema: string kgSchema: string
kgId: string kgId: string
...@@ -91,17 +104,18 @@ export type TSpaceFull = { ...@@ -91,17 +104,18 @@ export type TSpaceFull = {
id: string id: string
name: string name: string
key: string //??? key: string //???
type: string //??? _dataset_specs: TDatasetSpec[]
url: string //??? _datasets_cached: null
ziptarget: string //??? extends: null
src_volume_type: TSpaceType src_volume_type: TSpaceType
volume_src: TVolumeSrc<keyof IVolumeTypeDetail>[] type: string //???
availableParcellations: TParcSummary[] availableParcellations: TParcSummary[]
links: { links: {
templates: THref templates: THref
parcellation_maps: THref parcellation_maps: THref
features: THref
} }
originDatainfos: TDatainfos[]
} }
export type TParc = { export type TParc = {
...@@ -112,19 +126,20 @@ export type TParc = { ...@@ -112,19 +126,20 @@ export type TParc = {
availableSpaces: { availableSpaces: {
id: string id: string
name: string name: string
extends: null
key: string
src_volume_type: 'histology' | 'mri'
type: 'neuroglancer/precomputed' | 'nii'
_dataset_specs: TDatasetSpec[]
}[] }[]
links: { links: {
self: THref self: THref
} }
regions: THref regions: THref
features: THref
modality: TParcModality modality: TParcModality
version: TVersion version: TVersion
volumeSrc: { _dataset_specs: TDatasetSpec[]
[key: string]: {
[key: string]: TVolumeSrc<keyof IVolumeTypeDetail>[]
}
}
originDatainfos: TDatainfos[]
} }
export type TRegionDetail = { export type TRegionDetail = {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment