diff --git a/src/ui/nehubaContainer/nehubaContainer.component.ts b/src/ui/nehubaContainer/nehubaContainer.component.ts index 43f2368a217fa739739c22209bb539feb2ef1d3c..0941911444243f13ae334e1ee8cacdb04c472517 100644 --- a/src/ui/nehubaContainer/nehubaContainer.component.ts +++ b/src/ui/nehubaContainer/nehubaContainer.component.ts @@ -615,6 +615,8 @@ export class NehubaContainer implements OnInit, OnDestroy{ private handleParcellation(parcellation:any){ this.regionsLabelIndexMap = getLabelIndexMap(parcellation.regions) this.nehubaViewer.regionsLabelIndexMap = this.regionsLabelIndexMap + + /* TODO replace with proper KG id */ this.nehubaViewer.parcellationId = parcellation.ngId this.selectedParcellation = parcellation } @@ -635,6 +637,9 @@ export class NehubaContainer implements OnInit, OnDestroy{ this.nehubaViewer = this.cr.instance this.nehubaViewer.config = template.nehubaConfig + /* TODO replace with id from KG */ + this.nehubaViewer.templateId = template.name + this.nehubaViewerSubscriptions.push( this.nehubaViewer.debouncedViewerPositionChange.subscribe(this.handleEmittedNavigationChange.bind(this)) ) diff --git a/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts index 602a6121954ff9a0300611f78590bb66d0db0aaf..66759a6abf504ffa2cab96395f7bdecf21f8b9f6 100644 --- a/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts +++ b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts @@ -83,6 +83,7 @@ export class NehubaViewerUnit implements AfterViewInit,OnDestroy{ return true }), debounceTime(100), + filter(e => this.templateId === e.data.template), map(e => e.data.url) ).subscribe(url => { this.removeSpatialSearch3DLandmarks() @@ -164,6 +165,16 @@ export class NehubaViewerUnit implements AfterViewInit,OnDestroy{ : 0 } + /* required to check if correct landmarks are loaded */ + private _templateId : string + get templateId(){ + return this._templateId + } + set templateId(id:string){ + this._templateId = id + } + + /* required to check if the correct meshes are being loaded */ private _parcellationId : string get parcellationId(){ return this._parcellationId @@ -310,6 +321,7 @@ export class NehubaViewerUnit implements AfterViewInit,OnDestroy{ public addSpatialSearch3DLandmarks(geometries: any[],scale?:number,type?:'icosahedron'){ this.workerService.worker.postMessage({ type : 'GET_LANDMARKS_VTK', + template : this.templateId, landmarks : geometries.map(geometry => geometry === null ? null diff --git a/src/util/worker.js b/src/util/worker.js index 3afd96105f0277db61a196be8855a9cbda76cafb..b38930c75f0bb7f037c175350a28fd1f9717b191 100644 --- a/src/util/worker.js +++ b/src/util/worker.js @@ -112,6 +112,7 @@ const getLandmarksVtk = (action) => { // landmarks are array of triples in nm (array of array of numbers) const landmarks = action.landmarks + const template = action.template const reduce = landmarks.reduce((acc,curr,idx) => { //curr : null | [number,number,number] | [ [number,number,number], [number,number,number], [number,number,number] ][] @@ -173,6 +174,7 @@ const getLandmarksVtk = (action) => { landmarkVtkUrl = URL.createObjectURL(new Blob( [encoder.encode(vtk)], {type : 'application/octet-stream'} )) postMessage({ type : 'ASSEMBLED_LANDMARKS_VTK', + template, url : landmarkVtkUrl }) }