Skip to content
Snippets Groups Projects
Unverified Commit 8c7e2ae7 authored by Xiao Gui's avatar Xiao Gui
Browse files

fix: region selectable

fix: remove exmpt lbl on voi
parent c2a9fd93
No related branches found
No related tags found
No related merge requests found
# v2.12.3
## Bugfix
- Visually distinguish regions that are mapped in a space to those that are not
- Remove experimental flag to VOI
......@@ -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'
......
{
"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",
......
......@@ -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: {
......
......@@ -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,
......
......@@ -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) {
......
......@@ -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>
......
......@@ -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>
......
......@@ -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 []
}
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
......
......@@ -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)"
......
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