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

chore: update siibra-api ieeg dataset

parent bdd92bcc
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ import { viewerStateAddUserLandmarks, viewerStateChangeNavigation, viewreStateRe ...@@ -6,7 +6,7 @@ import { viewerStateAddUserLandmarks, viewerStateChangeNavigation, viewreStateRe
import { BsRegionInputBase } from "../../bsRegionInputBase"; import { BsRegionInputBase } from "../../bsRegionInputBase";
import { REGISTERED_FEATURE_INJECT_DATA } from "../../constants"; import { REGISTERED_FEATURE_INJECT_DATA } from "../../constants";
import { BsFeatureService, TFeatureCmpInput } from "../../service"; import { BsFeatureService, TFeatureCmpInput } from "../../service";
import { TBSDEtail, TBSSummary, SIIBRA_FEATURE_KEY, TContactPoint } from '../type' import { TBSDEtail, TBSSummary, SIIBRA_FEATURE_KEY, TContactPoint, TElectrode } from '../type'
import { ARIA_LABELS, CONST } from 'common/constants' import { ARIA_LABELS, CONST } from 'common/constants'
@Component({ @Component({
...@@ -64,12 +64,12 @@ export class BsFeatureIEEGCmp extends BsRegionInputBase implements OnDestroy{ ...@@ -64,12 +64,12 @@ export class BsFeatureIEEGCmp extends BsRegionInputBase implements OnDestroy{
this.unloadLandmarks() this.unloadLandmarks()
while(this.subs.length) this.subs.pop().unsubscribe() while(this.subs.length) this.subs.pop().unsubscribe()
} }
private openElectrodeIdSet = new Set<string>() private openElectrodeSet = new Set<TElectrode>()
public openElectrodeId$ = new BehaviorSubject<string[]>([]) public openElectrode$ = new BehaviorSubject<TElectrode[]>([])
handleDatumExpansion(id: string, state: boolean) { handleDatumExpansion(electrode: TElectrode, state: boolean) {
if (state) this.openElectrodeIdSet.add(id) if (state) this.openElectrodeSet.add(electrode)
else this.openElectrodeIdSet.delete(id) else this.openElectrodeSet.delete(electrode)
this.openElectrodeId$.next(Array.from(this.openElectrodeIdSet)) this.openElectrode$.next(Array.from(this.openElectrodeSet))
this.loadLandmarks() this.loadLandmarks()
} }
...@@ -109,19 +109,23 @@ export class BsFeatureIEEGCmp extends BsRegionInputBase implements OnDestroy{ ...@@ -109,19 +109,23 @@ export class BsFeatureIEEGCmp extends BsRegionInputBase implements OnDestroy{
}[] }[]
for (const detail of this.results) { for (const detail of this.results) {
for (const key in detail.__electrodes){ for (const subjectKey in detail.electrodes){
const electorde = detail.__electrodes[key] const electrodes = detail.electrodes[subjectKey]
if (!electorde.inRoi) continue for (const electrodId in electrodes) {
for (const cpKey in electorde.__contact_points) { const electrode = electrodes[electrodId]
const cp = electorde.__contact_points[cpKey] if (!electrode.inRoi) continue
lms.push({
"@id": `${detail.name}:${key}#${cpKey}`, for (const cpKey in electrode.contact_points) {
id: `${detail.name}:${key}#${cpKey}`, const cp = electrode.contact_points[cpKey]
name: `${detail.name}:${key}#${cpKey}`, lms.push({
position: cp.coord, "@id": `${detail.name}:${subjectKey}#${cpKey}`,
color: cp.inRoi ? [255, 100, 100]: [255,255,255], id: `${detail.name}:${subjectKey}#${cpKey}`,
showInSliceView: this.openElectrodeIdSet.has(electorde.id) name: `${detail.name}:${subjectKey}#${cpKey}`,
}) position: cp.location,
color: cp.inRoi ? [255, 100, 100]: [255, 255, 255],
showInSliceView: this.openElectrodeSet.has(electrode)
})
}
} }
} }
} }
...@@ -135,11 +139,11 @@ export class BsFeatureIEEGCmp extends BsRegionInputBase implements OnDestroy{ ...@@ -135,11 +139,11 @@ export class BsFeatureIEEGCmp extends BsRegionInputBase implements OnDestroy{
} }
handleContactPtClk(cp: TContactPoint) { handleContactPtClk(cp: TContactPoint) {
const { coord } = cp const { location } = cp
this.store.dispatch( this.store.dispatch(
viewerStateChangeNavigation({ viewerStateChangeNavigation({
navigation: { navigation: {
position: coord.map(v => v * 1e6), position: location.map(v => v * 1e6),
positionReal: true, positionReal: true,
animation: {} animation: {}
}, },
......
...@@ -4,11 +4,21 @@ ...@@ -4,11 +4,21 @@
<ng-template #contenttmpl> <ng-template #contenttmpl>
<ng-container *ngFor="let result of results$ | async"> <ng-container *ngFor="let result of results$ | async">
<ng-container *ngFor="let item of result | getProperty : '__electrodes' | keyvalue"> <ng-container *ngFor="let subjectKeyVal of result | getProperty : 'electrodes' | keyvalue">
<ng-template [ngIf]="item.value.inRoi">
<ng-container *ngTemplateOutlet="electrodeTmpl; context: { $implicit: item.value }"> <ng-container *ngFor="let electrodeKeyVal of subjectKeyVal.value | keyvalue; let first = first">
</ng-container>
</ng-template> <!-- subject id -->
<!-- <h4 *ngIf="first" class="mat-h4">
{{ subjectKeyVal.key }}
</h4> -->
<!-- electrodes -->
<ng-template [ngIf]="electrodeKeyVal.value.inRoi">
<ng-container *ngTemplateOutlet="electrodeTmpl; context: { $implicit: electrodeKeyVal.value }">
</ng-container>
</ng-template>
</ng-container>
</ng-container> </ng-container>
</ng-container> </ng-container>
</ng-template> </ng-template>
...@@ -17,16 +27,16 @@ ...@@ -17,16 +27,16 @@
<ng-template #electrodeTmpl let-electrode> <ng-template #electrodeTmpl let-electrode>
<mat-expansion-panel <mat-expansion-panel
[expanded]="openElectrodeId$ | async | arrayContains : electrode.id" [expanded]="openElectrode$ | async | arrayContains : electrode"
(opened)="handleDatumExpansion(electrode.id, true)" (opened)="handleDatumExpansion(electrode, true)"
(closed)="handleDatumExpansion(electrode.id, false)" (closed)="handleDatumExpansion(electrode, false)"
togglePosition="before"> togglePosition="before">
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> <mat-panel-title>
Electrode Electrode
</mat-panel-title> </mat-panel-title>
<mat-panel-description class="text-nowrap"> <mat-panel-description class="text-nowrap">
{{ electrode.id }} {{ electrode.electrode_id }}
</mat-panel-description> </mat-panel-description>
</mat-expansion-panel-header> </mat-expansion-panel-header>
...@@ -52,8 +62,8 @@ ...@@ -52,8 +62,8 @@
<section class="d-flex align-items-center mt-1"> <section class="d-flex align-items-center mt-1">
<section id="contact-points-list" class="flex-grow-1 flex-shrink-1 overflow-x-auto"> <section id="contact-points-list" class="flex-grow-1 flex-shrink-1 overflow-x-auto">
<div role="list"> <div role="list">
<mat-chip *ngFor="let cp_kv of electrode['__contact_points'] | keyvalue" <mat-chip *ngFor="let cp_kv of electrode.contact_points | keyvalue"
[matTooltip]="cp_kv['value']['coord']" [matTooltip]="cp_kv['value']['location']"
(click)="handleContactPtClk(cp_kv['value'])" (click)="handleContactPtClk(cp_kv['value'])"
class="ml-1"> class="ml-1">
{{ cp_kv['key'] }} {{ cp_kv['key'] }}
......
...@@ -4,24 +4,26 @@ export type TBSSummary = { ...@@ -4,24 +4,26 @@ export type TBSSummary = {
} }
export type TContactPoint = { export type TContactPoint = {
'id': string id: string
'coord': [number, number, number] location: [number, number, number]
'inRoi'?: boolean inRoi?: boolean
} }
export type TElectrode = { export type TElectrode = {
id: string electrode_id: string
subject_id: string subject_id: string
__contact_points: { contact_points: {
[key: string]: TContactPoint [key: string]: TContactPoint
} }
inRoi: boolean inRoi?: boolean
} }
export type TBSDEtail = { export type TBSDEtail = {
'__kg_id': string 'kg_id': string
'__electrodes': { 'electrodes': {
[key: string]: TElectrode [key: string]: {
[key: string]: TElectrode
}
} }
} }
export type _TBSDEtail = { export type _TBSDEtail = {
......
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