From a822a8a6a41bd99bc4e46e0022a8ef08497814b8 Mon Sep 17 00:00:00 2001 From: Xiao Gui <xgui3783@gmail.com> Date: Mon, 12 Jun 2023 13:56:25 +0200 Subject: [PATCH] fixed point assignment in labelled maps --- docs/releases/v2.11.3.md | 5 +++ mkdocs.yml | 1 + package-lock.json | 4 +-- package.json | 2 +- src/atlasComponents/sapi/schemaV3.ts | 21 +++--------- .../point-assignment.component.html | 10 ++++-- .../point-assignment.component.ts | 34 ++++++++++++++++--- 7 files changed, 52 insertions(+), 25 deletions(-) create mode 100644 docs/releases/v2.11.3.md diff --git a/docs/releases/v2.11.3.md b/docs/releases/v2.11.3.md new file mode 100644 index 000000000..1070a19f2 --- /dev/null +++ b/docs/releases/v2.11.3.md @@ -0,0 +1,5 @@ +# v2.11.3 + +## Bugfixes + +- Fixed point assignment for maps that do not have statistical maps. Also fixed error messages. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index fc88fe80b..9712d37e5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -33,6 +33,7 @@ nav: - Fetching datasets: 'advanced/datasets.md' - Display non-atlas volumes: 'advanced/otherVolumes.md' - Release notes: + - v2.11.3: 'releases/v2.11.3.md' - v2.11.2: 'releases/v2.11.2.md' - v2.11.1: 'releases/v2.11.1.md' - v2.11.0: 'releases/v2.11.0.md' diff --git a/package-lock.json b/package-lock.json index eaa6b864e..792fff775 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "siibra-explorer", - "version": "2.10.0", + "version": "2.11.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "siibra-explorer", - "version": "2.10.0", + "version": "2.11.2", "license": "apache-2.0", "dependencies": { "@angular/animations": "^14.2.12", diff --git a/package.json b/package.json index 4ea493045..be58cf386 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "siibra-explorer", - "version": "2.11.2", + "version": "2.11.3", "description": "siibra-explorer - explore brain atlases. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular", "scripts": { "lint": "eslint src --ext .ts", diff --git a/src/atlasComponents/sapi/schemaV3.ts b/src/atlasComponents/sapi/schemaV3.ts index e73a25736..3c10d79b9 100644 --- a/src/atlasComponents/sapi/schemaV3.ts +++ b/src/atlasComponents/sapi/schemaV3.ts @@ -642,12 +642,6 @@ export interface components { */ ontologyIdentifier?: (string)[] } - /** - * ImageTypes - * @description An enumeration. - * @enum {unknown} - */ - ImageTypes: "BlockfaceVolumeOfInterest" | "CellBodyStainedVolumeOfInterest" | "CellbodyStainedSection" | "MRIVolumeOfInterest" | "PLIVolumeOfInterest" | "SegmentedVolumeOfInterest" | "XPCTVolumeOfInterest" /** LocationModel */ LocationModel: { /** @Type */ @@ -1237,12 +1231,6 @@ export interface components { /** Max */ max: number } - /** - * TabularTypes - * @description An enumeration. - * @enum {unknown} - */ - TabularTypes: "ReceptorDensityFingerprint" | "LayerwiseBigBrainIntensities" | "LayerwiseCellDensity" | "RegionalBOLD" /** ValidationError */ ValidationError: { /** Location */ @@ -1677,6 +1665,7 @@ export interface operations { parcellation_id: string space_id: string point: string + assignment_type?: string sigma_mm?: number } } @@ -1902,7 +1891,7 @@ export interface operations { query: { parcellation_id: string region_id: string - type?: components["schemas"]["TabularTypes"] + type?: string page?: number size?: number } @@ -1928,7 +1917,7 @@ export interface operations { query: { parcellation_id: string region_id: string - type?: components["schemas"]["TabularTypes"] + type?: string } path: { feature_id: string @@ -1955,7 +1944,7 @@ export interface operations { query: { space_id: string bbox?: string - type?: components["schemas"]["ImageTypes"] + type?: string page?: number size?: number } @@ -1980,7 +1969,7 @@ export interface operations { parameters: { query: { space_id: string - type?: components["schemas"]["ImageTypes"] + type?: string } path: { feature_id: string diff --git a/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.html b/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.html index 57a9cf3d5..59694f74a 100644 --- a/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.html +++ b/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.html @@ -1,7 +1,13 @@ -<div class="sxplr-m-2" *ngIf="busy$ | async"> +<div class="sxplr-m-2" *ngIf="busy$ | async as busyMessage"> <spinner-cmp class="sxplr-d-inline-block"></spinner-cmp> <span> - Performing probabilistic assignment ... + {{ busyMessage }} + </span> +</div> + +<div class="sxplr-m-2" *ngIf="error$ | async"> + <span> + An error occurred when performing map assignment. </span> </div> diff --git a/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.ts b/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.ts index 45709ac78..b12a4b3cc 100644 --- a/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.ts +++ b/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.ts @@ -1,7 +1,7 @@ import { Component, Input, OnDestroy, Output, TemplateRef, EventEmitter } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { BehaviorSubject, EMPTY, Observable, Subscription, combineLatest, concat, of } from 'rxjs'; -import { map, shareReplay, switchMap, tap } from 'rxjs/operators'; +import { catchError, map, shareReplay, switchMap, tap } from 'rxjs/operators'; import { SAPI, EXPECTED_SIIBRA_API_VERSION } from 'src/atlasComponents/sapi/sapi.service'; import { SxplrParcellation, SxplrRegion, SxplrTemplate } from 'src/atlasComponents/sapi/sxplrTypes'; import { translateV3Entities } from 'src/atlasComponents/sapi/translateV3'; @@ -10,6 +10,9 @@ import { TSandsPoint } from 'src/util/types'; import { TZipFileConfig } from "src/zipFilesOutput/type" import { environment } from "src/environments/environment" +const DOING_PROB_ASGMT = "Performing probabilistic assignment ..." +const DOING_LABEL_ASGMT = "Probabilistic assignment failed. Performing labelled assignment ..." + @Component({ selector: 'sxplr-point-assignment', templateUrl: './point-assignment.component.html', @@ -22,9 +25,12 @@ export class PointAssignmentComponent implements OnDestroy { "map value", ] - #busy$ = new BehaviorSubject(false) + #busy$ = new BehaviorSubject<string>(null) busy$ = this.#busy$.asObservable() + #error$ = new BehaviorSubject<string>(null) + error$ = this.#error$.asObservable() + #point = new BehaviorSubject<TSandsPoint>(null) @Input() set point(val: TSandsPoint) { @@ -52,6 +58,9 @@ export class PointAssignmentComponent implements OnDestroy { this.#template, ]).pipe( switchMap(([ point, parcellation, template ]) => { + + this.#error$.next(null) + if (!point || !parcellation || !template) { return EMPTY } @@ -60,7 +69,7 @@ export class PointAssignmentComponent implements OnDestroy { console.warn(`point coordination space id ${ptSpaceId} is not the same as template id ${template.id}.`) return EMPTY } - this.#busy$.next(true) + this.#busy$.next(DOING_PROB_ASGMT) return concat( of(null), this.sapi.v3Get("/map/assign", { @@ -71,7 +80,24 @@ export class PointAssignmentComponent implements OnDestroy { sigma_mm: 0 } }).pipe( - tap(() => this.#busy$.next(false)), + catchError(() => { + this.#busy$.next(DOING_LABEL_ASGMT) + return this.sapi.v3Get("/map/assign", { + query: { + parcellation_id: parcellation.id, + point: point.coordinates.map(v => `${v.value/1e6}mm`).join(','), + space_id: template.id, + sigma_mm: 0, + assignment_type: "labelled" + } + }) + }), + catchError((err) => { + this.#busy$.next(null) + this.#error$.next(err.toString()) + return of(null) + }), + tap(() => this.#busy$.next(null)), ) ) }), -- GitLab