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

feat: use ieeg dataset rather than electrode

parent bd181061
No related branches found
No related tags found
No related merge requests found
......@@ -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(
......
......@@ -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>
......
......@@ -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(
......
......@@ -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'
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