diff --git a/docs/releases/v2.11.1.md b/docs/releases/v2.11.1.md index 7c187df69ab20e2bf1aeb6b1606076fc9cfe7367..3c4b52dceda310dbf1790cef6ff3b245e5875ffa 100644 --- a/docs/releases/v2.11.1.md +++ b/docs/releases/v2.11.1.md @@ -5,10 +5,12 @@ - Allow point assignment result to be sorted - Allow point assignment result to be downloaded as csv - Informs user when atlas download should be occurring, and check popup blocker +- Restores Julich Brain 2.9 in Colin 27 space full mesh view ## Bugfixes - Fixed point assignment full table not showing +- On template/parcellation/atlas change, clear currently selected feature ## Behind the scenes diff --git a/src/atlasComponents/sapi/sapi.service.ts b/src/atlasComponents/sapi/sapi.service.ts index 06c6808eaf4a88a75884fff18fae7d2827deebeb..7959d63fbd7715d7be672d626e02ffaa77d68100 100644 --- a/src/atlasComponents/sapi/sapi.service.ts +++ b/src/atlasComponents/sapi/sapi.service.ts @@ -515,11 +515,11 @@ export class SAPI{ const map = await this.getLabelledMap(parcellation, template) for (const regionname in map.indices) { - if (parcellation.id === IDS.PARCELLATION.CORTICAL_LAYERS) { - if (regionname.includes("left") || regionname.includes("right")) { - continue - } - } + // if (parcellation.id === IDS.PARCELLATION.CORTICAL_LAYERS) { + // if (regionname.includes("left") || regionname.includes("right")) { + // continue + // } + // } for (const { volume: volumeIdx, fragment, label } of map.indices[regionname]) { const { providedVolumes } = map.volumes[volumeIdx] if (!("neuroglancer/precomputed" in providedVolumes)) { diff --git a/src/atlasComponents/sapi/translateV3.ts b/src/atlasComponents/sapi/translateV3.ts index 79775ba84f4ca64aa8a03169373ed1049a487c92..e92c14d9fe61a46e14b7bb4be99a1541c8e39ec8 100644 --- a/src/atlasComponents/sapi/translateV3.ts +++ b/src/atlasComponents/sapi/translateV3.ts @@ -287,17 +287,7 @@ class TranslateV3 { segLayerSpec.layer.labelIndicies.push(label) segLayerSpec.region.push(region) } - const { ['@id']: mapId } = map for (const regionname in map.indices) { - /** - * temporary fix - * see https://github.com/FZJ-INM1-BDA/siibra-python/issues/317 - */ - if (mapId === "siibra-map-v0.0.1_bigbrain-cortical-labelled") { - if (regionname.includes("left") || regionname.includes("right")) { - continue - } - } for (const index of map.indices[regionname]) { const { volume:volumeIdx=0, fragment, label } = index if (!label) { diff --git a/src/state/atlasSelection/util.ts b/src/state/atlasSelection/util.ts index a76fd1f9f2e8fc45335a5b3695c65bb68322dfef..525df7f1fdc00f7528bdfbbc210a547db3b738ac 100644 --- a/src/state/atlasSelection/util.ts +++ b/src/state/atlasSelection/util.ts @@ -1,8 +1,6 @@ import { createSelector, select } from "@ngrx/store"; -import { forkJoin, of, pipe } from "rxjs"; -import { distinctUntilChanged, map, switchMap } from "rxjs/operators"; -import { SAPI } from "src/atlasComponents/sapi"; -import { translateV3Entities } from "src/atlasComponents/sapi/translateV3" +import { pipe } from "rxjs"; +import { distinctUntilChanged, map } from "rxjs/operators"; import { SxplrAtlas, SxplrParcellation, SxplrTemplate } from "src/atlasComponents/sapi/sxplrTypes"; import { jsonEqual } from "src/util/json"; import * as selectors from "./selectors" diff --git a/src/state/index.ts b/src/state/index.ts index 40e84c234c4bca8d7eb7fece2c2c999ab249629f..12adc4b974fb893cef495e9310a5b990966478d4 100644 --- a/src/state/index.ts +++ b/src/state/index.ts @@ -71,6 +71,7 @@ export function getStoreEffects() { plugins.Effects, atlasSelection.Effect, userInterface.Effects, + userInteraction.Effect, ] } diff --git a/src/state/userInteraction/effects.ts b/src/state/userInteraction/effects.ts index 5d4986ad5965117705e6d1aa869407fabdbd8a65..7fd81d8ae1252522deba3c4f589eda32d61513e7 100644 --- a/src/state/userInteraction/effects.ts +++ b/src/state/userInteraction/effects.ts @@ -1,17 +1,33 @@ import { Injectable } from "@angular/core"; import { Actions, createEffect, ofType } from "@ngrx/effects"; -import * as atlasSelectionActions from "../atlasSelection/actions" import * as userInterface from "../userInterface" -import { mapTo } from "rxjs/operators"; +import * as atlasSelection from "../atlasSelection" +import * as actions from "./actions" +import { filter, map, mapTo, skip } from "rxjs/operators"; +import { Store } from "@ngrx/store"; @Injectable() export class Effect { onStandAloneVolumesExistCloseMatDrawer = createEffect(() => this.action.pipe( - ofType(atlasSelectionActions.clearStandAloneVolumes), + ofType(atlasSelection.actions.clearStandAloneVolumes), mapTo(userInterface.actions.closeSidePanel()) )) - constructor(private action: Actions){ + #distinctATP$ = this.store.pipe( + atlasSelection.fromRootStore.distinctATP(), + ) + + onATPUpdateUnselectFeature = createEffect(() => this.#distinctATP$.pipe( + filter(v => !!v.atlas && !!v.parcellation && !!v.template), + /** + * First non empty emit would be from selecting atlas. + * So ignore it. + */ + skip(1), + map(() => actions.clearShownFeature()) + )) + + constructor(private action: Actions, private store: Store){ } -} \ No newline at end of file +} diff --git a/src/viewerModule/nehuba/layerCtrl.service/layerCtrl.service.ts b/src/viewerModule/nehuba/layerCtrl.service/layerCtrl.service.ts index f68170be4a59e2610000d997b852084512529dc4..5f1e17c0fbf181b76652db731c1e6fa2dac1ad5f 100644 --- a/src/viewerModule/nehuba/layerCtrl.service/layerCtrl.service.ts +++ b/src/viewerModule/nehuba/layerCtrl.service/layerCtrl.service.ts @@ -46,8 +46,9 @@ export class NehubaLayerControlService implements OnDestroy{ combineLatest([ this.completeNgIdLabelRegionMap$, this.customLayers$, + this.selectedRegion$, ]).pipe( - map(([record, layers]) => { + map(([record, layers, selectedRegions]) => { const returnVal: IColorMap = {} const cmCustomLayers = layers.filter(l => l.clType === "customlayer/colormap") as atlasAppearance.const.ColorMapCustomLayer[] @@ -72,11 +73,15 @@ export class NehubaLayerControlService implements OnDestroy{ get: (r: SxplrRegion) => r.color } })() + + const selectedRegionNameSet = new Set(selectedRegions.map(v => v.name)) for (const [ngId, labelRecord] of Object.entries(record)) { for (const [label, region] of Object.entries(labelRecord)) { if (!region.color) continue - const [ red, green, blue ] = useCm.get(region) || [200, 200, 200] + const [ red, green, blue ] = selectedRegionNameSet.size === 0 || selectedRegionNameSet.has(region.name) + ? useCm.get(region) || [200, 200, 200] + : [255, 255, 255] if (!returnVal[ngId]) { returnVal[ngId] = {} } diff --git a/src/viewerModule/nehuba/mesh.service/mesh.service.spec.ts b/src/viewerModule/nehuba/mesh.service/mesh.service.spec.ts index 051d366a882a44f75f782e10fe58ccd25314869e..7db5392a46b74554df8c9e2db2ab8d5e221ab44b 100644 --- a/src/viewerModule/nehuba/mesh.service/mesh.service.spec.ts +++ b/src/viewerModule/nehuba/mesh.service/mesh.service.spec.ts @@ -196,6 +196,8 @@ describe('> mesh.service.ts', () => { beforeEach(() => { const mockStore = TestBed.inject(MockStore) mockStore.overrideSelector(atlasSelection.selectors.selectedRegions, []) + mockStore.overrideSelector(atlasSelection.selectors.selectedTemplate, {} as any) + mockStore.overrideSelector(atlasSelection.selectors.selectedParcellation, {} as any) }) it("> load all meshes", () => { @@ -226,6 +228,8 @@ describe('> mesh.service.ts', () => { beforeEach(() => { const mockStore = TestBed.inject(MockStore) mockStore.overrideSelector(atlasSelection.selectors.selectedRegions, [fits1]) + mockStore.overrideSelector(atlasSelection.selectors.selectedTemplate, {} as any) + mockStore.overrideSelector(atlasSelection.selectors.selectedParcellation, {} as any) }) it("> load only selected mesh", () => { diff --git a/src/viewerModule/nehuba/mesh.service/mesh.service.ts b/src/viewerModule/nehuba/mesh.service/mesh.service.ts index 29a40e94c6882b6022033b2d55103627d3d9b8cf..d46e128f4a84d082272101b67a215bf75d5165c3 100644 --- a/src/viewerModule/nehuba/mesh.service/mesh.service.ts +++ b/src/viewerModule/nehuba/mesh.service/mesh.service.ts @@ -7,6 +7,7 @@ import { selectorAuxMeshes } from "../store"; import { LayerCtrlEffects } from "../layerCtrl.service/layerCtrl.effects"; import { atlasSelection } from "src/state"; import { BaseService } from "../base.service/base.service"; +import { IDS } from "src/atlasComponents/sapi" /** * control mesh loading etc @@ -126,8 +127,21 @@ export class NehubaMeshService implements OnDestroy { this.#allSegmentMeshes$, this.#selectedSegmentMeshes$, this.#auxMesh$, + this.store$.pipe( + select(atlasSelection.selectors.selectedTemplate) + ), + this.store$.pipe( + select(atlasSelection.selectors.selectedParcellation) + ) ]).pipe( - switchMap(([ allSegMesh, selectedSegMesh, auxmesh ]) => { + switchMap(([ allSegMesh, selectedSegMesh, auxmesh, selectedTemplate, selectedParcellation ]) => { + /** + * TODO monkey patching jba29 in colin to show all meshes + * + */ + if (selectedParcellation.id === IDS.PARCELLATION.JBA29 && selectedTemplate.id === IDS.TEMPLATES.COLIN27) { + return of(...allSegMesh) + } const hasSegSelected = selectedSegMesh.some(v => v.labelIndicies.length !== 0) const hasAuxMesh = auxmesh.length > 0 const meshesToLoad: IMeshesToLoad[] = []