diff --git a/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.component.ts b/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.component.ts index 3a0165f348cfdec0842b0ccea237cd1f4263a7d8..c4690d27534a803f23ee55d4732e0927210148da 100644 --- a/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.component.ts +++ b/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.component.ts @@ -109,19 +109,22 @@ export class BsFeatureIEEGCmp extends BsRegionInputBase implements OnDestroy{ }[] for (const detail of this.results) { - for (const key in detail.__contact_points){ - const cp = detail.__contact_points[key] - lms.push({ - "@id": `${detail["@id"]}#${key}`, - id: `${detail["@id"]}#${key}`, - name: `${detail.name}#${key}`, - position: cp.coord, - color: cp.inRoi ? [255, 100, 100]: [255,255,255], - showInSliceView: this.openElectrodeIdSet.has(detail["@id"]) - }) + for (const key in detail.__electrodes){ + const electorde = detail.__electrodes[key] + if (!electorde.inRoi) continue + for (const cp_key in electorde.__contact_points) { + const cp = electorde.__contact_points[cp_key] + lms.push({ + "@id": `${detail.name}:${key}#${cp_key}`, + id: `${detail.name}:${key}#${cp_key}`, + name: `${detail.name}:${key}#${cp_key}`, + position: cp.coord, + color: cp.inRoi ? [255, 100, 100]: [255,255,255], + showInSliceView: this.openElectrodeIdSet.has(electorde.id) + }) + } } } - this.loadedLms = lms this.store.dispatch( diff --git a/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.template.html b/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.template.html index faa88471f741d6afa2bab07fe611c06836d8183a..d8c35529a494deea91151a21df494b9cb0c21caa 100644 --- a/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.template.html +++ b/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.template.html @@ -3,17 +3,30 @@ </ng-template> <ng-template #contenttmpl> - <mat-expansion-panel *ngFor="let datum of (results$ | async)" - [expanded]="openElectrodeId$ | async | arrayContains : datum['@id']" - (opened)="handleDatumExpansion(datum['@id'], true)" - (closed)="handleDatumExpansion(datum['@id'], false)" + <ng-container *ngFor="let result of results$ | async"> + <ng-container *ngFor="let item of result | getProperty : '__electrodes' | keyvalue"> + <ng-template [ngIf]="item.value.inRoi"> + <ng-container *ngTemplateOutlet="electrodeTmpl; context: { $implicit: item.value }"> + </ng-container> + </ng-template> + </ng-container> + </ng-container> +</ng-template> + +<!-- template for electrode --> +<ng-template #electrodeTmpl let-electrode> + + <mat-expansion-panel + [expanded]="openElectrodeId$ | async | arrayContains : electrode.id" + (opened)="handleDatumExpansion(electrode.id, true)" + (closed)="handleDatumExpansion(electrode.id, false)" togglePosition="before"> <mat-expansion-panel-header> <mat-panel-title> Electrode </mat-panel-title> <mat-panel-description class="text-nowrap"> - {{ datum['@id'] }} + {{ electrode.id }} </mat-panel-description> </mat-expansion-panel-header> @@ -39,11 +52,11 @@ <section class="d-flex align-items-center mt-1"> <section id="contact-points-list" class="flex-grow-1 flex-shrink-1 overflow-x-auto"> <div role="list"> - <mat-chip *ngFor="let item of datum['__contact_points'] | keyvalue" - [matTooltip]="item['value']['coord']" - (click)="handleContactPtClk(item['value'])" + <mat-chip *ngFor="let cp_kv of electrode['__contact_points'] | keyvalue" + [matTooltip]="cp_kv['value']['coord']" + (click)="handleContactPtClk(cp_kv['value'])" class="ml-1"> - {{ item['key'] }} + {{ cp_kv['key'] }} </mat-chip> </div> </section> diff --git a/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCtrl.directive.ts b/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCtrl.directive.ts index 2fa03bf46adda065f6bf3121289464a2f988b93f..85997dcd7100e63cd4289839b7bab29cdd2cbc43 100644 --- a/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCtrl.directive.ts +++ b/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCtrl.directive.ts @@ -5,6 +5,7 @@ import { BsRegionInputBase } from "../bsRegionInputBase"; import { REGISTERED_FEATURE_INJECT_DATA } from "../constants"; import { BsFeatureService, TFeatureCmpInput } from "../service"; import { IBSSummaryResponse, IRegionalFeatureReadyDirective } from "../type"; +import { SIIBRA_FEATURE_KEY } from './type' @Directive({ selector: '[bs-features-ieeg-directive]', @@ -13,12 +14,9 @@ import { IBSSummaryResponse, IRegionalFeatureReadyDirective } from "../type"; export class BsFeatureIEEGDirective extends BsRegionInputBase implements IRegionalFeatureReadyDirective, OnDestroy{ - public results$: Observable<IBSSummaryResponse['IEEG_Electrode'][]> = this.region$.pipe( - switchMap(() => merge( - of([]), - this.getFeatureInstancesList('IEEG_Electrode').pipe( - catchError(() => of([])) - ) + public results$: Observable<IBSSummaryResponse['IEEG_Dataset'][]> = this.region$.pipe( + switchMap(() => this.getFeatureInstancesList(SIIBRA_FEATURE_KEY).pipe( + catchError(() => of([])) )), ) public busy$ = this.region$.pipe( diff --git a/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/type.ts b/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/type.ts index fb910a33c586525d52bf0168335f19f9b20adad5..60d27b1eeec12883f9c598f136a0b254ac157996 100644 --- a/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/type.ts +++ b/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/type.ts @@ -9,12 +9,28 @@ export type TContactPoint = { 'inRoi'?: boolean } +export type TElectrode = { + id: string + subject_id: string + __contact_points: { + [key: string]: TContactPoint + } + inRoi: boolean +} + export type TBSDEtail = { + '__kg_id': string + '__electrodes': { + [key: string]: TElectrode + } +} +export type _TBSDEtail = { '__kg_id': string '__contact_points': { [key: string]: TContactPoint } } -export const SIIBRA_FEATURE_KEY = 'IEEG_Electrode' +export const SIIBRA_FEATURE_KEY = 'IEEG_Dataset' +export const _SIIBRA_FEATURE_KEY = 'IEEG_Electrode' export const IEEG_FEATURE_NAME = 'iEEG recordings'