diff --git a/deploy/csp/index.js b/deploy/csp/index.js index 5f04bbcd2144b19ca15ba1acc765c4fba7afb45c..dd989a3d3f9883ce8aca6241e937add3dc5431c8 100644 --- a/deploy/csp/index.js +++ b/deploy/csp/index.js @@ -115,7 +115,7 @@ module.exports = { 'https://unpkg.com/d3@6.2.0/', // required for preview component 'https://unpkg.com/mathjax@3.1.2/', // math jax 'https://unpkg.com/three-surfer@0.0.13/dist/bundle.js', // for threeSurfer (freesurfer support in browser) - 'https://unpkg.com/ng-layer-tune@0.0.16/dist/ng-layer-tune/', // needed for ng layer control + 'https://unpkg.com/ng-layer-tune@0.0.18/dist/ng-layer-tune/', // needed for ng layer control 'https://unpkg.com/hbp-connectivity-component@0.6.6/', // needed for connectivity component (req, res) => res.locals.nonce ? `'nonce-${res.locals.nonce}'` : null, ...SCRIPT_SRC, diff --git a/docs/releases/v2.12.3.md b/docs/releases/v2.12.3.md new file mode 100644 index 0000000000000000000000000000000000000000..75da7002c5e96e121272ae3c172cbe3b20acb089 --- /dev/null +++ b/docs/releases/v2.12.3.md @@ -0,0 +1,8 @@ +# v2.12.3 + +## Bugfix + +- Visually distinguish regions that are mapped in a space to those that are not +- Remove experimental flag to VOI +- siibra-explorer now displays description and doi for more regions correctly (Julich Brain 3.0 in all MRI spaces and Julich Brain detailed maps in Big Brain spaces) +- Do not display connectivity in big brain space diff --git a/mkdocs.yml b/mkdocs.yml index 3b54fefc8324bbd99777bc67e61f5ec46d8865c2..46599c96864afde1458b6c31eb9e9329d18227fc 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -33,6 +33,7 @@ nav: - Fetching datasets: 'advanced/datasets.md' - Display non-atlas volumes: 'advanced/otherVolumes.md' - Release notes: + - v2.12.3: 'releases/v2.12.3.md' - v2.12.2: 'releases/v2.12.2.md' - v2.12.1: 'releases/v2.12.1.md' - v2.12.0: 'releases/v2.12.0.md' diff --git a/package.json b/package.json index 5746b8bb314805db1ef23fd255cbd2cfc2f07315..9a950eda81052fb46f1e8d2d6fad750132fd1b69 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "siibra-explorer", - "version": "2.12.2", + "version": "2.12.3", "description": "siibra-explorer - explore brain atlases. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular", "scripts": { "lint": "eslint src --ext .ts", diff --git a/src/atlasComponents/sapi/sapi.service.ts b/src/atlasComponents/sapi/sapi.service.ts index 50db1238456bd0f706188dfbd8651bdf489ae8ee..0b8323001c2201d06894f90e3d43e0c7412c0c85 100644 --- a/src/atlasComponents/sapi/sapi.service.ts +++ b/src/atlasComponents/sapi/sapi.service.ts @@ -22,7 +22,7 @@ export const useViewer = { } as const export const SIIBRA_API_VERSION_HEADER_KEY='x-siibra-api-version' -export const EXPECTED_SIIBRA_API_VERSION = '0.3.10' +export const EXPECTED_SIIBRA_API_VERSION = '0.3.11' let BS_ENDPOINT_CACHED_VALUE: Observable<string> = null @@ -461,7 +461,7 @@ export class SAPI{ ) } - private async getLabelledMap(parcellation: SxplrParcellation, template: SxplrTemplate) { + async getLabelledMap(parcellation: SxplrParcellation, template: SxplrTemplate) { // No need to retrieve sapi object, since we know @id maps to id return await this.v3Get("/map", { query: { diff --git a/src/atlasComponents/sapi/translateV3.ts b/src/atlasComponents/sapi/translateV3.ts index da87a784b79e7d07e4b6848bbba43de822dc2138..d7b7b75a21898e4149c5db349f717671f2570cb2 100644 --- a/src/atlasComponents/sapi/translateV3.ts +++ b/src/atlasComponents/sapi/translateV3.ts @@ -446,7 +446,7 @@ class TranslateV3 { this.#translatePoint(feat.boundingbox.center), this.#translatePoint(feat.boundingbox.maxpoint), this.#translatePoint(feat.boundingbox.minpoint), - await this.#extractNgPrecompUnfrag(feat.volume.providedVolumes), + this.#extractNgPrecompUnfrag(feat.volume.providedVolumes), ]) const { ['@id']: spaceId } = feat.boundingbox.space const getSpace = (id: string) => this.#sxplrTmplMap.get(id) diff --git a/src/atlasComponents/sapiViews/core/region/module.ts b/src/atlasComponents/sapiViews/core/region/module.ts index 6e9140d0b5968e384f4f08907246dd6b9a621a30..dc8a9711748846fec96dab6a738214d89e619b8a 100644 --- a/src/atlasComponents/sapiViews/core/region/module.ts +++ b/src/atlasComponents/sapiViews/core/region/module.ts @@ -10,6 +10,7 @@ import { SapiViewsUtilModule } from "../../util/module"; import { SapiViewsCoreRegionRegionListItem } from "./region/listItem/region.listItem.component"; import { SapiViewsCoreRegionRegionBase } from "./region/region.base.directive"; import { SapiViewsCoreRegionRegionRich } from "./region/rich/region.rich.component"; +import { MatTooltipModule } from "@angular/material/tooltip"; @NgModule({ imports: [ @@ -21,6 +22,7 @@ import { SapiViewsCoreRegionRegionRich } from "./region/rich/region.rich.compone StrictLocalModule, FeatureModule, ReadmoreModule, + MatTooltipModule, ], declarations: [ SapiViewsCoreRegionRegionListItem, diff --git a/src/atlasComponents/sapiViews/core/region/region/rich/region.rich.component.ts b/src/atlasComponents/sapiViews/core/region/region/rich/region.rich.component.ts index c61d33b9d2c25cd406383ed85cc437f6364748ca..d774b1e05f61c2ebe3a4f676d6464417626b4cdd 100644 --- a/src/atlasComponents/sapiViews/core/region/region/rich/region.rich.component.ts +++ b/src/atlasComponents/sapiViews/core/region/region/rich/region.rich.component.ts @@ -6,7 +6,7 @@ import { ARIA_LABELS, CONST } from 'common/constants' import { Feature } from "src/atlasComponents/sapi/sxplrTypes"; import { SAPI } from "src/atlasComponents/sapi/sapi.service"; import { environment } from "src/environments/environment"; -import { map, shareReplay, switchMap } from "rxjs/operators"; +import { catchError, map, shareReplay, switchMap } from "rxjs/operators"; import { PathReturn } from "src/atlasComponents/sapi/typeV3"; @Component({ @@ -41,7 +41,7 @@ export class SapiViewsCoreRegionRegionRich extends SapiViewsCoreRegionRegionBase activePanelTitles$: Observable<string[]> = new Subject() - private regionalStatisticalMaps$ = this.ATPR$.pipe( + private regionalMaps$ = this.ATPR$.pipe( switchMap(({ parcellation, template, region }) => concat( of([] as PathReturn<"/map">["volumes"]), @@ -49,14 +49,26 @@ export class SapiViewsCoreRegionRegionRich extends SapiViewsCoreRegionRegionBase map(v => { const mapIndices = v.indices[region.name] return mapIndices.map(mapIdx => v.volumes[mapIdx.volume]) + }), + catchError((_err, _obs) => { + /** + * if statistical map somehow fails to fetch (e.g. does not exist for this combination + * of parc tmpl), fallback to labelled map + */ + return this.sapi.getMap(parcellation.id, template.id, "LABELLED").pipe( + map(v => { + const mapIndices = v.indices[region.name] + return mapIndices.map(mapIdx => v.volumes[mapIdx.volume]) + }) + ) }) - ) + ), ) ), shareReplay(1) ) - public dois$ = this.regionalStatisticalMaps$.pipe( + public dois$ = this.regionalMaps$.pipe( map(sms => { const returnUrls: string[] = [] for (const sm of sms) { @@ -71,7 +83,7 @@ export class SapiViewsCoreRegionRegionRich extends SapiViewsCoreRegionRegionBase }) ) - public desc$ = this.regionalStatisticalMaps$.pipe( + public desc$ = this.regionalMaps$.pipe( map(sm => { for (const ds of (sm?.[0]?.datasets) || []) { if (ds.description) { diff --git a/src/atlasComponents/sapiViews/core/rich/regionsHierarchy/regionsHierarchy.component.ts b/src/atlasComponents/sapiViews/core/rich/regionsHierarchy/regionsHierarchy.component.ts index ac272bc82f976687831e70f358104f302bb52c8a..0c85164a964950a7dec142e1fb047ac1e1aa9106 100644 --- a/src/atlasComponents/sapiViews/core/rich/regionsHierarchy/regionsHierarchy.component.ts +++ b/src/atlasComponents/sapiViews/core/rich/regionsHierarchy/regionsHierarchy.component.ts @@ -20,6 +20,7 @@ const filterByRegexPipe = new FilterByRegexPipe() }) export class SapiViewsCoreRichRegionsHierarchy { + TXT_CANNOT_BE_SELECTED = "Not mapped in this template space." static IsParent(region: SxplrRegion, parentRegion: SxplrRegion): boolean { return region.parentIds.some(id => parentRegion.id === id) @@ -36,6 +37,9 @@ export class SapiViewsCoreRichRegionsHierarchy { ) } + @Input('sxplr-sapiviews-core-rich-regionshierarchy-label-mapped-region-names') + labelMappedRegionNames: string[] = [] + @Input('sxplr-sapiviews-core-rich-regionshierarchy-accent-regions') accentedRegions: SxplrRegion[] = [] @@ -100,10 +104,9 @@ export class SapiViewsCoreRichRegionsHierarchy { onNodeClick({node: roi, event }: {node: SxplrRegion, event: MouseEvent}){ /** - * only allow leave nodes to be selectable for now + * Only allow the regions that are labelled mapped to be selected. */ - const children = this._regions.filter(r => this.isParent(r, roi)) - if (children.length > 0) { + if (!this.labelMappedRegionNames.includes(roi.name)) { return } if (event.ctrlKey) { diff --git a/src/atlasComponents/sapiViews/core/rich/regionsHierarchy/regionsHierarchy.template.html b/src/atlasComponents/sapiViews/core/rich/regionsHierarchy/regionsHierarchy.template.html index 762ae45d856a8a5e53defdfbeea120c2437df898..fe58b7efcf598036e2fbae302f54720a9d0369d0 100644 --- a/src/atlasComponents/sapiViews/core/rich/regionsHierarchy/regionsHierarchy.template.html +++ b/src/atlasComponents/sapiViews/core/rich/regionsHierarchy/regionsHierarchy.template.html @@ -14,10 +14,12 @@ </mat-form-field> -<ng-template #tmplRef let-region> +<ng-template #tmplRef let-region let-last="last"> <div class="mat-body sxplr-d-flex sxplr-align-items-center sxplr-h-100 region-tmpl" + [matTooltip]="last && !labelMappedRegionNames.includes(region.name) ? TXT_CANNOT_BE_SELECTED : null" [ngClass]="{ - 'sxplr-custom-cmp accent': accentedRegions | includes : region + 'sxplr-custom-cmp accent': accentedRegions | includes : region, + 'muted-7': !labelMappedRegionNames.includes(region.name) }" [innerHTML]="region.name | hightlightPipe : searchTerm"> </div> diff --git a/src/atlasComponents/sapiViews/core/rich/regionsListSearch/regionListSearch.component.ts b/src/atlasComponents/sapiViews/core/rich/regionsListSearch/regionListSearch.component.ts index e55fb7e12f574713a7a9c8aab1de3c6cf62e7367..389486f779a8c750600664bfcdb27e8f4dcb31e2 100644 --- a/src/atlasComponents/sapiViews/core/rich/regionsListSearch/regionListSearch.component.ts +++ b/src/atlasComponents/sapiViews/core/rich/regionsListSearch/regionListSearch.component.ts @@ -5,6 +5,7 @@ import { UntypedFormControl } from "@angular/forms"; import { debounceTime, distinctUntilChanged, map, startWith } from "rxjs/operators"; import { MatAutocompleteSelectedEvent } from "@angular/material/autocomplete"; import { SapiViewsCoreRichRegionListTemplateDirective } from "./regionListSearchTmpl.directive"; +import { BehaviorSubject, combineLatest } from "rxjs"; const filterRegionViaSearch = (searchTerm: string) => (region:SxplrRegion) => { return region.name.toLocaleLowerCase().includes(searchTerm.toLocaleLowerCase()) @@ -25,13 +26,16 @@ export class SapiViewsCoreRichRegionListSearch { showNOptions = 4 - private _regions: SxplrRegion[] = [] - get regions(){ - return this._regions - } + #regions = new BehaviorSubject<SxplrRegion[]>([]) @Input('sxplr-sapiviews-core-rich-regionlistsearch-regions') set regions(reg: SxplrRegion[]) { - this._regions = reg.filter(r => !reg.some(c => c.parentIds.includes(r.id))) + this.#regions.next(reg) + } + + #mappedRegionNames = new BehaviorSubject<string[]>([]) + @Input('sxplr-sapiviews-core-rich-regionlistsearch-mapped-region-names') + set mappedRegions(regNames: string[]) { + this.#mappedRegionNames.next(regNames) } @ContentChild(SapiViewsCoreRichRegionListTemplateDirective) @@ -51,13 +55,18 @@ export class SapiViewsCoreRichRegionListSearch { public searchFormControl = new UntypedFormControl() - public searchedList$ = this.searchFormControl.valueChanges.pipe( - startWith(''), - distinctUntilChanged(), - debounceTime(160), - map((searchTerm: string | SxplrRegion) => { + public searchedList$ = combineLatest([ + this.searchFormControl.valueChanges.pipe( + startWith(''), + distinctUntilChanged(), + debounceTime(160), + ), + this.#regions, + this.#mappedRegionNames + ]).pipe( + map(([searchTerm, regions, mappedRegionNames]) => { if (typeof searchTerm === "string") { - return this.regions.filter(filterRegionViaSearch(searchTerm)) + return regions.filter(r => mappedRegionNames.includes(r.name)).filter(filterRegionViaSearch(searchTerm)) } return [] }) diff --git a/src/components/flatHierarchy/treeView/treeView.template.html b/src/components/flatHierarchy/treeView/treeView.template.html index 730cd04b0122a538195b971e9f8f90f39eed7e46..7ecb9798a4b6300275d18e0a8ee753062d8c67df 100644 --- a/src/components/flatHierarchy/treeView/treeView.template.html +++ b/src/components/flatHierarchy/treeView/treeView.template.html @@ -23,7 +23,8 @@ <ng-template [ngTemplateOutlet]="phTmpl" [ngTemplateOutletContext]="{ - $implicit: node + $implicit: node, + last: !node.expandable }"> </ng-template> @@ -51,7 +52,8 @@ <ng-template [ngTemplateOutlet]="renderNodeTmplRef" [ngTemplateOutletContext]="{ - $implicit: node.node + $implicit: node.node, + last: !node.expandable }"> </ng-template> </div> diff --git a/src/features/entry/entry.component.ts b/src/features/entry/entry.component.ts index e4cfbe75e126083681838c1fe815bca654737345..581b34e0009b0a27479a86ec302d74319a86513a 100644 --- a/src/features/entry/entry.component.ts +++ b/src/features/entry/entry.component.ts @@ -152,7 +152,7 @@ export class EntryComponent extends FeatureBase implements AfterViewInit, OnDest map(atlas => atlas?.species === SPECIES_ENUM.HOMO_SAPIENS || atlas?.species === SPECIES_ENUM.RATTUS_NORVEGICUS) ), this.TPRBbox$.pipe( - map(({ parcellation }) => parcellation?.id === IDS.PARCELLATION.JBA29 || parcellation?.id === IDS.PARCELLATION.WAXHOLMV4) + map(({ parcellation, template }) => template.id !== IDS.TEMPLATES.BIG_BRAIN && parcellation?.id === IDS.PARCELLATION.JBA29 || parcellation?.id === IDS.PARCELLATION.WAXHOLMV4) ) ]).pipe( map(flags => flags.every(f => f)) diff --git a/src/features/guards.ts b/src/features/guards.ts index fefbc7a0bbc14d1a5baf042ec6283de30d6516ed..eff1ea272787e87cee62e2fc5e10305880ea9452 100644 --- a/src/features/guards.ts +++ b/src/features/guards.ts @@ -8,11 +8,6 @@ export function isVoiData(feature: unknown): feature is VoiFeature { return !!feature['bbox'] } -export function notQuiteRight(feature: unknown): string[] { - if (feature['name'].includes("Cellular level 3D reconstructed volumes at 1µm resolution")) { - return [ - "This volume is currently not displayed correctly. We are working to restore the functionality." - ] - } +export function notQuiteRight(_feature: unknown): string[] { return [] } diff --git a/src/index.html b/src/index.html index b1c5716a7c0ffaa17c6da0b9c126f82f9b8532a2..8609160d1805457836393b85e4dcf055ad08df25 100644 --- a/src/index.html +++ b/src/index.html @@ -14,7 +14,7 @@ <script src="extra_js.js"></script> <script src="https://unpkg.com/kg-dataset-previewer@1.2.0/dist/kg-dataset-previewer/kg-dataset-previewer.js" defer></script> <script src="https://unpkg.com/three-surfer@0.0.13/dist/bundle.js" defer></script> - <script type="module" src="https://unpkg.com/ng-layer-tune@0.0.16/dist/ng-layer-tune/ng-layer-tune.esm.js"></script> + <script type="module" src="https://unpkg.com/ng-layer-tune@0.0.18/dist/ng-layer-tune/ng-layer-tune.esm.js"></script> <script type="module" src="https://unpkg.com/hbp-connectivity-component@0.6.6/dist/connectivity-component/connectivity-component.js" ></script> <script defer src="https://unpkg.com/mathjax@3.1.2/es5/tex-svg.js"></script> <script defer src="https://unpkg.com/d3@6.2.0/dist/d3.min.js"></script> diff --git a/src/viewerModule/viewerCmp/viewerCmp.component.ts b/src/viewerModule/viewerCmp/viewerCmp.component.ts index 75f18fd1e32b272b33b510222e3d11f9e71ffee6..8a5ed8f0aa91d858e4b617f81b7923658eebfdca 100644 --- a/src/viewerModule/viewerCmp/viewerCmp.component.ts +++ b/src/viewerModule/viewerCmp/viewerCmp.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, TemplateRef, ViewChild } from "@angular/core"; import { select, Store } from "@ngrx/store"; -import { combineLatest, Observable, Subscription } from "rxjs"; -import { debounceTime, map, shareReplay } from "rxjs/operators"; +import { combineLatest, Observable, of, Subscription } from "rxjs"; +import { debounceTime, map, shareReplay, switchMap } from "rxjs/operators"; import { CONST, ARIA_LABELS, QUICKTOUR_DESC } from 'common/constants' import { animate, state, style, transition, trigger } from "@angular/animations"; import { IQuickTourData } from "src/ui/quickTour"; @@ -139,15 +139,41 @@ export class ViewerCmp implements OnDestroy { select(atlasSelection.selectors.relevantSelectedPoint) ) - public view$ = combineLatest([ + #currentMap$ = combineLatest([ + this.#templateSelected$, + this.#parcellationSelected$ + ]).pipe( + switchMap(([tmpl, parc]) => tmpl && parc ? this.sapi.getLabelledMap(parc, tmpl) : of(null)) + ) + + + #view0$ = combineLatest([ this.#selectedRegions$, this.#viewerMode$, this.#selectedFeature$, this.#selectedPoint$, this.#templateSelected$, - this.#parcellationSelected$ + this.#parcellationSelected$, ]).pipe( - map(([ selectedRegions, viewerMode, selectedFeature, selectedPoint, selectedTemplate, selectedParcellation ]) => { + map(([ selectedRegions, viewerMode, selectedFeature, selectedPoint, selectedTemplate, selectedParcellation ]) => ({ + selectedRegions, viewerMode, selectedFeature, selectedPoint, selectedTemplate, selectedParcellation + })) + ) + + #view1$ = combineLatest([ + this.#currentMap$, + ]).pipe( + map(( [ currentMap ] ) => ({ + currentMap + })) + ) + + public view$ = combineLatest([ + this.#view0$, + this.#view1$, + ]).pipe( + map(([v0, v1]) => ({ ...v0, ...v1 })), + map(({ selectedRegions, viewerMode, selectedFeature, selectedPoint, selectedTemplate, selectedParcellation, currentMap }) => { let spatialObjectTitle: string let spatialObjectSubtitle: string if (selectedPoint) { @@ -162,6 +188,8 @@ export class ViewerCmp implements OnDestroy { if (!!selectedTemplate) { spatialObjectSubtitle = selectedTemplate.name } + + const labelMappedRegionNames = currentMap && Object.keys(currentMap.indices) || [] return { viewerMode, selectedRegions, @@ -169,6 +197,7 @@ export class ViewerCmp implements OnDestroy { selectedPoint, selectedTemplate, selectedParcellation, + labelMappedRegionNames, /** * Selected Spatial Object diff --git a/src/viewerModule/viewerCmp/viewerCmp.template.html b/src/viewerModule/viewerCmp/viewerCmp.template.html index 459fb19e841d22944af9cf5a8bca36512bcb6d0c..a96f025879febe5d5eb588927ad3052b0a8b16fc 100644 --- a/src/viewerModule/viewerCmp/viewerCmp.template.html +++ b/src/viewerModule/viewerCmp/viewerCmp.template.html @@ -540,6 +540,7 @@ <sxplr-sapiviews-core-rich-regionshierarchy class="sxplr-w-100 sxplr-flex-var" [sxplr-sapiviews-core-rich-regionshierarchy-regions]="allAvailableRegions$ | async" + [sxplr-sapiviews-core-rich-regionshierarchy-label-mapped-region-names]="view.labelMappedRegionNames" [sxplr-sapiviews-core-rich-regionshierarchy-accent-regions]="view.selectedRegions" (sxplr-sapiviews-core-rich-regionshierarchy-region-select)="selectRoi($event)" (sxplr-sapiviews-core-rich-regionshierarchy-region-toggle)="toggleRoi($event)" @@ -561,6 +562,7 @@ <sxplr-sapiviews-core-rich-regionlistsearch [sxplr-sapiviews-core-rich-regionlistsearch-regions]="allAvailableRegions$ | async" + [sxplr-sapiviews-core-rich-regionlistsearch-mapped-region-names]="view.labelMappedRegionNames" [sxplr-sapiviews-core-rich-regionlistsearch-current-search]="view.selectedRegions.length === 1 ? view.selectedRegions[0].name : null" (sxplr-sapiviews-core-rich-regionlistsearch-region-select)="selectRoi($event)" (sxplr-sapiviews-core-rich-regionlistsearch-region-toggle)="toggleRoi($event)">