diff --git a/src/assets/images/atlas-selection/allen-mouse-2015.png b/src/assets/images/atlas-selection/allen-mouse-2015.png deleted file mode 100644 index 36b493023e63d3b33c2527191165174713ff7701..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/allen-mouse-2015.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/allen-mouse-2017.png b/src/assets/images/atlas-selection/allen-mouse-2017.png deleted file mode 100644 index 4a8b4cad740bf6e0a5b7ee3f27661fe4941f13e3..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/allen-mouse-2017.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/allen-mouse.png b/src/assets/images/atlas-selection/allen-mouse.png deleted file mode 100644 index 1d38cfce2b17f7f973d1fab5469dfba4f1b63537..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/allen-mouse.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/bigbrain.png b/src/assets/images/atlas-selection/bigbrain.png deleted file mode 100644 index 416dbc79b489db22ed82868237e5a68c40ecf23a..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/bigbrain.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/colin27.png b/src/assets/images/atlas-selection/colin27.png deleted file mode 100644 index d49773ece71854f93d8dcaed9ca3a710e11decb0..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/colin27.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/cortical-layers.png b/src/assets/images/atlas-selection/cortical-layers.png deleted file mode 100644 index 38a9e902a8691dbb3e2d9732e42a12cda8cae2a2..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/cortical-layers.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/cytoarchitectonic-maps.png b/src/assets/images/atlas-selection/cytoarchitectonic-maps.png deleted file mode 100644 index c9645ea83f8299e1ce64e185df17d75de1032da5..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/cytoarchitectonic-maps.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/difumo-1024.png b/src/assets/images/atlas-selection/difumo-1024.png deleted file mode 100644 index 7ab4bf4ac91ac9be0eb6c96af1c45ab17cc9bddd..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/difumo-1024.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/difumo-128.png b/src/assets/images/atlas-selection/difumo-128.png deleted file mode 100644 index 47de2e12571b69f192f9117f41b45e1200c7f7e2..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/difumo-128.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/difumo-256.png b/src/assets/images/atlas-selection/difumo-256.png deleted file mode 100644 index 08e508a6faa65bcbbc9799ff37025915992b4199..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/difumo-256.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/difumo-512.png b/src/assets/images/atlas-selection/difumo-512.png deleted file mode 100644 index b1c064664a6836b2d41c60a4407def4bfbc2e4dc..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/difumo-512.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/difumo-64.png b/src/assets/images/atlas-selection/difumo-64.png deleted file mode 100644 index bf14836310113c9cb2688cb5f298a2aa87c010e3..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/difumo-64.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/fibre-long.png b/src/assets/images/atlas-selection/fibre-long.png deleted file mode 100644 index 040d96a8dc7c575e1076072e800fedf08a413cb1..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/fibre-long.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/fibre-short.png b/src/assets/images/atlas-selection/fibre-short.png deleted file mode 100644 index 2c52194bc5fa263114e6d4be9a2e6422ff5fa79e..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/fibre-short.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/freesurfer.png b/src/assets/images/atlas-selection/freesurfer.png deleted file mode 100644 index c4b2819bc44292bb5fde7a86241846b33a5c50b2..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/freesurfer.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/grey-white-matter.png b/src/assets/images/atlas-selection/grey-white-matter.png deleted file mode 100644 index 352a7de6500d4d82a2952f911815726d7bae474b..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/grey-white-matter.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/icbm2009c.png b/src/assets/images/atlas-selection/icbm2009c.png deleted file mode 100644 index 1dfc2c47e84d60c7a5b4d69eba182cf003f1bf62..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/icbm2009c.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/primate-parc.png b/src/assets/images/atlas-selection/primate-parc.png deleted file mode 100644 index 0bc2641af423732f7abe60d5914bc4ab63e09ed7..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/primate-parc.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/primate.png b/src/assets/images/atlas-selection/primate.png deleted file mode 100644 index 2f5458b28a49fde61dbcc97c04df3d0da8f219f4..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/primate.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/short-bundle-hcp.png b/src/assets/images/atlas-selection/short-bundle-hcp.png deleted file mode 100644 index 0204752305a93284af053ff9210266e30f288001..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/short-bundle-hcp.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/waxholm-v1.png b/src/assets/images/atlas-selection/waxholm-v1.png deleted file mode 100644 index 0e24e005e975938cbe6f3f4c658b6a306d9cce8e..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/waxholm-v1.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/waxholm-v2.png b/src/assets/images/atlas-selection/waxholm-v2.png deleted file mode 100644 index e18fe6d5876c02b5ab34297c048219d6f622f0f8..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/waxholm-v2.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/waxholm-v3.png b/src/assets/images/atlas-selection/waxholm-v3.png deleted file mode 100644 index 1b072a165fded37525ab849afe69ea61c3503f3b..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/waxholm-v3.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/waxholm-v4.png b/src/assets/images/atlas-selection/waxholm-v4.png deleted file mode 100644 index d0af0a5be2b2cf40fd814dce032fbd0801da30a8..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/waxholm-v4.png and /dev/null differ diff --git a/src/assets/images/atlas-selection/waxholm.png b/src/assets/images/atlas-selection/waxholm.png deleted file mode 100644 index fea10fee5272e99bc6cfd969a42307c38fa8b6d7..0000000000000000000000000000000000000000 Binary files a/src/assets/images/atlas-selection/waxholm.png and /dev/null differ diff --git a/src/atlasComponents/sapiViews/core/atlas/dropdownAtlasSelector/dropdownAtlasSelector.component.ts b/src/atlasComponents/sapiViews/core/atlas/dropdownAtlasSelector/dropdownAtlasSelector.component.ts deleted file mode 100644 index 815a4d45ed29cad974c1465e8a8cca5a0af6bcee..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/atlas/dropdownAtlasSelector/dropdownAtlasSelector.component.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { Component, OnDestroy } from "@angular/core"; -import { Store, select } from "@ngrx/store"; -import { Observable, Subscription } from "rxjs"; -import { ARIA_LABELS } from 'common/constants' -import { atlasSelection, generalActions } from "src/state" -import { SAPI, SapiAtlasModel } from "src/atlasComponents/sapi"; - -@Component({ - selector: 'sxplr-sapiviews-core-atlas-dropdown-selector', - templateUrl: './dropdownAtlasSelector.template.html', - styleUrls: [ - './dropdownAtlasSelector.style.css' - ] -}) - -export class SapiViewsCoreAtlasAtlasDropdownSelector implements OnDestroy{ - - private subs: Subscription[] = [] - private fetchedAtlases: SapiAtlasModel[] = [] - public fetchedAtlases$: Observable<SapiAtlasModel[]> = this.sapi.atlases$ - public selectedAtlas$: Observable<SapiAtlasModel> = this.store$.pipe( - select(atlasSelection.selectors.selectedAtlas) - ) - - public SELECT_ATLAS_ARIA_LABEL = ARIA_LABELS.SELECT_ATLAS - - constructor( - private store$: Store<any>, - private sapi: SAPI, - ){ - this.subs.push( - this.fetchedAtlases$.subscribe(val => this.fetchedAtlases = val) - ) - } - - ngOnDestroy(): void { - this.subs.pop().unsubscribe() - } - - handleChangeAtlas({ value }) { - const found = this.fetchedAtlases.find(atlas => atlas["@id"] === value) - if (found) { - this.store$.dispatch( - atlasSelection.actions.selectAtlas({ - atlas: found - }) - ) - } else { - this.store$.dispatch( - generalActions.generalActionError({ - message: `Atlas with id ${value} not found.` - }) - ) - } - } -} diff --git a/src/atlasComponents/sapiViews/core/atlas/dropdownAtlasSelector/dropdownAtlasSelector.stories.ts b/src/atlasComponents/sapiViews/core/atlas/dropdownAtlasSelector/dropdownAtlasSelector.stories.ts deleted file mode 100644 index 027fa024eb8bf497fa6600558b59098bab837d54..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/atlas/dropdownAtlasSelector/dropdownAtlasSelector.stories.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { CommonModule } from "@angular/common" -import { HttpClientModule } from "@angular/common/http" -import { Meta, moduleMetadata, Story } from "@storybook/angular" -import { SAPI } from "src/atlasComponents/sapi" -import { provideDarkTheme } from "src/atlasComponents/sapi/stories.base" -import { SapiViewsCoreAtlasAtlasDropdownSelector } from "./dropdownAtlasSelector.component" -import { SapiViewsCoreAtlasModule } from "../module" -import { atlasSelection } from "src/state" -import { StoreModule } from "@ngrx/store" - -export default { - component: SapiViewsCoreAtlasAtlasDropdownSelector, - decorators: [ - moduleMetadata({ - imports: [ - CommonModule, - HttpClientModule, - SapiViewsCoreAtlasModule, - - StoreModule.forRoot({ - [atlasSelection.nameSpace]: atlasSelection.reducer - }), - ], - providers: [ - SAPI, - ...provideDarkTheme, - ], - declarations: [] - }) - ], -} as Meta - -const Template: Story<SapiViewsCoreAtlasAtlasDropdownSelector> = (args: SapiViewsCoreAtlasAtlasDropdownSelector, { parameters }) => { - /** - * TODO can't seem to hook in handlechangeAtlas action - * always results in maximum call stack reached - * perhaps related: https://github.com/storybookjs/storybook/issues/13238 - */ - return ({ - props: { - }, - }) -} - - -export const Default = Template.bind({}) -Default.args = { - -} \ No newline at end of file diff --git a/src/atlasComponents/sapiViews/core/atlas/dropdownAtlasSelector/dropdownAtlasSelector.style.css b/src/atlasComponents/sapiViews/core/atlas/dropdownAtlasSelector/dropdownAtlasSelector.style.css deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/atlasComponents/sapiViews/core/atlas/dropdownAtlasSelector/dropdownAtlasSelector.template.html b/src/atlasComponents/sapiViews/core/atlas/dropdownAtlasSelector/dropdownAtlasSelector.template.html deleted file mode 100644 index f3922fea6c44412fc83137f6c3ed71db7efd26e7..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/atlas/dropdownAtlasSelector/dropdownAtlasSelector.template.html +++ /dev/null @@ -1,15 +0,0 @@ -<mat-form-field> - <mat-label> - {{ SELECT_ATLAS_ARIA_LABEL }} - </mat-label> - <mat-select - [aria-label]="SELECT_ATLAS_ARIA_LABEL" - [value]="(selectedAtlas$ | async)?.['@id']" - (selectionChange)="handleChangeAtlas($event)"> - <mat-option - *ngFor="let atlas of (fetchedAtlases$ | async)" - [value]="atlas['@id']"> - {{ atlas.name }} - </mat-option> - </mat-select> -</mat-form-field> diff --git a/src/atlasComponents/sapiViews/core/atlas/module.ts b/src/atlasComponents/sapiViews/core/atlas/module.ts index 52055dc938e718d432b1fa6370c657382c90ddda..174ba5d3945d86de16c184062fadbdebc038782a 100644 --- a/src/atlasComponents/sapiViews/core/atlas/module.ts +++ b/src/atlasComponents/sapiViews/core/atlas/module.ts @@ -1,43 +1,24 @@ import { CommonModule } from "@angular/common"; import { NgModule } from "@angular/core"; import { SpinnerModule } from "src/components/spinner"; -import { AngularMaterialModule } from "src/sharedModules"; -import { QuickTourModule } from "src/ui/quickTour"; -import { SapiViewsUtilModule } from "../../util"; -import { SapiViewsCoreParcellationModule } from "../parcellation"; -import { SapiViewsCoreSpaceModule } from "../space"; -import { SapiViewsCoreAtlasAtlasDropdownSelector } from "./dropdownAtlasSelector/dropdownAtlasSelector.component"; import { SapiViewsCoreAtlasSplashScreen } from "./splashScreen/splashScreen.component"; -import { SapiViewsCoreAtlasAtlasTmplParcSelector } from "./tmplParcSelector/tmplParcSelector.component"; -import {DialogModule} from "src/ui/dialogInfo/module"; -import { - SapiViewCoreAtlasSmartChip -} from "src/atlasComponents/sapiViews/core/atlas/smartChip/atlas.smartChip.components"; -import {UtilModule} from "src/util"; +import { MatCardModule } from "@angular/material/card"; +import { SAPIModule } from "src/atlasComponents/sapi/module"; +import { MatRippleModule } from "@angular/material/core"; @NgModule({ imports: [ CommonModule, - AngularMaterialModule, - SapiViewsCoreSpaceModule, - SapiViewsCoreParcellationModule, - QuickTourModule, + MatCardModule, + MatRippleModule, SpinnerModule, - SapiViewsUtilModule, - DialogModule, - UtilModule + SAPIModule, ], declarations: [ - SapiViewsCoreAtlasAtlasDropdownSelector, - SapiViewsCoreAtlasAtlasTmplParcSelector, SapiViewsCoreAtlasSplashScreen, - SapiViewCoreAtlasSmartChip, ], exports: [ - SapiViewsCoreAtlasAtlasDropdownSelector, - SapiViewsCoreAtlasAtlasTmplParcSelector, SapiViewsCoreAtlasSplashScreen, - SapiViewCoreAtlasSmartChip, ] }) diff --git a/src/atlasComponents/sapiViews/core/atlas/smartChip/atlas.smartChip.components.ts b/src/atlasComponents/sapiViews/core/atlas/smartChip/atlas.smartChip.components.ts deleted file mode 100644 index 55bc9a10d87165d8a51fb6fd67a4bee31a109ae6..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/atlas/smartChip/atlas.smartChip.components.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {Component, EventEmitter, Input, Output} from "@angular/core"; -import {SapiAtlasModel} from "src/atlasComponents/sapi"; - -@Component({ - selector: 'sxplr-sapiviews-core-atlas-smartchip', - templateUrl: './atlas.smartChip.template.html', - styleUrls: ['./atlas.smartChip.style.css'] -}) - -export class SapiViewCoreAtlasSmartChip { - - @Input('sxplr-sapiviews-core-atlas-smartchip-atlas') - atlas: SapiAtlasModel - - @Input('sxplr-sapiviews-core-atlas-smartchip-all-atlases') - atlases: SapiAtlasModel[] - - @Input('sxplr-sapiviews-core-atlas-smartchip-custom-color') - customColor: string - - @Output('sxplr-sapiviews-core-atlas-smartchip-select-atlas') - onSelectAtlas = new EventEmitter<SapiAtlasModel>() - - // constructor() {} - - - selectAtlas(atlas: SapiAtlasModel){ - if (this.trackByFn(atlas) === this.trackByFn(this.atlas)) return - this.onSelectAtlas.emit(atlas) - } - - trackByFn(atlas: SapiAtlasModel){ - return atlas["@id"] - } - -} diff --git a/src/atlasComponents/sapiViews/core/atlas/smartChip/atlas.smartChip.stories.ts b/src/atlasComponents/sapiViews/core/atlas/smartChip/atlas.smartChip.stories.ts deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/atlasComponents/sapiViews/core/atlas/smartChip/atlas.smartChip.style.css b/src/atlasComponents/sapiViews/core/atlas/smartChip/atlas.smartChip.style.css deleted file mode 100644 index 514406d3214b63840f5450f87da4d8abf149c6e5..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/atlas/smartChip/atlas.smartChip.style.css +++ /dev/null @@ -1,34 +0,0 @@ -.otherversion-wrapper -{ - position: relative; - overflow: hidden; - margin: 0.5rem; -} - -.otherversion-wrapper.loading > .spinner-container -{ - position: absolute; - left: 0; - top: 0; - width: 100%; - height: 100%; - - display: flex; - align-items: center; -} - -.otherversion-wrapper.loading > .spinner-container > spinner-cmp -{ - margin: 0.5rem; -} - -.icons-container -{ - /*transform: scale(0.7);*/ - margin-right: -1.5rem; -} - -.icons-container > * -{ - margin: auto 0.2rem; -} diff --git a/src/atlasComponents/sapiViews/core/atlas/smartChip/atlas.smartChip.template.html b/src/atlasComponents/sapiViews/core/atlas/smartChip/atlas.smartChip.template.html deleted file mode 100644 index 71f475622f6ed2ab9ae6e3017bf4435c670abcc9..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/atlas/smartChip/atlas.smartChip.template.html +++ /dev/null @@ -1,23 +0,0 @@ -<div (iav-outsideClick)="atlasMenuTrigger.closeMenu()"> - <div [style.background-color]="customColor && customColor" - [matMenuTriggerFor]="atlasMenu" - #atlasMenuTrigger="matMenuTrigger" - matRipple - class="custom-chip"> - <span class="mat-body sxplr-white-space-nowrap"> - {{ atlas.name }} - </span> - </div> - - <mat-menu #atlasMenu="matMenu" - [hasBackdrop]="false" - class="parc-smart-chip-menu-panel sxplr-of-x-hidden sxplr-box-shadow-none sxplr-mxw-80vw"> - - <div *ngFor="let atl of atlases"> - <button mat-menu-item - (click)="selectAtlas(atl)" - [style.background-color]="(atl | equality : atlas : trackByFn) ? 'grey' : ''"> - {{atl.name}}</button> - </div> - </mat-menu> -</div> \ No newline at end of file diff --git a/src/atlasComponents/sapiViews/core/atlas/tmplParcSelector/tmplParcSelector.component.ts b/src/atlasComponents/sapiViews/core/atlas/tmplParcSelector/tmplParcSelector.component.ts deleted file mode 100644 index 58a2151732937cd390d516ace5a2bfab2de87f7b..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/atlas/tmplParcSelector/tmplParcSelector.component.ts +++ /dev/null @@ -1,217 +0,0 @@ -import { animate, state, style, transition, trigger } from "@angular/animations"; -import { ChangeDetectionStrategy, Component, ElementRef, HostBinding, QueryList, ViewChild, ViewChildren } from "@angular/core"; -import { select, Store } from "@ngrx/store"; -import { combineLatest, forkJoin, merge, Observable, Subject, Subscription } from "rxjs"; -import { distinctUntilChanged, map, mapTo, shareReplay, switchMap, take } from "rxjs/operators"; -import { SAPI } from "src/atlasComponents/sapi"; -import { atlasSelection } from "src/state"; -import { fromRootStore } from "src/state/atlasSelection"; -import { IQuickTourData } from "src/ui/quickTour"; -import { ARIA_LABELS, CONST, QUICKTOUR_DESC } from 'common/constants' -import { MatMenuTrigger } from "@angular/material/menu"; -import { SapiParcellationModel, SapiSpaceModel } from "src/atlasComponents/sapi/type"; -import { InterSpaceCoordXformSvc } from "src/atlasComponents/sapi/core/space/interSpaceCoordXform.service" - -@Component({ - selector: `sxplr-sapiviews-core-atlas-tmplparcselector`, - templateUrl: './tmplParcSelector.template.html', - styleUrls: [ - `./tmplParcSelector.style.css` - ], - exportAs: 'sxplrSapiViewsCoreAtlasTmplparcselector', - animations: [ - trigger('toggleAtlasLayerSelector', [ - state('false', style({ - transform: 'scale(0)', - opacity: 0, - transformOrigin: '0% 100%' - })), - state('true', style({ - transform: 'scale(1)', - opacity: 1, - transformOrigin: '0% 100%' - })), - transition('false => true', [ - animate('200ms cubic-bezier(0.35, 0, 0.25, 1)') - ]), - transition('true => false', [ - animate('200ms cubic-bezier(0.35, 0, 0.25, 1)') - ]) - ]) - ], - changeDetection: ChangeDetectionStrategy.OnPush -}) - -export class SapiViewsCoreAtlasAtlasTmplParcSelector { - - public ARIA_LABELS = ARIA_LABELS - public CONST = CONST - - @ViewChildren(MatMenuTrigger) - matMenuTriggers: QueryList<MatMenuTrigger> - - @ViewChild('selectorPanelTmpl', { read: ElementRef }) - selectorPanelTemplateRef: ElementRef - - private atp$ = this.store$.pipe( - fromRootStore.distinctATP() - ) - - public availableParcellations$ = this.store$.pipe( - fromRootStore.allAvailParcs(this.sapi), - shareReplay(1), - ) - - public availableTemplates$ = this.store$.pipe( - fromRootStore.allAvailSpaces(this.sapi), - ) - - public selectedTemplate$ = this.atp$.pipe( - map(({ template }) => template) - ) - - public selectedParcellation$ = this.atp$.pipe( - map(({ parcellation }) => parcellation) - ) - - public parcsAvailableInCurrentTmpl$: Observable<SapiParcellationModel[]> = combineLatest([ - this.atp$, - this.availableParcellations$, - ]).pipe( - switchMap(([{ atlas, template }, parcs]) => - forkJoin( - parcs.map( - parc => this.sapi.getParcellation(atlas["@id"], parc["@id"]).getVolumes().pipe( - map( - volumes => { - return { - parcellation: parc, - volumes - } - } - ) - ) - ) - ).pipe( - map(arr => - arr.filter( - item => item.volumes.find(vol => vol.data.space["@id"] === template["@id"]) - ).map( - ({ parcellation }) => parcellation - ) - ) - ) - ) - ) - - private showOverlayIntentByTemplate$ = new Subject() - private showOverlayIntentByParcellation$ = new Subject() - public showLoadingOverlay$ = merge( - this.showOverlayIntentByTemplate$.pipe( - mapTo(true) - ), - this.selectedTemplate$.pipe( - mapTo(false) - ), - this.showOverlayIntentByParcellation$.pipe( - mapTo(true) - ), - this.selectedParcellation$.pipe( - mapTo(false) - ) - ).pipe( - distinctUntilChanged(), - ) - - private subscriptions: Subscription[] = [] - - @HostBinding('attr.data-opened') - public selectorExpanded: boolean = false - - public quickTourData: IQuickTourData = { - order: 4, - description: QUICKTOUR_DESC.LAYER_SELECTOR, - } - - - constructor( - private store$: Store, - private sapi: SAPI, - private interSpaceCoordXformSvc: InterSpaceCoordXformSvc, - ) { - - } - ngOnDestroy() { - while (this.subscriptions.length) this.subscriptions.pop().unsubscribe() - } - - - toggleSelector() { - this.selectorExpanded = !this.selectorExpanded - /** - * on selector open, call transform end point - * this caches the result, and will not bottleneck when the user selects a new space - */ - if (this.selectorExpanded) { - forkJoin({ - availableTemplates: this.availableTemplates$.pipe( - take(1) - ), - selectedTemplate: this.selectedTemplate$.pipe( - take(1) - ), - navigation: this.store$.pipe( - select(atlasSelection.selectors.navigation), - take(1) - ) - }).pipe( - - ).subscribe(({ availableTemplates, selectedTemplate, navigation }) => { - for (const avail of availableTemplates) { - this.interSpaceCoordXformSvc.transform( - InterSpaceCoordXformSvc.TmplIdToValidSpaceName(selectedTemplate["@id"]), - InterSpaceCoordXformSvc.TmplIdToValidSpaceName(avail["@id"]), - navigation.position as [number, number, number] - ).subscribe() - } - }) - } - } - - closeSelector() { - this.selectorExpanded = false - } - - openSelector() { - this.selectorExpanded = true - } - - selectTemplate(tmpl: SapiSpaceModel) { - this.showOverlayIntentByTemplate$.next(true) - - this.store$.dispatch( - atlasSelection.actions.selectTemplate({ - template: tmpl - }) - ) - } - - selectParcellation(parc: SapiParcellationModel) { - this.showOverlayIntentByParcellation$.next(true) - - this.store$.dispatch( - atlasSelection.actions.selectParcellation({ - parcellation: parc - }) - ) - } - - collapseExpandedGroup() { - this.matMenuTriggers.forEach(t => t.menuOpen && t.closeMenu()) - } - - - trackTmpl(t:SapiSpaceModel) { - return t['@id'] - } -} \ No newline at end of file diff --git a/src/atlasComponents/sapiViews/core/atlas/tmplParcSelector/tmplParcSelector.stories.ts b/src/atlasComponents/sapiViews/core/atlas/tmplParcSelector/tmplParcSelector.stories.ts deleted file mode 100644 index 3f18f737ec57e70b77c688c95f7fdbdc84c9e95b..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/atlas/tmplParcSelector/tmplParcSelector.stories.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { CommonModule } from "@angular/common" -import { HttpClientModule } from "@angular/common/http" -import { provideMockStore } from "@ngrx/store/testing" -import { action } from "@storybook/addon-actions" -import { Meta, moduleMetadata, Story } from "@storybook/angular" -import { SAPI } from "src/atlasComponents/sapi" -import { InterSpaceCoordXformSvc } from "src/atlasComponents/sapi/core/space/interSpaceCoordXform.service" -import { spaceId, provideDarkTheme, getHumanAtlas, getMni152, getJba29, getSpace, atlasId, getParc, parcId } from "src/atlasComponents/sapi/stories.base" -import { AngularMaterialModule } from "src/sharedModules" -import { atlasSelection } from "src/state" -import { SapiViewsCoreAtlasModule } from "../module" -import { SapiViewsCoreAtlasAtlasTmplParcSelector } from "./tmplParcSelector.component" - -const actionsData = { - selectTemplate: action('selectTemplate'), - selectParcellation: action('selectParcellation') -} - -export default { - component: SapiViewsCoreAtlasAtlasTmplParcSelector, - decorators: [ - moduleMetadata({ - imports: [ - CommonModule, - HttpClientModule, - SapiViewsCoreAtlasModule, - AngularMaterialModule, - ], - providers: [ - SAPI, - InterSpaceCoordXformSvc, - ...provideDarkTheme, - ], - declarations: [ - ] - }) - ], -} as Meta - -const Template: Story<SapiViewsCoreAtlasAtlasTmplParcSelector> = (args: SapiViewsCoreAtlasAtlasTmplParcSelector, { loaded }) => { - const { - atlas, - template, - parcellation, - } = loaded - - return ({ - props: { - selectTemplate: actionsData.selectTemplate, - selectParcellation: actionsData.selectParcellation - }, - moduleMetadata: { - providers: [ - provideMockStore({ - initialState: { - [atlasSelection.nameSpace]: { - ...atlasSelection.defaultState, - selectedAtlas: atlas, - selectedTemplate: template, - selectedParcellation: parcellation, - } - } - }) - ] - } - }) -} -Template.loaders = [ - -] - -export const MNI152JBA29 = Template.bind({}) -MNI152JBA29.args = { - -} -MNI152JBA29.loaders = [ - async () => { - const atlas = await getHumanAtlas() - const template = await getMni152() - const parcellation = await getJba29() - return { - atlas, - template, - parcellation, - } - } -] - -export const BigBrainJBA29 = Template.bind({}) -BigBrainJBA29.args = { - -} -BigBrainJBA29.loaders = [ - async () => { - const atlas = await getHumanAtlas() - const template = await getSpace(atlasId.human, spaceId.human.bigbrain) - const parcellation = await getJba29() - return { - atlas, - template, - parcellation, - } - } -] - -export const BigBrainCorticalLayers = Template.bind({}) -BigBrainCorticalLayers.args = { - -} -BigBrainCorticalLayers.loaders = [ - async () => { - const atlas = await getHumanAtlas() - const template = await getSpace(atlasId.human, spaceId.human.bigbrain) - const parcellation = await getParc(atlasId.human, parcId.human.corticalLayers) - return { - atlas, - template, - parcellation, - } - } -] - -export const MNI152LongBundle = Template.bind({}) -MNI152LongBundle.args = { - -} -MNI152LongBundle.loaders = [ - async () => { - const atlas = await getHumanAtlas() - const template = await getMni152() - const parcellation = await getParc(atlasId.human, parcId.human.longBundle) - return { - atlas, - template, - parcellation, - } - } -] \ No newline at end of file diff --git a/src/atlasComponents/sapiViews/core/atlas/tmplParcSelector/tmplParcSelector.style.css b/src/atlasComponents/sapiViews/core/atlas/tmplParcSelector/tmplParcSelector.style.css deleted file mode 100644 index 49568298b447009881affb039d95cdd967cd675f..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/atlas/tmplParcSelector/tmplParcSelector.style.css +++ /dev/null @@ -1,41 +0,0 @@ -.selector-container -{ - overflow-y:scroll; - max-height: 80vh; - width: 21rem; - bottom: 4rem; -} - -.loading-overlay -{ - background-color: rgba(250, 250, 250, 0.8); -} - -.loading-overlay -{ - position: fixed; - width: 100%; - height: 100%; - top: 0; - left: 0; - font-size: 200%; - - display: grid; - grid-template-columns: auto; - grid-template-rows: 1fr auto 1fr; - grid-template-columns: 1fr auto 1fr; - grid-template-areas: "." "vertical-center" "."; -} - -.loading-overlay > .spinner -{ - grid-column: 2; - grid-row: 2; -} - -/* necessary to align the tiles to the start of grid tile */ -sxplr-sapiviews-core-space-tile, -sxplr-sapiviews-core-parcellation-tile -{ - height: 100%; -} \ No newline at end of file diff --git a/src/atlasComponents/sapiViews/core/atlas/tmplParcSelector/tmplParcSelector.template.html b/src/atlasComponents/sapiViews/core/atlas/tmplParcSelector/tmplParcSelector.template.html deleted file mode 100644 index db9ba08d8bf273f3726bda3fe2ae8d19b94f5b0a..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/atlas/tmplParcSelector/tmplParcSelector.template.html +++ /dev/null @@ -1,103 +0,0 @@ -<!-- selector panel when expanded --> - -<mat-card class="selector-container m-2 position-absolute" - [ngClass]="{'pe-all': selectorExpanded}" - [@toggleAtlasLayerSelector]="selectorExpanded" - (@toggleAtlasLayerSelector.done)="atlasSelectorTour?.attachTo(selectorExpanded ? selectorPanelTemplateRef : null)" - #selectorPanelTmpl> - - <mat-card-content> - - <!-- templates --> - <mat-card-subtitle> - {{ CONST.ATLAS_SELECTOR_LABEL_SPACES }} - </mat-card-subtitle> - - <!-- template grid and tiles --> - <mat-grid-list cols="3" - rowHeight="2:3" - gutterSize="16"> - - <mat-grid-tile *ngFor="let template of availableTemplates$ | async; trackBy: trackTmpl" - [attr.aria-checked]="(selectedTemplate$ | async)?.['@id'] === template['@id']"> - - <sxplr-sapiviews-core-space-tile - [ngClass]="{ - 'sxplr-extra-muted': !(template | spaceSupportedInCurrentParcellation | async) - }" - [sxplr-sapiviews-core-space-tile-space]="template" - [sxplr-sapiviews-core-space-tile-selected]="(selectedTemplate$ | async)?.['@id'] === template['@id']" - (click)="selectTemplate(template)"> - </sxplr-sapiviews-core-space-tile> - </mat-grid-tile> - </mat-grid-list> - - <mat-divider></mat-divider> - - <!-- parcellations --> - <mat-card-subtitle class="mt-2"> - {{ CONST.ATLAS_SELECTOR_LABEL_PARC_MAPS }} - </mat-card-subtitle> - - <mat-grid-list cols="3" - rowHeight="2:3" - gutterSize="16"> - - <!-- using single parc template, since it's reused in non individual parcellation and tmpl for grp parcellation --> - <ng-template #singleParcTmpl let-parc> - <sxplr-sapiviews-core-parcellation-tile - [ngClass]="{ - 'sxplr-extra-muted': !(parc | parcellationSupportedInCurrentSpace | async) - }" - [sxplr-sapiviews-core-parcellation-tile-selected]="(selectedParcellation$ | async)?.['@id'] === parc['@id']" - [sxplr-sapiviews-core-parcellation-tile-parcellation]="parc" - (sxplr-sapiviews-core-parcellation-tile-onclick-parc)="selectParcellation($event)"> - - </sxplr-sapiviews-core-parcellation-tile> - </ng-template> - - <mat-grid-tile *ngFor="let parc of availableParcellations$ | async | filterUnsupportedParc | filterGroupedParcs"> - <ng-template - [ngTemplateOutlet]="singleParcTmpl" - [ngTemplateOutletContext]="{ $implicit: parc }"> - </ng-template> - </mat-grid-tile> - - <mat-grid-tile *ngFor="let group of availableParcellations$ | async | filterUnsupportedParc | filterGroupedParcs : true | filterUnsupportedParc"> - <sxplr-sapiviews-core-parcellation-tile - [sxplr-sapiviews-core-parcellation-tile-groupmenu-parc-tmpl]="singleParcTmpl" - [sxplr-sapiviews-core-parcellation-tile-parcellation]="group" - (sxplr-sapiviews-core-parcellation-tile-onclick-parc)="selectParcellation($event)"> - - </sxplr-sapiviews-core-parcellation-tile> - </mat-grid-tile> - </mat-grid-list> - - </mat-card-content> - - <div [ngClass]="{ - 'sxplr-d-none': !(showLoadingOverlay$ | async) - }" - class="loading-overlay"> - <spinner-cmp class="spinner"></spinner-cmp> - </div> - - -</mat-card> - -<!-- place holder when not expanded --> -<div class="position-relative m-2 cursor-pointer scale-up-bl pe-all sxplr-d-inline-block" - quick-tour - [quick-tour-description]="quickTourData.description" - [quick-tour-order]="quickTourData.order" - #atlasSelectorTour="quickTour"> - <!-- TODO check when do we disable atlas selector --> - <button color="primary" - *ngIf="true" - matTooltip="Select layer" - mat-mini-fab - [attr.aria-label]="ARIA_LABELS.TOGGLE_ATLAS_LAYER_SELECTOR" - (click)="toggleSelector()"> - <i class="fas fa-layer-group"></i> - </button> -</div> diff --git a/src/atlasComponents/sapiViews/core/datasets/dataset/dataset.stories.ts b/src/atlasComponents/sapiViews/core/datasets/dataset/dataset.stories.ts index acec7a744768e383bdb511d15b4a8d537b9e0633..641e4fb6f7008cfa7128efd019ea7e5871e2b09b 100644 --- a/src/atlasComponents/sapiViews/core/datasets/dataset/dataset.stories.ts +++ b/src/atlasComponents/sapiViews/core/datasets/dataset/dataset.stories.ts @@ -36,7 +36,7 @@ const Template: Story<DatasetView> = (args: DatasetView, { loaded }) => { const loadFeat = async () => { const features = await getHoc1RightFeatures() - const receptorfeat = features.find(f => f['@type'] === "siibra/core/dataset") + const receptorfeat = features.find(f => f['@type'] === "siibra/features/receptor") const feature = await getHoc1RightFeatureDetail(receptorfeat["@id"]) return { feature diff --git a/src/atlasComponents/sapiViews/core/parcellation/filterUnsupportedParc.pipe.ts b/src/atlasComponents/sapiViews/core/parcellation/filterUnsupportedParc.pipe.ts index 3a9d1a30ec5a9bc9ed281cca3e44051cd7b5b163..222020d7296acd3555b08c2b69c05fd49ceba80c 100644 --- a/src/atlasComponents/sapiViews/core/parcellation/filterUnsupportedParc.pipe.ts +++ b/src/atlasComponents/sapiViews/core/parcellation/filterUnsupportedParc.pipe.ts @@ -10,7 +10,6 @@ const unsupportedIds = [ ] const hideGroup = [ - "cytoarchitecture" ] @Pipe({ diff --git a/src/atlasComponents/sapiViews/core/parcellation/getSpaceById.pipe.ts b/src/atlasComponents/sapiViews/core/parcellation/getSpaceById.pipe.ts deleted file mode 100644 index 7112adcea7c31b8b3e47219831f3c4614ecef5d3..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/parcellation/getSpaceById.pipe.ts +++ /dev/null @@ -1,28 +0,0 @@ -import {Pipe, PipeTransform} from "@angular/core"; -import {Store} from "@ngrx/store"; -import {atlasSelection} from "src/state"; -import {SAPI, SapiSpaceModel,} from "src/atlasComponents/sapi"; -import {Observable} from "rxjs"; -import {filter, map} from "rxjs/operators"; - -@Pipe({ - name: 'getSpaceById', - pure: false, -}) - -export class GetSpaceByIdPipe implements PipeTransform { - - private allAvailableSpaces$ = this.store$.pipe( - atlasSelection.fromRootStore.allAvailSpaces(this.sapi) - ) - - constructor(private store$: Store, private sapi: SAPI){} - - public transform(spaceId: string) - : Observable<SapiSpaceModel> { - return this.allAvailableSpaces$.pipe( - filter(s => s && s.length > 0), - map(res => res.filter(t => t.fullName).find(t => t['@id'] === spaceId)) - ) - } -} \ No newline at end of file diff --git a/src/atlasComponents/sapiViews/core/parcellation/module.ts b/src/atlasComponents/sapiViews/core/parcellation/module.ts index 9f4ba762b4ada51b8130ec8eb90f2f2a6f2b6916..d3074f6e8e56b7ddabbf65bd74336f7d098ae42a 100644 --- a/src/atlasComponents/sapiViews/core/parcellation/module.ts +++ b/src/atlasComponents/sapiViews/core/parcellation/module.ts @@ -11,15 +11,8 @@ import { SapiViewsUtilModule } from "../../util"; import { FilterGroupedParcellationPipe } from "./filterGroupedParcellations.pipe"; import { FilterUnsupportedParcPipe } from "./filterUnsupportedParc.pipe"; import { ParcellationDoiPipe } from "./parcellationDoi.pipe"; -import { ParcellationIsBaseLayer } from "./parcellationIsBaseLayer.pipe"; import { ParcellationVisibilityService } from "./parcellationVis.service"; -import { PreviewParcellationUrlPipe } from "./previewParcellationUrl.pipe"; -import { - SapiViewsCoreParcellationParcellationSmartChip, - TemplateNotAvailableDialog -} from "./smartChip/parcellation.smartChip.component"; -import { SapiViewsCoreParcellationParcellationTile } from "./tile/parcellation.tile.component"; -import {GetSpaceByIdPipe} from "src/atlasComponents/sapiViews/core/parcellation/getSpaceById.pipe"; +import { ParcellationGroupSelectedPipe } from "./parcellationGroupSelected.pipe"; @NgModule({ imports: [ @@ -32,21 +25,16 @@ import {GetSpaceByIdPipe} from "src/atlasComponents/sapiViews/core/parcellation/ StrictLocalModule ], declarations: [ - SapiViewsCoreParcellationParcellationTile, - SapiViewsCoreParcellationParcellationSmartChip, - PreviewParcellationUrlPipe, FilterGroupedParcellationPipe, FilterUnsupportedParcPipe, - ParcellationIsBaseLayer, ParcellationDoiPipe, - GetSpaceByIdPipe, - TemplateNotAvailableDialog + ParcellationGroupSelectedPipe, ], exports: [ - SapiViewsCoreParcellationParcellationTile, - SapiViewsCoreParcellationParcellationSmartChip, FilterGroupedParcellationPipe, FilterUnsupportedParcPipe, + ParcellationGroupSelectedPipe, + ParcellationDoiPipe, ], providers: [ ParcellationVisibilityService, diff --git a/src/atlasComponents/sapiViews/core/parcellation/parcellationIsBaseLayer.pipe.ts b/src/atlasComponents/sapiViews/core/parcellation/parcellationIsBaseLayer.pipe.ts deleted file mode 100644 index 2c3c09a9d9b7307a7a1f8b18c193565137e9bd2f..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/parcellation/parcellationIsBaseLayer.pipe.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Pipe, PipeTransform } from "@angular/core"; -import { SapiParcellationModel } from "src/atlasComponents/sapi/type"; - -const baseLayerIds = [ - /** - * julich brain - */ - "minds/core/parcellationatlas/v1.0.0/94c1125b-b87e-45e4-901c-00daee7f2579-290", - "minds/core/parcellationatlas/v1.0.0/94c1125b-b87e-45e4-901c-00daee7f2579-25", - "minds/core/parcellationatlas/v1.0.0/94c1125b-b87e-45e4-901c-00daee7f2579", - - /** - * allen mouse - */ - "minds/core/parcellationatlas/v1.0.0/05655b58-3b6f-49db-b285-64b5a0276f83", - "minds/core/parcellationatlas/v1.0.0/39a1384b-8413-4d27-af8d-22432225401f", - - /** - * waxholm - */ - "minds/core/parcellationatlas/v1.0.0/11017b35-7056-4593-baad-3934d211daba", - "minds/core/parcellationatlas/v1.0.0/2449a7f0-6dd0-4b5a-8f1e-aec0db03679d", - "minds/core/parcellationatlas/v1.0.0/ebb923ba-b4d5-4b82-8088-fa9215c2e1fe", - "minds/core/parcellationatlas/v1.0.0/ebb923ba-b4d5-4b82-8088-fa9215c2e1fe-v4", - - /** - * monkey - */ - "minds/core/parcellationatlas/v1.0.0/mebrains-tmp-id", -] - -@Pipe({ - name: 'parcellationIsBaseLayer', - pure: true -}) - -export class ParcellationIsBaseLayer implements PipeTransform{ - public transform(parc: SapiParcellationModel): boolean { - /** - * currently, the only base layer is cyto maps - */ - return baseLayerIds.includes(parc["@id"]) - } -} diff --git a/src/atlasComponents/sapiViews/core/parcellation/previewParcellationUrl.pipe.ts b/src/atlasComponents/sapiViews/core/parcellation/previewParcellationUrl.pipe.ts deleted file mode 100644 index 7c1a543002a3f533271b778e209c9b39f241b0d8..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/parcellation/previewParcellationUrl.pipe.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Pipe, PipeTransform } from "@angular/core"; -import { SapiParcellationModel } from "src/atlasComponents/sapi"; -import { GroupedParcellation } from "./groupedParcellation"; - -const previewImgMap = new Map([ - - ['minds/core/parcellationatlas/v1.0.0/94c1125b-b87e-45e4-901c-00daee7f2579', 'cytoarchitectonic-maps.png'], - ['juelich/iav/atlas/v1.0.0/3', 'cortical-layers.png'], - ['juelich/iav/atlas/v1.0.0/4', 'grey-white-matter.png'], - ['juelich/iav/atlas/v1.0.0/5', 'fibre-long.png'], - ['juelich/iav/atlas/v1.0.0/6', 'fibre-short.png'], - ['minds/core/parcellationatlas/v1.0.0/d80fbab2-ce7f-4901-a3a2-3c8ef8a3b721', 'difumo-64.png'], - ['minds/core/parcellationatlas/v1.0.0/73f41e04-b7ee-4301-a828-4b298ad05ab8', 'difumo-128.png'], - ['minds/core/parcellationatlas/v1.0.0/141d510f-0342-4f94-ace7-c97d5f160235', 'difumo-256.png'], - ['minds/core/parcellationatlas/v1.0.0/63b5794f-79a4-4464-8dc1-b32e170f3d16', 'difumo-512.png'], - ['minds/core/parcellationatlas/v1.0.0/12fca5c5-b02c-46ce-ab9f-f12babf4c7e1', 'difumo-1024.png'], - - - ['minds/core/parcellationatlas/v1.0.0/05655b58-3b6f-49db-b285-64b5a0276f83', 'allen-mouse-2017.png'], - ['minds/core/parcellationatlas/v1.0.0/39a1384b-8413-4d27-af8d-22432225401f', 'allen-mouse-2015.png'], - - - ['minds/core/parcellationatlas/v1.0.0/ebb923ba-b4d5-4b82-8088-fa9215c2e1fe', 'waxholm-v3.png'], - ['minds/core/parcellationatlas/v1.0.0/2449a7f0-6dd0-4b5a-8f1e-aec0db03679d', 'waxholm-v2.png'], - ['minds/core/parcellationatlas/v1.0.0/11017b35-7056-4593-baad-3934d211daba', 'waxholm-v1.png'], - ['juelich/iav/atlas/v1.0.0/79cbeaa4ee96d5d3dfe2876e9f74b3dc3d3ffb84304fb9b965b1776563a1069c', 'short-bundle-hcp.png'], - - ['minds/core/parcellationatlas/v1.0.0/mebrains-tmp-id', 'primate-parc.png'], -]) - -/** - * used for directories - */ -const previewNameToPngMap = new Map([ - ['fibre architecture', 'fibre-long.png'], - ['functional modes', 'difumo-128.png'] -]) - -@Pipe({ - name: 'previewParcellationUrl', - pure: true -}) - -export class PreviewParcellationUrlPipe implements PipeTransform{ - public transform(tile: SapiParcellationModel | GroupedParcellation): string { - if (tile instanceof GroupedParcellation) { - const filename = previewNameToPngMap.get(tile.name) - return filename && `assets/images/atlas-selection/${filename}` - } - const filename = previewImgMap.get(tile['@id']) - return filename && `assets/images/atlas-selection/${filename}` - } -} diff --git a/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.component.ts b/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.component.ts deleted file mode 100644 index 2f7c8ed602bc949df8a3538a8f2c9fcbbb85cd59..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.component.ts +++ /dev/null @@ -1,170 +0,0 @@ -import {Component, EventEmitter, Inject, Input, OnChanges, Output, SimpleChanges} from "@angular/core"; -import { BehaviorSubject, concat, Observable, of, timer } from "rxjs"; -import {SapiParcellationModel, SapiSpaceModel} from "src/atlasComponents/sapi/type"; -import { ParcellationVisibilityService } from "../parcellationVis.service"; -import { ARIA_LABELS } from "common/constants" -import { getTraverseFunctions } from "../parcellationVersion.pipe"; -import {filter, mapTo, shareReplay, switchMap, take} from "rxjs/operators"; -import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from "@angular/material/dialog"; - -@Component({ - selector: `sxplr-sapiviews-core-parcellation-smartchip`, - templateUrl: `./parcellation.smartChip.template.html`, - styleUrls: [ - `./parcellation.smartChip.style.css` - ] -}) - -export class SapiViewsCoreParcellationParcellationSmartChip implements OnChanges{ - - public ARIA_LABELS = ARIA_LABELS - - @Input('sxplr-sapiviews-core-parcellation-smartchip-selected-space') - selectedSpace: SapiSpaceModel - - @Input('sxplr-sapiviews-core-parcellation-smartchip-selected-all-spaces') - allAvailableSpaces: SapiSpaceModel[] - - @Input('sxplr-sapiviews-core-parcellation-smartchip-parcellation') - parcellation: SapiParcellationModel - - @Input('sxplr-sapiviews-core-parcellation-smartchip-all-parcellations') - parcellations: SapiParcellationModel[] - - @Input('sxplr-sapiviews-core-parcellation-smartchip-custom-color') - customColor: string - - @Output('sxplr-sapiviews-core-parcellation-smartchip-dismiss-nonbase-layer') - onDismiss = new EventEmitter<SapiParcellationModel>() - - @Output('sxplr-sapiviews-core-parcellation-smartchip-select-parcellation') - onSelectParcellation = new EventEmitter<SapiParcellationModel>() - - @Output('sxplr-sapiviews-core-parcellation-smartchip-select-space-parcellation') - onSelectSpaceParcellation = new EventEmitter<{space: SapiSpaceModel, parcellation: SapiParcellationModel}>() - - constructor( - private svc: ParcellationVisibilityService, - public dialog: MatDialog - ){ - - } - - private templateNotAvailableDialog: MatDialogRef<TemplateNotAvailableDialog> - - otherVersions: SapiParcellationModel[] - - ngOnChanges(changes: SimpleChanges) { - const { parcellation } = changes - if (parcellation) { - this.onDismissClicked$.next(false) - } - this.otherVersions = [] - if (!this.parcellation) { - return - } - this.otherVersions = [ this.parcellation ] - if (!this.parcellations || this.parcellations.length === 0) { - return - } - if (!this.parcellation.version) { - return - } - - this.otherVersions = [] - - const { - findNewest, - findOlder - } = getTraverseFunctions(this.parcellations) - - let cursor: SapiParcellationModel = findNewest() - while (cursor) { - this.otherVersions.push(cursor) - cursor = findOlder(cursor) - } - } - - loadingParc$: Observable<SapiParcellationModel> = this.onSelectParcellation.pipe( - switchMap(parc => concat( - of(parc), - timer(5000).pipe( - mapTo(null) - ), - )), - shareReplay(1), - ) - - parcellationVisibility$: Observable<boolean> = this.svc.visibility$ - - toggleParcellationVisibility(){ - this.svc.toggleVisibility() - } - - dismiss(){ - if (this.onDismissClicked$.value) return - this.onDismissClicked$.next(true) - this.onDismiss.emit(this.parcellation) - } - - selectParcellation(parc: SapiParcellationModel){ - if (this.trackByFn(parc) === this.trackByFn(this.parcellation)) return - this.onSelectParcellation.emit(parc) - } - - trackByFn(parc: SapiParcellationModel){ - return parc["@id"] - } - - selectSpaceAndParcellation(space, parcellation) { - if (this.trackByFn(parcellation) === this.trackByFn(this.parcellation) - && space['@id'] === this.selectedSpace['@id']) return - - this.onSelectSpaceParcellation.emit({space, parcellation}) - } - - openChangeTemplateModal(supportedSpaces, parc) { - const spaces = this.allAvailableSpaces.filter(s => supportedSpaces.includes(s['@id'])) - this.templateNotAvailableDialog = this.dialog.open(TemplateNotAvailableDialog, { - data: spaces - }) - - this.templateNotAvailableDialog.afterClosed().pipe( - take(1), - filter(r => !!r) - ).subscribe(res => { - this.selectSpaceAndParcellation(res, parc) - }) - } - - onDismissClicked$ = new BehaviorSubject<boolean>(false) -} - - -@Component({ - selector: 'template-not-available-dialog', - template: ` - <div class="d-flex align-items-start"> - - <div class="flex-grow-1"> - <p>Parcellation is not available for the current template space. Please select template space to explore - the parcellation:</p> - <div class="d-flex align-items-center"> - <button mat-button *ngFor="let space of availableSpaces" - (click)="selectTemplate(space)">{{space.fullName}}</button> - </div> - </div> - <button class="flex-grow-0" mat-icon-button (click)="dialogRef.close()"><i class="fas fa-times"></i></button> - </div> - `, -}) -export class TemplateNotAvailableDialog { - constructor( - public dialogRef: MatDialogRef<TemplateNotAvailableDialog>, - @Inject(MAT_DIALOG_DATA) public availableSpaces: SapiSpaceModel[], - ) {} - - selectTemplate(space) { - this.dialogRef.close(space) - } -} \ No newline at end of file diff --git a/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.stories.ts b/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.stories.ts deleted file mode 100644 index 054c0c70eacd03943a5db1465bd412f4a8353c04..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.stories.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { CommonModule } from "@angular/common" -import { HttpClientModule } from "@angular/common/http" -import { Component, Input } from "@angular/core" -import { Meta, moduleMetadata, Story } from "@storybook/angular" -import { action } from "@storybook/addon-actions" -import { SAPI, SapiParcellationModel } from "src/atlasComponents/sapi" -import { atlasId, getAtlas, provideDarkTheme, getParc, getAtlases } from "src/atlasComponents/sapi/stories.base" -import { AngularMaterialModule } from "src/sharedModules" -import { SapiViewsCoreParcellationModule } from "../module" -import { provideMockStore } from "@ngrx/store/testing" -import { within, userEvent } from '@storybook/testing-library'; -import { ARIA_LABELS } from "common/constants" -import { ParcellationVisibilityService } from "../parcellationVis.service" -import { of } from "rxjs" - -@Component({ - selector: `parc-smart-chip-wrapper`, - template: ` - <mat-accordion> - <mat-expansion-panel *ngFor="let item of parcRecords | keyvalue"> - <mat-expansion-panel-header> - {{ item.key }} - </mat-expansion-panel-header> - - <div class="sxplr-of-x-scroll sxplr-white-space-nowrap"> - <sxplr-sapiviews-core-parcellation-smartchip *ngFor="let parc of item.value | filterUnsupportedParc" - [sxplr-sapiviews-core-parcellation-smartchip-parcellation]="parc" - [sxplr-sapiviews-core-parcellation-smartchip-all-parcellations]="item.value" - (sxplr-sapiviews-core-parcellation-smartchip-select-parcellation)="selectParcellation($event)"> - </sxplr-sapiviews-core-parcellation-smartchip> - </div> - - </mat-expansion-panel> - </mat-accordion> - `, - styles: [ - `sxplr-sapiviews-core-parcellation-chip { display: block; }` - ] -}) - -class ParcSmartChipWrapper{ - @Input() - parcRecords: Record<string, SapiParcellationModel[]> = {} - - selectParcellation(parc: SapiParcellationModel){ - - } -} - - -export default { - component: ParcSmartChipWrapper, - decorators: [ - moduleMetadata({ - imports: [ - CommonModule, - HttpClientModule, - SapiViewsCoreParcellationModule, - AngularMaterialModule, - ], - providers: [ - provideMockStore(), - SAPI, - ...provideDarkTheme, - ], - declarations: [] - }) - ], -} as Meta - -const Template: Story<ParcSmartChipWrapper> = (args: ParcSmartChipWrapper, { loaded, parameters }) => { - const { - parcRecords - } = loaded - const { providers = [] } = parameters - - return ({ - props: { - ...args, - selectParcellation: action("selectParcellation"), - parcRecords - }, - moduleMetadata: { - providers - } - }) -} -Template.loaders = [] - -const asyncLoader = async () => { - const parcRecords: Record<string, SapiParcellationModel[]> = {} - - for (const species in atlasId) { - - const atlasDetail = await getAtlas(atlasId[species]) - parcRecords[species] = [] - for (const parc of atlasDetail.parcellations) { - const parcDetail = await getParc(atlasDetail['@id'], parc['@id']) - parcRecords[species].push(parcDetail) - } - } - - return { - parcRecords - } -} - -export const Default = Template.bind({}) -Default.loaders = [ - async () => { - const { - parcRecords - } = await asyncLoader() - return { - parcRecords - } - } -] - -export const TestInteraction = Template.bind({}) -TestInteraction.loaders = [ - ...Default.loaders -] -TestInteraction.parameters = { - providers: [ - { - provide: ParcellationVisibilityService, - useValue: { - setVisibility: action('setVisibility'), - toggleVisibility: action('toggleVisibility'), - visibility$: of(true) - } - } - ] -} -TestInteraction.play = async ({ args, canvasElement }) => { - const canvas = within(canvasElement) - - await userEvent.click(canvas.getByText("human")) - const allEye = canvas.getAllByText(ARIA_LABELS.TOGGLE_DELINEATION) - await userEvent.hover(allEye[0]) - await userEvent.click(allEye[0]) -} diff --git a/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.style.css b/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.style.css deleted file mode 100644 index f83fb1f49984f554b1a3fbcea0852d7f8005949b..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.style.css +++ /dev/null @@ -1,34 +0,0 @@ -.otherversion-wrapper -{ - position: relative; - overflow: hidden; - margin: 0.5rem; -} - -.otherversion-wrapper.loading > .spinner-container -{ - position: absolute; - left: 0; - top: 0; - width: 100%; - height: 100%; - - display: flex; - align-items: center; -} - -.otherversion-wrapper.loading > .spinner-container > spinner-cmp -{ - margin: 0.5rem; -} - -.icons-container -{ - transform: scale(0.7); - margin-right: -1.5rem; -} - -.icons-container > * -{ - margin: auto 0.2rem; -} diff --git a/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.template.html b/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.template.html deleted file mode 100644 index fdf7b4d946d8ec848ec53558e9bec8f98b0cfffc..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.template.html +++ /dev/null @@ -1,149 +0,0 @@ -<div (iav-outsideClick)="menuTrigger.closeMenu()"> - <mat-menu #otherParcMenu="matMenu" - [hasBackdrop]="false" - class="parc-smart-chip-menu-panel sxplr-mxw-80vw ml-4"> - - <div *ngFor="let parc of parcellations | filterUnsupportedParc | filterGroupedParcs : true" - [ngClass]="{'loading': (loadingParc$ | async) === parc}"> - <button mat-menu-item - [matMenuTriggerFor]="subParcMenu" - [matMenuTriggerData]="{group: parc}" - (click)="selectParcellation(parc)" - [style.background-color]="(parcellation | equality : parc : trackByFn) ? 'grey' : ''"> - {{parc.name}} - </button> - </div> - - <div *ngFor="let parc of parcellations | filterUnsupportedParc | filterGroupedParcs" - [ngClass]="{'loading': (loadingParc$ | async) === parc}" - class="d-flex align-items-center justify-content-space-between"> - <ng-container *ngIf="(parc | parcellationSupportedInCurrentSpace | async) as sup;"> - <button mat-menu-item - (click)="sup.supported? selectParcellation(parc) : openChangeTemplateModal(sup.spaces, parc)" - [style.background-color]="(parcellation | equality : parc : trackByFn) ? 'grey' : ''"> - {{parc.name}} - </button> - </ng-container> - <ng-container [ngTemplateOutlet]="menuItemSuffix" [ngTemplateOutletContext]="{parc: parc}"></ng-container> - </div> - - </mat-menu> - - <mat-menu #subParcMenu="matMenu" class="parc-smart-chip-menu-panel sxplr-mxw-80vw"> - <ng-template matMenuContent let-group="group"> - <div *ngFor="let parc of group.parcellations" - [ngClass]="{'loading': (loadingParc$ | async) === parc}" - class="d-flex align-items-center justify-content-space-between"> - <ng-container *ngIf="(parc | parcellationSupportedInCurrentSpace | async) as sup;"> - <button mat-menu-item - (click)="sup.supported? selectParcellation(parc) : openChangeTemplateModal(sup.spaces, parc)" - [style.background-color]="(parcellation | equality : parc : trackByFn) ? 'grey' : ''"> - {{parc.name}} - </button> - </ng-container> - <ng-container [ngTemplateOutlet]="menuItemSuffix" [ngTemplateOutletContext]="{parc: parc}"></ng-container> - </div> - </ng-template> - </mat-menu> - - <div [style.background-color]="customColor && customColor" - [matMenuTriggerFor]="otherParcMenu" - #menuTrigger="matMenuTrigger" - matRipple - class="custom-chip layer-chip-overflowed"> - <span class="mat-body sxplr-white-space-nowrap"> - {{ parcellation.name }} - </span> - <ng-container [ngTemplateOutlet]="chipSuffix"></ng-container> - </div> - -</div> - -<!-- parcellation description template --> -<ng-template #parcDescTmpl let-parc="parcellation"> - <h1 mat-dialog-title> - {{ parc.name }} - </h1> - <div mat-dialog-content> - <markdown-dom - *ngIf="parc.brainAtlasVersions.length > 0 && parc.brainAtlasVersions[0].versionInnovation" - [markdown]="parc.brainAtlasVersions[0].versionInnovation"> - </markdown-dom> - </div> - - <mat-dialog-actions align="start"> - <a *ngFor="let url of parc | parcellationDoiPipe" - [href]="url" - sxplr-hide-when-local - target="_blank" - mat-raised-button - color="primary"> - <div class="fas fa-external-link-alt"></div> - <span> - Dataset Detail - </span> - </a> - - <button mat-button mat-dialog-close>Close</button> - </mat-dialog-actions> -</ng-template> - -<!-- Suffix for selected chip --> -<ng-template #chipSuffix> - <ng-template #mainParcDesc> - <ng-template [ngTemplateOutlet]="parcDescTmpl" - [ngTemplateOutletContext]="{ parcellation: parcellation }"> - </ng-template> - </ng-template> - - <span class="small-icon-button mr-2 ml-3" - matRipple - [sxplr-dialog]="mainParcDesc" - [sxplr-dialog-size]="null" - (click)="$event.stopPropagation()"> - <i class="fas fa-info"></i> - </span> - - <span class="small-icon-button mr-2" - [matTooltip]="ARIA_LABELS.TOGGLE_DELINEATION" - iav-stop="mousedown click" - [iav-key-listener]="[{'type': 'keydown', 'key': 'q', 'capture': true, 'target': 'document' }]" - (iav-key-event)="toggleParcellationVisibility()" - (click)="toggleParcellationVisibility()"> - <i class="fas" - [ngClass]="(parcellationVisibility$ | async) ? 'fa-eye': 'fa-eye-slash'" - aria-hidden="true"> - </i> - <span class="sr-only"> - {{ ARIA_LABELS.TOGGLE_DELINEATION }} - </span> - </span> - - <span class="small-icon-button mr-2" - *ngIf="!(parcellation | parcellationIsBaseLayer)" - color="default" - (click)="dismiss()"> - - <spinner-cmp class="sxplr-w-100 sxplr-h-100 d-inline-block" - *ngIf="onDismissClicked$ | async; else defaultDismissIcon"></spinner-cmp> - <ng-template #defaultDismissIcon> - <i class="fas fa-times"></i> - </ng-template> - - </span> -</ng-template> - -<!-- Suffix for menu items --> -<ng-template #menuItemSuffix let-parc="parc" let-grouped="grouped"> - <ng-template #otherParcDesc> - <ng-template [ngTemplateOutlet]="parcDescTmpl" - [ngTemplateOutletContext]="{ parcellation: parc }"> - </ng-template> - </ng-template> - - <button mat-menu-item class="w-0 d-flex align-items-center justify-content-center" - [sxplr-dialog]="otherParcDesc" - [sxplr-dialog-size]="null"> - <i class="fas fa-info"></i> - </button> -</ng-template> \ No newline at end of file diff --git a/src/atlasComponents/sapiViews/core/parcellation/tile/parcellation.tile.component.ts b/src/atlasComponents/sapiViews/core/parcellation/tile/parcellation.tile.component.ts deleted file mode 100644 index 839e8791ff2df8090de142deedf0e39046cfec32..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/parcellation/tile/parcellation.tile.component.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, TemplateRef } from "@angular/core"; -import { SapiParcellationModel } from "src/atlasComponents/sapi"; -import { GroupedParcellation } from "../groupedParcellation"; - -const lightthemeId = [ - 'juelich/iav/atlas/v1.0.0/3', - 'juelich/iav/atlas/v1.0.0/4', -] - -@Component({ - selector: `sxplr-sapiviews-core-parcellation-tile`, - templateUrl: './parcellation.tile.template.html', - styleUrls: [ - `./parcellation.tile.style.css` - ], -}) - -export class SapiViewsCoreParcellationParcellationTile implements OnChanges{ - @Input('sxplr-sapiviews-core-parcellation-tile-groupmenu-parc-tmpl') - singleParcTmpl: TemplateRef<any> - - private _parcellation: SapiParcellationModel | GroupedParcellation - @Input('sxplr-sapiviews-core-parcellation-tile-parcellation') - set parcellation(val: SapiParcellationModel | GroupedParcellation) { - this._parcellation = val - this.ngOnChanges() - } - get parcellation(){ - return this._parcellation - } - - @Input('sxplr-sapiviews-core-parcellation-tile-selected') - selected: boolean = false - - @Output('sxplr-sapiviews-core-parcellation-tile-onclick-parc') - onClickOnParcellation = new EventEmitter<SapiParcellationModel>() - - public gutterSize = "2" - public rowHeight = "6:11" - - public darktheme = false - public pureParc: SapiParcellationModel - public dirParc: GroupedParcellation - - ngOnChanges(): void { - if (this.parcellation instanceof GroupedParcellation) { - this.dirParc = this.parcellation - } else { - this.pureParc = this.parcellation - } - this.darktheme = !!this.dirParc || lightthemeId.indexOf(this.parcellation['@id']) < 0 - } - - clickOnParcellation(parc: SapiParcellationModel){ - this.onClickOnParcellation.emit(parc) - } -} diff --git a/src/atlasComponents/sapiViews/core/parcellation/tile/parcellation.tile.stories.ts b/src/atlasComponents/sapiViews/core/parcellation/tile/parcellation.tile.stories.ts deleted file mode 100644 index 1fad5b1cd9332700829f662798829e919691b956..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/parcellation/tile/parcellation.tile.stories.ts +++ /dev/null @@ -1,160 +0,0 @@ -import { CommonModule } from "@angular/common" -import { HttpClientModule } from "@angular/common/http" -import { Component, Input, Output, EventEmitter } from "@angular/core" -import { provideMockStore } from "@ngrx/store/testing" -import { Meta, moduleMetadata, Story } from "@storybook/angular" -import { SAPI, SapiParcellationModel } from "src/atlasComponents/sapi" -import { atlasId, parcId, getAtlas, provideDarkTheme, getParc } from "src/atlasComponents/sapi/stories.base" -import { AngularMaterialModule } from "src/sharedModules" -import { SapiViewsCoreParcellationModule } from "../module" - -@Component({ - selector: `parc-tile-wrapper`, - template: ` - <ng-template #grpParcTmpl let-parc> - {{ parc.name }} - </ng-template> - - <mat-accordion> - <mat-expansion-panel *ngFor="let item of parcs | keyvalue"> - - <mat-expansion-panel-header> - {{ item.key }} - </mat-expansion-panel-header> - - <ng-template matExpansionPanelContent> - <div class="sxplr-d-inline-flex align-items-start"> - <sxplr-sapiviews-core-parcellation-tile - *ngFor="let parc of item.value" - [sxplr-sapiviews-core-parcellation-tile-parcellation]="parc" - [sxplr-sapiviews-core-parcellation-tile-selected]="parc['@id'] === selected" - class="sxplr-m-2" - (sxplr-sapiviews-core-parcellation-tile-onclick-parc)="parcClicked.emit($event)"> - </sxplr-sapiviews-core-parcellation-tile> - </div> - </ng-template> - - </mat-expansion-panel> - - <mat-expansion-panel> - <mat-expansion-panel-header> - > grouped - </mat-expansion-panel-header> - - <ng-template matExpansionPanelContent> - <ng-container *ngFor="let item of parcs | keyvalue"> - <sxplr-sapiviews-core-parcellation-tile - *ngFor="let parc of (item.value | filterGroupedParcs : true)" - [sxplr-sapiviews-core-parcellation-tile-parcellation]="parc" - class="sxplr-m-2" - (sxplr-sapiviews-core-parcellation-tile-onclick-parc)="parcClicked.emit($event)"> - </sxplr-sapiviews-core-parcellation-tile> - </ng-container> - </ng-template> - </mat-expansion-panel> - - <mat-expansion-panel> - <mat-expansion-panel-header> - > grouped tmpl - </mat-expansion-panel-header> - - <ng-template matExpansionPanelContent> - <ng-container *ngFor="let item of parcs | keyvalue"> - <sxplr-sapiviews-core-parcellation-tile - *ngFor="let parc of (item.value | filterGroupedParcs : true)" - [sxplr-sapiviews-core-parcellation-tile-groupmenu-parc-tmpl]="grpParcTmpl" - [sxplr-sapiviews-core-parcellation-tile-parcellation]="parc" - class="sxplr-m-2" - (sxplr-sapiviews-core-parcellation-tile-onclick-parc)="parcClicked.emit($event)"> - </sxplr-sapiviews-core-parcellation-tile> - </ng-container> - </ng-template> - </mat-expansion-panel> - </mat-accordion> - `, - styles: [ - `sxplr-sapiviews-core-parcellation-tile { display: inline-block; max-width: 8rem; }` - ] -}) - -class ParcTileWrapper{ - @Input() - parcs: Record<string, SapiParcellationModel[]> = {} - - @Input() - selected: string = parcId.human.longBundle - - @Output() - parcClicked = new EventEmitter() -} - -export default { - component: ParcTileWrapper, - decorators: [ - moduleMetadata({ - imports: [ - CommonModule, - HttpClientModule, - SapiViewsCoreParcellationModule, - AngularMaterialModule, - ], - providers: [ - provideMockStore(), - SAPI, - ...provideDarkTheme, - ], - declarations: [ - ParcTileWrapper - ] - }) - ], -} as Meta - -const Template: Story<ParcTileWrapper> = (args: ParcTileWrapper, { loaded }) => { - const { - parcs - } = loaded - - return ({ - props: { - ...args, - parcs - } - }) -} -Template.loaders = [ - -] - -const asyncLoader = async () => { - const parcs: Record<string, SapiParcellationModel[]> = {} - for (const species in atlasId) { - const atlasDetail = await getAtlas(atlasId[species]) - parcs[species] = [] - - for (const parc of atlasDetail.parcellations) { - const parcDetail = await getParc(atlasDetail['@id'], parc['@id']) - parcs[species].push(parcDetail) - } - } - - return { - parcs - } -} - -export const Default = Template.bind({}) -Default.args = { - selected: parcId.human.longBundle -} -Default.loaders = [ - - async () => { - const { - parcs - } = await asyncLoader() - return { - parcs - } - } -] diff --git a/src/atlasComponents/sapiViews/core/parcellation/tile/parcellation.tile.style.css b/src/atlasComponents/sapiViews/core/parcellation/tile/parcellation.tile.style.css deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/atlasComponents/sapiViews/core/parcellation/tile/parcellation.tile.template.html b/src/atlasComponents/sapiViews/core/parcellation/tile/parcellation.tile.template.html deleted file mode 100644 index 19cd424794e7bc343d775fa541979bf1019cf0ac..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/parcellation/tile/parcellation.tile.template.html +++ /dev/null @@ -1,69 +0,0 @@ -<mat-menu hasBackDrop="false" #matMenu="matMenu"> - - <ng-template matMenuContent let-subParcellations="subParcellations"> - - <div class="sxplr-custom-cmp sxplr-ml-2 sxplr-mr-2"> - <mat-grid-list - cols="1" - [rowHeight]="rowHeight" - [gutterSize]="gutterSize"> - - <mat-grid-tile - *ngFor="let parc of subParcellations"> - - - <!-- if parent component injected template, use injected template --> - <ng-template - [ngIf]="singleParcTmpl" - [ngIfElse]="fallbackGrpParcTmpl" - [ngTemplateOutlet]="singleParcTmpl" - [ngTemplateOutletContext]="{ - $implicit: parc - }"> - </ng-template> - - <ng-template #fallbackGrpParcTmpl> - <tile-cmp *ngIf="parc" - class="sxplr-custom-cmp text" - [tile-text]="parc.name" - [tile-image-src]="parc | previewParcellationUrl" - [tile-selected]="selected" - [tile-image-darktheme]="darktheme" - (click)="clickOnParcellation(parc)"> - - </tile-cmp> - </ng-template> - - </mat-grid-tile> - </mat-grid-list> - </div> - </ng-template> -</mat-menu> - -<ng-template [ngIf]="parcellation"> - - <tile-cmp *ngIf="pureParc" - [tile-text]="pureParc.name" - [tile-image-src]="pureParc | previewParcellationUrl" - [tile-selected]="selected" - [tile-image-darktheme]="darktheme" - (click)="clickOnParcellation(pureParc)" - > - - </tile-cmp> - - - <tile-cmp *ngIf="dirParc" - [tile-text]="dirParc.name" - [tile-image-src]="dirParc | previewParcellationUrl" - [tile-selected]="selected" - [tile-image-darktheme]="darktheme" - tile-is-dir="true" - [matMenuTriggerFor]="matMenu" - [matMenuTriggerData]="{ - subParcellations: dirParc.parcellations || [] - }" - > - </tile-cmp> - -</ng-template> \ No newline at end of file diff --git a/src/atlasComponents/sapiViews/core/parcellation/tile/singleTile.stories.ts b/src/atlasComponents/sapiViews/core/parcellation/tile/singleTile.stories.ts deleted file mode 100644 index 920c1cfc82a26550a2710a584f6db9f45b0ea5af..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/parcellation/tile/singleTile.stories.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { CommonModule } from "@angular/common" -import { HttpClientModule } from "@angular/common/http" -import { provideMockStore } from "@ngrx/store/testing" -import { Meta, moduleMetadata, Story } from "@storybook/angular" -import { SAPI, SapiParcellationModel } from "src/atlasComponents/sapi" -import { parcId, provideDarkTheme, getParc, getHumanAtlas } from "src/atlasComponents/sapi/stories.base" -import { AngularMaterialModule } from "src/sharedModules" -import { FilterGroupedParcellationPipe } from "../filterGroupedParcellations.pipe" -import { GroupedParcellation } from "../groupedParcellation" -import { SapiViewsCoreParcellationModule } from "../module" -import { SapiViewsCoreParcellationParcellationTile } from "./parcellation.tile.component" - -export default { - component: SapiViewsCoreParcellationParcellationTile, - decorators: [ - moduleMetadata({ - imports: [ - CommonModule, - HttpClientModule, - SapiViewsCoreParcellationModule, - AngularMaterialModule, - ], - providers: [ - provideMockStore(), - SAPI, - ...provideDarkTheme, - ], - declarations: [ - - ], - }), - ], -} as Meta - -const Template: Story<SapiViewsCoreParcellationParcellationTile> = (args: SapiViewsCoreParcellationParcellationTile, { loaded }) => { - const { - groups - } = loaded - - const { - gutterSize, - rowHeight - } = args - return ({ - props: { - gutterSize, - rowHeight, - parcellation: groups[1] - }, - styles: [ - `sxplr-sapiviews-core-parcellation-tile { display: inline-block; max-width: 8rem; }` - ] - }) -} -Template.loaders = [ - -] - -const asyncLoader = async () => { - const parcs: SapiParcellationModel[] = [] - - const atlasDetail = await getHumanAtlas() - - for (const parc of atlasDetail.parcellations) { - const parcDetail = await getParc(atlasDetail['@id'], parc['@id']) - parcs.push(parcDetail) - } - - const pipe = new FilterGroupedParcellationPipe() - const groups = pipe.transform(parcs, true) as GroupedParcellation[] - return { - groups - } -} - -export const Default = Template.bind({}) -Default.args = { - selected: parcId.human.longBundle -} -Default.loaders = [ - - async () => { - const { - groups - } = await asyncLoader() - return { - groups - } - } -] diff --git a/src/atlasComponents/sapiViews/core/rich/ATPSelector/module.ts b/src/atlasComponents/sapiViews/core/rich/ATPSelector/module.ts index 59d64b311aa6a241d4d3c13251b7a3b7cc365632..188a5487140e5da124b84bebab05c831796b54c1 100644 --- a/src/atlasComponents/sapiViews/core/rich/ATPSelector/module.ts +++ b/src/atlasComponents/sapiViews/core/rich/ATPSelector/module.ts @@ -7,7 +7,7 @@ import { MarkdownModule } from "src/components/markdown"; import { SmartChipModule } from "src/components/smartChip"; import { DialogModule } from "src/ui/dialogInfo"; import { UtilModule } from "src/util"; -import { FilterGroupedParcellationPipe, ParcellationDoiPipe, ParcellationGroupSelectedPipe } from "src/atlasComponents/sapiViews/core/parcellation"; +import { SapiViewsCoreParcellationModule } from "src/atlasComponents/sapiViews/core/parcellation"; import { PureATPSelector } from "./pureDumb/pureATPSelector.components"; import { WrapperATPSelector } from "./wrapper/wrapper.component"; import { SAPIModule } from "src/atlasComponents/sapi/module"; @@ -23,14 +23,11 @@ import { SAPIModule } from "src/atlasComponents/sapi/module"; MatButtonModule, DialogModule, SAPIModule, + SapiViewsCoreParcellationModule, ], declarations: [ PureATPSelector, WrapperATPSelector, - - FilterGroupedParcellationPipe, - ParcellationDoiPipe, - ParcellationGroupSelectedPipe, ], exports: [ PureATPSelector, diff --git a/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.components.ts b/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.components.ts index 99dbb387baa78c02dc0f8f4eb5a9d50f0a49f188..17615f1d4d0b6194561315f59b051cf2ab6120b3 100644 --- a/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.components.ts +++ b/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.components.ts @@ -13,6 +13,15 @@ export type ATP = { template: SapiSpaceModel parcellation: SapiParcellationModel } + +function isATPGuard(atp: Record<string, unknown>): atp is Partial<ATP> { + const { atlas, template, parcellation } = atp + if (atlas && atlas["@type"] === "juelich/iav/atlas/v1.0.0") return true + if (template && template["@type"] === "https://openminds.ebrains.eu/sands/CoordinateSpace") return true + if (parcellation && parcellation["@type"] === "minds/core/parcellationatlas/v1.0.0") return true + return false +} + const pipe = new FilterGroupedParcellationPipe() @@ -50,14 +59,15 @@ export class PureATPSelector implements OnChanges{ public isBusy: boolean = false @Output('sxplr-pure-atp-selector-on-select') - selectLeafEmitter = new EventEmitter<ATP>() + selectLeafEmitter = new EventEmitter<Partial<ATP>>() getChildren(parc: GroupedParcellation|SapiParcellationModel){ return (parc as GroupedParcellation).parcellations || [] } - selectLeaf(atp: ATP) { + selectLeaf(atp: Record<string, unknown>) { if (this.isBusy) return + if (!isATPGuard(atp)) return this.selectLeafEmitter.emit(atp) } diff --git a/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.stories.ts b/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.stories.ts index cb0eeafc5e4bb5fb953ecfb011a85d1e8128a066..1113a1873c48a6a08e2113aaca7bec113ed0a227 100644 --- a/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.stories.ts +++ b/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.stories.ts @@ -9,6 +9,7 @@ import { UtilModule } from "src/util"; import { ATPSelectorModule } from "../module"; import { defaultColorPalette } from "./pureATPSelector.components" import { loadAtlasEtcData, wrapperDecoratorFn } from "../story.base" +import { provideMockStore } from "@ngrx/store/testing"; @Component({ selector: 'atlas-selector-wrapper-story', @@ -77,6 +78,7 @@ export default { ], providers: [ ...provideDarkTheme, + provideMockStore(), ] }), componentWrapperDecorator(wrapperDecoratorFn) diff --git a/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.style.scss b/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.style.scss index 04f66421997ddc3e2c7f33812d52752aa0ba3595..f5c72a7f8bcd6303da0c2c95f4e1cf6d5ec72e56 100644 --- a/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.style.scss +++ b/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.style.scss @@ -21,7 +21,7 @@ sxplr-smart-chip:not(:last-child) { - margin-left: -3.5rem; + margin-left: -2.5rem; .chip-text { diff --git a/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.template.html b/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.template.html index cd071fbba5874bd6ff88d4a4538fbefc9b60a814..295862fa4208bf50833a3a170a2458e6ba0412fb 100644 --- a/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.template.html +++ b/src/atlasComponents/sapiViews/core/rich/ATPSelector/pureDumb/pureATPSelector.template.html @@ -1,7 +1,7 @@ <ng-template [ngIf]="selectedATP" let-ATP> <!-- parcellation smart chip --> - <sxplr-smart-chip *ngIf="ATP.parcellation" + <sxplr-smart-chip *ngIf="ATP.parcellation && parcAndGroup.length > 1" [items]="parcAndGroup" [color]="colorPalette[2]" [getChildren]="getChildren" @@ -44,7 +44,7 @@ </sxplr-smart-chip> <!-- space smart chip --> - <sxplr-smart-chip *ngIf="ATP.template" + <sxplr-smart-chip *ngIf="ATP.template && availableTemplates.length > 1" [items]="availableTemplates" [color]="colorPalette[1]" (itemClicked)="selectLeaf({ template: $event })" @@ -106,8 +106,8 @@ </ng-template> <!-- button body --> - <span *ngIf="item; else noItemTmpl" class="full-sized-button"> - {{ item.name || item.fullName }} + <span *ngIf="item" class="full-sized-button"> + {{ item.version?.name || item.name || item.fullName }} </span> <!-- suffix --> diff --git a/src/atlasComponents/sapiViews/core/rich/ATPSelector/wrapper/wrapper.component.ts b/src/atlasComponents/sapiViews/core/rich/ATPSelector/wrapper/wrapper.component.ts index 0b4bfe6c852be9215f343b9263bc3fdb613796c3..06cb6e4e2aad29c1c2c2c1eafdc3ffb132b763c7 100644 --- a/src/atlasComponents/sapiViews/core/rich/ATPSelector/wrapper/wrapper.component.ts +++ b/src/atlasComponents/sapiViews/core/rich/ATPSelector/wrapper/wrapper.component.ts @@ -77,7 +77,7 @@ export class WrapperATPSelector implements OnDestroy{ } if (template) { return this.#parcSupportedInSpacePipe.transform(selectedATP.parcellation, template).pipe( - switchMap(({ supported }) => supported + switchMap(supported => supported ? of({ template }) : this.#askUser(`Incompatible parcellation`, `Attempting to load template **${template.fullName}**, which does not support parcellation **${selectedATP.parcellation.name}**. Proceed anyway and load the default parcellation?`).pipe( switchMap(flag => of(flag ? { template } : null)) @@ -86,7 +86,7 @@ export class WrapperATPSelector implements OnDestroy{ } if (parcellation) { return this.#parcSupportedInSpacePipe.transform(parcellation, selectedATP.template).pipe( - switchMap(({ supported }) => supported + switchMap(supported=> supported ? of({ parcellation }) : this.#askUser(`Incompatible template`, `Attempting to load parcellation **${parcellation.name}**, which is not supported in template **${selectedATP.template.fullName}**. Proceed anyway and load the default template?`).pipe( switchMap(flag => of(flag ? { parcellation } : null)) diff --git a/src/atlasComponents/sapiViews/core/space/module.ts b/src/atlasComponents/sapiViews/core/space/module.ts index 419db6cf81431503153a0f0d8faa537b12115430..57dba91de5499f6e9f3c82e57f7f14f692512411 100644 --- a/src/atlasComponents/sapiViews/core/space/module.ts +++ b/src/atlasComponents/sapiViews/core/space/module.ts @@ -2,11 +2,6 @@ import { CommonModule } from "@angular/common"; import { NgModule } from "@angular/core"; import { ComponentsModule } from "src/components"; import { SapiViewsCoreSpaceBoundingBox } from "./boundingBox.directive"; -import { PreviewSpaceUrlPipe } from "./previewSpaceUrl.pipe"; -import { SapiViewsCoreSpaceSpaceTile } from "./tile/space.tile.component"; -import { - SapiViewCoreSpaceSmartChip -} from "src/atlasComponents/sapiViews/core/space/smartChip/space.smartChip.components"; import { AngularMaterialModule } from "src/sharedModules"; import { DialogModule } from "src/ui/dialogInfo/module"; import { SapiViewsUtilModule } from "../../util"; @@ -22,15 +17,10 @@ import {UtilModule} from "src/util"; UtilModule ], declarations: [ - SapiViewsCoreSpaceSpaceTile, - PreviewSpaceUrlPipe, SapiViewsCoreSpaceBoundingBox, - SapiViewCoreSpaceSmartChip, ], exports: [ - SapiViewsCoreSpaceSpaceTile, SapiViewsCoreSpaceBoundingBox, - SapiViewCoreSpaceSmartChip, ] }) diff --git a/src/atlasComponents/sapiViews/core/space/previewSpaceUrl.pipe.ts b/src/atlasComponents/sapiViews/core/space/previewSpaceUrl.pipe.ts deleted file mode 100644 index 8bbecdf23e0cf041912d5293c3be12eef5d5f7b6..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/space/previewSpaceUrl.pipe.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Pipe, PipeTransform } from "@angular/core" -import { SapiSpaceModel } from "src/atlasComponents/sapi" - -const previewImgMap = new Map([ - ['minds/core/referencespace/v1.0.0/a1655b99-82f1-420f-a3c2-fe80fd4c8588', 'bigbrain.png'], - ['minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2', 'icbm2009c.png'], - ['minds/core/referencespace/v1.0.0/7f39f7be-445b-47c0-9791-e971c0b6d992', 'colin27.png'], - - ['minds/core/referencespace/v1.0.0/265d32a0-3d84-40a5-926f-bf89f68212b9', 'allen-mouse.png'], - - ['minds/core/referencespace/v1.0.0/d5717c4a-0fa1-46e6-918c-b8003069ade8', 'waxholm.png'], - - ['minds/core/referencespace/v1.0.0/tmp-fsaverage', 'freesurfer.png'], - ['minds/core/referencespace/v1.0.0/tmp-fsaverage6', 'freesurfer.png'], - - ['minds/core/referencespace/v1.0.0/tmp-hcp32k', 'freesurfer.png'], - ['minds/core/referencespace/v1.0.0/MEBRAINS_T1.masked', 'primate.png'], - -]) - -@Pipe({ - name: 'previewSpaceUrl', - pure: true -}) - -export class PreviewSpaceUrlPipe implements PipeTransform{ - public transform(tile: SapiSpaceModel){ - const filename = previewImgMap.get(tile['@id']) - return filename && `assets/images/atlas-selection/${filename}` - } -} diff --git a/src/atlasComponents/sapiViews/core/space/smartChip/space.smartChip.components.ts b/src/atlasComponents/sapiViews/core/space/smartChip/space.smartChip.components.ts deleted file mode 100644 index 6548aaa26a03134f1cb36a3a50f46337b18f13ca..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/space/smartChip/space.smartChip.components.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {Component, EventEmitter, HostListener, Input, Output, Renderer2} from "@angular/core"; -import { SapiSpaceModel } from "src/atlasComponents/sapi/type"; -import {Renderer} from "@angular/compiler-cli/ngcc/src/rendering/renderer"; - -@Component({ - selector: 'sxplr-sapiviews-core-space-smartchip', - templateUrl: './space.smartChip.template.html', - styleUrls: ['./space.smartChip.style.css'] -}) - -export class SapiViewCoreSpaceSmartChip { - - @Input('sxplr-sapiviews-core-space-smartchip-space') - space: SapiSpaceModel - - @Input('sxplr-sapiviews-core-space-smartchip-all-spaces') - spaces: SapiSpaceModel[] - - @Input('sxplr-sapiviews-core-space-smartchip-custom-color') - customColor: string - - @Output('sxplr-sapiviews-core-space-smartchip-select-space') - onSelectSpace = new EventEmitter<SapiSpaceModel>() - - - - selectSpace(space: SapiSpaceModel){ - if (this.trackByFn(space) === this.trackByFn(this.space)) return - this.onSelectSpace.emit(space) - } - - trackByFn(space: SapiSpaceModel){ - return space["@id"] - } - -} diff --git a/src/atlasComponents/sapiViews/core/space/smartChip/space.smartChip.stories.ts b/src/atlasComponents/sapiViews/core/space/smartChip/space.smartChip.stories.ts deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/atlasComponents/sapiViews/core/space/smartChip/space.smartChip.style.css b/src/atlasComponents/sapiViews/core/space/smartChip/space.smartChip.style.css deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/atlasComponents/sapiViews/core/space/smartChip/space.smartChip.template.html b/src/atlasComponents/sapiViews/core/space/smartChip/space.smartChip.template.html deleted file mode 100644 index aa534108dac396b61c86f12845bb301590d8fb6b..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/space/smartChip/space.smartChip.template.html +++ /dev/null @@ -1,23 +0,0 @@ -<div (iav-outsideClick)="spaceMenuTrigger.closeMenu()"> - <div [style.background-color]="customColor && customColor" - [matMenuTriggerFor]="spacesMenu" - #spaceMenuTrigger="matMenuTrigger" - matRipple - class="custom-chip layer-chip-overflowed"> - <span class="mat-body sxplr-white-space-nowrap"> - {{ space.shortName }} - </span> - </div> - - <mat-menu #spacesMenu="matMenu" - [hasBackdrop]="false" - class="parc-smart-chip-menu-panel ml-4"> - - <div *ngFor="let spc of spaces"> - <button mat-menu-item - (click)="selectSpace(spc)" - [style.background-color]="(spc | equality : space : trackByFn) ? 'grey' : ''"> - {{spc.fullName}}</button> - </div> - </mat-menu> -</div> \ No newline at end of file diff --git a/src/atlasComponents/sapiViews/core/space/tile/space.tile.component.ts b/src/atlasComponents/sapiViews/core/space/tile/space.tile.component.ts deleted file mode 100644 index e9aaab3bebbdce796155a754857d9b0ff67ce090..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/space/tile/space.tile.component.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Component, Input } from "@angular/core"; -import { SapiSpaceModel } from "src/atlasComponents/sapi"; - -@Component({ - selector: `sxplr-sapiviews-core-space-tile`, - templateUrl: `./space.tile.template.html`, - styleUrls: [ - `./space.tile.style.css` - ] -}) - -export class SapiViewsCoreSpaceSpaceTile { - @Input('sxplr-sapiviews-core-space-tile-space') - space: SapiSpaceModel - - @Input('sxplr-sapiviews-core-space-tile-selected') - selected: boolean = false - -} \ No newline at end of file diff --git a/src/atlasComponents/sapiViews/core/space/tile/space.tile.stories.ts b/src/atlasComponents/sapiViews/core/space/tile/space.tile.stories.ts deleted file mode 100644 index fd385d0f599b21101fdc6021714ad78e921d5178..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/space/tile/space.tile.stories.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { CommonModule } from "@angular/common" -import { HttpClientModule } from "@angular/common/http" -import { Component, Input } from "@angular/core" -import { Meta, moduleMetadata, Story } from "@storybook/angular" -import { SAPI, SapiSpaceModel } from "src/atlasComponents/sapi" -import { atlasId, spaceId, getAtlas, getSpace, provideDarkTheme } from "src/atlasComponents/sapi/stories.base" -import { AngularMaterialModule } from "src/sharedModules" -import { SapiViewsCoreSpaceModule } from "../module" -import { SapiViewsCoreSpaceSpaceTile } from "./space.tile.component" - -@Component({ - selector: `space-tile-wrapper`, - template: ` - <mat-accordion> - <mat-expansion-panel *ngFor="let item of spaces | keyvalue"> - - <mat-expansion-panel-header> - {{ item.key }} - </mat-expansion-panel-header> - - <ng-template matExpansionPanelContent> - <div class="sxplr-d-inline-flex align-items-start"> - <sxplr-sapiviews-core-space-tile - *ngFor="let spc of item.value" - [sxplr-sapiviews-core-space-tile-space]="spc" - [sxplr-sapiviews-core-space-tile-selected]="spc['@id'] === selected" - class="sxplr-m-2"> - </sxplr-sapiviews-core-space-tile> - </div> - </ng-template> - - </mat-expansion-panel> - </mat-accordion> - `, - styles: [ - `sxplr-sapiviews-core-space-tile { display: inline-block; max-width: 8rem; }` - ] -}) - -class SpaceTileWrapper{ - @Input() - spaces: Record<string, SapiSpaceModel[]> = {} - - @Input() - selected: string = spaceId.human.mni152 -} - -export default { - component: SpaceTileWrapper, - decorators: [ - moduleMetadata({ - imports: [ - CommonModule, - HttpClientModule, - SapiViewsCoreSpaceModule, - AngularMaterialModule, - ], - providers: [ - SAPI, - ...provideDarkTheme, - ], - declarations: [ - SpaceTileWrapper - ] - }) - ], -} as Meta - -const Template: Story<SapiViewsCoreSpaceSpaceTile> = (args: SapiViewsCoreSpaceSpaceTile, { loaded }) => { - const { - spaces - } = loaded - - return ({ - props: { - ...args, - spaces - } - }) -} -Template.loaders = [ - -] - -const asyncLoader = async () => { - const spaces: Record<string, SapiSpaceModel[]> = {} - for (const species in atlasId) { - const atlasDetail = await getAtlas(atlasId[species]) - spaces[species] = [] - - for (const spc of atlasDetail.spaces) { - const spcDetail = await getSpace(atlasDetail['@id'], spc['@id']) - spaces[species].push(spcDetail) - } - } - - return { - spaces - } -} - -export const Default = Template.bind({}) -Default.args = { - selected: spaceId.human.mni152 -} -Default.loaders = [ - - async () => { - const { - spaces - } = await asyncLoader() - return { - spaces - } - } -] diff --git a/src/atlasComponents/sapiViews/core/space/tile/space.tile.style.css b/src/atlasComponents/sapiViews/core/space/tile/space.tile.style.css deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/atlasComponents/sapiViews/core/space/tile/space.tile.template.html b/src/atlasComponents/sapiViews/core/space/tile/space.tile.template.html deleted file mode 100644 index 74ba27c9a7384a0f470b083f4aa5a1df4489401a..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/core/space/tile/space.tile.template.html +++ /dev/null @@ -1,7 +0,0 @@ -<tile-cmp - *ngIf="space" - [tile-text]="space.fullName" - [tile-image-src]="space | previewSpaceUrl" - [tile-selected]="selected"> - -</tile-cmp> \ No newline at end of file diff --git a/src/atlasComponents/sapiViews/util/module.ts b/src/atlasComponents/sapiViews/util/module.ts index 53a3a88c549821dfe9a7ee654c93dac7747cd368..2ab8ff874d96216b9ad2528ac1ed83a3e95c204d 100644 --- a/src/atlasComponents/sapiViews/util/module.ts +++ b/src/atlasComponents/sapiViews/util/module.ts @@ -3,10 +3,8 @@ import { AddUnitAndJoin } from "./addUnitAndJoin.pipe"; import { EqualityPipe } from "./equality.pipe"; import { IncludesPipe } from "./includes.pipe"; import { NumbersPipe } from "./numbers.pipe"; -import { ParcellationSupportedInCurrentSpace } from "./parcellationSupportedInCurrentSpace.pipe"; import { ParcellationSupportedInSpacePipe } from "./parcellationSupportedInSpace.pipe"; import { ParseDoiPipe } from "./parseDoi.pipe"; -import { SpaceSupportedInCurrentParcellationPipe } from "./spaceSupportedInCurrentParcellation.pipe"; @NgModule({ declarations: [ @@ -16,8 +14,6 @@ import { SpaceSupportedInCurrentParcellationPipe } from "./spaceSupportedInCurre AddUnitAndJoin, IncludesPipe, ParcellationSupportedInSpacePipe, - ParcellationSupportedInCurrentSpace, - SpaceSupportedInCurrentParcellationPipe, ], exports: [ EqualityPipe, @@ -26,8 +22,6 @@ import { SpaceSupportedInCurrentParcellationPipe } from "./spaceSupportedInCurre AddUnitAndJoin, IncludesPipe, ParcellationSupportedInSpacePipe, - ParcellationSupportedInCurrentSpace, - SpaceSupportedInCurrentParcellationPipe, ] }) diff --git a/src/atlasComponents/sapiViews/util/parcellationSupportedInCurrentSpace.pipe.ts b/src/atlasComponents/sapiViews/util/parcellationSupportedInCurrentSpace.pipe.ts deleted file mode 100644 index f69e2e660adad683355b591e91b49c6ceca75031..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/util/parcellationSupportedInCurrentSpace.pipe.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Pipe, PipeTransform } from "@angular/core"; -import { select, Store } from "@ngrx/store"; -import { Observable } from "rxjs"; -import {switchMap, tap} from "rxjs/operators"; -import { SAPI } from "src/atlasComponents/sapi/sapi.service"; -import { SapiParcellationModel } from "src/atlasComponents/sapi/type"; -import { atlasSelection } from "src/state"; -import { ParcellationSupportedInSpacePipe } from "./parcellationSupportedInSpace.pipe" - -@Pipe({ - name: 'parcellationSupportedInCurrentSpace', - /** - * the pipe is not exactly pure, since it makes http call - * but for the sake of angular change detection, this is suitable - * since the result should only change on input change - */ - pure: true -}) - -export class ParcellationSupportedInCurrentSpace implements PipeTransform{ - - private transformPipe = new ParcellationSupportedInSpacePipe(this.sapi) - - private selectedTemplate$ = this.store.pipe( - select(atlasSelection.selectors.selectedTemplate) - ) - constructor( - private store: Store, - private sapi: SAPI, - ){} - - public transform(parcellation: SapiParcellationModel) - : Observable<{supported: boolean, spaces?: Array<string>}> { - return this.selectedTemplate$.pipe( - switchMap(tmpl => this.transformPipe.transform(parcellation, tmpl)) - ) - } -} diff --git a/src/atlasComponents/sapiViews/util/parcellationSupportedInSpace.pipe.ts b/src/atlasComponents/sapiViews/util/parcellationSupportedInSpace.pipe.ts index cb99c280146659c97798935b110b9d31c94b2672..8d69ecf0ce16d1df1227b985471003a8280110d5 100644 --- a/src/atlasComponents/sapiViews/util/parcellationSupportedInSpace.pipe.ts +++ b/src/atlasComponents/sapiViews/util/parcellationSupportedInSpace.pipe.ts @@ -28,8 +28,7 @@ export class ParcellationSupportedInSpacePipe implements PipeTransform{ constructor(private sapi: SAPI){} - public transform(parc: SapiParcellationModel|string, tmpl: SapiSpaceModel|string) - : Observable<{supported: boolean, spaces?: (Array<string>)}> { + public transform(parc: SapiParcellationModel|string, tmpl: SapiSpaceModel|string): Observable<boolean> { if (!parc) return NEVER const parcId = typeof parc === "string" ? parc @@ -39,17 +38,11 @@ export class ParcellationSupportedInSpacePipe implements PipeTransform{ : tmpl["@id"] for (const key in knownExceptions.supported) { if (key === parcId && knownExceptions.supported[key].indexOf(tmplId) >= 0) { - return of({supported: true}) + return of(true) } } return this.sapi.registry.get<SAPIParcellation>(parcId).getVolumes().pipe( - map(volumes => { - const supported = volumes.some(v => v.data.space["@id"] === tmplId) - return { - supported, - spaces: [...new Set(volumes.map(v => v.data.space["@id"]))] - } - }) + map(volumes => volumes.some(v => v.data.space["@id"] === tmplId)) ) } -} +} \ No newline at end of file diff --git a/src/atlasComponents/sapiViews/util/spaceSupportedInCurrentParcellation.pipe.ts b/src/atlasComponents/sapiViews/util/spaceSupportedInCurrentParcellation.pipe.ts deleted file mode 100644 index ba5a056e5607c5b8fcf2ab57858bbcd1f6fde238..0000000000000000000000000000000000000000 --- a/src/atlasComponents/sapiViews/util/spaceSupportedInCurrentParcellation.pipe.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Pipe, PipeTransform } from "@angular/core"; -import { select, Store } from "@ngrx/store"; -import { Observable } from "rxjs"; -import { switchMap } from "rxjs/operators"; -import { SAPI } from "src/atlasComponents/sapi/sapi.service"; -import { SapiSpaceModel } from "src/atlasComponents/sapi/type"; -import { atlasSelection } from "src/state"; -import { ParcellationSupportedInSpacePipe } from "./parcellationSupportedInSpace.pipe" - -@Pipe({ - name: "spaceSupportedInCurrentParcellation", - /** - * the pipe is not exactly pure, since it makes http call - * but for the sake of angular change detection, this is suitable - * since the result should only change on input change - */ - pure: true -}) - -export class SpaceSupportedInCurrentParcellationPipe implements PipeTransform{ - private supportedPipe = new ParcellationSupportedInSpacePipe(this.sapi) - private selectedParcellation$ = this.store.pipe( - select(atlasSelection.selectors.selectedParcellation) - ) - constructor( - private store: Store, - private sapi: SAPI - ){ - - } - public transform(space: SapiSpaceModel): Observable<{ supported: boolean, spaces?: string[] }> { - return this.selectedParcellation$.pipe( - switchMap(parc => - this.supportedPipe.transform(parc, space) - ) - ) - } -} diff --git a/src/components/smartChip/component/smartChip.style.css b/src/components/smartChip/component/smartChip.style.css index 412628c323bea965f7bdcce09161f031c537b6be..f05cd3d5b254057c9d4bcea56fe7d268620c7302 100644 --- a/src/components/smartChip/component/smartChip.style.css +++ b/src/components/smartChip/component/smartChip.style.css @@ -1,10 +1,17 @@ +:host +{ + margin: 0.5rem 1rem; + min-height: 32px; + height: 1px; +} + .smart-chip { + height: 100%; + display: inline-block; padding: 0.5rem 1rem; - margin: 0.5rem 1rem; border-radius: 1rem; - height: 1.25rem; display: inline-flex; flex-direction: row; diff --git a/src/extra_styles.css b/src/extra_styles.css index 47b5ab196c1a6f7c83906c5dac362cb6019f5a29..be7921bd06d387cb19123c41f97c0b7834bfdadb 100644 --- a/src/extra_styles.css +++ b/src/extra_styles.css @@ -877,34 +877,6 @@ how-to-cite img width: 100%; } -.mat-menu-panel.parc-smart-chip-menu-panel -{ - max-width: 100vw; -} - -.custom-chip { - padding: 5px 10px; - border-radius: 15px; - cursor: pointer; -} - -.custom-chip:hover { - filter: brightness(1.1); -} - -.layer-chip-overflowed { - margin-left: -2.5rem !important; - padding-left: 3rem !important; -} - -.small-icon-button { - font-size: 12px; - min-width: 20px; - text-align: center; - height: 20px; - padding: 0 5px; - border-radius: 50%; -} /* this is required to set snackbar to be none-interactive */ /* ignore css lint error, they don't know what they are talking about */ .cdk-overlay-pane:has(> .sxplr-pe-none) diff --git a/src/state/atlasSelection/actions.ts b/src/state/atlasSelection/actions.ts index 8787234b909287c331473dfe6d0cceb578375111..7cf6d778a8549575c94b8244266ad5cc213cb0a8 100644 --- a/src/state/atlasSelection/actions.ts +++ b/src/state/atlasSelection/actions.ts @@ -116,10 +116,6 @@ export const selectATPById = createAction( }>() ) -export const clearNonBaseParcLayer = createAction( - `${nameSpace} clearNonBaseParcLayer` -) - export const clearStandAloneVolumes = createAction( `${nameSpace} clearStandAloneVolumes` ) diff --git a/src/state/atlasSelection/effects.ts b/src/state/atlasSelection/effects.ts index d5cd89ecc34b7f8fb49c69865ac9e69ed885e137..a84da1c3dfaa44031c79b46a04dfe5334522e434 100644 --- a/src/state/atlasSelection/effects.ts +++ b/src/state/atlasSelection/effects.ts @@ -6,10 +6,7 @@ import { SAPI, SapiAtlasModel, SapiParcellationModel, SAPIRegion, SapiRegionMode import * as mainActions from "../actions" import { select, Store } from "@ngrx/store"; import { selectors, actions } from '.' -import { fromRootStore } from "./util"; import { AtlasSelectionState } from "./const" -import { ParcellationIsBaseLayer } from "src/atlasComponents/sapiViews/core/parcellation/parcellationIsBaseLayer.pipe"; -import { OrderParcellationByVersionPipe } from "src/atlasComponents/sapiViews/core/parcellation/parcellationVersion.pipe"; import { atlasAppearance, atlasSelection } from ".."; import { ParcellationSupportedInSpacePipe } from "src/atlasComponents/sapiViews/util/parcellationSupportedInSpace.pipe"; import { InterSpaceCoordXformSvc } from "src/atlasComponents/sapi/core/space/interSpaceCoordXform.service"; @@ -140,7 +137,7 @@ export class Effect { return concat( ...currAtlas.parcellations.map( p => this.parcSupportedInSpacePipe.transform(p["@id"], template).pipe( - filter(flag => flag.supported), + filter(flag => flag), switchMap(() => this.sapiSvc.getParcDetail(currAtlas["@id"], p['@id'])), ) ) @@ -159,7 +156,7 @@ export class Effect { return concat( ...currAtlas.spaces.map( sp => this.parcSupportedInSpacePipe.transform(parcellation["@id"], sp["@id"]).pipe( - filter(flag => flag.supported), + filter(flag => flag), switchMap(() => this.sapiSvc.getSpaceDetail(currAtlas["@id"], sp['@id'])), ) ) @@ -295,25 +292,6 @@ export class Effect { })) )) - onNonBaseLayerRemoval = createEffect(() => this.action.pipe( - ofType(actions.clearNonBaseParcLayer), - switchMapTo( - this.store.pipe( - fromRootStore.allAvailParcs(this.sapiSvc), - map(parcs => { - const baseLayers = parcs.filter(this.parcellationIsBaseLayerPipe.transform) - const newestLayer = this.orderParcellationByVersionPipe.transform(baseLayers) - return actions.selectParcellation({ - parcellation: newestLayer - }) - }) - ) - ) - )) - - private parcellationIsBaseLayerPipe = new ParcellationIsBaseLayer() - private orderParcellationByVersionPipe = new OrderParcellationByVersionPipe() - onClearStandAloneVolumes = createEffect(() => this.action.pipe( ofType(actions.clearStandAloneVolumes), mapTo(actions.setStandAloneVolumes({ diff --git a/src/viewerModule/module.ts b/src/viewerModule/module.ts index e7107258f1c109ddb6f49266dc710c326ef4cbf9..597e574ea77d5f1d1a350e9ae236663d09e25f2a 100644 --- a/src/viewerModule/module.ts +++ b/src/viewerModule/module.ts @@ -29,6 +29,7 @@ import { ShareModule } from "src/share"; import { LeapModule } from "./leap/module"; import { environment } from "src/environments/environment" +import { ATPSelectorModule } from "src/atlasComponents/sapiViews/core/rich/ATPSelector"; @NgModule({ imports: [ @@ -50,6 +51,7 @@ import { environment } from "src/environments/environment" DialogModule, MouseoverModule, ShareModule, + ATPSelectorModule, ...(environment.ENABLE_LEAP_MOTION ? [LeapModule] : []) ], declarations: [ diff --git a/src/viewerModule/viewerCmp/viewerCmp.component.ts b/src/viewerModule/viewerCmp/viewerCmp.component.ts index 894e0611ada773587efb69e30364e9712d94324f..cef42ef50ec244b4f503d545935bc9548d167d4d 100644 --- a/src/viewerModule/viewerCmp/viewerCmp.component.ts +++ b/src/viewerModule/viewerCmp/viewerCmp.component.ts @@ -106,14 +106,6 @@ export class ViewerCmp implements OnDestroy { map(({ parcellation }) => parcellation) ) - public allAvailableSpaces$ = this.store$.pipe( - atlasSelection.fromRootStore.allAvailSpaces(this.sapi) - ) - - public allAvailableParcellations$ = this.store$.pipe( - atlasSelection.fromRootStore.allAvailParcs(this.sapi) - ) - public selectedRegions$ = this.store$.pipe( select(atlasSelection.selectors.selectedRegions), ) @@ -406,42 +398,6 @@ export class ViewerCmp implements OnDestroy { ) } - onDismissNonbaseLayer(): void{ - this.store$.dispatch( - atlasSelection.actions.clearNonBaseParcLayer() - ) - } - onSelectAtlas(atlas: SapiAtlasModel): void{ - this.store$.dispatch( - atlasSelection.actions.selectAtlas({ - atlas - }) - ) - } - onSelectSpace(template: SapiSpaceModel): void{ - this.store$.dispatch( - atlasSelection.actions.selectTemplate({ - template - }) - ) - } - onSelectParcellation(parcellation: SapiParcellationModel): void{ - this.store$.dispatch( - atlasSelection.actions.selectParcellation({ - parcellation - }) - ) - } - onSelectSpaceAndParcellation(e): void{ - const {space, parcellation} = e - this.store$.dispatch( - atlasSelection.actions.setAtlasSelectionState({ - selectedTemplate: space, - selectedParcellation: parcellation - }) - ) - } - navigateTo(position: number[]): void { this.store$.dispatch( atlasSelection.actions.navigateTo({ diff --git a/src/viewerModule/viewerCmp/viewerCmp.style.css b/src/viewerModule/viewerCmp/viewerCmp.style.css index 10966ff6188c80716aa4cc89042c114eae46c037..ce7549bda645ca175e0c23c25f204291e3847db9 100644 --- a/src/viewerModule/viewerCmp/viewerCmp.style.css +++ b/src/viewerModule/viewerCmp/viewerCmp.style.css @@ -126,7 +126,7 @@ mat-list[dense].contextual-block .region-chip-suffix { - transform: scale(0.7); + transform: scale(0.9); margin-right: -0.25rem; } @@ -140,13 +140,3 @@ mat-list[dense].contextual-block align-items: flex-end; justify-content: flex-end; } - -.arrow-between-chips { - margin: 0 -30px; - padding: 0 30px; -} - -.hide-chip-corner { - margin-left: -2.5rem; - padding-left: 3rem; -} diff --git a/src/viewerModule/viewerCmp/viewerCmp.template.html b/src/viewerModule/viewerCmp/viewerCmp.template.html index b17d590f475235bd27b78fe425c96c70b2e66069..44ebe7530e85c2442158d5572cef9515091b8d58 100644 --- a/src/viewerModule/viewerCmp/viewerCmp.template.html +++ b/src/viewerModule/viewerCmp/viewerCmp.template.html @@ -402,41 +402,11 @@ sxplr-mxw-80vw sxplr-pe-all sxplr-of-x-auto - sxplr-of-y-hidden"> - - <!-- selected atlas chip --> - <sxplr-sapiviews-core-atlas-smartchip - class="sxplr-z-4 sxplr-ml-2" - [sxplr-sapiviews-core-atlas-smartchip-custom-color]="'dimgrey'" - [sxplr-sapiviews-core-atlas-smartchip-atlas]="selectedAtlas$ | async" - [sxplr-sapiviews-core-atlas-smartchip-all-atlases]="fetchedAtlases$ | async" - (sxplr-sapiviews-core-atlas-smartchip-select-atlas)="onSelectAtlas($event)" - > - </sxplr-sapiviews-core-atlas-smartchip> - - - <!-- selected space chip --> - <sxplr-sapiviews-core-space-smartchip - class="sxplr-z-3" - [sxplr-sapiviews-core-space-smartchip-custom-color]="'grey'" - [sxplr-sapiviews-core-space-smartchip-space]="templateSelected$ | async" - [sxplr-sapiviews-core-space-smartchip-all-spaces]="allAvailableSpaces$ | async" - (sxplr-sapiviews-core-space-smartchip-select-space)="onSelectSpace($event)"> - </sxplr-sapiviews-core-space-smartchip> - - <!-- selected parcellation chip --> - <sxplr-sapiviews-core-parcellation-smartchip - class="sxplr-z-2 sxplr-mr-1" - [sxplr-sapiviews-core-parcellation-smartchip-selected-space]="templateSelected$ | async" - [sxplr-sapiviews-core-parcellation-smartchip-selected-all-spaces]="allAvailableSpaces$ | async" - [sxplr-sapiviews-core-parcellation-smartchip-parcellation]="parcellationSelected$ | async" - [sxplr-sapiviews-core-parcellation-smartchip-all-parcellations]="allAvailableParcellations$ | async" - (sxplr-sapiviews-core-parcellation-smartchip-dismiss-nonbase-layer)="onDismissNonbaseLayer()" - (sxplr-sapiviews-core-parcellation-smartchip-select-parcellation)="onSelectParcellation($event)" - (sxplr-sapiviews-core-parcellation-smartchip-select-space-parcellation)="onSelectSpaceAndParcellation($event)" - [sxplr-sapiviews-core-parcellation-smartchip-custom-color]="'darkgrey'" - > - </sxplr-sapiviews-core-parcellation-smartchip> + sxplr-of-y-hidden + sxplr-align-items-center"> + + <sxplr-wrapper-atp-selector class="sxplr-z-2"> + </sxplr-wrapper-atp-selector> <!-- selected region chip --> <sxplr-sapiviews-core-region-region-chip @@ -452,9 +422,7 @@ </div> <div suffix class="region-chip-suffix"> - <button mat-mini-fab - color="primary" - iav-stop="mousedown click" + <button mat-icon-button iav-stop="mousedown click" (click)="clearRoi()"> <i class="fas fa-times"></i> </button>