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
import { BsRegionInputBase } from "../../bsRegionInputBase";
import { REGISTERED_FEATURE_INJECT_DATA } from "../../constants";
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'
@Component({
......@@ -64,12 +64,12 @@ export class BsFeatureIEEGCmp extends BsRegionInputBase implements OnDestroy{
this.unloadLandmarks()
while(this.subs.length) this.subs.pop().unsubscribe()
}
private openElectrodeIdSet = new Set<string>()
public openElectrodeId$ = new BehaviorSubject<string[]>([])
handleDatumExpansion(id: string, state: boolean) {
if (state) this.openElectrodeIdSet.add(id)
else this.openElectrodeIdSet.delete(id)
this.openElectrodeId$.next(Array.from(this.openElectrodeIdSet))
private openElectrodeSet = new Set<TElectrode>()
public openElectrode$ = new BehaviorSubject<TElectrode[]>([])
handleDatumExpansion(electrode: TElectrode, state: boolean) {
if (state) this.openElectrodeSet.add(electrode)
else this.openElectrodeSet.delete(electrode)
this.openElectrode$.next(Array.from(this.openElectrodeSet))
this.loadLandmarks()
}
......@@ -109,19 +109,23 @@ export class BsFeatureIEEGCmp extends BsRegionInputBase implements OnDestroy{
}[]
for (const detail of this.results) {
for (const key in detail.__electrodes){
const electorde = detail.__electrodes[key]
if (!electorde.inRoi) continue
for (const cpKey in electorde.__contact_points) {
const cp = electorde.__contact_points[cpKey]
lms.push({
"@id": `${detail.name}:${key}#${cpKey}`,
id: `${detail.name}:${key}#${cpKey}`,
name: `${detail.name}:${key}#${cpKey}`,
position: cp.coord,
color: cp.inRoi ? [255, 100, 100]: [255,255,255],
showInSliceView: this.openElectrodeIdSet.has(electorde.id)
})
for (const subjectKey in detail.electrodes){
const electrodes = detail.electrodes[subjectKey]
for (const electrodId in electrodes) {
const electrode = electrodes[electrodId]
if (!electrode.inRoi) continue
for (const cpKey in electrode.contact_points) {
const cp = electrode.contact_points[cpKey]
lms.push({
"@id": `${detail.name}:${subjectKey}#${cpKey}`,
id: `${detail.name}:${subjectKey}#${cpKey}`,
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{
}
handleContactPtClk(cp: TContactPoint) {
const { coord } = cp
const { location } = cp
this.store.dispatch(
viewerStateChangeNavigation({
navigation: {
position: coord.map(v => v * 1e6),
position: location.map(v => v * 1e6),
positionReal: true,
animation: {}
},
......
......@@ -4,11 +4,21 @@
<ng-template #contenttmpl>
<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 *ngFor="let subjectKeyVal of result | getProperty : 'electrodes' | keyvalue">
<ng-container *ngFor="let electrodeKeyVal of subjectKeyVal.value | keyvalue; let first = first">
<!-- 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-template>
......@@ -17,16 +27,16 @@
<ng-template #electrodeTmpl let-electrode>
<mat-expansion-panel
[expanded]="openElectrodeId$ | async | arrayContains : electrode.id"
(opened)="handleDatumExpansion(electrode.id, true)"
(closed)="handleDatumExpansion(electrode.id, false)"
[expanded]="openElectrode$ | async | arrayContains : electrode"
(opened)="handleDatumExpansion(electrode, true)"
(closed)="handleDatumExpansion(electrode, false)"
togglePosition="before">
<mat-expansion-panel-header>
<mat-panel-title>
Electrode
</mat-panel-title>
<mat-panel-description class="text-nowrap">
{{ electrode.id }}
{{ electrode.electrode_id }}
</mat-panel-description>
</mat-expansion-panel-header>
......@@ -52,8 +62,8 @@
<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 cp_kv of electrode['__contact_points'] | keyvalue"
[matTooltip]="cp_kv['value']['coord']"
<mat-chip *ngFor="let cp_kv of electrode.contact_points | keyvalue"
[matTooltip]="cp_kv['value']['location']"
(click)="handleContactPtClk(cp_kv['value'])"
class="ml-1">
{{ cp_kv['key'] }}
......
......@@ -4,24 +4,26 @@ export type TBSSummary = {
}
export type TContactPoint = {
'id': string
'coord': [number, number, number]
'inRoi'?: boolean
id: string
location: [number, number, number]
inRoi?: boolean
}
export type TElectrode = {
id: string
electrode_id: string
subject_id: string
__contact_points: {
contact_points: {
[key: string]: TContactPoint
}
inRoi: boolean
inRoi?: boolean
}
export type TBSDEtail = {
'__kg_id': string
'__electrodes': {
[key: string]: TElectrode
'kg_id': string
'electrodes': {
[key: string]: {
[key: string]: TElectrode
}
}
}
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