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

feat: added desc and external link to rich region

chore: updated sapi schema
parent 3fac56da
No related branches found
No related tags found
No related merge requests found
...@@ -481,11 +481,11 @@ export interface components { ...@@ -481,11 +481,11 @@ export interface components {
/** @Type */ /** @Type */
"@type": string "@type": string
/** Index */ /** Index */
index: (string)[] index: string[]
/** Dtype */ /** Dtype */
dtype: string dtype: string
/** Columns */ /** Columns */
columns: (string)[] columns: string[]
/** Ndim */ /** Ndim */
ndim: number ndim: number
/** Data */ /** Data */
...@@ -622,6 +622,12 @@ export interface components { ...@@ -622,6 +622,12 @@ export interface components {
*/ */
ontologyIdentifier?: (string)[] ontologyIdentifier?: (string)[]
} }
/**
* ImageTypes
* @description An enumeration.
* @enum {unknown}
*/
ImageTypes: "BlockfaceVolumeOfInterest" | "CellBodyStainedVolumeOfInterest" | "CellbodyStainedSection" | "MRIVolumeOfInterest" | "PLIVolumeOfInterest" | "SegmentedVolumeOfInterest"
/** LocationModel */ /** LocationModel */
LocationModel: { LocationModel: {
/** @Type */ /** @Type */
...@@ -1189,6 +1195,8 @@ export interface components { ...@@ -1189,6 +1195,8 @@ export interface components {
})) | undefined })) | undefined
} }
space: components["schemas"]["SiibraAtIdModel"] space: components["schemas"]["SiibraAtIdModel"]
/** Datasets */
datasets: (components["schemas"]["EbrainsDatasetModel"])[]
} }
/** Coordinates */ /** Coordinates */
api__models__openminds__SANDS__v3__atlas__parcellationEntityVersion__Coordinates: { api__models__openminds__SANDS__v3__atlas__parcellationEntityVersion__Coordinates: {
...@@ -1739,6 +1747,7 @@ export interface operations { ...@@ -1739,6 +1747,7 @@ export interface operations {
query: { query: {
space_id: string space_id: string
bbox?: string bbox?: string
type?: components["schemas"]["ImageTypes"]
page?: number page?: number
size?: number size?: number
} }
...@@ -1764,6 +1773,7 @@ export interface operations { ...@@ -1764,6 +1773,7 @@ export interface operations {
query: { query: {
space_id: string space_id: string
bbox?: string bbox?: string
type?: components["schemas"]["ImageTypes"]
} }
path: { path: {
feature_id: string feature_id: string
......
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { NgModule } from "@angular/core"; import { NgModule } from "@angular/core";
import { MarkdownModule } from "src/components/markdown"; import { MarkdownModule } from "src/components/markdown";
import { ReadmoreModule } from "src/components/readmore";
import { SpinnerModule } from "src/components/spinner"; import { SpinnerModule } from "src/components/spinner";
import { FeatureModule } from "src/features"; import { FeatureModule } from "src/features";
import { AngularMaterialModule } from "src/sharedModules"; import { AngularMaterialModule } from "src/sharedModules";
...@@ -23,6 +24,7 @@ import { SapiViewsCoreRegionRegionRich } from "./region/rich/region.rich.compone ...@@ -23,6 +24,7 @@ import { SapiViewsCoreRegionRegionRich } from "./region/rich/region.rich.compone
MarkdownModule, MarkdownModule,
StrictLocalModule, StrictLocalModule,
FeatureModule, FeatureModule,
ReadmoreModule,
], ],
declarations: [ declarations: [
SapiViewsCoreRegionRegionListItem, SapiViewsCoreRegionRegionListItem,
......
import { Directive, EventEmitter, Input, OnDestroy, Output } from "@angular/core"; import { Directive, EventEmitter, Input, Output, SimpleChanges } from "@angular/core";
import { SxplrAtlas, SxplrParcellation, SxplrRegion, SxplrTemplate } from "src/atlasComponents/sapi/sxplrTypes"; import { SxplrAtlas, SxplrParcellation, SxplrRegion, SxplrTemplate } from "src/atlasComponents/sapi/sxplrTypes";
import { translateV3Entities } from "src/atlasComponents/sapi/translateV3" import { translateV3Entities } from "src/atlasComponents/sapi/translateV3"
import { rgbToHsl } from 'common/util' import { rgbToHsl } from 'common/util'
import { SAPI } from "src/atlasComponents/sapi/sapi.service"; import { SAPI } from "src/atlasComponents/sapi/sapi.service";
import { BehaviorSubject, Subject } from "rxjs"; import { BehaviorSubject, combineLatest } from "rxjs";
import { SAPIRegion } from "src/atlasComponents/sapi/core"; import { SAPIRegion } from "src/atlasComponents/sapi/core";
import { switchMap } from "rxjs/operators"; import { map, switchMap } from "rxjs/operators";
@Directive({ @Directive({
selector: `[sxplr-sapiviews-core-region]`, selector: `[sxplr-sapiviews-core-region]`,
...@@ -28,11 +28,10 @@ export class SapiViewsCoreRegionRegionBase { ...@@ -28,11 +28,10 @@ export class SapiViewsCoreRegionRegionBase {
@Output('sxplr-sapiviews-core-region-navigate-to') @Output('sxplr-sapiviews-core-region-navigate-to')
onNavigateTo = new EventEmitter<number[]>() onNavigateTo = new EventEmitter<number[]>()
protected region$ = new Subject<SxplrRegion>() protected region$ = new BehaviorSubject<SxplrRegion>(null)
private _region: SxplrRegion private _region: SxplrRegion
@Input('sxplr-sapiviews-core-region-region') @Input('sxplr-sapiviews-core-region-region')
set region(val: SxplrRegion) { set region(val: SxplrRegion) {
this.region$.next(val) this.region$.next(val)
if (!this.shouldFetchDetail || !val) { if (!this.shouldFetchDetail || !val) {
...@@ -60,6 +59,24 @@ export class SapiViewsCoreRegionRegionBase { ...@@ -60,6 +59,24 @@ export class SapiViewsCoreRegionRegionBase {
return this._region return this._region
} }
private ATP$ = new BehaviorSubject<{
atlas: SxplrAtlas
template: SxplrTemplate
parcellation: SxplrParcellation
}>(null)
protected ATPR$ = combineLatest([
this.ATP$,
this.region$
]).pipe(
map(([ atp, region ]) => ({ ...atp, region }))
)
ngOnChanges(sc: SimpleChanges): void {
const { atlas, template, parcellation } = this
this.ATP$.next({ atlas, template, parcellation })
}
regionRgbString: string = `rgb(200, 200, 200)` regionRgbString: string = `rgb(200, 200, 200)`
regionDarkmode = false regionDarkmode = false
// in mm!! // in mm!!
......
...@@ -12,18 +12,6 @@ import { SapiViewsCoreRegionRegionBase } from "./region.base.directive"; ...@@ -12,18 +12,6 @@ import { SapiViewsCoreRegionRegionBase } from "./region.base.directive";
export class SapiViewsCoreRegionRegionalFeatureDirective extends SapiViewsCoreRegionRegionBase implements OnChanges{ export class SapiViewsCoreRegionRegionalFeatureDirective extends SapiViewsCoreRegionRegionBase implements OnChanges{
private ATPR$ = new BehaviorSubject<{
atlas: SxplrAtlas
template: SxplrTemplate
parcellation: SxplrParcellation
region: SxplrRegion
}>(null)
ngOnChanges(sc: SimpleChanges): void {
const { atlas, template, parcellation, region } = this
this.ATPR$.next({ atlas, template, parcellation, region })
}
constructor(sapi: SAPI){ constructor(sapi: SAPI){
super(sapi) super(sapi)
} }
......
import { Observable, Subject } from "rxjs"; import { concat, Observable, of, Subject } from "rxjs";
import { Component, EventEmitter, Inject, Output } from "@angular/core"; import { Component, EventEmitter, Inject, Output } from "@angular/core";
import { DARKTHEME } from "src/util/injectionTokens"; import { DARKTHEME } from "src/util/injectionTokens";
import { SapiViewsCoreRegionRegionBase } from "../region.base.directive"; import { SapiViewsCoreRegionRegionBase } from "../region.base.directive";
...@@ -6,6 +6,8 @@ import { ARIA_LABELS, CONST } from 'common/constants' ...@@ -6,6 +6,8 @@ import { ARIA_LABELS, CONST } from 'common/constants'
import { Feature } from "src/atlasComponents/sapi/sxplrTypes"; import { Feature } from "src/atlasComponents/sapi/sxplrTypes";
import { SAPI } from "src/atlasComponents/sapi/sapi.service"; import { SAPI } from "src/atlasComponents/sapi/sapi.service";
import { environment } from "src/environments/environment"; import { environment } from "src/environments/environment";
import { map, shareReplay, switchMap } from "rxjs/operators";
import { PathReturn } from "src/atlasComponents/sapi/typeV3";
@Component({ @Component({
selector: 'sxplr-sapiviews-core-region-region-rich', selector: 'sxplr-sapiviews-core-region-region-rich',
...@@ -51,4 +53,43 @@ export class SapiViewsCoreRegionRegionRich extends SapiViewsCoreRegionRegionBase ...@@ -51,4 +53,43 @@ export class SapiViewsCoreRegionRegionRich extends SapiViewsCoreRegionRegionBase
activePanelTitles$: Observable<string[]> = new Subject() activePanelTitles$: Observable<string[]> = new Subject()
private regionalStatisticalMaps$ = this.ATPR$.pipe(
switchMap(({ parcellation, template, region }) =>
concat(
of([] as PathReturn<"/map">["volumes"]),
this.sapi.getMap(parcellation.id, template.id, "STATISTICAL").pipe(
map(v => {
const mapIndices = v.indices[region.name]
return mapIndices.map(mapIdx => v.volumes[mapIdx.volume])
})
)
)
),
shareReplay(1)
)
public dois$ = this.regionalStatisticalMaps$.pipe(
map(sms => {
const returnUrls: string[] = []
for (const sm of sms) {
for (const ds of sm.datasets) {
for (const url of ds.urls) {
returnUrls.push(url.url)
}
}
}
return returnUrls
})
)
public desc$ = this.regionalStatisticalMaps$.pipe(
map(sm => {
for (const ds of (sm?.[0]?.datasets) || []) {
if (ds.description) {
return ds.description
}
}
}),
)
} }
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</button> </button>
<!-- explore doi --> <!-- explore doi -->
<a *ngFor="let doi of dois" <a *ngFor="let doi of dois$ | async"
[href]="doi | parseDoi" [href]="doi | parseDoi"
sxplr-hide-when-local sxplr-hide-when-local
[matTooltip]="ARIA_LABELS.EXPLORE_DATASET_IN_KG" [matTooltip]="ARIA_LABELS.EXPLORE_DATASET_IN_KG"
...@@ -54,32 +54,12 @@ ...@@ -54,32 +54,12 @@
</div> </div>
</mat-card> </mat-card>
<!-- desc -->
<!-- kg regional features list --> <ng-template [ngIf]="(desc$ | async) || region.desc" let-desc>
<ng-template #kgRegionalFeatureList> <readmore-component>
<div sxplr-sapiviews-core-region-regional-feature <markdown-dom class="sxplr-m-2 sxplr-muted" [markdown]="desc">
[sxplr-sapiviews-core-region-atlas]="atlas" </markdown-dom>
[sxplr-sapiviews-core-region-template]="template" </readmore-component>
[sxplr-sapiviews-core-region-parcellation]="parcellation"
[sxplr-sapiviews-core-region-region]="region"
#rfDir="sapiViewsRegionalFeature"
class="feature-list-container"
>
<spinner-cmp *ngIf="rfDir.busy$ | async"></spinner-cmp>
<!-- <sxplr-sapiviews-features-entry-list-item
*ngFor="let feat of rfDir.listOfFeatures$ | async | orderFilterFeatures"
[sxplr-sapiviews-features-entry-list-item-feature]="feat"
(click)="handleRegionalFeatureClicked(feat)">
</sxplr-sapiviews-features-entry-list-item> -->
</div>
</ng-template>
<ng-template #regionDesc>
<markdown-dom class="sxplr-muted" [markdown]="region?.desc || 'No description provided.'">
</markdown-dom>
</ng-template> </ng-template>
<sxplr-feature-entry <sxplr-feature-entry
...@@ -90,31 +70,9 @@ ...@@ -90,31 +70,9 @@
<mat-accordion class="d-block mt-2"> <mat-accordion class="d-block mt-2">
<!-- desc -->
<ng-container *ngTemplateOutlet="ngMatAccordionTmpl; context: {
title: CONST.DESCRIPTION,
iconClass: 'fas fa-info',
content: regionDesc,
desc: '',
iconTooltip: 'Description',
iavNgIf: !!region?.desc
}">
</ng-container>
<!-- only show dynamic data when strict-local is set to false --> <!-- only show dynamic data when strict-local is set to false -->
<ng-template [ngIf]="!environment.STRICT_LOCAL"> <ng-template [ngIf]="!environment.STRICT_LOCAL">
<!-- feature list -->
<!-- <ng-container *ngTemplateOutlet="ngMatAccordionTmpl; context: {
title: CONST.REGIONAL_FEATURES,
iconClass: 'fas fa-database',
content: kgRegionalFeatureList,
desc: '',
iconTooltip: 'Regional Features',
iavNgIf: true
}">
</ng-container> -->
<!-- connectivity --> <!-- connectivity -->
<ng-template #sxplrSapiviewsFeaturesConnectivityBrowser> <ng-template #sxplrSapiviewsFeaturesConnectivityBrowser>
......
...@@ -11,7 +11,7 @@ import { readmoreAnimations } from "./readmore.animations"; ...@@ -11,7 +11,7 @@ import { readmoreAnimations } from "./readmore.animations";
}) })
export class ReadmoreComponent implements OnChanges, AfterContentChecked { export class ReadmoreComponent implements OnChanges, AfterContentChecked {
@Input() public collapsedHeight: number = 45 @Input() public collapsedHeight: number = 85
@Input() public show: boolean = false @Input() public show: boolean = false
@Input() public animationLength: number = 180 @Input() public animationLength: number = 180
@ViewChild('contentContainer', { read: ElementRef, static: true }) public contentContainer: ElementRef @ViewChild('contentContainer', { read: ElementRef, static: true }) public contentContainer: ElementRef
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment