diff --git a/angular.json b/angular.json index 381d8126cb58142d0ab49b4dabda5cd8ad15124d..0cd29585665857860e19b5f64ad44a737dbc86c2 100644 --- a/angular.json +++ b/angular.json @@ -1,5 +1,8 @@ { "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "cli": { + "analytics": false + }, "version": 1, "newProjectRoot": "projects", "projects": { diff --git a/src/util/pureConstant.service.ts b/src/util/pureConstant.service.ts index f0c01ff0755e005bc28eb68eb8ff2b9ef5c0df16..da6a4b63a5357539ddcf30c413ddef449b1bd44a 100644 --- a/src/util/pureConstant.service.ts +++ b/src/util/pureConstant.service.ts @@ -515,12 +515,13 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" shareReplay(1) ) + public ngLayerObj = {} + public initFetchTemplate$ = this.fetchedAtlases$.pipe( switchMap(atlases => { return forkJoin( atlases.map(atlas => this.getSpacesAndParc(atlas['@id']).pipe( switchMap(({ templateSpaces, parcellations }) => { - const ngLayerObj = {} return forkJoin( templateSpaces.map( tmpl => { @@ -535,7 +536,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" name: 'Julich-Brain Probabilistic Cytoarchitectonic Maps (v2.9)' }) } - ngLayerObj[tmpl.id] = {} + this.ngLayerObj[tmpl.id] = {} return tmpl.availableParcellations.map( parc => this.getRegions(atlas['@id'], parc.id, tmpl.id).pipe( tap(regions => { @@ -558,7 +559,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" const ngId = getNgId(atlas['@id'], tmpl.id, parc.id, dedicatedMap[0]['@id']) region['ngId'] = ngId region['labelIndex'] = dedicatedMap[0].detail['neuroglancer/precomputed'].labelIndex - ngLayerObj[tmpl.id][ngId] = { + this.ngLayerObj[tmpl.id][ngId] = { source: `precomputed://${dedicatedMap[0].url}`, type: "segmentation", transform: dedicatedMap[0].detail['neuroglancer/precomputed'].transform @@ -622,7 +623,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" const key = 'whole brain' const ngIdKey = getNgId(atlas['@id'], tmpl.id, parseId(parc.id), key) - ngLayerObj[tmpl.id][ngIdKey] = { + this.ngLayerObj[tmpl.id][ngIdKey] = { source: `precomputed://${vol.url}`, type: "segmentation", transform: vol.detail['neuroglancer/precomputed'].transform @@ -639,7 +640,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" }] for (const { key, mapIndex } of mapIndexKey) { const ngIdKey = getNgId(atlas['@id'], tmpl.id, parseId(parc.id), key) - ngLayerObj[tmpl.id][ngIdKey] = { + this.ngLayerObj[tmpl.id][ngIdKey] = { source: `precomputed://${precomputedVols[mapIndex].url}`, type: "segmentation", transform: precomputedVols[mapIndex].detail['neuroglancer/precomputed'].transform @@ -660,7 +661,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" } ).reduce(flattenReducer, []) ).pipe( - mapTo({ templateSpaces, parcellations, ngLayerObj }) + mapTo({ templateSpaces, parcellations, ngLayerObj: this.ngLayerObj }) ) }), map(({ templateSpaces, parcellations, ngLayerObj }) => { diff --git a/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.component.ts b/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.component.ts index 877da82be1fa38705be3345b5eec9fc0bcfd3774..db5bea46b74d1711d4ee7aac6ebe8613c67b39e9 100644 --- a/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.component.ts +++ b/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.component.ts @@ -1,7 +1,7 @@ import { Component, HostBinding, Inject, Optional } from "@angular/core"; import { select, Store } from "@ngrx/store"; import { combineLatest, merge, Observable, of, Subscription } from "rxjs"; -import { filter, map, pairwise, withLatestFrom } from "rxjs/operators"; +import {filter, map, pairwise, withLatestFrom} from "rxjs/operators"; import { ngViewerActionSetPerspOctantRemoval } from "src/services/state/ngViewerState/actions"; import { ngViewerSelectorOctantRemoval } from "src/services/state/ngViewerState/selectors"; import { viewerStateCustomLandmarkSelector, viewerStateSelectedTemplatePureSelector } from "src/services/state/viewerState/selectors"; @@ -10,6 +10,7 @@ import { NEHUBA_INSTANCE_INJTKN } from "src/viewerModule/nehuba/util"; import { ARIA_LABELS } from 'common/constants' import { actionSetAuxMeshes, selectorAuxMeshes } from "../../store"; import { FormBuilder, FormControl, FormGroup } from "@angular/forms"; +import {PureContantService} from "src/util"; @Component({ selector: 'viewer-ctrl-component', @@ -27,6 +28,8 @@ export class ViewerCtrlCmp{ @HostBinding('attr.darktheme') darktheme = false + private selectedTemplateId: string + private _flagDelin = true get flagDelin(){ return this._flagDelin @@ -71,6 +74,7 @@ export class ViewerCtrlCmp{ constructor( private store$: Store<any>, formBuilder: FormBuilder, + private pureConstantService: PureContantService, @Optional() @Inject(NEHUBA_INSTANCE_INJTKN) private nehubaInst$: Observable<NehubaViewerUnit>, ){ @@ -97,6 +101,7 @@ export class ViewerCtrlCmp{ this.store$.pipe( select(viewerStateSelectedTemplatePureSelector) ).subscribe(tmpl => { + this.selectedTemplateId = tmpl['@id'] const { useTheme } = tmpl || {} this.darktheme = useTheme === 'dark' }), @@ -156,7 +161,7 @@ export class ViewerCtrlCmp{ const visibleParcLayers = ((window as any).viewer.layerManager.managedLayers) .slice(1) .filter(({ visible }) => visible) - .filter(({initialSpecification}) => !initialSpecification.type || initialSpecification.type !== 'annotation') + .filter(l => Object.keys(this.pureConstantService.ngLayerObj[this.selectedTemplateId]).includes(l.name)) .filter(layer => !this.auxMeshesNamesSet.has(layer.name)) if (this.flagDelin) {